From patchwork Thu Dec 24 13:38:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 41777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5374AB7BEE for ; Fri, 25 Dec 2009 00:40:15 +1100 (EST) Received: from localhost ([127.0.0.1]:48428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNnvI-0001V7-Cr for incoming@patchwork.ozlabs.org; Thu, 24 Dec 2009 08:40:12 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNnu7-0000TK-4C for qemu-devel@nongnu.org; Thu, 24 Dec 2009 08:38:59 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNnu2-0000Lc-96 for qemu-devel@nongnu.org; Thu, 24 Dec 2009 08:38:58 -0500 Received: from [199.232.76.173] (port=48558 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNnu1-0000LC-T8 for qemu-devel@nongnu.org; Thu, 24 Dec 2009 08:38:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41070) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNnu1-0003tn-Eo for qemu-devel@nongnu.org; Thu, 24 Dec 2009 08:38:53 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBODcqjY029818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 24 Dec 2009 08:38:52 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBODcpHI022592; Thu, 24 Dec 2009 08:38:51 -0500 Received: from localhost.localdomain (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 09E5225004D; Thu, 24 Dec 2009 15:38:51 +0200 (IST) From: Avi Kivity To: qemu-devel@nongnu.org Date: Thu, 24 Dec 2009 15:38:50 +0200 Message-Id: <1261661930-11888-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Marcelo Tosatti , kvm@vger.kernel.org Subject: [Qemu-devel] [PATCH master, stable-0.12] linuxboot: fix gdt address calculation X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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)