Fixed numbers in boot structs

This commit is contained in:
notsomeidiot123 2025-03-30 12:20:35 -04:00
parent b8934b5c4c
commit 79496c1299
4 changed files with 17 additions and 7 deletions

View File

@ -330,17 +330,18 @@ part_2:
; debug ; debug
cmp eax, -1 cmp eax, -1
je .find_fs_driver_no_disk je .find_fs_driver_no_disk
mov [disk_module_struct.size], edx
mov esi, eax mov esi, eax
and edx, 0xfffffc00 and edx, 0xfffffc00
add edx, 0x1000 add edx, 0x1000
add [kload_paddr], edx add [kload_paddr], edx
; debug ; debug
mov edi, [kload_paddr] mov edi, [kload_paddr]
call read_file
mov esi, [kload_paddr]
; call load_elf
mov [disk_module_struct.ptr], edi mov [disk_module_struct.ptr], edi
call read_file
jc load_fail
; mov esi, [kload_paddr]
; call load_elf
; debug ; debug
jc load_fail jc load_fail
jmp .find_fs_driver jmp .find_fs_driver
@ -559,6 +560,11 @@ read_file:
add eax, ecx add eax, ecx
add eax, edx add eax, edx
mov [DAP.sector_start], eax mov [DAP.sector_start], eax
mov ecx, [fat_bpb.part_start]
add [DAP.sector_start], ecx
mov edx, [DAP.sector_start]
; cmp esi, 3
; je $
xor ecx, ecx xor ecx, ecx
mov cl, [fat_bpb.sectors_per_cluster] mov cl, [fat_bpb.sectors_per_cluster]
mov [DAP.read_count], cx mov [DAP.read_count], cx
@ -856,10 +862,12 @@ k_info:
;loaded_modules points to a struct array containing a ptr to the entry point of each pre-loaded module to be executed during startup ;loaded_modules points to a struct array containing a ptr to the entry point of each pre-loaded module to be executed during startup
disk_module_struct: disk_module_struct:
.ptr: dd 0 .ptr: dd 0
.size: dd 0
.type: dd 1 .type: dd 1
.next_entry: dd fs_module_struct .next_entry: dd fs_module_struct
fs_module_struct: fs_module_struct:
.ptr: dd 0 .ptr: dd 0
.size: dd 0
.type: dd 2 .type: dd 2
.next_entry: dd 0 .next_entry: dd 0
kernel_file: db "kernel", 0, 0, "elf" kernel_file: db "kernel", 0, 0, "elf"

View File

@ -20,8 +20,8 @@ extern void kmain(kernel_info_t *kernel_info){
//TODO: Map and load filesystem and disk modules //TODO: Map and load filesystem and disk modules
//TODO: Start Initial Process //TODO: Start Initial Process
printf("%x", kernel_info->loaded_modules->ptr); printf("%x\n", *(uint32_t *)kernel_info->loaded_modules->ptr);
printf("%x", kmain); printf("%x", kernel_info->loaded_modules->size);
init_scheduler(); init_scheduler();
thread_start(pid0); thread_start(pid0);

View File

@ -5,6 +5,7 @@
typedef struct module_linked_list{ typedef struct module_linked_list{
void *ptr; void *ptr;
uint32_t size;
uint32_t type; uint32_t type;
struct module_linked_list *link; struct module_linked_list *link;
}__attribute__((packed)) kernel_module_t; }__attribute__((packed)) kernel_module_t;

View File

@ -1,5 +1,6 @@
#include<stdint.h> #include<stdint.h>
void main(){ void main(){
uint32_t *t = (void *)0xb8000; uint16_t *t = (void *)0xb8000;
*t = 0x0f41;
} }