1 ; -----------------------------------------------------------------------
3 ; Copyright 1994-2008 H. Peter Anvin - All Rights Reserved
5 ; This program is free software; you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by
7 ; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 ; Bostom MA 02111-1307, USA; either version 2 of the License, or
9 ; (at your option) any later version; incorporated herein by reference.
11 ; -----------------------------------------------------------------------
16 ; Memory layout of segments
20 ; Memory below 0800h is reserved for the BIOS and the MBR.
23 ; Text starts at the load address of 07C00h.
26 ; The secondary BSS section, above the text; we really wish we could
27 ; just make it follow .bcopy32 or hang off the end,
28 ; but it doesn't seem to work that way.
29 LATEBSS_START equ 0B800h
31 ; Reserve memory for the stack. This causes checkov to abort the
32 ; compile if we violate this space.
34 STACK_START equ TEXT_START-STACK_SIZE
41 ; The various sections and their relationship
45 ; Use .earlybss for things that MUST be in low memory.
46 section .earlybss nobits start=BSS_START
47 section .bcopy32 align=4 valign=16 follows=.data vfollows=.earlybss
48 section .config align=4 valign=16 follows=.bcopy32 vfollows=.bcopy32
49 section .config.end nobits valign=4 vfollows=.config
51 ; Use .bss for things that doesn't have to be in low memory;
52 ; with .bss1 and .bss2 to offload. .earlybss should be used
53 ; for things that absolutely have to be below 0x7c00.
54 section .bss nobits valign=16 vfollows=.config.end
56 ; Warning here: RBFG build 22 randomly overwrites
57 ; memory location [0x5680,0x576c), possibly more. It
58 ; seems that it gets confused and screws up the
59 ; pointer to its own internal packet buffer and starts
60 ; writing a received ARP packet into low memory.
62 section .rbfg nobits start=0x5680
63 RBFG_brainfuck: resb 2048 ; Bigger than an Ethernet packet...
66 ; For section following .rbfg
68 section .bss2 nobits valign=16 vfollows=.rbfg
70 section .bss2 nobits valign=16 vfollows=.bss
73 section .text start=TEXT_START
74 ; NASM BUG: .data always follows .text; can't override
75 section .data align=16 ; follows=.text
77 ; This empty section works around a NASM bug with regards
78 ; to follows= and nobits sections following a section which
80 section .advpad progbits align=512 follows=.config
82 section .adv nobits align=512 follows=.advpad
84 ; .uibss contains bss data which is guaranteed to be
85 ; safe to clobber during the loading of the image. This
86 ; is because while loading the primary image we will clobber
87 ; the spillover from the last fractional sector load.
88 section .uibss nobits align=16 follows=.adv
91 section .bss1 nobits align=16 follows=.uibss
93 ; Reserve space for stack
94 section .stack nobits align=16 start=STACK_START