BCOS 80x86 Stage 1 SourceProject Map
80x86 PC BIOS PXE Boot Loader
File: 80x86/sys_src/p1/pc_bios/bootpxe/0index.asm
 

Copyright © Brendan Trotter 2008

This material is provided by Brendan Trotter as a service to interested parties on an "as-is" basis, for informational purposes only. Brendan Trotter assumes no responsibility for any errors or omissions. Brendan Trotter does not make, and expressly disclaims any, representations or warranties, express or implied, regarding this web page and the host web site, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose.

Under no circumstances shall Brendan Trotter, or any associated contributors, volunteers or representatives be liable for any damages, whether direct, indirect, special or consequential damages for lost revenues, lost profits, or otherwise, arising from or in connection with this web page, the host web site, or the materials contained herein.

All materials contained in these files are protected by copyright laws, and may not be reproduced, republished, distributed, transmitted, displayed, broadcast or otherwise exploited in any manner without the express prior written permission of Brendan Trotter. You may make one copy of this web page for your personal and non-commercial use only, without altering or removing this copyright notice or any other notice.




Overview

This index file determines the layout of all other source files in memory. The final binary is used to boot the OS from a network card via. PXE.

Like all boot loaders designed for the PC BIOS, this boot loader must comply with the Common PC BIOS Module Transition State Specification.


Included System Files

The following line/s include standard "include" files into the binary.

22: ;Standard include files
23: 
24: 
%include "asm.inc"
25: %include "kernel/log.inc"
26: %include "kernel/a20.inc"
27: %include "kernel/pasm.inc"
28: %include "ff/header.inc"
29: %include "ff/frl.inc"
30: 
31: 
32: 
;PXE boot loader include files
33: 
34: 
%include "options.inc"
35: %include "pxe.inc"


Assembler Setup

Here we just tell the assembler what address the code starts at, what mode the CPU is expected to be operating in and which instructions to accept.

Note: This code starts as "8086 compatible", then checks if the CPU meets the operating system's minimum requirements. After this check we tell the assembler to allow the full "80486" instruction set.

48:       ORG 0x7C00
49: 
50: 
      BITS 16
51:       CPU 8086
52: 
53: 
BOOTLOADER_START:
54:       section .bss
55: BSS_START:
56:       section .text


Start of Binary and Entry Point

This is the beginning of the binary, which is also the entry point. When PXE starts the boot loader everything should be considered undefined, except for the registers shown below.

A far jump is used deliberately to set CS to a known value (even though the PXE specification says that PXE should use 0x0000:0x7C00 and not 0x07C0:0x0000).

68: ;Input
69: ; es:bx     Address of the PXENV+ structure (obsolete)
70: ; ss:sp+4   Address of the !PXE structure
71: 
72: 
      jmp 0x0000:START


Source Code

 78: %include "data.asm"
 79: %include "init.asm"
 80: %include "abort.asm"
 81: %include "video/init.asm"
 82: %include "video/print.asm"
 83: %include "cpu.asm"
 84: 
 85: 
      CPU 486
 86: 
 87: 
%include "gatea20.asm"
 88: %include "goflat.asm"
 89: %include "pxeapi.asm"
 90: %include "unload.asm"
 91: %include "progress.asm"
 92: %include "log/init.asm"
 93: %include "log/movelog.asm"
 94: %include "log/addchar.asm"
 95: %include "log/addstrng.asm"
 96: %include "log/addhex.asm"
 97: %include "log/addip.asm"
 98: %include "log/addmac.asm"
 99: %include "log/adddec.asm"
100: %include "pasm/init.asm"
101: %include "pasm/addentry.asm"
102: %include "pasm/probe.asm"
103: %include "pasm/cmos.asm"
104: %include "pasm/88.asm"
105: %include "pasm/da88.asm"
106: %include "pasm/8a.asm"
107: %include "pasm/c7.asm"
108: %include "pasm/e801.asm"
109: ;%include "pasm/e881.asm"           ;Disabled due to buggy BIOSs (see note in "pasm/init.asm")
110: %include "pasm/e820.asm"
111: %include "pasm/e820acpi.asm"
112: %include "pasm/showpasm.asm"
113: %include "pasm/findtop.asm"
114: %include "pasm/movepasm.asm"
115: %include "pasm/foreach.asm"
116: %include "nff/precheck.asm"
117: %include "nff/crc.asm"
118: %include "frl/init.asm"
119: %include "frl/check.asm"
120: %include "frl/movefrl.asm"
121: %include "frl/bitmap.asm"
122: %include "frl/chcktrust.asm"
123: %include "frl/clean.asm"
124: %include "mem/init.asm"
125: %include "mem/alloc.asm"
126: %include "mem/free.asm"
127: %include "mem/test.asm"
128: %include "mem/show.asm"
129: %include "file/start.asm"
130: %include "file/end.asm"
131: %include "commonpc/init.asm"
132: %include "commonpc/start.asm"
133: %include "script/init.asm"
134: %include "image/init.asm"
135: %include "bcat/init.asm"
136: %include "bcat/addentry.asm"
137: %include "bcat/finalize.asm"


The End

Here we define a few labels that are used later.

145:       align 4
146: BOOTLOADER_END:
147:       section .bss
148:       alignb 4
149: BSS_END:
150: 
151: 
%if (BSS_END-BSS_START + BOOTLOADER_END-BOOTLOADER_START) > 0xFFFF
152: %error Maximum TFTP pack size setting (in 'options.inc') is too large!
153: %endif


Generated on Sun Aug 16 02:07:23 2009