From 202ed40d7acea163b438f570868e5c00bcb5d805 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 20 Jun 2007 17:08:23 -0700 Subject: [PATCH] Workaround for VMware console bug; make more common code common --- bootsect.inc | 1 + cleanup.inc | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ extlinux.asm | 23 ----------------------- isolinux.asm | 22 ---------------------- ldlinux.asm | 22 ---------------------- pxelinux.asm | 25 +++---------------------- runkernel.inc | 10 +--------- ui.inc | 26 ++++++++++++++++++++++++++ 8 files changed, 80 insertions(+), 98 deletions(-) create mode 100644 cleanup.inc diff --git a/bootsect.inc b/bootsect.inc index 3a5fd1b..6989956 100644 --- a/bootsect.inc +++ b/bootsect.inc @@ -108,6 +108,7 @@ replace_bootstrap: ; Prepare for shutting down ; call vgaclearmode + call cleanup_hardware ; ; Set up initial stack frame (not used by PXE if keeppxe is diff --git a/cleanup.inc b/cleanup.inc new file mode 100644 index 0000000..3685a01 --- /dev/null +++ b/cleanup.inc @@ -0,0 +1,49 @@ +;; ----------------------------------------------------------------------- +;; +;; Copyright 2007 H. Peter Anvin - All Rights Reserved +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, Inc., 53 Temple Place Ste 330, +;; Boston MA 02111-1307, USA; either version 2 of the License, or +;; (at your option) any later version; incorporated herein by reference. +;; +;; ----------------------------------------------------------------------- + +;; +;; cleanup.inc +;; +;; Some final tidying before jumping to a kernel or bootsector +;; + +; +; cleanup_hardware: +; +; Shut down anything transient. *No segment assumptions*. +; Can trash any registers. +; +cleanup_hardware: + +; +; Linux wants the floppy motor shut off before starting the kernel, +; at least bootsect.S seems to imply so. If we don't load the floppy +; driver, this is *definitely* so! +; + xor ax,ax + xor dx,dx + int 13h + +; Vmware crashes if we scroll in the decompressor! Try to detect vmware +; and if it is Vmware, clear the screen... + mov eax,'VMXh' + xor ebx, ebx + mov ecx, 10 ; Get version + mov dx, 'VX' + in eax, dx + cmp ebx, 'VMXh' + jne .no_vmware + + mov ax,0x0003 ; Set mode (clear screen/home cursor) + int 10h +.no_vmware: + ret diff --git a/extlinux.asm b/extlinux.asm index e5c89ba..c43a051 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -862,24 +862,6 @@ load_config: %include "ui.inc" ; -; Linux kernel loading code is common. -; -%include "runkernel.inc" - -; -; COMBOOT-loading code -; -%include "comboot.inc" -%include "com32.inc" -%include "cmdline.inc" - -; -; Boot sector loading code -; -%include "bootsect.inc" - - -; ; getlinsec_ext: same as getlinsec, except load any sector from the zero ; block as all zeros; use to load any data derived ; from an ext2 block pointer, i.e. anything *except the @@ -909,11 +891,6 @@ getlinsec_ext: ret ; -; Abort loading code -; -%include "abort.inc" - -; ; allocate_file: Allocate a file structure ; ; If successful: diff --git a/isolinux.asm b/isolinux.asm index f9e8741..68aea24 100644 --- a/isolinux.asm +++ b/isolinux.asm @@ -945,23 +945,6 @@ load_config: %include "ui.inc" ; -; Linux kernel loading code is common. -; -%include "runkernel.inc" - -; -; COMBOOT-loading code -; -%include "comboot.inc" -%include "com32.inc" -%include "cmdline.inc" - -; -; Boot sector loading code -; -%include "bootsect.inc" - -; ; Enable disk emulation. The kind of disk we emulate is dependent on the size of ; the file: 1200K, 1440K or 2880K floppy, otherwise harddisk. ; @@ -1133,11 +1116,6 @@ local_boot: jmp kaboom ; If we returned, oh boy... ; -; Abort loading code -; -%include "abort.inc" - -; ; close_file: ; Deallocates a file structure (pointer in SI) ; Assumes CS == DS. diff --git a/ldlinux.asm b/ldlinux.asm index 5a5216f..8fbf0a3 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -926,28 +926,6 @@ getfattype: %include "ui.inc" ; -; Linux kernel loading code is common. -; -%include "runkernel.inc" - -; -; COMBOOT-loading code -; -%include "comboot.inc" -%include "com32.inc" -%include "cmdline.inc" - -; -; Boot sector loading code -; -%include "bootsect.inc" - -; -; Abort loading code -; -%include "abort.inc" - -; ; allocate_file: Allocate a file structure ; ; If successful: diff --git a/pxelinux.asm b/pxelinux.asm index 003d910..3bcb372 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -823,12 +823,6 @@ config_scan: .success: ; -; Now we have the config file open. Parse the config file and -; run the user interface. -; -%include "ui.inc" - -; ; Linux kernel loading code is common. However, we need to define ; a couple of helper macros... ; @@ -858,19 +852,11 @@ config_scan: call unload_pxe %endmacro -%include "runkernel.inc" - -; -; COMBOOT-loading code -; -%include "comboot.inc" -%include "com32.inc" -%include "cmdline.inc" - ; -; Boot sector loading code +; Now we have the config file open. Parse the config file and +; run the user interface. ; -%include "bootsect.inc" +%include "ui.inc" ; ; Boot to the local disk by returning the appropriate PXE magic. @@ -895,11 +881,6 @@ local_boot: retf ; Return to PXE ; -; Abort loading code -; -%include "abort.inc" - -; ; kaboom: write a message and bail out. Wait for quite a while, ; or a user keypress, then do a hard reboot. ; diff --git a/runkernel.inc b/runkernel.inc index 1ba620e..66304af 100644 --- a/runkernel.inc +++ b/runkernel.inc @@ -454,16 +454,8 @@ root_not_floppy: mov [cs:fdctab],word linux_fdctab ; Save new floppy tab pos mov [cs:fdctab+2],es %endif -; -; Linux wants the floppy motor shut off before starting the kernel, -; at least bootsect.S seems to imply so. If we don't load the floppy -; driver, this is *definitely* so! -; -kill_motor: - xor ax,ax - xor dx,dx - int 13h + call cleanup_hardware ; ; If we're debugging, wait for a keypress so we can read any debug messages ; diff --git a/ui.inc b/ui.inc index 189b599..25822ad 100644 --- a/ui.inc +++ b/ui.inc @@ -625,3 +625,29 @@ FuncFlag resb 1 ; Escape sequences received from keyboard KernelType resb 1 ; Kernel type, from vkernel, if known section .text +; +; Linux kernel loading code is common. +; +%include "runkernel.inc" + +; +; COMBOOT-loading code +; +%include "comboot.inc" +%include "com32.inc" +%include "cmdline.inc" + +; +; Boot sector loading code +; +%include "bootsect.inc" + +; +; Abort loading code +; +%include "abort.inc" + +; +; Hardware cleanup common code +; +%include "cleanup.inc" -- 2.7.4