From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kyafk-00063t-IB for qemu-devel@nongnu.org; Fri, 07 Nov 2008 18:23:24 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kyafj-00063W-7V for qemu-devel@nongnu.org; Fri, 07 Nov 2008 18:23:24 -0500 Received: from [199.232.76.173] (port=56685 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kyafi-00063T-Vq for qemu-devel@nongnu.org; Fri, 07 Nov 2008 18:23:23 -0500 Received: from mail.gmx.net ([213.165.64.20]:58625) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Kyafi-0003gS-EN for qemu-devel@nongnu.org; Fri, 07 Nov 2008 18:23:22 -0500 Message-ID: From: "Sebastian Herbszt" References: <20081103092620.8058.91416.stgit@dhcp-1-237.local> <20081103092640.8058.55798.stgit@dhcp-1-237.local> In-Reply-To: <20081103092640.8058.55798.stgit@dhcp-1-237.local> Date: Sat, 8 Nov 2008 00:20:56 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [Bochs-developers] [PATCH v2 4/6] Execute rombios32 code from romaddress 0xe0000. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov , bochs-developers@lists.sourceforge.net Cc: qemu-devel@nongnu.org Gleb Natapov wrote: > Signed-off-by: Gleb Natapov > --- > > bios/Makefile.in | 1 + > bios/rombios.c | 17 +---------------- > bios/rombios32.ld | 8 +++----- > bios/rombios32start.S | 9 ++++++++- > 4 files changed, 13 insertions(+), 22 deletions(-) > > diff --git a/bios/Makefile.in b/bios/Makefile.in > index b055910..af674b4 100644 > --- a/bios/Makefile.in > +++ b/bios/Makefile.in > @@ -106,6 +106,7 @@ rombios32.o: rombios32.c acpi-dsdt.hex > ifeq ("1", "0") > acpi-dsdt.hex: acpi-dsdt.dsl > iasl -tc -p $@ $< > + sed -i -e's/^unsigned/const unsigned/' $@ > endif > > rombios32start.o: rombios32start.S > diff --git a/bios/rombios.c b/bios/rombios.c > index 03540cb..098543c 100644 > --- a/bios/rombios.c > +++ b/bios/rombios.c > @@ -10026,13 +10026,6 @@ rombios32_05: > mov gs, ax > cld > > - ;; copy rombios32 code to ram (ram offset = 1MB) > - mov esi, #0xfffe0000 > - mov edi, #0x00040000 > - mov ecx, #0x10000 / 4 > - rep > - movsd > - > ;; init the stack pointer > mov esp, #0x00080000 > > @@ -10041,17 +10034,9 @@ rombios32_05: > push #0x04b2 > > ;; call rombios32 code > - mov eax, #0x00040000 > + mov eax, #0x000e0000 > call eax > > - ;; reset the memory (some boot loaders such as syslinux suppose > - ;; that the memory is set to zero) > - mov edi, #0x00040000 > - mov ecx, #0x40000 / 4 > - xor eax, eax > - rep > - stosd > - > ;; return to 16 bit protected mode first > db 0xea > dd rombios32_10 > diff --git a/bios/rombios32.ld b/bios/rombios32.ld > index c7f6066..113a2c0 100644 > --- a/bios/rombios32.ld > +++ b/bios/rombios32.ld > @@ -3,14 +3,12 @@ OUTPUT_ARCH(i386) > ENTRY(_start); > SECTIONS > { > - . = 0x00040000; > + . = 0x000e0000; > .text : { *(.text) } > .rodata : { *(.rodata) } > - . = ALIGN(4096); > - .data : { *(.data) } > - __bss_start = . ; > - .bss : { *(.bss) *(COMMON) } > _end = . ; > + .data 0x700 : AT (_end) { __data_start = .; *(.data); __data_end = .;} > + .bss : { __bss_start = .; *(.bss) *(COMMON); __bss_end = .;} > /DISCARD/ : { *(.stab) > *(.stabstr) > *(.comment) The .data section is currently empty because all data is read-only and put into .rodata, .rodata.str1.1 and .rodata.str1.4. As soon as we put something into .data we get a link error because .data now overlaps .rodata.str1.1. The error is gone if we put all .rodata input sections into .rodata output section with ".rodata : { *(.rodata*)". > diff --git a/bios/rombios32start.S b/bios/rombios32start.S > index 601e2b0..1900261 100644 > --- a/bios/rombios32start.S > +++ b/bios/rombios32start.S > @@ -32,10 +32,17 @@ _start: > /* clear bss section */ > xor %eax, %eax > mov $__bss_start, %edi > - mov $_end, %ecx > + mov $__bss_end, %ecx > sub %edi, %ecx > rep stosb We do overwrite data at 0x700 here. Is this acceptable for S3 resume? > + /* copy data section */ > + mov $_end, %esi > + mov $__data_start, %edi > + mov $__data_end, %ecx > + sub %edi, %ecx > + rep movsb > + As described above this is currently a no-op, because __data_start = __data_end = 0x700. > jmp rombios32_init > > .code16 > - Sebastian