From: Avi Kivity Date: Thu, 24 Dec 2009 13:38:50 +0000 (+0200) Subject: linuxboot: fix gdt address calculation X-Git-Tag: v0.12.2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4713c69fa2319fceb5dd939d72a35e8b97c26878;p=thirdparty%2Fqemu.git linuxboot: fix gdt address calculation The gdt address calculation in linuxboot.bin is broken in two ways: first it loads %cs into %eax, but that instruction leaves the high bits of %eax undefined and we did not clear them. Secondly, we completely ignore the incorrect %eax, and use the undefined %ebx instead. With these issues fixed, linuxboot works again. Signed-off-by: Avi Kivity Signed-off-by: Anthony Liguori (cherry picked from commit d0652aa8ac8d82e077acf8e781557f4c4367dcf5) --- diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S index c4c9109b67b..8aebe51ee59 100644 --- a/pc-bios/optionrom/linuxboot.S +++ b/pc-bios/optionrom/linuxboot.S @@ -86,9 +86,10 @@ copy_kernel: /* Now create the GDT descriptor */ movw $((3 * 8) - 1), -16(%bp) mov %cs, %eax + movzwl %ax, %eax shl $4, %eax - addl $gdt, %ebx - movl %ebx, -14(%bp) + addl $gdt, %eax + movl %eax, -14(%bp) /* And load the GDT */ data32 lgdt -16(%bp)