diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-02-12 13:37:20 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-12 16:13:31 -0800 |
commit | 831f1a04fbbbb1f65d95858b1b435325f67981f2 (patch) | |
tree | 85cbb2146f765f5dff1cc9d32332caeae6bb4303 | |
parent | 60701611cfd3242f5ed4dc8fa985477eb53ad202 (diff) | |
download | syslinux.git-831f1a04fbbbb1f65d95858b1b435325f67981f2.tar.gz syslinux.git-831f1a04fbbbb1f65d95858b1b435325f67981f2.tar.xz syslinux.git-831f1a04fbbbb1f65d95858b1b435325f67981f2.zip |
pxelinux: move the stack to avoid AMI BIOS bug
There is apparently some AMI BIOSes which leave a BEV stack just below
7c00h, which means that they can't return from the PXE NBP. Thus, for
PXELINUX, move the stack down a few kilobytes.
This particularly refers to the "rouilj/ops12" system my private
sysdump archive.
Reported-and-tested-by: John Rouillard <rouilj@renesys.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | core/layout.inc | 10 | ||||
-rw-r--r-- | core/pxelinux.asm | 19 | ||||
-rw-r--r-- | core/syslinux.ld | 3 |
3 files changed, 24 insertions, 8 deletions
diff --git a/core/layout.inc b/core/layout.inc index 8c2e2485..db035b57 100644 --- a/core/layout.inc +++ b/core/layout.inc @@ -26,6 +26,16 @@ BSS_START equ 0800h ; Text starts at the load address of 07C00h. TEXT_START equ 7C00h +; Stack layout + global STACK_LEN, STACK_TOP, STACK_BASE +STACK_LEN equ 4096 +%if IS_PXELINUX +STACK_TOP equ 7000h +%else +STACK_TOP equ 7c00h +%endif +STACK_BASE equ STACK_TOP - STACK_LEN + ; The secondary BSS section, above the text; we really wish we could ; just make it follow .bcopy32 or hang off the end, ; but it doesn't seem to work that way. diff --git a/core/pxelinux.asm b/core/pxelinux.asm index 6ad15845..c3caacd6 100644 --- a/core/pxelinux.asm +++ b/core/pxelinux.asm @@ -212,12 +212,15 @@ pxe_unload_stack_pkt_len equ $-pxe_unload_stack_pkt packet_buf resb 2048 ; Transfer packet packet_buf_size equ $-packet_buf +; +; Location of the stack. There are apparently some AMI BIOSes in the +; field which put their BEV stack somewhere below 7C00h (and therefore +; don't handle localboot properly), so avoid that immediate memory +; region. +; +StackBuf equ STACK_TOP-44 ; Base of stack if we use our own + section .text - ; - ; PXELINUX needs more BSS than the other derivatives; - ; therefore we relocate it from 7C00h on startup. - ; -StackBuf equ $-44 ; Base of stack if we use our own ; ; Primary entry point. @@ -255,6 +258,12 @@ _start1: mov ds,ax mov es,ax + ; Clobber the stack segment, to test for specific pathologies + mov di,STACK_BASE + mov cx,STACK_LEN >> 1 + mov ax,0xf4f4 + rep stosw + ; That is all pushed onto the PXE stack. Save the pointer ; to it and switch to an internal stack. mov [InitStack],sp diff --git a/core/syslinux.ld b/core/syslinux.ld index c1da230e..f6446e1b 100644 --- a/core/syslinux.ld +++ b/core/syslinux.ld @@ -20,8 +20,6 @@ OUTPUT_ARCH(i386) EXTERN(_start) ENTRY(_start) -STACK_LEN = 4096; - SECTIONS { /* "Early" sections (before the load) */ @@ -63,7 +61,6 @@ SECTIONS /* Stack */ - STACK_BASE = 0x7c00 - STACK_LEN; . = STACK_BASE; .stack : AT(STACK_BASE) { __stack_start = .; |