[syslinux] [PATCH 05/19] core: Delete the aux segment

Matt Fleming matt at console-pimps.org
Fri Mar 23 11:02:39 PDT 2012


From: Matt Fleming <matt.fleming at intel.com>

We don't need to use a special aux segment because we can represent
'fontbuf' with OFFS() and SEG(). We're guaranteed to be able to break
the 32-bit pointer up with these macros because we control where in
the address space the core is loaded. (Not all 32-bit pointers can be
represented with OFFS() and SEG(), only addresses in the range
0..0xFFFFF.)

This fixes the breakage that was introduced in commit 14531c47bc95
("core: Delete code that is duplicated in ldlinux").

This allows the default font to be displayed. Previously junk was
being returned in the COMBOOT API call to query the userfont, leading
the caller to believe that a user font was installed even when it
wasn't.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>
---
 core/comboot.inc    |    6 ++++--
 core/font.c         |   20 +++++++++++---------
 core/include/core.h |    1 -
 core/init.inc       |    2 +-
 core/layout.inc     |   15 ---------------
 core/syslinux.ld    |   15 ---------------
 6 files changed, 16 insertions(+), 43 deletions(-)

diff --git a/core/comboot.inc b/core/comboot.inc
index e0ad068..38d65dd 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -669,10 +669,12 @@ comapi_userfont:
 		and al,al
 		jz .done
 		mov al,[VGAFontSize]
-		mov P_ES,aux_seg
-		mov P_BX,aux.fontbuf
+		pm_call pm_userfont
+		mov P_ES,es
+		mov P_BX,bx
 
 .done:		; CF=0 here
+		mov P_AL,al
 		ret
 
 ;
diff --git a/core/font.c b/core/font.c
index b14d3d2..0eeb90f 100644
--- a/core/font.c
+++ b/core/font.c
@@ -24,12 +24,8 @@
 #include "bios.h"
 #include "core.h"
 
-struct aux {
-	char fontbuf[8192];
-	char serial[serial_buf_size];
-};
-
-#define fontbuf		offsetof(struct aux, fontbuf)
+char fontbuf[8192];
+char serial[serial_buf_size];
 
 extern uint16_t VGAFontSize;
 extern uint8_t UserFont;
@@ -91,7 +87,7 @@ void loadfont(char *filename)
 
 	/* Copy to font buffer */
 	VGAFontSize = height;
-	di = (uint32_t *)MK_PTR(aux_seg, fontbuf);
+	di = (uint32_t *)fontbuf;
 	si = (uint32_t *)trackbuf;
 	for (i = 0; i < (height << 6); i++)
 		*di++ = *si++;
@@ -118,8 +114,8 @@ void use_font(void)
 
 	memset(&ireg, 0, sizeof(ireg));
 
-	ireg.es = aux_seg;
-	ireg.ebp.w[0] = fontbuf; /* ES:BP -> font */
+	ireg.es = SEG(fontbuf);
+	ireg.ebp.w[0] = OFFS(fontbuf); /* ES:BP -> font */
 
 	/* Are we using a user-specified font? */
 	if (UserFont & 0x1) {
@@ -193,3 +189,9 @@ void pm_adjust_screen(com32sys_t *regs)
 {
 	adjust_screen();
 }
+
+void pm_userfont(com32sys_t *regs)
+{
+	regs->es = SEG(fontbuf);
+	regs->ebx.w[0] = OFFS(fontbuf);
+}
diff --git a/core/include/core.h b/core/include/core.h
index 69c16d6..a247d49 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -24,7 +24,6 @@ extern char ConfigFile[];
 extern char syslinux_banner[];
 extern char copyright_str[];
 
-extern char aux_seg[];
 extern uint8_t KbdMap[256];
 
 /* diskstart.inc isolinux.asm*/
diff --git a/core/init.inc b/core/init.inc
index 286b380..e0ffd23 100644
--- a/core/init.inc
+++ b/core/init.inc
@@ -63,7 +63,7 @@ pm_decompress:
 		mov edi,__bss16_start
 		mov ecx,__bss16_dwords
 		rep stosd
-		mov edi,__high_clear_start	; .uibss, .auxseg, .lowmem
+		mov edi,__high_clear_start	; .uibss, .lowmem
 		mov ecx,__high_clear_dwords
 		rep stosd
 
diff --git a/core/layout.inc b/core/layout.inc
index dab27dd..c58c0fd 100644
--- a/core/layout.inc
+++ b/core/layout.inc
@@ -128,21 +128,6 @@ RBFG_brainfuck:	resb 2048		; Bigger than an Ethernet packet...
 serial_buf_size	equ 4096		; Should be a power of 2
 
 ;
-; Contents of aux_seg
-;
-		extern aux_seg		; Actual segment assigned by linker
-
-		struc aux
-.fontbuf	resb 8192
-.serial		resb serial_buf_size
-
-		alignb 4096		; Align the next segment to 4K
-		endstruc
-
-		section .auxseg		write nobits align=16
-auxseg		resb aux_size
-
-;
 ; Transfer buffer segment: guaranteed to be aligned 64K, used for disk I/O
 ; One symbol for the segment number, one for the absolute address
 ;
diff --git a/core/syslinux.ld b/core/syslinux.ld
index 43fc153..81d6b11 100644
--- a/core/syslinux.ld
+++ b/core/syslinux.ld
@@ -212,21 +212,6 @@ SECTIONS
 	xfer_buf_seg = core_xfer_buf >> 4;
 
 	/*
-	 * The auxilliary data segment is used by the 16-bit code
-	 * for items that don't need to live in the bottom 64K.
-	 */
-
-	. = ALIGN(16);
-	.auxseg (NOLOAD) : {
-		__auxseg_start = .;
-		*(.auxseg)
-		__auxseg_end = .;
-	}
-	__auxseg_len = ABSOLUTE(__auxseg_end) - ABSOLUTE(__auxseg_start);
-	__auxseg_dwords = (__auxseg_len + 3) >> 2;
-	aux_seg = __auxseg_start >> 4;
-
-	/*
 	 * Used to allocate lowmem buffers from 32-bit code
 	 */
 	.lowmem (NOLOAD) : {
-- 
1.7.4.4




More information about the Syslinux mailing list