[syslinux:elflink] pxe: move hardwired DHCP options into high memory

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Tue May 29 12:24:02 PDT 2012


Commit-ID:  08ece8fc875e095e359a5b4fc8c9b8703b250501
Gitweb:     http://www.syslinux.org/commit/08ece8fc875e095e359a5b4fc8c9b8703b250501
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 29 May 2012 12:22:32 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 29 May 2012 12:22:32 -0700

pxe: move hardwired DHCP options into high memory

If we have hardwired DHCP options, move them into high memory instead
of into the trackbuf.  This eliminates yet another trackbuf user.

Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>

---
 core/init.inc     |    5 +++
 core/layout.inc   |    2 +
 core/pxelinux.asm |   95 +++++++++++++++++++++++++---------------------------
 core/syslinux.ld  |   15 ++++++++
 4 files changed, 68 insertions(+), 49 deletions(-)

diff --git a/core/init.inc b/core/init.inc
index e0ffd23..5cb8e49 100644
--- a/core/init.inc
+++ b/core/init.inc
@@ -23,6 +23,11 @@ common_init:
 		; Initialize PM invocation framework
 		call pm_init
 
+%if IS_PXELINUX
+		; Save derivative-specific data
+		pm_call pm_save_data
+%endif
+
 		; Decompress PM code to its target location
 		pm_call pm_decompress
 		cmp eax,__pm_code_len
diff --git a/core/layout.inc b/core/layout.inc
index c58c0fd..2484392 100644
--- a/core/layout.inc
+++ b/core/layout.inc
@@ -97,6 +97,8 @@ RBFG_brainfuck:	resb 2048		; Bigger than an Ethernet packet...
 		; the spillover from the last fractional sector load.
 		section .uibss		write nobits align=16
 
+		section .savedata	write nobits align=16
+
 		; Symbols from linker script
 %macro SECINFO 1
 		extern __%1_start, __%1_lma, __%1_end
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index e59a0e2..c7d3889 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -154,54 +154,6 @@ _start1:
 
 		lss esp,[BaseStack]
 		sti			; Stack set up and ready
-;
-; Move the hardwired DHCP options (if present) to a safe place...
-;
-bdhcp_copy:
-		mov cx,[bdhcp_len]
-		mov ax,trackbufsize/2
-		jcxz .none
-		cmp cx,ax
-		jbe .oksize
-		mov cx,ax
-		mov [bdhcp_len],ax
-.oksize:
-		mov eax,[bdhcp_offset]
-		add eax,_start
-		mov si,ax
-		and si,000Fh
-		shr eax,4
-		push ds
-		mov ds,ax
-		mov di,trackbuf
-		add cx,3
-		shr cx,2
-		rep movsd
-		pop ds
-.none:
-
-adhcp_copy:
-		mov cx,[adhcp_len]
-		mov ax,trackbufsize/2
-		jcxz .none
-		cmp cx,ax
-		jbe .oksize
-		mov cx,ax
-		mov [adhcp_len],ax
-.oksize:
-		mov eax,[adhcp_offset]
-		add eax,_start
-		mov si,ax
-		and si,000Fh
-		shr eax,4
-		push ds
-		mov ds,ax
-		mov di,trackbuf+trackbufsize/2
-		add cx,3
-		shr cx,2
-		rep movsd
-		pop ds
-.none:
 
 ;
 ; Initialize screen (if we're using one)
@@ -284,10 +236,55 @@ enter_command:
 auto_boot:
 		pm_call hello
 
+;
+; Save hardwired DHCP options.  This is done before the C environment
+; is initialized, so it has to be done in assembly.
+;
+%define MAX_DHCP_OPTS	4096
+		bits 32
+
+		section .savedata
+		global bdhcp_data, adhcp_data
+bdhcp_data:	resb MAX_DHCP_OPTS
+adhcp_data:	resb MAX_DHCP_OPTS
+
+		section .textnr
+pm_save_data:
+		mov eax,MAX_DHCP_OPTS
+		movzx ecx,word [bdhcp_len]
+		cmp ecx,eax
+		jna .oksize
+		mov ecx,eax
+		mov [bdhcp_len],ax
+.oksize:
+		mov esi,[bdhcp_offset]
+		add esi,_start
+		mov edi,bdhcp_data
+		add ecx,3
+		shr ecx,2
+		rep movsd
+
+adhcp_copy:
+		movzx ecx,word [adhcp_len]
+		cmp ecx,eax
+		jna .oksize
+		mov ecx,eax
+		mov [adhcp_len],ax
+.oksize:
+		mov esi,[adhcp_offset]
+		add esi,_start
+		mov edi,adhcp_data
+		add ecx,3
+		shr ecx,2
+		rep movsd
+		ret
+
+		bits 16
+
 ; As core/ui.inc used to be included here in core/pxelinux.asm, and it's no
 ; longer used, its global variables that were previously used by
 ; core/pxelinux.asm are now declared here.
-               section .bss16
+		section .bss16
 		alignb 4
 Kernel_EAX	resd 1
 Kernel_SI	resw 1
diff --git a/core/syslinux.ld b/core/syslinux.ld
index 81d6b11..c58851b 100644
--- a/core/syslinux.ld
+++ b/core/syslinux.ld
@@ -376,6 +376,8 @@ SECTIONS
 
 	/* Very large objects which don't need to be zeroed */
 
+	. = ALIGN(128);
+
 	__hugebss_vma = .;
 	__hugebss_lma = .;		/* Dummy */
 	.hugebss (NOLOAD) : AT (__hugebss_lma) {
@@ -387,6 +389,19 @@ SECTIONS
 	__hugebss_len = ABSOLUTE(__hugebss_end) - ABSOLUTE(__hugebss_start);
 	__hugebss_dwords = (__hugebss_len + 3) >> 2;
 
+	/* Data saved away before bss initialization */
+	. = ALIGN(128);
+
+	__savedata_vma = .;
+	__savedata_lma = .;		/* Dummy */
+	.savedata (NOLOAD) : AT (__savedata_lma) {
+		__savedata_start = .;
+		*(.savedata)
+		*(.savedata.*)
+		__savedata_end = .;
+	}
+	__savedata_len = ABSOLUTE(__savedata_end) - ABSOLUTE(__savedata_start);
+	__savedata_dwords = (__savedata_len + 3) >> 2;
 
 	/* XXX: This stack should be unified with the COM32 stack */
 	__stack_vma = .;


More information about the Syslinux-commits mailing list