From a68e1063c089a84675a01a8a0e1c3669d5b040c2 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Fri, 12 Feb 2010 16:49:55 -0800 Subject: [PATCH] core: document the stack location, use STACK_TOP throughout The global absolute symbol STACK_TOP defined in layout.inc can be used by the linker script as well as by anything else that needs to know where the stack is. Also document why we do it differently for PXELINUX. Signed-off-by: H. Peter Anvin --- core/diskstart.inc | 2 +- core/isolinux.asm | 2 +- core/layout.inc | 10 +++++++++- core/pxelinux.asm | 5 +---- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/core/diskstart.inc b/core/diskstart.inc index 5322922..e194b97 100644 --- a/core/diskstart.inc +++ b/core/diskstart.inc @@ -28,7 +28,7 @@ SuperInfo resq 16 ; The first 16 bytes expanded 8 times ; "close" to the initial stack pointer offset, in order to ; reduce the code size... ; -StackBuf equ $-44-32 ; Start the stack here (grow down - 4K) +StackBuf equ STACK_TOP-44-32 ; Start the stack here (grow down - 4K) PartInfo equ StackBuf ; Saved partition table entry FloppyTable equ PartInfo+16 ; Floppy info table (must follow PartInfo) OrigFDCTabPtr equ StackBuf-8 ; The 2nd high dword on the stack diff --git a/core/isolinux.asm b/core/isolinux.asm index 2627c2d..ef7d92d 100644 --- a/core/isolinux.asm +++ b/core/isolinux.asm @@ -199,7 +199,7 @@ Files resb MAX_OPEN*open_file_t_size ;; CD-ROM sector (2K) of the file, so the number one priority is actually ;; loading the rest. ;; -StackBuf equ $-44 ; 44 bytes needed for +StackBuf equ STACK_TOP-44 ; 44 bytes needed for ; the bootsector chainloading ; code! OrigESDI equ StackBuf-4 ; The high dword on the stack diff --git a/core/layout.inc b/core/layout.inc index db035b5..19b5057 100644 --- a/core/layout.inc +++ b/core/layout.inc @@ -1,7 +1,7 @@ ; ----------------------------------------------------------------------- ; ; Copyright 1994-2009 H. Peter Anvin - All Rights Reserved -; Copyright 2009 Intel Corporation; author: H. Peter Anvin +; Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin ; ; 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 @@ -26,7 +26,15 @@ BSS_START equ 0800h ; Text starts at the load address of 07C00h. TEXT_START equ 7C00h +; ; Stack layout +; +; PXELINUX: 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. +; The range that is known to be bad is approximately 75E8..7C00; the +; lower bound is tight. +; global STACK_LEN, STACK_TOP, STACK_BASE STACK_LEN equ 4096 %if IS_PXELINUX diff --git a/core/pxelinux.asm b/core/pxelinux.asm index c3caacd..ff0f36c 100644 --- a/core/pxelinux.asm +++ b/core/pxelinux.asm @@ -213,10 +213,7 @@ 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. +; Location of the stack. ; StackBuf equ STACK_TOP-44 ; Base of stack if we use our own -- 2.7.4