StupidOS/boot/common/bootinfo.inc

77 lines
1.3 KiB
PHP
Raw Normal View History

2024-07-05 05:46:04 +00:00
;; File: bootinfo.inc
2024-07-02 08:32:11 +00:00
2024-07-07 13:48:22 +00:00
include '../../kernel/sys/bootinfo.inc'
2024-07-05 06:16:40 +00:00
;; Constant: BOOTINFO_MEMORY_LIMIT
2024-07-02 08:32:11 +00:00
BOOTINFO_MEMORY_LIMIT = 0xFFFFF000
;; Function: boot_info_add_memmap
;;
;; In:
;; EAX - base
;; EDX - length
;;
boot_info_add_memmap:
cmp eax, BOOTINFO_MEMORY_LIMIT
jbe @f
ret
@@:
mov ecx, BOOTINFO_MEMORY_LIMIT
sub ecx, edx
cmp eax, ecx
jbe @f
ret
@@:
; ----------------------------------------------------------------------
; dirty hack - TODO: clean this mess
cmp eax, 0x100000
jne @f
mov [boot_structure.high_mem], edx
@@:
; end hack
; ----------------------------------------------------------------------
2024-07-02 08:32:11 +00:00
push ebx
xor ecx, ecx
.loop:
mov ebx, [boot_structure.mmap + ecx * 8 + 4]
or ebx, ebx
jnz @f
mov [boot_structure.mmap + ecx * 8], eax
mov [boot_structure.mmap + ecx * 8 + 4], edx
jmp .end
@@:
inc ecx
cmp ecx, 40
jne .loop
.end:
pop ebx
ret
2024-07-05 05:46:04 +00:00
boot_sanitize_memory_map:
ret
2024-07-02 08:32:11 +00:00
;; Function: boot_info_print_mmap
boot_info_print_mmap:
xor ecx, ecx
.loop:
mov eax, [boot_structure.mmap + ecx * 8 + 4]
or eax, eax
jz @f
push ecx
push dword [boot_structure.mmap + ecx * 8 + 4]
push dword [boot_structure.mmap + ecx * 8]
mov si, szMsgMemMap
call bios_log
pop ecx
@@:
inc ecx
cmp ecx, 40
jbe .loop
ret
2024-07-05 05:46:04 +00:00
szMsgMemMap db 'Address: %x - Length: %x', 0