Compare commits
4 Commits
916d7bd030
...
f0fcefc5eb
Author | SHA1 | Date |
---|---|---|
Eric-Paul Ickhorn | f0fcefc5eb | |
Eric-Paul Ickhorn | c249510163 | |
Eric-Paul Ickhorn | 459936de7a | |
Eric-Paul Ickhorn | f73227fe74 |
|
@ -0,0 +1,45 @@
|
|||
# i386 Nightloader | Folder Structure
|
||||
|
||||
## Legacy BIOS bootsector (bootsector/)
|
||||
|
||||
Contains one file, the source of the bootsector. This assembly program
|
||||
must span the first 512 byte of a legacy Nightloader-booted Partition.
|
||||
|
||||
## Legacy BIOS Edition (legacy-boot/)
|
||||
|
||||
This edition of the Nightloader is made for older devices that predate
|
||||
UEFI (or potentially for devices that have unreliable UEFI-support).
|
||||
|
||||
This folder contains the assembly sources to create the loader
|
||||
partition which contains raw machine code that is loaded by the
|
||||
bootsector and to which the control is handed thereafter.
|
||||
|
||||
### Source Folder Structure
|
||||
|
||||
#### drivers/
|
||||
|
||||
- acpi
|
||||
Driver for the Avanced Control and Power Interface.
|
||||
- pci
|
||||
Driver for the Peripheral Component Interconnect. This is used to
|
||||
first find and then interact with the builtin devices in a computer,
|
||||
mostly storage devices, but also network cards, USB keyboards, etc..
|
||||
- ahci
|
||||
Driver for AHCI, the ATA Host Controller Interface (ATA meaning
|
||||
(IBM PC) AT Attachment), storage interface. This is used to interact
|
||||
with practically every modern consumer SSD and HDD. Older HDDs might
|
||||
use another interface, but that's not of elevated relevance.
|
||||
|
||||
|
||||
#### memory/
|
||||
|
||||
Memory Management functions, A20 line check, GDT setup and, some day
|
||||
in the future, paging for add-ons execution. This also contains utils
|
||||
like the allocators (arena, pool) used throughout the bootloader.
|
||||
|
||||
#### utility/
|
||||
|
||||
Helper functions that make it easier to write the other functionality
|
||||
but don't fall into any of the other categories on their own.
|
||||
|
||||
## Documentation (docs/)
|
|
@ -53,7 +53,7 @@ acpi_enumerate_tables:
|
|||
mov ebx, [esi + 8]
|
||||
add ebx, eax
|
||||
|
||||
mov eax, [ebx]Z
|
||||
mov eax, [ebx]
|
||||
|
||||
inc ecx
|
||||
jmp .enumeration_loop
|
||||
|
@ -97,7 +97,7 @@ acpi_search_rsdt:
|
|||
pop ebp
|
||||
|
||||
cmp ax, 0
|
||||
jne .rsdp_found
|
||||
jne .resolve_rsdp
|
||||
|
||||
add ecx, 16
|
||||
cmp ecx, 0x100000
|
||||
|
@ -105,6 +105,7 @@ acpi_search_rsdt:
|
|||
|
||||
; If no "RSD PTR "-signature could be found
|
||||
xor ecx, ecx
|
||||
jmp .epilog
|
||||
|
||||
.resolve_rsdp:
|
||||
; The 4-byte RSDT-pointer is at byte-offset 4 into the RSDP strucfture.
|
||||
|
|
|
@ -34,7 +34,7 @@ initialize_pci_driver:
|
|||
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push ebx
|
||||
push dword PCI_DEVICE_COUNT_OFFSET
|
||||
push dword 2
|
||||
push dword 0
|
||||
push dword 0
|
||||
|
|
|
@ -190,11 +190,12 @@ pci_enumerate_bus:
|
|||
|
||||
mov [esi + (64 - 8)], ebx
|
||||
mov [esi + (64 - 12)], ecx
|
||||
mov [esi + (64 - 16)], edx
|
||||
mov [esi + (64 - 20)], edi
|
||||
; [esi]: Device-in-bus Index
|
||||
; [esi + 4]: Number of existing devices
|
||||
; [esi + 8]: Bus number
|
||||
; [esi + 12]:
|
||||
; [esi + 12]: PCI driver area pointer
|
||||
mov [esi], dword 0
|
||||
mov [esi + 4], dword 0
|
||||
mov eax, [ebp - 8]
|
||||
|
@ -259,6 +260,7 @@ pci_enumerate_bus:
|
|||
.epilog:
|
||||
mov ebx, [esi + (64 - 8)]
|
||||
mov ecx, [esi + (64 - 12)]
|
||||
mov edx, [esi + (64 - 16)]
|
||||
mov edi, [esi + (64 - 20)]
|
||||
|
||||
mov eax, [esi + 4]
|
||||
|
@ -313,7 +315,6 @@ pci_enumerate:
|
|||
cmp edx, [ebp - 8]
|
||||
jae .epilog
|
||||
|
||||
|
||||
.call_bus_enumerator:
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
|
|
|
@ -54,6 +54,12 @@ stage_2_setup_entry:
|
|||
bits 32
|
||||
stage2_protected_entry:
|
||||
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
call setup_drivers
|
||||
mov esp, ebp
|
||||
pop ebp
|
||||
|
||||
cli
|
||||
hlt
|
||||
|
||||
|
|
Loading…
Reference in New Issue