diff options
author | hpa <hpa> | 2004-12-27 03:28:08 +0000 |
---|---|---|
committer | hpa <hpa> | 2004-12-27 03:28:08 +0000 |
commit | 88310d544e0e2758355f8372fcfe7ceb73256973 (patch) | |
tree | 07e78283dbc0c1c7fdca5ebfde71978ff27f75ad | |
parent | e73cd0b64ed52d9d08ef1bfcae8b8c30f7157a75 (diff) | |
download | syslinux-88310d544e0e2758355f8372fcfe7ceb73256973.tar.gz |
Reorganize memory slightly; split .bss into .bss and .earlybss and
move its base down to 0800h; relocate pxelinux since it needs
copious amounts of bss.
-rw-r--r-- | bcopy32.inc | 7 | ||||
-rw-r--r-- | extlinux.asm | 10 | ||||
-rw-r--r-- | isolinux.asm | 10 | ||||
-rw-r--r-- | ldlinux.asm | 10 | ||||
-rw-r--r-- | pxelinux.asm | 47 |
5 files changed, 56 insertions, 28 deletions
diff --git a/bcopy32.inc b/bcopy32.inc index 3bd2ca9f..7b707801 100644 --- a/bcopy32.inc +++ b/bcopy32.inc @@ -383,6 +383,9 @@ try_wbinvd: ; necessary code into the trackbuf area before doing the copy, ; and do adjustments to anything except BSS area references. ; +; NOTE: Since PXELINUX relocates itself, put all these +; references in the ".earlybss" segment. +; ; After performing the copy, this routine resets the stack and ; jumps to 0:7c00. ; @@ -393,7 +396,7 @@ try_wbinvd: ; ESI, EDI, ECX - same as bcopy ; On stack - initial state (fd, ad, ds, es, fs, gs) ; -ADJUST equ (__bcopy_start - $$) + 7C00h - BSS_START +ADJUST equ (__bcopy_start - $$) + TEXT_START - BSS_START align 2 adjlist dw bcopy_gdt.adj1 - ADJUST @@ -450,7 +453,7 @@ bcopy_over_self: jmp 0:7c00h __bcopy_end: - section .bss + section .earlybss A20Test resw 1 ; Counter for testing status of A20 A20Type resw 1 ; A20 type A20Tries resb 1 ; Times until giving up on A20 diff --git a/extlinux.asm b/extlinux.asm index bb6215de..fcd3fc30 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -107,13 +107,14 @@ file_mode resw 1 ; ; Memory below this point is reserved for the BIOS and the MBR ; -BSS_START equ 1000h - section .bss start=BSS_START +BSS_START equ 0800h + section .earlybss nobits start=BSS_START trackbufsize equ 8192 trackbuf resb trackbufsize ; Track buffer goes here getcbuf resb trackbufsize - ; ends at 5000h + ; ends at 4800h + section .bss nobits align=256 follows=.earlybss SuperBlock resb 1024 ; ext2 superblock SuperInfo resq 16 ; DOS superblock expanded ClustSize resd 1 ; Bytes/cluster ("block") @@ -141,7 +142,8 @@ xbs_vgatmpbuf equ 2*trackbufsize section .text - org 7C00h +TEXT_START equ 7C00h + org TEXT_START ; ; Some of the things that have to be saved very early are saved ; "close" to the initial stack pointer offset, in order to diff --git a/isolinux.asm b/isolinux.asm index 78e642a4..3ba82972 100644 --- a/isolinux.asm +++ b/isolinux.asm @@ -103,13 +103,14 @@ dir_clust resd 1 ; Length in clusters ; ; Memory below this point is reserved for the BIOS and the MBR ; -BSS_START equ 1000h - section .bss start=BSS_START +BSS_START equ 0800h + section .earlybss nobits start=BSS_START trackbufsize equ 8192 trackbuf resb trackbufsize ; Track buffer goes here getcbuf resb trackbufsize -; ends at 5000h +; ends at 4800h + section .bss nobits align=256 follows=.earlybss alignb 4 ISOFileName resb 64 ; ISO filename canonicalization buffer ISOFileNameEnd equ $ @@ -140,7 +141,8 @@ xbs_vgabuf equ trackbufsize xbs_vgatmpbuf equ 2*trackbufsize section .text - org 7C00h +TEXT_START equ 7C00h + org TEXT_START ;; ;; 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 diff --git a/ldlinux.asm b/ldlinux.asm index badbf765..2a5dfcc6 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -109,13 +109,14 @@ file_left resd 1 ; Number of sectors left ; ; Memory below this point is reserved for the BIOS and the MBR ; -BSS_START equ 1000h - section .bss start=BSS_START +BSS_START equ 0800h + section .earlybss nobits start=BSS_START trackbufsize equ 8192 trackbuf resb trackbufsize ; Track buffer goes here getcbuf resb trackbufsize - ; ends at 5000h + ; ends at 4800h + section .bss nobits align=256 follows=.earlybss alignb 8 ; Expanded superblock @@ -151,7 +152,8 @@ xbs_vgatmpbuf equ 2*trackbufsize section .text - org 7C00h +TEXT_START equ 7C00h + org TEXT_START ; ; Some of the things that have to be saved very early are saved ; "close" to the initial stack pointer offset, in order to diff --git a/pxelinux.asm b/pxelinux.asm index 329c7f82..2b7819bd 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -175,18 +175,19 @@ tftp_pktbuf resw 1 ; Packet buffer offset ; ; Memory below this point is reserved for the BIOS and the MBR ; -BSS_START equ 1000h - section .bss start=BSS_START +BSS_START equ 0800h + section .earlybss nobits start=BSS_START trackbufsize equ 8192 trackbuf resb trackbufsize ; Track buffer goes here getcbuf resb trackbufsize - ; ends at 5000h + ; ends at 4800h -; Warning here: RBFG build 22 randomly overwrites memory location -; [0x5680,0x576c), possibly more. It seems that it gets confused and -; screws up the pointer to its own internal packet buffer and starts -; writing a received ARP packet into low memory. -RBFB_brainfuck resb 800h + ; Put some large buffers here, before RBFG_brainfuck, + ; where we can still carefully control the address + ; assignments... + + alignb open_file_t_size +Files resb MAX_OPEN*open_file_t_size alignb FILENAME_MAX BootFile resb 256 ; Boot file from DHCP packet @@ -195,6 +196,14 @@ ConfigName resb 256-4 ; Configuration file from DHCP option PathPrefix resb 256 ; Path prefix derived from boot file DotQuadBuf resb 16 ; Buffer for dotted-quad IP address IPOption resb 80 ; ip= option buffer + +; Warning here: RBFG build 22 randomly overwrites memory location +; [0x5680,0x576c), possibly more. It seems that it gets confused and +; screws up the pointer to its own internal packet buffer and starts +; writing a received ARP packet into low memory. +RBFG_brainfuck resb 0E00h + + section .bss nobits align=256 follows=.earlybss alignb 4 InitStack resd 1 ; Pointer to reset stack RebootTime resd 1 ; Reboot timeout, if set by option @@ -223,9 +232,6 @@ pxe_unload_stack_pkt: .reserved: resw 10 ; Reserved pxe_unload_stack_pkt_len equ $-pxe_unload_stack_pkt - alignb open_file_t_size -Files resb MAX_OPEN*open_file_t_size - alignb 16 ; BOOTP/DHCP packet buffer @@ -245,7 +251,12 @@ xbs_vgabuf equ trackbufsize xbs_vgatmpbuf equ 2*trackbufsize section .text - org 7C00h + ; + ; PXELINUX needs more BSS than the other derivatives; + ; therefore we relocate it from 7C00h on startup + ; +TEXT_START equ 9000h + org TEXT_START StackBuf equ $-44 ; Base of stack if we use our own ; @@ -253,8 +264,6 @@ StackBuf equ $-44 ; Base of stack if we use our own ; bootsec equ $ _start: - jmp 0:_start1 ; Canonicalize address -_start1: pushfd ; Paranoia... in case of return to PXE pushad ; ... save as much state as possible push ds @@ -262,6 +271,15 @@ _start1: push fs push gs + mov si,ldlinux_end-(TEXT_START-7C00h)-4 + mov di,ldlinux_end-4 + mov cx,ldlinux_end-TEXT_START + shr cx,2 + std ; Overlapping areas, copy backwards + rep movsb + + jmp 0:_start1 ; Canonicalize address +_start1: mov bp,sp les bx,[bp+48] ; ES:BX -> !PXE or PXENV+ structure @@ -2283,6 +2301,7 @@ writestr equ cwritestr %include "highmem.inc" ; High memory sizing %include "strcpy.inc" ; strcpy() %include "rawcon.inc" ; Console I/O w/o using the console functions +%include "dnsresolv.inc" ; DNS resolver ; ----------------------------------------------------------------------------- ; Begin data section |