diff mbox

Fix thinko in linuxboot.S

Message ID 1259153378-27567-1-git-send-email-pbonzini@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Nov. 25, 2009, 12:49 p.m. UTC
The %gs segment that was used was not matching the comments.
I just moved the GDT descriptor on the stack instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 pc-bios/optionrom/linuxboot.S |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

Comments

Alexander Graf Nov. 25, 2009, 12:53 p.m. UTC | #1
On 25.11.2009, at 13:49, Paolo Bonzini wrote:

> The %gs segment that was used was not matching the comments.
> I just moved the GDT descriptor on the stack instead.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Looks good. Have you verified it works? :-)

Alex
Paolo Bonzini Nov. 25, 2009, 1:21 p.m. UTC | #2
On 11/25/2009 01:53 PM, Alexander Graf wrote:
>
> On 25.11.2009, at 13:49, Paolo Bonzini wrote:
>
>> The %gs segment that was used was not matching the comments.
>> I just moved the GDT descriptor on the stack instead.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> Looks good. Have you verified it works? :-)

Yes. :-)

Paolo
diff mbox

Patch

diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S
index b3c90e3..14e1ae8 100644
--- a/pc-bios/optionrom/linuxboot.S
+++ b/pc-bios/optionrom/linuxboot.S
@@ -79,24 +79,20 @@  copy_kernel:
 	   mode, so let's get into 32 bit mode, write the kernel and jump
 	   back again. */
 
-	/* Set DS to SS+SP - 0x10, so we can write our GDT descriptor there */
-	mov		%ss, %eax
-	shl		$4, %eax
-	add		%esp, %eax
-	sub		$0x10, %eax
-	shr		$4, %eax
+	/* Reserve space on the stack for our GDT descriptor. */
+	mov		%esp, %ebp
+	sub		$16, %esp
 
 	/* Now create the GDT descriptor */
+	movw		$((3 * 8) - 1), -16(%bp)
 	mov		%cs, %eax
 	shl		$4, %eax
-	movw		$((3 * 8) - 1), %bx
-	movw		%bx, %gs:0
-	movl		$gdt, %ebx
-	add		%eax, %ebx
-	movl		%ebx, %gs:2
+	addl		$gdt, %ebx
+	movl		%ebx, -14(%bp)
 
 	/* And load the GDT */
-	data32 lgdt	%gs:0
+	data32 lgdt	-16(%bp)
+	mov		%ebp, %esp
 
 	/* Get us to protected mode now */
 	mov		$1, %eax