Actually use sections, and move common variables into the .inc files.
authorhpa <hpa>
Fri, 17 Dec 2004 06:42:00 +0000 (06:42 +0000)
committerhpa <hpa>
Fri, 17 Dec 2004 06:42:00 +0000 (06:42 +0000)
The .bss section at the beginning of each .asm file is now downright
tiny.

18 files changed:
bcopy32.inc
com32.inc
comboot.inc
conio.inc
font.inc
getc.inc
graphics.inc
highmem.inc
isolinux.asm
ldlinux.asm
loadhigh.inc
parsecmd.inc
parseconfig.inc
pxelinux.asm
runkernel.inc
strcpy.inc
ui.inc
writestr.inc

index f72cb55..ae4f8d0 100644 (file)
 ; trackbuf area (1000h).  The routine bcopy_over_self handles this mode
 ; of operation, including any necessary adjustments.
 ;
-               align 4
+               section .text
+               align 8
 __bcopy_start:
 
+               ; This is in the .text segment since it needs to be
+               ; contiguous with the rest of the bcopy stuff
+
 bcopy_gdt:     dw bcopy_gdt_size-1     ; Null descriptor - contains GDT
 .adj1:         dd bcopy_gdt            ; pointer for LGDT instruction
                dw 0
@@ -445,3 +449,8 @@ bcopy_over_self:
                popfd
                jmp 0:7c00h
 __bcopy_end:
+
+               section .bss
+A20Test                resw 1                  ; Counter for testing status of A20
+A20Type                resw 1                  ; A20 type
+A20Tries       resb 1                  ; Times until giving up on A20
index 26ebfbf..6da6041 100644 (file)
--- a/com32.inc
+++ b/com32.inc
@@ -31,7 +31,8 @@ pm_idt:               equ 0x100000
 pm_entry:      equ 0x101000
 
                bits 16
-               align 2
+               section .data
+               align 2, db 0
 com32_pmidt:
                dw 8*256                ; Limit
                dd pm_idt               ; Address
@@ -40,6 +41,7 @@ com32_rmidt:
                dw 0ffffh               ; Limit
                dd 0                    ; Address
 
+               section .text
 is_com32_image:
                push si                 ; Save file handle
                push dx                 ; File length held in DX:AX
@@ -347,3 +349,10 @@ com32_sys_resume:
                ret                     ; Return to 32-bit program
 
                bits 16
+
+               section .bss
+               alignb 4
+PMESP          resd 1                  ; Protected-mode ESP
+Com32SysSP     resw 1                  ; SP saved during COM32 syscall
+
+               section .text
index af34686..00d603c 100644 (file)
@@ -17,6 +17,8 @@
 ;; Common code for running a COMBOOT image
 ;;
 
+               section .text
+
 ; Parameter registers definition; this is the definition
 ; of the stack frame used by INT 21h and INT 22h.
 %define                P_FLAGS         word [bp+44]
@@ -561,9 +563,10 @@ comapi_configfile:
                clc
                ret
 
-;
-; This stuff should really be in the data section...
-;
+               section .bss
+SavedSSSP      resd 1                  ; Our SS:SP while running a COMBOOT image
+
+               section .data
 %macro                 int21 2
                db %1
                dw %2
index f90e269..c0dcecc 100644 (file)
--- a/conio.inc
+++ b/conio.inc
@@ -23,6 +23,8 @@
 ;
 ; loadkeys:    Load a LILO-style keymap; SI and DX:AX set by searchdir
 ;
+               section .text
+
 loadkeys:
                and dx,dx                       ; Should be 256 bytes exactly
                jne loadkeys_ret
@@ -370,3 +372,23 @@ debug_tracer:      pushad
                popad
                ret
 %endif ; DEBUG_TRACERS
+
+               section .bss
+               alignb 2
+NextCharJump    resw 1                 ; Routine to interpret next print char
+CursorDX        equ $
+CursorCol       resb 1                 ; Cursor column for message file
+CursorRow       resb 1                 ; Cursor row for message file
+ScreenSize      equ $
+VidCols         resb 1                 ; Columns on screen-1
+VidRows         resb 1                 ; Rows on screen-1
+
+; Serial console stuff...
+BaudDivisor    resw 1                  ; Baud rate divisor
+FlowControl    equ $
+FlowOutput     resb 1                  ; Outputs to assert for serial flow
+FlowInput      resb 1                  ; Input bits for serial flow
+FlowIgnore     resb 1                  ; Ignore input unless these bits set
+
+TextAttribute   resb 1                 ; Text attribute for message file
+DisplayMask    resb 1                  ; Display modes mask
index 2a9bfaa..e8e610a 100644 (file)
--- a/font.inc
+++ b/font.inc
@@ -17,6 +17,8 @@
 ;; VGA font handling code
 ;;
 
+               section .text
+
 ;
 ; loadfont:    Load a .psf font file and install it onto the VGA console
 ;              (if we're not on a VGA screen then ignore.)  It is called with
@@ -115,3 +117,11 @@ vidrows_ok:        mov [VidRows],al
                popa
                ret
 
+               
+; VGA font buffer at the end of memory (so loading a font works even
+; in graphics mode, but don't put too much pressure on the .bss)
+               section vgafont nobits start=0E000h
+vgafontbuf     resb 8192
+
+               section .text
+
index 6fd2406..c32ee6c 100644 (file)
--- a/getc.inc
+++ b/getc.inc
 ;
 open:
                call searchdir
-               jz open_return
+               jz openfd.ret
 openfd:
                pushf
-               mov [FBytes1],ax
-               mov [FBytes2],dx
+               mov [FBytes],ax
+               mov [FBytes+2],dx
                mov eax,[FBytes]
                add eax,SECTOR_SIZE-1
                shr eax,SECTOR_SHIFT
@@ -46,21 +46,21 @@ openfd:
                mov ax,[EndOfGetCBuf]   ; Pointer at end of buffer ->
                mov [FPtr],ax           ;  nothing loaded yet
                popf                    ; Restore no ZF
-open_return:   ret
+.ret:          ret
 
 getc:
                stc                     ; If we exit here -> EOF
                mov ecx,[FBytes]
-               jecxz getc_ret
+               jecxz .ret
                mov si,[FPtr]
                cmp si,[EndOfGetCBuf]
-               jb getc_loaded
+               jb .loaded
                ; Buffer empty -- load another set
                mov ecx,[FSectors]
                cmp ecx,trackbufsize >> SECTOR_SHIFT
-               jna getc_oksize
+               jna .oksize
                mov ecx,trackbufsize >> SECTOR_SHIFT
-getc_oksize:   sub [FSectors],ecx      ; Reduce remaining clusters
+.oksize:       sub [FSectors],ecx      ; Reduce remaining clusters
                mov si,[FNextClust]
                push es                 ; ES may be != DS, save old ES
                push ds
@@ -71,11 +71,11 @@ getc_oksize:        sub [FSectors],ecx      ; Reduce remaining clusters
                mov [FNextClust],si     ; Store new next pointer
                pop si                  ; SI -> newly loaded data
                pop es                  ; Restore ES
-getc_loaded:   lodsb                   ; Load a byte, increment SI
+.loaded:       lodsb                   ; Load a byte, increment SI
                mov [FPtr],si           ; Update next byte pointer
                dec dword [FBytes]      ; Update bytes left counter
                clc                     ; Not EOF
-getc_ret:      ret
+.ret:          ret
 
 ;
 ; ungetc:      Push a character (in AL) back into the getc buffer
@@ -100,19 +100,19 @@ ungetc:
 ;              Otherwise AL = first character after whitespace
 ;
 skipspace:
-skipspace_loop: call getc
-               jc skipspace_eof
+.loop:         call getc
+               jc .eof
                cmp al,1Ah                      ; DOS EOF
-               je skipspace_eof
+               je .eof
                cmp al,0Ah
-               je skipspace_eoln
+               je .eoln
                cmp al,' '
-               jbe skipspace_loop
+               jbe .loop
                ret                             ; CF = ZF = 0
-skipspace_eof: cmp al,al                       ; Set ZF
+.eof:          cmp al,al                       ; Set ZF
                stc                             ; Set CF
                ret
-skipspace_eoln: add al,0FFh                    ; Set CF, clear ZF
+.eoln:         add al,0FFh                     ; Set CF, clear ZF
                ret
 
 ;
@@ -121,17 +121,17 @@ skipspace_eoln: add al,0FFh                       ; Set CF, clear ZF
 ;
 getint:
                mov di,NumBuf
-gi_getnum:     cmp di,NumBufEnd        ; Last byte in NumBuf
-               jae gi_loaded
+.getnum:       cmp di,NumBufEnd        ; Last byte in NumBuf
+               jae .loaded
                push di
                call getc
                pop di
-               jc gi_loaded
+               jc .loaded
                stosb
                cmp al,'-'
-               jnb gi_getnum
+               jnb .getnum
                call ungetc             ; Unget non-numeric
-gi_loaded:     mov byte [di],0
+.loaded:       mov byte [di],0
                mov si,NumBuf
                ; Fall through to parseint
 
@@ -151,86 +151,97 @@ parseint:
                mov ebx,eax             ; Accumulator
                mov ecx,ebx             ; Base
                 xor bp,bp               ; Used for negative flag
-pi_begin:      lodsb
+.begin:                lodsb
                cmp al,'-'
-               jne pi_not_minus
+               jne .not_minus
                xor bp,1                ; Set unary minus flag
-               jmp short pi_begin
-pi_not_minus:
+               jmp short .begin
+.not_minus:
                cmp al,'0'
-               jb pi_err
-               je pi_octhex
+               jb .err
+               je .octhex
                cmp al,'9'
-               ja pi_err
+               ja .err
                mov cl,10               ; Base = decimal
-               jmp short pi_foundbase
-pi_octhex:
+               jmp short .foundbase
+.octhex:
                lodsb
                cmp al,'0'
-               jb pi_km                ; Value is zero
+               jb .km          ; Value is zero
                or al,20h               ; Downcase
                cmp al,'x'
-               je pi_ishex
+               je .ishex
                cmp al,'7'
-               ja pi_err
+               ja .err
                mov cl,8                ; Base = octal
-               jmp short pi_foundbase
-pi_ishex:
+               jmp short .foundbase
+.ishex:
                mov al,'0'              ; No numeric value accrued yet
                mov cl,16               ; Base = hex
-pi_foundbase:
+.foundbase:
                 call unhexchar
-                jc pi_km                ; Not a (hex) digit
+                jc .km                ; Not a (hex) digit
                 cmp al,cl
-               jae pi_km               ; Invalid for base
+               jae .km         ; Invalid for base
                imul ebx,ecx            ; Multiply accumulated by base
                 add ebx,eax             ; Add current digit
                lodsb
-               jmp short pi_foundbase
-pi_km:
+               jmp short .foundbase
+.km:
                dec si                  ; Back up to last non-numeric
                lodsb
                or al,20h
                cmp al,'k'
-               je pi_isk
+               je .isk
                cmp al,'m'
-               je pi_ism
+               je .ism
                dec si                  ; Back up
-pi_fini:       and bp,bp
-               jz pi_ret               ; CF=0!
+.fini:         and bp,bp
+               jz .ret         ; CF=0!
                neg ebx                 ; Value was negative
-pi_done:       clc
-pi_ret:                pop bp
+.done:         clc
+.ret:          pop bp
                 pop ecx
                 pop eax
                ret
-pi_err:                stc
-               jmp short pi_ret
-pi_isk:                shl ebx,10              ; x 2^10
-               jmp short pi_done
-pi_ism:                shl ebx,20              ; x 2^20
-               jmp short pi_done
+.err:          stc
+               jmp short .ret
+.isk:          shl ebx,10              ; x 2^10
+               jmp short .done
+.ism:          shl ebx,20              ; x 2^20
+               jmp short .done
+
+
+               section .bss
+               alignb 4
+NumBuf         resb 15                 ; Buffer to load number
+NumBufEnd      resb 1                  ; Last byte in NumBuf
+FBytes         resd 1                  ; Number of bytes left in getc file
+FSectors       resd 1                  ; Number of sectors in getc file
+FNextClust     resw 1                  ; Pointer to next cluster in d:o
+FPtr           resw 1                  ; Pointer to next char in buffer
 
 ;
 ; unhexchar:    Convert a hexadecimal digit in AL to the equivalent number;
 ;               return CF=1 if not a hex digit
 ;
+               section .text
 unhexchar:
                 cmp al,'0'
-               jb uxc_ret              ; If failure, CF == 1 already
+               jb .ret                 ; If failure, CF == 1 already
                 cmp al,'9'
-                ja uxc_1
+                ja .notdigit
                sub al,'0'              ; CF <- 0
                ret
-uxc_1:          or al,20h              ; upper case -> lower case
+.notdigit:     or al,20h               ; upper case -> lower case
                cmp al,'a'
-                jb uxc_ret             ; If failure, CF == 1 already
+                jb .ret                        ; If failure, CF == 1 already
                 cmp al,'f'
-                ja uxc_err
+                ja .err
                 sub al,'a'-10           ; CF <- 0
                 ret
-uxc_err:        stc
-uxc_ret:       ret
+.err:          stc
+.ret:          ret
 
 ;
 ;
@@ -244,36 +255,36 @@ uxc_ret:  ret
 getline:
                call skipspace
                 mov dl,1                ; Empty line -> empty string.
-                jz gl_eof               ; eof
-                jc gl_eoln              ; eoln
+                jz .eof               ; eof
+                jc .eoln              ; eoln
                call ungetc
-gl_fillloop:   push dx
+.fillloop:     push dx
                push di
                call getc
                pop di
                pop dx
-               jc gl_ret               ; CF set!
+               jc .ret         ; CF set!
                cmp al,' '
-               jna gl_ctrl
+               jna .ctrl
                xor dx,dx
-gl_store:      stosb
-               jmp short gl_fillloop
-gl_ctrl:       cmp al,10
-               je gl_ret               ; CF clear!
+.store:                stosb
+               jmp short .fillloop
+.ctrl:         cmp al,10
+               je .ret         ; CF clear!
                cmp al,26
-               je gl_eof
+               je .eof
                and dl,dl
-               jnz gl_fillloop         ; Ignore multiple spaces
+               jnz .fillloop           ; Ignore multiple spaces
                mov al,' '              ; Ctrl -> space
                inc dx
-               jmp short gl_store
-gl_eoln:        clc                     ; End of line is not end of file
-                jmp short gl_ret
-gl_eof:         stc
-gl_ret:                pushf                   ; We want the last char to be space!
+               jmp short .store
+.eoln:         clc                     ; End of line is not end of file
+                jmp short .ret
+.eof:          stc
+.ret:          pushf                   ; We want the last char to be space!
                and dl,dl
-               jnz gl_xret
+               jnz .xret
                mov al,' '
                stosb
-gl_xret:       popf
+.xret:         popf
                ret
index 4c0e9e6..273cc6b 100644 (file)
@@ -23,6 +23,8 @@
 ;
 ; SI   = cluster/socket pointer
 ;
+               section .text
+
 vgadisplayfile:
                mov [VGACluster],si
                push es
@@ -312,7 +314,23 @@ vgacursorcommon:
                ret
 
 
+               section .data
                ; Map colors to consecutive DAC registers
 linear_color   db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0
 UsingVGA       db 0
 
+               section .bss
+               alignb 2
+GraphXSize     resw 1                  ; Width of splash screen file
+VGAPos         resw 1                  ; Pointer into VGA memory
+VGACluster     resw 1                  ; Cluster pointer for VGA image file
+VGAFilePtr     resw 1                  ; Pointer into VGAFileBuf
+TextColorReg   resb 17                 ; VGA color registers for text mode
+%if IS_SYSLINUX
+VGAFileBuf     resb FILENAME_MAX+2     ; Unmangled VGA image name
+%else
+VGAFileBuf     resb FILENAME_MAX       ; Unmangled VGA image name
+%endif
+VGAFileBufEnd  equ $
+VGAFileMBuf    resb FILENAME_MAX       ; Mangled VGA image name
+
index 25407c0..fdeaf69 100644 (file)
@@ -18,6 +18,8 @@
 ;; mem= command on the command line while booting a new kernel.
 ;;
 
+               section .text
+
 ;
 ; This is set up as a subroutine; it will set up the global variable
 ; HighMemSize.  All registers are preserved.  Assumes DS == CS.
@@ -134,3 +136,10 @@ got_highmem:
                popad
                pop es
                ret                             ; Done!
+
+               section .bss
+               alignb 4
+E820Buf                resd 5                  ; INT 15:E820 data buffer
+E820Mem                resd 1                  ; Memory detected by E820
+E820Max                resd 1                  ; Is E820 memory capped?
+HighMemSize    resd 1                  ; End of memory pointer (bytes)
index 0fb9f85..c545b01 100644 (file)
@@ -122,93 +122,20 @@ trackbuf  resb trackbufsize       ; Track buffer goes here
 getcbuf                resb trackbufsize
 ;              ends at 5000h
 
-VKernelBuf:    resb vk_size            ; "Current" vkernel
                alignb 4
-AppendBuf       resb max_cmd_len+1     ; append=
-Ontimeout      resb max_cmd_len+1      ; ontimeout
-Onerror                resb max_cmd_len+1      ; onerror
-KbdMap         resb 256                ; Keyboard map
-FKeyName       resb 10*FILENAME_MAX    ; File names for F-key help
-NumBuf         resb 15                 ; Buffer to load number
-NumBufEnd      resb 1                  ; Last byte in NumBuf
 ISOFileName    resb 64                 ; ISO filename canonicalization buffer
 ISOFileNameEnd equ $
-               alignb 32
-KernelName      resb FILENAME_MAX       ; Mangled name for kernel
-KernelCName     resb FILENAME_MAX      ; Unmangled kernel name
-InitRDCName     resb FILENAME_MAX       ; Unmangled initrd name
-MNameBuf       resb FILENAME_MAX
-InitRD         resb FILENAME_MAX
-PartInfo       resb 16                 ; Partition table entry
-E820Buf                resd 5                  ; INT 15:E820 data buffer
-E820Mem                resd 1                  ; Memory detected by E820
-E820Max                resd 1                  ; Is E820 memory capped?
-HiLoadAddr      resd 1                 ; Address pointer for high load loop
-HighMemSize    resd 1                  ; End of memory pointer (bytes)
-RamdiskMax     resd 1                  ; Highest address for a ramdisk
-KernelSize     resd 1                  ; Size of kernel (bytes)
-SavedSSSP      resd 1                  ; Our SS:SP while running a COMBOOT image
-PMESP          resd 1                  ; Protected-mode ESP
-FSectors       resd 1                  ; Number of sectors in getc file
-RootDir                resb dir_t_size         ; Root directory
 CurDir         resb dir_t_size         ; Current directory
-KernelSects    resd 1                  ; Kernel size in clusters
-InitStack      resd 1                  ; Initial stack pointer (SS:SP)
+RootDir                resb dir_t_size         ; Root directory
 FirstSecSum    resd 1                  ; Checksum of bytes 64-2048
 ImageDwords    resd 1                  ; isolinux.bin size, dwords
-FBytes         equ $                   ; Used by open/getc
-FBytes1                resw 1
-FBytes2                resw 1
-FNextClust     resw 1                  ; Pointer to next cluster in d:o
-FPtr           resw 1                  ; Pointer to next char in buffer
-CmdOptPtr       resw 1                 ; Pointer to first option on cmd line
-KernelCNameLen  resw 1                 ; Length of unmangled kernel name
-InitRDCNameLen  resw 1                 ; Length of unmangled initrd name
-NextCharJump    resw 1                 ; Routine to interpret next print char
-SetupSecs      resw 1                  ; Number of setup sectors
-A20Test                resw 1                  ; Counter for testing status of A20
-A20Type                resw 1                  ; A20 type
-CmdLineLen     resw 1                  ; Length of command line including null
-GraphXSize     resw 1                  ; Width of splash screen file
-VGAPos         resw 1                  ; Pointer into VGA memory
-VGACluster     resw 1                  ; Cluster pointer for VGA image file
-VGAFilePtr     resw 1                  ; Pointer into VGAFileBuf
-Com32SysSP     resw 1                  ; SP saved during COM32 syscall
-ConfigFile     resw 1                  ; Socket for config file
-PktTimeout     resw 1                  ; Timeout for current packet
-KernelExtPtr   resw 1                  ; During search, final null pointer
-LocalBootType  resw 1                  ; Local boot return code
-ImageSectors   resw 1                  ; isolinux.bin size, sectors
+InitStack      resd 1                  ; Initial stack pointer (SS:SP)
 DiskSys                resw 1                  ; Last INT 13h call
-CursorDX        equ $
-CursorCol       resb 1                 ; Cursor column for message file
-CursorRow       resb 1                 ; Cursor row for message file
-ScreenSize      equ $
-VidCols         resb 1                 ; Columns on screen-1
-VidRows         resb 1                 ; Rows on screen-1
-BaudDivisor    resw 1                  ; Baud rate divisor
-FlowControl    equ $
-FlowOutput     resb 1                  ; Outputs to assert for serial flow
-FlowInput      resb 1                  ; Input bits for serial flow
-FlowIgnore     resb 1                  ; Ignore input unless these bits set
-TextAttribute   resb 1                 ; Text attribute for message file
-RetryCount      resb 1                 ; Used for disk access retries
-KbdFlags       resb 1                  ; Check for keyboard escapes
-LoadFlags      resb 1                  ; Loadflags from kernel
-A20Tries       resb 1                  ; Times until giving up on A20
-FuncFlag       resb 1                  ; == 1 if <Ctrl-F> pressed
-DisplayMask    resb 1                  ; Display modes mask
-ISOFlags       resb 1                  ; Flags for ISO directory search
+ImageSectors   resw 1                  ; isolinux.bin size, sectors
 DiskError      resb 1                  ; Error code for disk I/O
 DriveNo                resb 1                  ; CD-ROM BIOS drive number
-TextColorReg   resb 17                 ; VGA color registers for text mode
-VGAFileBuf     resb FILENAME_MAX       ; Unmangled VGA image name
-VGAFileBufEnd  equ $
-VGAFileMBuf    resb FILENAME_MAX       ; Mangled VGA image name
-                alignb 4               ; For the good of REP MOVSD
-command_line   resb max_cmd_len+2      ; Command line buffer
-               alignb 4
-default_cmd    resb max_cmd_len+1      ; "default" command line
+ISOFlags       resb 1                  ; Flags for ISO directory search
+RetryCount      resb 1                 ; Used for disk access retries
 
                alignb open_file_t_size
 Files          resb MAX_OPEN*open_file_t_size
@@ -1597,6 +1524,8 @@ getfssec:
 ;  Begin data section
 ; -----------------------------------------------------------------------------
 
+               section .data
+
 boot_prompt    db 'boot: ', 0
 wipe_char      db BS, ' ', BS, 0
 err_notfound   db 'Could not find kernel image: ',0
@@ -1757,14 +1686,3 @@ linuxauto_len   equ $-linuxauto_cmd
 boot_image      db 'BOOT_IMAGE='
 boot_image_len  equ $-boot_image
 ldlinux_end     equ $
-
-; VGA font buffer at the end of memory (so loading a font works even
-; in graphics mode.)
-vgafontbuf     equ 0E000h
-
-; This is a compile-time assert that we didn't run out of space
-%ifndef DEPEND
-%if (ldlinux_end-bootsec+7C00h) > vgafontbuf
-%error "Out of memory, better reorganize something..."
-%endif
-%endif
index 082ebce..f54feb3 100644 (file)
@@ -132,21 +132,11 @@ trackbuf  resb trackbufsize       ; Track buffer goes here
 getcbuf                resb trackbufsize
                ; ends at 5000h
 
-VKernelBuf:    resb vk_size            ; "Current" vkernel
-               alignb 4
-AppendBuf       resb max_cmd_len+1     ; append=
-Ontimeout      resb max_cmd_len+1      ; ontimeout
-Onerror                resb max_cmd_len+1      ; onerror
-KbdMap         resb 256                ; Keyboard map
-FKeyName       resb 10*16              ; File names for F-key help
-NumBuf         resb 15                 ; Buffer to load number
-NumBufEnd      resb 1                  ; Last byte in NumBuf
                alignb 8
 
                ; Expanded superblock
 SuperInfo      equ $
                resq 16                 ; The first 16 bytes expanded 8 times
-
 FAT            resd 1                  ; Location of (first) FAT
 RootDirArea    resd 1                  ; Location of root directory area
 RootDir                resd 1                  ; Location of root directory proper
@@ -154,82 +144,14 @@ DataArea  resd 1                  ; Location of data area
 RootDirSize    resd 1                  ; Root dir size in sectors
 TotalSectors   resd 1                  ; Total number of sectors
 EndSector      resd 1                  ; Location of filesystem end
-
-               alignb 4
-E820Buf                resd 5                  ; INT 15:E820 data buffer
-E820Mem                resd 1                  ; Memory detected by E820
-E820Max                resd 1                  ; Is E820 memory capped?
-HiLoadAddr      resd 1                 ; Address pointer for high load loop
-HighMemSize    resd 1                  ; End of memory pointer (bytes)
-RamdiskMax     resd 1                  ; Highest address for a ramdisk
-KernelSize     resd 1                  ; Size of kernel (bytes)
-SavedSSSP      resd 1                  ; Our SS:SP while running a COMBOOT image
-PMESP          resd 1                  ; Protected-mode ESP
-FSectors       resd 1                  ; Number of sectors in getc file
 ClustSize      resd 1                  ; Bytes/cluster
 ClustMask      resd 1                  ; Sectors/cluster - 1
-KernelName      resb 12                        ; Mangled name for kernel
-                                       ; (note the spare byte after!)
-OrigKernelExt  resd 1                  ; Original kernel extension
-FBytes         equ $                   ; Used by open/getc
-FBytes1                resw 1
-FBytes2                resw 1
-DirBlocksLeft  resw 1                  ; Ditto
-RunLinClust    resw 1                  ; Cluster # for LDLINUX.SYS
-KernelSects    resw 1                  ; Kernel size in clusters
-FNextClust     resw 1                  ; Pointer to next cluster in d:o
-FPtr           resw 1                  ; Pointer to next char in buffer
-CmdOptPtr       resw 1                 ; Pointer to first option on cmd line
-KernelCNameLen  resw 1                 ; Length of unmangled kernel name
-InitRDCNameLen  resw 1                 ; Length of unmangled initrd name
-NextCharJump    resw 1                 ; Routine to interpret next print char
-SetupSecs      resw 1                  ; Number of setup sectors
-A20Test                resw 1                  ; Counter for testing status of A20
-A20Type                resw 1                  ; A20 type
-CmdLineLen     resw 1                  ; Length of command line including null
-GraphXSize     resw 1                  ; Width of splash screen file
-VGAPos         resw 1                  ; Pointer into VGA memory
-VGACluster     resw 1                  ; Cluster pointer for VGA image file
-VGAFilePtr     resw 1                  ; Pointer into VGAFileBuf
-Com32SysSP     resw 1                  ; SP saved during COM32 syscall
-DirScanCtr     resw 1                  ; OBSOLETE FIX THIS
-EndofDirSec    resw 1                  ; OBSOLETE FIX THIS
-CachePtrs      times (65536/SECTOR_SIZE) resw 1
-NextCacheSlot  resw 1
-CursorDX        equ $
-CursorCol       resb 1                 ; Cursor column for message file
-CursorRow       resb 1                 ; Cursor row for message file
-ScreenSize      equ $
-VidCols         resb 1                 ; Columns on screen-1
-VidRows         resb 1                 ; Rows on screen-1
-BaudDivisor    resw 1                  ; Baud rate divisor
-FlowControl    equ $
-FlowOutput     resb 1                  ; Outputs to assert for serial flow
-FlowInput      resb 1                  ; Input bits for serial flow
-FlowIgnore     resb 1                  ; Ignore input unless these bits set
-TextAttribute   resb 1                 ; Text attribute for message file
-RetryCount      resb 1                 ; Used for disk access retries
-KbdFlags       resb 1                  ; Check for keyboard escapes
-LoadFlags      resb 1                  ; Loadflags from kernel
-A20Tries       resb 1                  ; Times until giving up on A20
-FuncFlag       resb 1                  ; Escape sequences received from keyboard
-DisplayMask    resb 1                  ; Display modes mask
+CachePtrs      resw 65536/SECTOR_SIZE  ; Cached sector pointers
+NextCacheSlot  resw 1                  ; Next cache slot to occupy
 CopySuper      resb 1                  ; Distinguish .bs versus .bss
 DriveNumber    resb 1                  ; BIOS drive number
 ClustShift     resb 1                  ; Shift count for sectors/cluster
 ClustByteShift resb 1                  ; Shift count for bytes/cluster
-MNameBuf        resb 11                ; Generic mangled file name buffer
-InitRD          resb 11                 ; initrd= mangled name
-KernelCName     resb 13                 ; Unmangled kernel name
-InitRDCName     resb 13                ; Unmangled initrd name
-TextColorReg   resb 17                 ; VGA color registers for text mode
-VGAFileBuf     resb 13                 ; Unmangled VGA image name
-VGAFileBufEnd  equ $
-VGAFileMBuf    resb 11                 ; Mangled VGA image name
-                alignb 4               ; For the good of REP MOVSD
-command_line   resb max_cmd_len+2      ; Command line buffer
-               alignb 4
-default_cmd    resb max_cmd_len+1      ; "default" command line
 
                alignb open_file_t_size
 Files          resb MAX_OPEN*open_file_t_size
@@ -1603,6 +1525,7 @@ getcachesector:
 ;  Begin data section
 ; -----------------------------------------------------------------------------
 
+               section .data
 ;
 ; Lower-case table for codepage 865
 ;
@@ -1720,15 +1643,3 @@ boot_image_len  equ $-boot_image
 
                align 4, db 0           ; Pad out any unfinished dword
 ldlinux_end    equ $
-ldlinux_len    equ $-ldlinux_magic
-
-; VGA font buffer at the end of memory (so loading a font works even
-; in graphics mode.)
-vgafontbuf     equ 0E000h
-
-; This is a compile-time assert that we didn't run out of space
-%ifndef DEPEND
-%if (ldlinux_end-bootsec+7C00h) > vgafontbuf
-%error "Out of memory, better reorganize something..."
-%endif
-%endif
index b7caec4..0bad64f 100644 (file)
@@ -17,6 +17,8 @@
 ;; Load a file into high memory
 ;;
 
+               section .text
+
 ;
 ; load_high:   loads (the remainder of) a file into high memory.
 ;              This routine prints dots for each 64K transferred, and
index afea465..5d1830e 100644 (file)
@@ -17,6 +17,8 @@
 ;; Command line parser code
 ;;
 
+               section .text
+
 ; -------------------------------------------------------------------------
 ;  getcommand: Get a keyword from the current "getc" file and match it
 ;              against a list of keywords (keywd_table).  Each entry in
@@ -87,3 +89,25 @@ getcommand:
                call getc
                jc .eof
                jmp short .skipline
+
+               section .bss
+               alignb 32
+VKernelBuf:    resb vk_size            ; "Current" vkernel
+AppendBuf       resb max_cmd_len+1     ; append=
+Ontimeout      resb max_cmd_len+1      ; ontimeout
+Onerror                resb max_cmd_len+1      ; onerror
+KbdMap         resb 256                ; Keyboard map
+FKeyName       resb 10*FILENAME_MAX    ; File names for F-key help
+KernelCNameLen resw 1                  ; Length of unmangled kernel name
+InitRDCNameLen resw 1                  ; Length of unmangled initrd name
+%if IS_SYSLINUX
+KernelName      resb FILENAME_MAX+1    ; Mangled name for kernel
+KernelCName     resb FILENAME_MAX+2    ; Unmangled kernel name
+InitRDCName     resb FILENAME_MAX+2    ; Unmangled initrd name
+%else
+KernelName      resb FILENAME_MAX      ; Mangled name for kernel
+KernelCName     resb FILENAME_MAX      ; Unmangled kernel name
+InitRDCName     resb FILENAME_MAX      ; Unmangled initrd name
+%endif
+MNameBuf        resb FILENAME_MAX
+InitRD          resb FILENAME_MAX
index 5c1411c..1f6ebc6 100644 (file)
@@ -17,6 +17,7 @@
 ;; Configuration file operations
 ;;
 
+               section .text
 ;
 ; "default" command
 ; 
index 731577d..1ae05d7 100644 (file)
@@ -203,98 +203,27 @@ getcbuf           resb trackbufsize
 ; writing a received ARP packet into low memory.
 RBFB_brainfuck resb 800h
 
-VKernelBuf:    resb vk_size            ; "Current" vkernel
-               alignb 4
-AppendBuf       resb max_cmd_len+1     ; append=
-Ontimeout      resb max_cmd_len+1      ; ontimeout
-Onerror                resb max_cmd_len+1      ; onerror
-KbdMap         resb 256                ; Keyboard map
-PathPrefix     resb 256                ; Path prefix derived from the above
+               alignb FILENAME_MAX
 BootFile       resb 256                ; Boot file from DHCP packet
 ConfigName     resb 256                ; Configuration file from DHCP option
-FKeyName       resb 10*FILENAME_MAX    ; File names for F-key help
-               alignb FILENAME_MAX
-KernelName      resb FILENAME_MAX       ; Mangled name for kernel
-KernelCName     resb FILENAME_MAX      ; Unmangled kernel name
-InitRDCName     resb FILENAME_MAX       ; Unmangled initrd name
-MNameBuf       resb FILENAME_MAX
-InitRD         resb FILENAME_MAX
-NumBuf         resb 15                 ; Buffer to load number
-NumBufEnd      resb 1                  ; Last byte in NumBuf
+PathPrefix     resb 256                ; Path prefix derived from boot file
 DotQuadBuf     resb 16                 ; Buffer for dotted-quad IP address
 IPOption       resb 80                 ; ip= option buffer
-MACLen         resb 1                  ; MAC address len
-MACType                resb 1                  ; MAC address type
 MAC            resb 16                 ; Actual MAC address
 MACStr         resb 3*17               ; MAC address as a string
-PartInfo       resb 16                 ; Partition table entry
-E820Buf                resd 5                  ; INT 15:E820 data buffer
-E820Mem                resd 1                  ; Memory detected by E820
-E820Max                resd 1                  ; Is E820 memory capped?
-HiLoadAddr      resd 1                 ; Address pointer for high load loop
-HighMemSize    resd 1                  ; End of memory pointer (bytes)
-RamdiskMax     resd 1                  ; Highest address for a ramdisk
-KernelSize     resd 1                  ; Size of kernel (bytes)
-SavedSSSP      resd 1                  ; Our SS:SP while running a COMBOOT image
-PMESP          resd 1                  ; Protected-mode ESP
-FSectors       resd 1                  ; Number of sectors in getc file
+               alignb 4
 InitStack      resd 1                  ; Pointer to reset stack
 RebootTime     resd 1                  ; Reboot timeout, if set by option
-KernelSects    resd 1                  ; Kernel size in clusters
 StrucPtr       resd 1                  ; Pointer to PXENV+ or !PXE structure
-FBytes         equ $                   ; Used by open/getc
-FBytes1                resw 1
-FBytes2                resw 1
-FNextClust     resw 1                  ; Pointer to next cluster in d:o
-FPtr           resw 1                  ; Pointer to next char in buffer
-CmdOptPtr       resw 1                 ; Pointer to first option on cmd line
-KernelCNameLen  resw 1                 ; Length of unmangled kernel name
-InitRDCNameLen  resw 1                 ; Length of unmangled initrd name
-NextCharJump    resw 1                 ; Routine to interpret next print char
-SetupSecs      resw 1                  ; Number of setup sectors
-A20Test                resw 1                  ; Counter for testing status of A20
-A20Type                resw 1                  ; A20 type
-CmdLineLen     resw 1                  ; Length of command line including null
-GraphXSize     resw 1                  ; Width of splash screen file
-VGAPos         resw 1                  ; Pointer into VGA memory
-VGACluster     resw 1                  ; Cluster pointer for VGA image file
-VGAFilePtr     resw 1                  ; Pointer into VGAFileBuf
-Com32SysSP     resw 1                  ; SP saved during COM32 syscall
-ConfigFile     resw 1                  ; Socket for config file
-PktTimeout     resw 1                  ; Timeout for current packet
-KernelExtPtr   resw 1                  ; During search, final null pointer
+APIVer         resw 1                  ; PXE API version found
 IPOptionLen    resw 1                  ; Length of IPOption
+IdleTimer      resw 1                  ; Time to check for ARP?
 LocalBootType  resw 1                  ; Local boot return code
+PktTimeout     resw 1                  ; Timeout for current packet
 RealBaseMem    resw 1                  ; Amount of DOS memory after freeing
-APIVer         resw 1                  ; PXE API version found
-IdleTimer      resw 1                  ; Time to check for ARP?
-CursorDX        equ $
-CursorCol       resb 1                 ; Cursor column for message file
-CursorRow       resb 1                 ; Cursor row for message file
-ScreenSize      equ $
-VidCols         resb 1                 ; Columns on screen-1
-VidRows         resb 1                 ; Rows on screen-1
-BaudDivisor    resw 1                  ; Baud rate divisor
-FlowControl    equ $
-FlowOutput     resb 1                  ; Outputs to assert for serial flow
-FlowInput      resb 1                  ; Input bits for serial flow
-FlowIgnore     resb 1                  ; Ignore input unless these bits set
-TextAttribute   resb 1                 ; Text attribute for message file
-RetryCount      resb 1                 ; Used for disk access retries
-KbdFlags       resb 1                  ; Check for keyboard escapes
-LoadFlags      resb 1                  ; Loadflags from kernel
-A20Tries       resb 1                  ; Times until giving up on A20
-FuncFlag       resb 1                  ; == 1 if <Ctrl-F> pressed
-DisplayMask    resb 1                  ; Display modes mask
+MACLen         resb 1                  ; MAC address len
+MACType                resb 1                  ; MAC address type
 OverLoad       resb 1                  ; Set if DHCP packet uses "overloading"
-TextColorReg   resb 17                 ; VGA color registers for text mode
-VGAFileBuf     resb FILENAME_MAX       ; Unmangled VGA image name
-VGAFileBufEnd  equ $
-VGAFileMBuf    resb FILENAME_MAX       ; Mangled VGA image name
-                alignb 4               ; For the good of REP MOVSD
-command_line   resb max_cmd_len+2      ; Command line buffer
-               alignb 4
-default_cmd    resb max_cmd_len+1      ; "default" command line
 
 ;
 ; PXE packets which don't need static initialization
@@ -2305,6 +2234,8 @@ writestr  equ cwritestr
 ;  Begin data section
 ; -----------------------------------------------------------------------------
 
+               section .data
+
 hextbl_lower   db '0123456789abcdef'
 copyright_str   db ' Copyright (C) 1994-', year, ' H. Peter Anvin'
                db CR, LF, 0
@@ -2560,14 +2491,3 @@ linuxauto_len   equ $-linuxauto_cmd
 boot_image      db 'BOOT_IMAGE='
 boot_image_len  equ $-boot_image
 ldlinux_end     equ $
-
-; VGA font buffer at the end of memory (so loading a font works even
-; in graphics mode.)
-vgafontbuf     equ 0E000h
-
-; This is a compile-time assert that we didn't run out of space
-%ifndef DEPEND
-%if (ldlinux_end-bootsec+7C00h) > vgafontbuf
-%error "Out of memory, better reorganize something..."
-%endif
-%endif
index 64dd463..0ff4562 100644 (file)
@@ -513,6 +513,7 @@ load_old_kernel:
 ;      su_ramdisklen   - Size of file
 ;      SI              - initrd filehandle/cluster pointer
 ;
+               section .text
 loadinitrd:
                 push es                         ; Save ES on entry
                mov ax,real_mode_seg
@@ -533,3 +534,12 @@ loadinitrd:
                call crlf
                 pop es                          ; Restore original ES
                 ret
+
+               section .bss
+               alignb 4
+RamdiskMax     resd 1                  ; Highest address for ramdisk
+KernelSize     resd 1                  ; Size of kernel in bytes
+KernelSects    resd 1                  ; Size of kernel in sectors
+CmdLineLen     resw 1                  ; Length of command line including null
+SetupSecs      resw 1                  ; Number of setup sectors
+LoadFlags      resb 1                  ; Loadflags from kernel
index beb5954..5068a8e 100644 (file)
@@ -2,6 +2,8 @@
 ; strcpy: Copy DS:SI -> ES:DI up to and including a null byte;
 ;        on exit SI and DI point to the byte *after* the null byte
 ;
+               section .text
+
 strcpy:                push ax
 .loop:         lodsb
                stosb
diff --git a/ui.inc b/ui.inc
index 3394492..ac721b6 100644 (file)
--- a/ui.inc
+++ b/ui.inc
@@ -470,3 +470,15 @@ kernel_good:
 %endif
                ; Otherwise Linux kernel
 
+               section .bss
+               alignb 2
+KernelExtPtr   resw 1                  ; During search, final null pointer
+CmdOptPtr       resw 1                 ; Pointer to first option on cmd line
+KbdFlags       resb 1                  ; Check for keyboard escapes
+FuncFlag       resb 1                  ; Escape sequences received from keyboard
+                alignb 4               ; For the good of REP MOVSD
+command_line   resb max_cmd_len+2      ; Command line buffer
+               alignb 4
+default_cmd    resb max_cmd_len+1      ; "default" command line
+
+               section .text
index 65d50cc..4bfbe24 100644 (file)
@@ -17,6 +17,7 @@
 ;; Code to write a simple string.
 ;;
 
+               section .text
 ;
 ; crlf: Print a newline
 ;