aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-05-28 22:11:57 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-05-28 22:11:57 -0700
commit3ec40a0119587f63411475c76c69f9db24c7598e (patch)
treef0365e546f3cf24966936f8e3a59b6673f8ccdf4
parent4ba801edb01acae7281fe09f6225c38390033817 (diff)
downloadsyslinux.git-3ec40a0119587f63411475c76c69f9db24c7598e.tar.gz
syslinux.git-3ec40a0119587f63411475c76c69f9db24c7598e.tar.xz
syslinux.git-3ec40a0119587f63411475c76c69f9db24c7598e.zip
Fix localboot stack bug; cleanup section handling in the ELF universesyslinux-3.70-pre11
Fix and clean up section handling in ELF; fix stack reset in localboot directive (for non-pxelinux, that is.)
-rw-r--r--configinit.inc8
-rw-r--r--cpuinit.inc6
-rw-r--r--layout.inc11
-rw-r--r--localboot.inc5
-rw-r--r--pxelinux.asm13
-rw-r--r--syslinux.ld46
6 files changed, 43 insertions, 46 deletions
diff --git a/configinit.inc b/configinit.inc
index a5eaf1b3..cf6a814c 100644
--- a/configinit.inc
+++ b/configinit.inc
@@ -23,11 +23,9 @@ reset_config:
; Initialize the .config section
xor eax,eax
- mov si,section..config.start
- mov di,section..config.vstart
- mov cx,section..config.end.start
- sub cx,di
- shr cx,2
+ mov si,__config_lma
+ mov di,__config_start
+ mov cx,__config_dwords
rep movsd
%ifndef DEPEND
diff --git a/cpuinit.inc b/cpuinit.inc
index 0d9f4047..fd62cc77 100644
--- a/cpuinit.inc
+++ b/cpuinit.inc
@@ -42,9 +42,9 @@ skip_checks:
;
; Initialize the bcopy32 code in low memory
;
- mov si,section..bcopy32.start
- mov di,__bcopy_start
- mov cx,__bcopy_size >> 2
+ mov si,__bcopy32_lma
+ mov di,__bcopy32_start
+ mov cx,__bcopy32_dwords
rep movsd
;
diff --git a/layout.inc b/layout.inc
index f58ec8fa..51460e14 100644
--- a/layout.inc
+++ b/layout.inc
@@ -80,11 +80,12 @@ RBFG_brainfuck: resb 2048 ; Bigger than an Ethernet packet...
section .bss1 write nobits align=16
; Symbols from linker script
- extern Stack
- extern section..bcopy32.start
- extern section..config.start
- extern section..config.vstart
- extern section..config.end.start
+%macro SECINFO 1
+ extern __%1_start, __%1_lma, __%1_end
+ extern __%1_len, __%1_dwords
+%endmacro
+ SECINFO bcopy32
+ SECINFO config
global _start
diff --git a/localboot.inc b/localboot.inc
index 288d390a..b6b31deb 100644
--- a/localboot.inc
+++ b/localboot.inc
@@ -26,10 +26,7 @@
local_boot:
call vgaclearmode
- lss sp,[cs:Stack] ; Restore stack pointer
- xor dx,dx
- mov ds,dx
- mov es,dx
+ RESET_STACK_AND_SEGS dx ; dx <- 0
mov fs,dx
mov gs,dx
mov si,localboot_msg
diff --git a/pxelinux.asm b/pxelinux.asm
index c4feee2e..ce3250bc 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -271,19 +271,6 @@ _start:
mov ds,ax
mov es,ax
-%ifndef DEPEND
-%if TEXT_START != 0x7c00
- ; This is uglier than it should be, but works around
- ; some NASM 0.98.38 bugs.
- mov di,section..bcopy32.start
- add di,__bcopy_size-4
- lea si,[di-(TEXT_START-7C00h)]
- lea cx,[di-(TEXT_START-4)]
- shr cx,2
- std ; Overlapping areas, copy backwards
- rep movsd
-%endif
-%endif
jmp 0:_start1 ; Canonicalize address
_start1:
mov bp,sp
diff --git a/syslinux.ld b/syslinux.ld
index d6fa685d..3c55820f 100644
--- a/syslinux.ld
+++ b/syslinux.ld
@@ -17,28 +17,36 @@ SECTIONS
.earlybss : {
__earlybss_start = .;
*(.earlybss)
- __earlybss_len = . - __earlybss_start;
+ __earlybss_end = .;
}
+ __earlybss_len = __earlybss_end - __earlybss_start;
+ __earlybss_dwords = (__earlybss_len + 3) >> 2;
.bcopy32 : AT (__bcopy32_lma) {
FILL(0x90909090)
__bcopy32_start = .;
*(.bcopy32)
- __bcopy32_len = . - __bcopy32_start;
+ __bcopy32_end = .;
}
+ __bcopy32_len = __bcopy32_end - __bcopy32_start;
+ __bcopy32_dwords = (__bcopy32_len + 3) >> 2;
.config : AT (__config_lma) {
__config_start = .;
*(.config)
- __config_len = . - __config_start;
+ __config_end = .;
}
+ __config_len = __config_end - __config_start;
+ __config_dwords = (__config_len + 3) >> 2;
.bss : AT(__bss_start) {
__bss_start = .;
*(.bss)
*(.bss2)
- __bss_len = . - __bss_start;
+ __bss_end = .;
}
+ __bss_len = __bss_end - __bss_start;
+ __bss_dwords = (__bss_len + 3) >> 2;
/* Stack */
@@ -46,8 +54,10 @@ SECTIONS
.stack : {
__stack_start = .;
. += STACK_LEN;
- __stack_len = . - __stack_start;
+ __stack_end = .;
}
+ __stack_len = __stack_end - __stack_start;
+ __stack_dwords = (__stack_len + 3) >> 2;
/* Initialized sections */
@@ -56,8 +66,10 @@ SECTIONS
FILL(0x90909090)
__text_start = .;
*(.text)
- __text_len = . - __text_start;
+ __text_end = .;
}
+ __text_len = __text_end - __text_start;
+ __text_dwords = (__text_len + 3) >> 2;
. = ALIGN(4);
__bcopy32_lma = .;
@@ -67,8 +79,10 @@ SECTIONS
.data : {
__data_start = .;
*(.data)
- __data_len = . - __data_start;
+ __data_end = .;
}
+ __data_len = __data_end - __data_start;
+ __data_dwords = (__data_len + 3) >> 2;
. = ALIGN(4);
__config_lma = .;
@@ -80,26 +94,26 @@ SECTIONS
.adv : {
__adv_start = .;
*(.adv)
- __adv_len = . - __adv_start;
+ __adv_end = .;
}
+ __adv_len = __adv_end - __adv_start;
+ __adv_dwords = (__adv_len + 3) >> 2;
/* Late uninitialized sections */
.uibss : {
__uibss_start = .;
*(.uibss)
- __uibss_len = . - __uibss_start;
+ __uibss_end = .;
}
+ __uibss_len = __uibss_end - __uibss_start;
+ __uibss_dwords = (__uibss_len + 3) >> 2;
.bss1 : {
__bss1_start = .;
*(.bss1)
- __bss1_len = . - __bss1_start;
+ __bss1_end = .;
}
-
- Stack = __stack_start;
- section..bcopy32.start = __bcopy32_lma;
- section..config.start = __config_lma;
- section..config.vstart = __config_start;
- section..config.end.start = __config_start + SIZEOF(.config);
+ __bss1_len = __bss1_end - __bss1_start;
+ __bss1_dwords = (__bss1_len + 3) >> 2;
}