summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2002-10-25 16:02:28 +0000
committerhpa <hpa>2002-10-25 16:02:28 +0000
commit9665c8054dfbd821bdd1113f91590881e5c7e5ee (patch)
treee13199751367ccf08079e99da255f3d995c30a7b
parentf805675eef4b2119d252465a211b643f79d17c7e (diff)
downloadsyslinux-9665c8054dfbd821bdd1113f91590881e5c7e5ee.tar.gz
Use a more conventional stack arrangement in PXELINUX. Also make itsyslinux-2.00-pre16
possible to query the invocation record for PXELINUX.
-rw-r--r--bootsect.inc7
-rw-r--r--comboot.doc33
-rw-r--r--comboot.inc26
-rw-r--r--pxelinux.asm36
4 files changed, 73 insertions, 29 deletions
diff --git a/bootsect.inc b/bootsect.inc
index b114c4eb..ccf5331c 100644
--- a/bootsect.inc
+++ b/bootsect.inc
@@ -86,13 +86,12 @@ load_bootsec:
pop ecx ; Byte count to copy
cli
-%if IS_PXELINUX
- lss sp,[Stack] ; Reset stack to PXE original
- pop es
-%else
xor ebx,ebx
mov ds,bx
mov es,bx
+%if IS_PXELINUX
+ lss sp,[InitStack] ; Reset stack to PXE original
+%else
mov esp,7C00h
pushad
pushfd
diff --git a/comboot.doc b/comboot.doc
index f427246f..43c80f99 100644
--- a/comboot.doc
+++ b/comboot.doc
@@ -341,6 +341,7 @@ AX=000Ah Get Derivative-Specific Information
Output: AL 32h (PXELINUX)
DX PXE API version detected (DH=major, DL=minor)
ES:BX pointer to PXENV+ or !PXE structure
+ FS:SI pointer to original stack with invocation record
Note: DX notes the API version detected by PXELINUX,
which may be more conservative than the actual version
@@ -354,6 +355,26 @@ AX=000Ah Get Derivative-Specific Information
signature to determine which particular structure was
provided.
+ The FS:SI pointer points to the top of the original stack
+ provided by the PXE stack, with the following values
+ pushed at the time PXELINUX is started:
+
+ fs:[si+0] GS <- top of stack
+ fs:[si+2] FS
+ fs:[si+4] ES
+ fs:[si+6] DS
+ fs:[si+8] EFLAGS
+ fs:[si+12] EDI
+ fs:[si+16] ESI
+ fs:[si+20] EBP
+ fs:[si+24] -
+ fs:[si+28] EBX
+ fs:[si+32] EDX
+ fs:[si+36] ECX
+ fs:[si+40] EAX
+ fs:[si+44] PXE return IP <- t.o.s. when PXELINUX invoked
+ fs:[si+46] PXE return CS
+
[ISOLINUX]
Input: AX 000Ah
@@ -394,11 +415,13 @@ AX=000Ch Perform final cleanup
INVOKING THIS CALL, NO OTHER API CALLS MAY BE INVOKED, NOR MAY
THE PROGRAM TERMINATE AND RETURN TO THE BOOT LOADER. This
call basically tells the boot loader "get out of the way, I'll
- handle it from here." The boot loader will continue to
- provide interrupt and BIOS call thunking services as long its
- memory areas (0x1000-0xffff, 0x100000-0x100fff) are not
- overwritten. MAKE SURE TO DISABLE INTERRUPTS BEFORE
- OVERWRITING THESE MEMORY AREAS.
+ handle it from here."
+
+ For COM32 images, the boot loader will continue to provide
+ interrupt and BIOS call thunking services as long its memory
+ areas (0x1000-0xffff, 0x100000-0x100fff) are not overwritten.
+ MAKE SURE TO DISABLE INTERRUPTS, AND INSTALL NEW GDT AND IDTS
+ BEFORE OVERWRITING THESE MEMORY AREAS.
The permissible values for DX are as follows:
diff --git a/comboot.inc b/comboot.inc
index 15b25fce..46463694 100644
--- a/comboot.inc
+++ b/comboot.inc
@@ -19,13 +19,15 @@
; Parameter registers definition; this is the definition
; of the stack frame used by INT 21h and INT 22h.
-%define P_FLAGS word [bp+40]
-%define P_FLAGSL byte [bp+40]
-%define P_FLAGSH byte [bp+41]
-%define P_CS word [bp+38]
-%define P_IP word [bp+36]
-%define P_DS word [bp+34]
-%define P_ES word [bp+32]
+%define P_FLAGS word [bp+44]
+%define P_FLAGSL byte [bp+44]
+%define P_FLAGSH byte [bp+45]
+%define P_CS word [bp+42]
+%define P_IP word [bp+40]
+%define P_DS word [bp+38]
+%define P_ES word [bp+36]
+%define P_FS word [bp+34]
+%define P_GS word [bp+32]
%define P_EAX dword [bp+28]
%define P_AX word [bp+28]
%define P_HAX word [bp+30]
@@ -147,6 +149,8 @@ comboot_setup_api:
comboot_int21: cli
push ds
push es
+ push fs
+ push gs
pushad
cld
mov bp,cs
@@ -167,6 +171,8 @@ comboot_int21: cli
comboot_resume:
setc P_FLAGSL ; Propagate CF->error
popad
+ pop gs
+ pop fs
pop es
pop ds
iret
@@ -277,6 +283,8 @@ comboot_int22:
cli
push ds
push es
+ push fs
+ push gs
pushad
cld
mov bp,cs
@@ -453,6 +461,10 @@ comapi_derinfo:
mov P_BX,ax
mov ax,[StrucPtr+2]
mov P_ES,ax
+ mov ax,[InitStack]
+ mov P_SI,ax
+ mov ax,[InitStack+2]
+ mov P_FS,ax
%elif IS_ISOLINUX
mov al,[DriveNo]
mov P_DL,al
diff --git a/pxelinux.asm b/pxelinux.asm
index 302ed0b3..fd00340e 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -194,7 +194,7 @@ RamdiskMax resd 1 ; Highest address for a ramdisk
KernelSize resd 1 ; Size of kernel (bytes)
SavedSSSP resd 1 ; Our SS:SP while running a COMBOOT image
PMESP resd 1 ; Protected-mode ESP
-Stack resd 1 ; Pointer to reset stack
+InitStack resd 1 ; Pointer to reset stack
PXEEntry resd 1 ; !PXE API entry point
RebootTime resd 1 ; Reboot timeout, if set by option
KernelClust resd 1 ; Kernel size in clusters
@@ -271,6 +271,8 @@ packet_buf_size equ $-packet_buf
section .text
org 7C00h
+StackBuf equ $
+
;
; Primary entry point.
;
@@ -290,12 +292,19 @@ _start1:
mov ax,cs
mov ds,ax
- sti ; Stack already set up by PXE
+
+ ; That is all pushed onto the PXE stack. Save the pointer
+ ; to it and switch to an internal stack.
+ mov [InitStack],sp
+ mov [InitStack+2],ss
+
+ cli ; Paranoia
+ mov ss,ax
+ mov sp,StackBuf
+
+ sti ; Stack set up and ready
cld ; Copy upwards
- push ds
- mov [Stack],sp
- mov [Stack+2],ss
;
; Initialize screen (if we're using one)
;
@@ -803,10 +812,6 @@ config_scan:
%define HAVE_UNLOAD_PREP
%macro UNLOAD_PREP 0
call unload_pxe
- cli
- xor ax,ax
- mov ss,ax
- mov sp,7C00h ; Set up a conventional stack
%endmacro
%include "runkernel.inc"
@@ -828,12 +833,15 @@ config_scan:
;
local_boot:
call vgaclearmode
- lss sp,[cs:Stack] ; Restore stack pointer
- pop ds ; Restore DS
+ xor si,si
+ mov ds,si ; Restore DI
+ mov ss,si
+ mov sp,StackBuf ; Reset the stack
mov [LocalBootType],ax
mov si,localboot_msg
call writestr
; Restore the environment we were called with
+ lss sp,[InitStack]
pop gs
pop fs
pop es
@@ -870,7 +878,8 @@ abort_load:
mov ax,cs ; Restore CS = DS = ES
mov ds,ax
mov es,ax
- lss sp,[Stack] ; Reset the stack
+ mov ss,ax
+ mov sp,StackBuf ; Reset the stack
sti
call cwritestr ; Expects SI -> error msg
al_ok: jmp enter_command ; Return to command prompt
@@ -889,7 +898,8 @@ kaboom:
mov ax,cs
mov es,ax
mov ds,ax
- lss sp,[Stack]
+ mov ss,ax
+ mov sp,StackBuf
sti
.patch: mov si,bailmsg
call writestr ; Returns with AL = 0