start file searching

This commit is contained in:
notsomeidiot123 2024-09-30 03:11:06 -04:00
parent fdb376b351
commit 0aa9699c54
1 changed files with 21 additions and 1 deletions

View File

@ -300,6 +300,8 @@ times 1024-($-$$) db 0
part_2: part_2:
call get_mmap call get_mmap
call paging_en call paging_en
mov esi, 0
call cache_file_table
call open_file call open_file
jmp $ jmp $
load_kernel: load_kernel:
@ -399,6 +401,9 @@ open_file:
mov si, DAP mov si, DAP
int 0x13 int 0x13
jc load_fail jc load_fail
; debug
mov si, root_dir
mov di,
jmp $ jmp $
; debug ; debug
read_file: read_file:
@ -417,6 +422,7 @@ read_fat:
pop esi pop esi
and esi, 0xfff and esi, 0xfff
mov eax, [esi + file_table] mov eax, [esi + file_table]
cache_file_table: cache_file_table:
;args: ;args:
;esi: fat block index (in 4kb) ;esi: fat block index (in 4kb)
@ -430,6 +436,7 @@ cache_file_table:
div ecx div ecx
push eax ;will be important for the DAP push eax ;will be important for the DAP
mov [loaded_fat_block], esi
mov ecx, eax mov ecx, eax
@ -440,8 +447,20 @@ cache_file_table:
xor edx, edx xor edx, edx
mov dx, [fat_bpb.reserved_sectors] mov dx, [fat_bpb.reserved_sectors]
add eax, edx;sector_to_read add eax, edx;sector_to_read
mov [DAP.start_sector], eax mov [DAP.sector_start], eax
pop eax
mov [DAP.read_count], ax
mov word [DAP.offset], file_table
mov ah, 0x42
mov si, DAP
mov dl, [data.boot_disc]
int 0x13
jc load_fail
pop ecx
pop edx
ret
jmp $
load_elf: load_elf:
;parse elf and relocate each section to it's appropriate location ;parse elf and relocate each section to it's appropriate location
;kernel info ;kernel info
@ -459,6 +478,7 @@ k_info:
;.entry_point: dd 0 ;.entry_point: dd 0
; cr3_load: dd 0 ; cr3_load: dd 0
;.type: db 0 ;.type: db 0
kernel_file: db ""
loaded_fat_block: dd 0 loaded_fat_block: dd 0
root_dir EQU 0x1000 root_dir EQU 0x1000
file_table EQU 0xa000 file_table EQU 0xa000