mirror of
https://github.com/reactos/reactos.git
synced 2024-10-31 03:48:17 +00:00
425bbb1543
- Added assembler versions of memcmp() memcpy() memset() - Implemented Int386() so that real-mode interrupts can be called from C-code - Removed unnecessary call in DbgPrint() macro (freeldr.sys is ~16k smaller now) - 64-bit lba sector addressing for disk calls - Re-coded biosdisk.S as i386disk.c - Re-coded mem.S as i386mem.c - Re-coded rtlcode.S as i386rtl.c - Cleaned up i386trap.S so that it only saves the registers once. - Re-coded biosvid.S as i386vid.c - Video fade in/out - VESA text modes supported now - Offscreen buffering to remove flicker - Standardized format of boot sector so that BootPartition is stored right before 0xaa55 - Prefixed all file system functions with 'Fs' svn path=/trunk/; revision=3782
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
FreeLoader notes
|
|
|
|
To build FreeLoader you will need DJGPP because Mingw32 doesn't support 16-bit code
|
|
|
|
Memory layout:
|
|
|
|
0000:0000 - 0000:0FFF: Interrupt vector table & BIOS data
|
|
0000:1000 - 0000:6FFF: Real mode stack area
|
|
0000:7000 - 0000:7FFF: Unused
|
|
0000:8000 - xxxx:xxxx: FreeLoader program & data area
|
|
xxxx:xxxx - 7000:7FFF: Random memory allocation heap
|
|
7000:8000 - 7000:FFFF: Protected mode stack area
|
|
8000:0000 - 8000:FFFF: File system read buffer
|
|
9000:0000 - 9000:FFFF: Disk read buffer for BIOS Int 13h
|
|
A000:0000 - FFFF:FFFF: reserved
|
|
|
|
|
|
FreeLoader Boot Process
|
|
|
|
FAT 12/16/32 Boot Sector
|
|
|
|
The BIOS loads the boot sector at 0000:7C00. The FAT32 boot sector
|
|
relocates itself higher in memory at 9000:0000 and loads it's extra sector
|
|
at 9000:0200 and then looks for freeldr.sys on the file system. Once found
|
|
it loads freeldr.sys to 0000:7E00 and then jumps to it's entry point at
|
|
0000:8000. The FAT12/16 boot sector does no relocation, it just searches for
|
|
the freeldr.sys and loads the first 512 bytes to 0000:7E00. This extra code
|
|
enables it to fully navigate the file allocation table. Then it loads
|
|
freeldr.sys to 0000:7E00 and jumps to it's entry point at 0000:8000. Before
|
|
FreeLoader gets control the boot sector saves the screen contents to a buffer
|
|
at 9000:8000 and the cursor x & y position to bytes at 9000:8FA0 & 9000:8FA1
|
|
respectively.
|
|
|
|
|
|
ISO-9660 (CD-ROM) Boot Sector
|
|
|
|
The BIOS loads the boot sector (2048 bytes) at 0000:7C00. First, the
|
|
boot sector relocates itself to 0000:7000 (up to 0000:7800). Then it looks
|
|
for the I386 directory and makes it the current directory. Next it looks for
|
|
FREELDR.SYS and loads it at 0000:8000. Finally it restores the boot drive
|
|
number in the DL register and jumps to FreeLoader's entry point at 0000:8000.
|
|
|
|
|
|
FreeLoader Initialization
|
|
|
|
When FreeLoader gets control it saves the boot drive, passed to it in
|
|
the DL register, and sets up the stack, enables protected mode, and calls
|
|
BootMain(). |