From: Avi Kivity Subject: [PATCH master, stable-0.12] linuxboot: fix gdt address calculation Date: Thu, 24 Dec 2009 15:38:50 +0200 Message-ID: <1261661930-11888-1-git-send-email-avi@redhat.com> Cc: kvm@vger.kernel.org, Marcelo Tosatti To: qemu-devel@nongnu.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:32463 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754960AbZLXNix (ORCPT ); Thu, 24 Dec 2009 08:38:53 -0500 Sender: kvm-owner@vger.kernel.org List-ID: 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 --- pc-bios/optionrom/linuxboot.S | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S index c4c9109..8aebe51 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) -- 1.6.5.3