re-worked ndis to do device detection from a win2k-style registry enum database,...
[reactos.git] / freeldr / notes.txt
1 FreeLoader notes
2
3 To build FreeLoader you will need DJGPP because Mingw32 doesn't support 16-bit code
4
5 Memory layout:
6
7 0000:0000 - 0000:0FFF: Interrupt vector table & BIOS data
8 0000:1000 - 0000:6FFF: Real mode stack area
9 0000:7000 - 0000:7FFF: Unused
10 0000:8000 - xxxx:xxxx: FreeLoader program & data area
11 xxxx:xxxx - 7000:7FFF: Random memory allocation heap
12 7000:8000 - 7000:FFFF: Protected mode stack area
13 8000:0000 - 8000:FFFF: File system read buffer
14 9000:0000 - 9000:FFFF: Disk read buffer for BIOS Int 13h
15 A000:0000 - FFFF:FFFF: reserved
16
17
18 FreeLoader Boot Process
19
20 FAT 12/16/32 Boot Sector
21
22 The BIOS loads the boot sector at 0000:7C00. The FAT32 boot sector
23 relocates itself higher in memory at 9000:0000 and loads it's extra sector
24 at 9000:0200 and then looks for freeldr.sys on the file system. Once found
25 it loads freeldr.sys to 0000:7E00 and then jumps to it's entry point at
26 0000:8000. The FAT12/16 boot sector does no relocation, it just searches for
27 the freeldr.sys and loads the first 512 bytes to 0000:7E00. This extra code
28 enables it to fully navigate the file allocation table. Then it loads
29 freeldr.sys to 0000:7E00 and jumps to it's entry point at 0000:8000. Before
30 FreeLoader gets control the boot sector saves the screen contents to a buffer
31 at 9000:8000 and the cursor x & y position to bytes at 9000:8FA0 & 9000:8FA1
32 respectively.
33
34
35 ISO-9660 (CD-ROM) Boot Sector
36
37 The BIOS loads the boot sector (2048 bytes) at 0000:7C00. First, the
38 boot sector relocates itself to 0000:7000 (up to 0000:7800). Then it looks
39 for the I386 directory and makes it the current directory. Next it looks for
40 FREELDR.SYS and loads it at 0000:8000. Finally it restores the boot drive
41 number in the DL register and jumps to FreeLoader's entry point at 0000:8000.
42
43
44 FreeLoader Initialization
45
46 When FreeLoader gets control it saves the boot drive, passed to it in
47 the DL register, and sets up the stack, enables protected mode, and calls
48 BootMain().