summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2006-08-17 15:19:44 -0700
committerH. Peter Anvin <hpa@zytor.com>2006-08-17 15:19:44 -0700
commit243a8f70d28ac922df7855301496727a743ab469 (patch)
tree64384ffc6129bcb534f0b1ceeb5833d25c72cdf6
parentfce3daf690aac2e42b067f8d3eba9285bf4b4dc9 (diff)
downloadsyslinux-243a8f70d28ac922df7855301496727a743ab469.tar.gz
Clean up the reset stack macro further; incorporate segment reset
as well as enable interrupts.
-rw-r--r--abort.inc6
-rw-r--r--comboot.inc7
-rw-r--r--stack.inc14
3 files changed, 13 insertions, 14 deletions
diff --git a/abort.inc b/abort.inc
index f1773b5f..80d70ad6 100644
--- a/abort.inc
+++ b/abort.inc
@@ -46,11 +46,7 @@ abort_check:
; SI = offset (in _text) of error message to print
;
abort_load:
- mov ax,cs ; Restore CS = DS = ES
- mov ds,ax
- mov es,ax
- RESET_STACK ; AX must = 0
- sti
+ RESET_STACK_AND_SEGS AX
call cwritestr ; Expects SI -> error msg
; Return to the command prompt
diff --git a/comboot.inc b/comboot.inc
index 3e18b9d3..9a96326d 100644
--- a/comboot.inc
+++ b/comboot.inc
@@ -204,12 +204,7 @@ comboot_bogus: cli ; Don't trust anyone
comboot_exit:
mov bx,enter_command ; Normal return to command prompt
comboot_exit_special:
- xor ax,ax
- mov ds,ax
- mov es,ax
- RESET_STACK ; AX must = 0
- sti
- cld
+ RESET_STACK_AND_SEGS AX
call adjust_screen ; The COMBOOT program might have changed the screen
jmp bx
diff --git a/stack.inc b/stack.inc
index f3ec26ec..47246e1c 100644
--- a/stack.inc
+++ b/stack.inc
@@ -20,11 +20,17 @@
%define _STACK_INC
;
-; This macro resets the stack pointer. It assumes CS == DS and AX == 0.
+; This macro resets the stack pointer, and sets CS == DS == ES == 0,
+; interrupts on, DF = 0.
;
-%macro RESET_STACK 0
+; It takes a 16-bit register that can be safely clobbered as parameter.
+;
+%macro RESET_STACK_AND_SEGS 1
+ xor %1,%1
+ mov ds,%1
+ mov es,%1
%if IS_SYSLINUX || IS_EXTLINUX
- mov ss,ax ; Just in case...
+ mov ss,%1 ; Just in case...
mov sp,StackBuf-2*3 ; Reset stack
%elif IS_PXELINUX
lss esp,[BaseStack]
@@ -33,6 +39,8 @@
%else
NEED TO KNOW HOW TO RESET STACK
%endif
+ sti
+ cld
%endmacro
%endif ; _STACK_INC