0xe820 stuff (WIP)

rust
E. Almqvist 3 years ago
parent 1a5bcf7087
commit 8f0a20faa0
  1. 51
      bootloader/bios/memory.asm
  2. 2
      bootloader/bootloader.asm
  3. 3
      bootloader/equ/bios.asm

@ -1,25 +1,36 @@
; SRs to find memory size and leave it as a "note" for the kernel ; SRs to find memory size and leave it as a "note" for the kernel
; Descriptor Table for address ranges
map_phys_mem_init:
mov ebx, 0
map_phys_mem:
mov eax, 0xE820 ; Function code
; Tell the CPU about the descriptors location (ES:DI)
;mov es, addr_rng_dt_start
;mov di,
mov ecx, ADDR_RNG_DT_SIZE
mov edx, 'SMAP' ; Signature
int BIOS_PMEM_INT
ret mmap_e820:
mov di, 0x8004
mov ebx, 0 ; Must be 0
mov bp, 0 ; entry count
mov eax, 0xe820 ; function reg
mov edx, 'SMAP'
mov [es:di + 20], dword 1 ; fill
mov ecx, 24 ; ask for 24 bytes
int 0x15 ; Do the interupt
; carry flag = (un)supported function
jc short mmap_fail
addr_rng_dt_start: ; TODO more error stuff
addr_rng_low: dd 0 cmp eax, edx
addr_rng_high: dd 0 jne short mmap_fail
addr_rng_len_low: dd 0
addr_rng_len_high: dd 0 test ebx, ebx
addr_rng_type: dd 0 je short mmap_fail
addr_rng_dt_end:
mmap_fail:
stc
ret
e820_dt_start:
e820_low: dd 0
e820_high: dd 0
e820_len_low: dd 0
e820_len_high: dd 0
e820_type: dd 0
e820_dt_end:
ADDR_RNG_DT_SIZE equ addr_rng_dt_end - addr_rng_dt_start

@ -5,7 +5,7 @@
mov [BOOT_DRIVE], dl mov [BOOT_DRIVE], dl
; Move the stack pointer somewhere safe ; Move the stack pointer somewhere safe
mov bp, 0x9000 ; move it to 0x8000 mov bp, 0x9000 ; move it to 0x9000
mov sp, bp mov sp, bp
; Load kernel into memory ; Load kernel into memory

@ -6,6 +6,3 @@ BIOS_TTY_MODE equ 0x0e
BIOS_DISK_INT equ 0x13 BIOS_DISK_INT equ 0x13
BIOS_DISK_READ equ 0x02 BIOS_DISK_READ equ 0x02
; Physical Memory
BIOS_PMEM_INT equ 0x15

Loading…
Cancel
Save