|
|
@ -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 |
|
|
|
|
|
|
|