From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kwvi3-0005bZ-8t for qemu-devel@nongnu.org; Mon, 03 Nov 2008 04:26:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kwvi1-0005ax-PZ for qemu-devel@nongnu.org; Mon, 03 Nov 2008 04:26:54 -0500 Received: from [199.232.76.173] (port=57852 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kwvhz-0005aU-CK for qemu-devel@nongnu.org; Mon, 03 Nov 2008 04:26:51 -0500 Received: from mx2.redhat.com ([66.187.237.31]:33610) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kwvhz-00005s-Ce for qemu-devel@nongnu.org; Mon, 03 Nov 2008 04:26:51 -0500 From: Gleb Natapov Date: Mon, 03 Nov 2008 11:26:46 +0200 Message-ID: <20081103092646.8058.1107.stgit@dhcp-1-237.local> In-Reply-To: <20081103092620.8058.91416.stgit@dhcp-1-237.local> References: <20081103092620.8058.91416.stgit@dhcp-1-237.local> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH v2 5/6] Don't use unreserved memory in BIOS. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: bochs-developers@lists.sourceforge.net Cc: qemu-devel@nongnu.org Use only first page and last page of low memory. OSes assumes that first page is used by bios and last page is reserved in e820 map. Signed-off-by: Gleb Natapov --- bios/rombios.c | 6 +++--- bios/rombios.h | 1 - bios/rombios32.c | 11 ++++------- bios/rombios32start.S | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/bios/rombios.c b/bios/rombios.c index 098543c..6fc4e0e 100644 --- a/bios/rombios.c +++ b/bios/rombios.c @@ -4541,7 +4541,7 @@ ASM_END { case 0: set_e820_range(ES, regs.u.r16.di, - 0x0000000L, 0x0009fc00L, 1); + 0x0000000L, 0x0009f000L, 1); regs.u.r32.ebx = 1; regs.u.r32.eax = 0x534D4150; regs.u.r32.ecx = 0x14; @@ -4550,7 +4550,7 @@ ASM_END break; case 1: set_e820_range(ES, regs.u.r16.di, - 0x0009fc00L, 0x000a0000L, 2); + 0x0009f000L, 0x000a0000L, 2); regs.u.r32.ebx = 2; regs.u.r32.eax = 0x534D4150; regs.u.r32.ecx = 0x14; @@ -10027,7 +10027,7 @@ rombios32_05: cld ;; init the stack pointer - mov esp, #0x00080000 + mov esp, #0x9fbf0 ;; pass pointer to s3_resume_flag and s3_resume_vector to rombios32 push #0x04b0 diff --git a/bios/rombios.h b/bios/rombios.h index f0ed88e..b3df88b 100644 --- a/bios/rombios.h +++ b/bios/rombios.h @@ -56,7 +56,6 @@ #define ACPI_DATA_SIZE 0x00010000L #define PM_IO_BASE 0xb000 #define SMB_IO_BASE 0xb100 -#define CPU_COUNT_ADDR 0xf000 // Define the application NAME #if defined(BX_QEMU) diff --git a/bios/rombios32.c b/bios/rombios32.c index 0a8d498..66e6a52 100644 --- a/bios/rombios32.c +++ b/bios/rombios32.c @@ -57,7 +57,7 @@ typedef unsigned long long uint64_t; #define APIC_ENABLED 0x0100 -#define AP_BOOT_ADDR 0x10000 +#define AP_BOOT_ADDR 0x9f000 #define MPTABLE_MAX_SIZE 0x00002000 #define SMI_CMD_IO_ADDR 0xb2 @@ -392,7 +392,7 @@ void delay_ms(int n) } } -int smp_cpus; +uint16_t smp_cpus; uint32_t cpuid_signature; uint32_t cpuid_features; uint32_t cpuid_ext_features; @@ -495,7 +495,7 @@ void smp_probe(void) { uint32_t val, sipi_vector; - smp_cpus = 1; + writew(&smp_cpus, 1); if (cpuid_features & CPUID_APIC) { /* enable local APIC */ @@ -503,7 +503,6 @@ void smp_probe(void) val |= APIC_ENABLED; writel(APIC_BASE + APIC_SVR, val); - writew((void *)CPU_COUNT_ADDR, 1); /* copy AP boot code */ memcpy((void *)AP_BOOT_ADDR, &smp_ap_boot_code_start, &smp_ap_boot_code_end - &smp_ap_boot_code_start); @@ -514,10 +513,8 @@ void smp_probe(void) writel(APIC_BASE + APIC_ICR_LOW, 0x000C4600 | sipi_vector); delay_ms(10); - - smp_cpus = readw((void *)CPU_COUNT_ADDR); } - BX_INFO("Found %d cpu(s)\n", smp_cpus); + BX_INFO("Found %d cpu(s)\n", readw(&smp_cpus)); } /****************************************************/ diff --git a/bios/rombios32start.S b/bios/rombios32start.S index 1900261..836652c 100644 --- a/bios/rombios32start.S +++ b/bios/rombios32start.S @@ -49,7 +49,7 @@ _start: smp_ap_boot_code_start: xor %ax, %ax mov %ax, %ds - lock incw CPU_COUNT_ADDR + lock incw smp_cpus 1: hlt jmp 1b