summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-06-20 17:08:23 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-06-20 17:08:23 -0700
commit202ed40d7acea163b438f570868e5c00bcb5d805 (patch)
treee35377a435c3c7fd5adffbdb0e0476adb86ecb40
parent37068e7b512c7cc409f09977085b4c76bf2685c9 (diff)
downloadsyslinux-202ed40d7acea163b438f570868e5c00bcb5d805.tar.gz
Workaround for VMware console bug; make more common code common
-rw-r--r--bootsect.inc1
-rw-r--r--cleanup.inc49
-rw-r--r--extlinux.asm23
-rw-r--r--isolinux.asm22
-rw-r--r--ldlinux.asm22
-rw-r--r--pxelinux.asm25
-rw-r--r--runkernel.inc10
-rw-r--r--ui.inc26
8 files changed, 80 insertions, 98 deletions
diff --git a/bootsect.inc b/bootsect.inc
index 3a5fd1b9..69899565 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 00000000..3685a011
--- /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 e5c89bad..c43a0517 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 f9e8741d..68aea24d 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 5a5216fb..8fbf0a33 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 003d9103..3bcb372c 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 1ba620e6..66304af5 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 189b599b..25822ad5 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"