From patchwork Mon Jan 31 13:11:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 81099 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 231E6B70EC for ; Tue, 1 Feb 2011 00:12:29 +1100 (EST) Received: from localhost ([127.0.0.1]:56934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjtYM-0007RF-Fv for incoming@patchwork.ozlabs.org; Mon, 31 Jan 2011 08:12:22 -0500 Received: from [140.186.70.92] (port=60415 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PjtX7-00075b-Pa for qemu-devel@nongnu.org; Mon, 31 Jan 2011 08:11:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PjtX6-0002aa-Of for qemu-devel@nongnu.org; Mon, 31 Jan 2011 08:11:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PjtX6-0002aL-G3 for qemu-devel@nongnu.org; Mon, 31 Jan 2011 08:11:04 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0VDB3aU022139 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 31 Jan 2011 08:11:03 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0VDB2Wa021337 for ; Mon, 31 Jan 2011 08:11:02 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id A461518D3E9; Mon, 31 Jan 2011 15:11:01 +0200 (IST) Date: Mon, 31 Jan 2011 15:11:01 +0200 From: Gleb Natapov To: qemu-devel@nongnu.org Message-ID: <20110131131101.GY14750@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCHv2] fix linuxboot.bin and multiboot.bin to not hijack int19 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 Currently linuxboot.bin and multiboot.bin option roms override int19 vector to intercept boot process. No sane option rom should do that. Provide bev entry instead that will be called by BIOS if option rom is selected for booting. Signed-off-by: Gleb Natapov Acked-by: Alexander Graf --- Note that this patch should be applied after qemu will upgrade to Seabios that supports boot order. Otherwise there will be change in behavior since option rom will not be selected for booting by default. v1->v2: - change PRODUCT to BOOT_ROM_PRODUCT - move pnp header from OPTION_ROM_START to BOOT_ROM_START -- Gleb. diff --git a/pc-bios/optionrom/linuxboot.S b/pc-bios/optionrom/linuxboot.S index c109363..748c831 100644 --- a/pc-bios/optionrom/linuxboot.S +++ b/pc-bios/optionrom/linuxboot.S @@ -22,6 +22,8 @@ #include "optionrom.h" +#define BOOT_ROM_PRODUCT "Linux loader" + BOOT_ROM_START run_linuxboot: diff --git a/pc-bios/optionrom/multiboot.S b/pc-bios/optionrom/multiboot.S index 9131837..cc5ca1b 100644 --- a/pc-bios/optionrom/multiboot.S +++ b/pc-bios/optionrom/multiboot.S @@ -20,6 +20,8 @@ #include "optionrom.h" +#define BOOT_ROM_PRODUCT "multiboot loader" + #define MULTIBOOT_MAGIC 0x2badb002 #define GS_PROT_JUMP 0 diff --git a/pc-bios/optionrom/optionrom.h b/pc-bios/optionrom/optionrom.h index fbdd48a..aa783de 100644 --- a/pc-bios/optionrom/optionrom.h +++ b/pc-bios/optionrom/optionrom.h @@ -97,22 +97,28 @@ #define BOOT_ROM_START \ OPTION_ROM_START \ - push %eax; \ - push %ds; \ - \ - /* setup ds so we can access the IVT */ \ - xor %ax, %ax; \ - mov %ax, %ds; \ - \ - /* install our int 19 handler */ \ - movw $int19_handler, (0x19*4); \ - mov %cs, (0x19*4+2); \ - \ - pop %ds; \ - pop %eax; \ lret; \ - \ - int19_handler:; \ + .org 0x18; \ + .short 0; \ + .short _pnph; \ + _pnph: \ + .ascii "$PnP"; \ + .byte 0x01; \ + .byte ( _pnph_len / 16 ); \ + .short 0x0000; \ + .byte 0x00; \ + .byte 0x00; \ + .long 0x00000000; \ + .short _manufacturer; \ + .short _product; \ + .long 0x00000000; \ + .short 0x0000; \ + .short 0x0000; \ + .short _bev; \ + .short 0x0000; \ + .short 0x0000; \ + .equ _pnph_len, . - _pnph; \ + _bev:; \ /* DS = CS */ \ movw %cs, %ax; \ movw %ax, %ds; @@ -122,5 +128,9 @@ _end: #define BOOT_ROM_END \ + _manufacturer:; \ + .asciz "QEMU"; \ + _product:; \ + .asciz BOOT_ROM_PRODUCT; \ OPTION_ROM_END