core: move initial code to a new .init segment; unify .bss+.bss1
authorH. Peter Anvin <hpa@zytor.com>
Thu, 14 May 2009 01:35:35 +0000 (18:35 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 14 May 2009 01:35:35 +0000 (18:35 -0700)
Move code used before loading is complete to a new .init segment;
.text is now only the stuff that is used at any time.  Move the .bss1
segment down to where .bss and .bss2 already are; it seems to fit
better there now.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/diskstart.inc
core/extlinux.asm
core/isolinux.asm
core/layout.inc
core/ldlinux.asm
core/syslinux.ld

index ee57590..6f38c7a 100644 (file)
@@ -22,7 +22,7 @@
                alignb 8
 SuperInfo      resq 16                 ; The first 16 bytes expanded 8 times
 
-               section .text
+               section .init
 ;
 ; Some of the things that have to be saved very early are saved
 ; "close" to the initial stack pointer offset, in order to
@@ -651,6 +651,7 @@ rl_checkpt_off      equ ($-$$)
 ;  End of code and data that have to be in the first sector
 ; ----------------------------------------------------------------------------
 
+               section .text
 all_read:
 ;
 ; Let the user (and programmer!) know we got this far.  This used to be
@@ -679,4 +680,3 @@ expand_super:
 ;
 ; Fall through to the mainline code...
 ;
-               section .text
index 167e713..809571e 100644 (file)
@@ -171,7 +171,12 @@ Files              resb MAX_OPEN*open_file_t_size
 ; verbosity and using the full screen system
 ;
                ; E9 = JMP NEAR
-               mov dword [kaboom.patch],0e9h+((kaboom2-(kaboom.patch+3)) << 8)
+               mov di,kaboom.patch
+               mov al,0e9h
+               stosb
+               mov ax,kaboom2-3
+               sub ax,bx
+               stosw
 
 ;
 ; Now we're all set to start with our *real* business. First load the
index 8481b4b..4cb4cb8 100644 (file)
@@ -200,7 +200,7 @@ _spec_len   equ _spec_end - _spec_start
                alignb open_file_t_size
 Files          resb MAX_OPEN*open_file_t_size
 
-               section .text
+               section .init
 ;;
 ;; Primary entry point.  Because BIOSes are buggy, we only load the first
 ;; CD-ROM sector (2K) of the file, so the number one priority is actually
@@ -693,9 +693,7 @@ writemsg:   push ax
 ;
 
 writechr:
-               jmp near writechr_simple        ; 3-byte jump
-
-writechr_simple:
+.simple:
                pushfd
                pushad
                mov ah,0Eh
@@ -1079,6 +1077,7 @@ rl_checkpt        equ $                           ; Must be <= 800h
 ; ----------------------------------------------------------------------------
 ;  End of code and data that have to be in the first sector
 ; ----------------------------------------------------------------------------
+               section .text
 
 all_read:
 
@@ -1093,7 +1092,12 @@ all_read:
 %include "cpuinit.inc"
 
                ; Patch the writechr routine to point to the full code
-               mov word [writechr+1], writechr_full-(writechr+3)
+               mov di,writechr
+               mov al,0e9h
+               stosb
+               mov ax,writechr_full-3
+               sub ax,bx
+               stosw
 
 ; Tell the user we got this far...
 %ifndef DEBUG_MESSAGES                 ; Gets messy with debugging on
index 8d56745..a73a36c 100644 (file)
@@ -56,7 +56,8 @@ RBFG_brainfuck:       resb 2048               ; Bigger than an Ethernet packet...
 
                section .bss2           write nobits align=16
 
-               section .text           exec write progbits align=16
+               section .init           exec write progbits align=1
+               section .text           exec write progbits align=1
                section .bcopyxx        exec write progbits align=16
                section .data           write progbits align=16
 
index 4bee097..92dc6da 100644 (file)
@@ -228,7 +228,12 @@ getfattype:
 ; verbosity and using the full screen system
 ;
                ; E9 = JMP NEAR
-               mov dword [kaboom.patch],0e9h+((kaboom2-(kaboom.patch+3)) << 8)
+               mov di,kaboom.patch
+               mov al,0e9h
+               stosb
+               mov ax,kaboom2-3
+               sub ax,bx
+               stosw
 
 ;
 ; Now we're all set to start with our *real* business. First load the
index c1da230..898b49d 100644 (file)
@@ -38,6 +38,7 @@ SECTIONS
        .bss : {
                __bss_start = .;
                *(.bss)
+               *(.bss1)
                *(.bss2)
                __bss_end = .;
        }
@@ -76,6 +77,15 @@ SECTIONS
        /* Initialized sections */
 
        . = 0x7c00;
+       .init : {
+               FILL(0x90909090)
+               __init_start = .;
+               *(.init)
+               __init_end = .;
+       }
+       __init_len = __init_end - __init_start;
+       __init_dwords = (__init_len + 3) >> 2;
+
        .text : {
                FILL(0x90909090)
                __text_start = .;
@@ -133,15 +143,7 @@ SECTIONS
        __uibss_len = __uibss_end - __uibss_start;
        __uibss_dwords = (__uibss_len + 3) >> 2;
 
-       .bss1 : {
-               __bss1_start = .;
-               *(.bss1)
-               __bss1_end = .;
-       }
-       __bss1_len = __bss1_end - __bss1_start;
-       __bss1_dwords = (__bss1_len + 3) >> 2;
-
-       . = ASSERT(__bss1_end <= 0x10000, "64K overflow");
+       . = ASSERT(__uibss_end <= 0x10000, "64K overflow");
 
        . = 0x100000;
        .com32 : {