mirror of
https://github.com/gbowne1/ClassicOS.git
synced 2024-11-21 05:46:52 -08:00
Bootloader issues #2
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gbowne1/ClassicOS#2
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Some considerations for improving the current boot.asm
enabling the A20 line explicitly. This should allow better access to memory above 1MB.
obtaining a memory map using BIOS interrupt 0x15, function 0xE820 before switching to protected mode.
This can be useful for the kernel to know about available memory.
We have a stack in protected mode. However, I think we should also consider setting up a small stack in real mode as well for some safety.
Error handling BIOS calls like checking after disk read operations (int 0x13). If the carry flag is set after the interrupt, it indicates an error
Consider using a smaller buffer size for reading sectors. Might create a potential stack overflow risk due to large sector count (64).
The kernel stack size of 16 KB might be sufficient for a simple kernel, but for more complex kernels,
you might need to increase it to avoid stack overflows. The kernel stack is defined in the .bss section.
Might try using defined constants
In the GDT, the GDT limits are set to 0xFFFF, which may not be sufficient for larger kernels.
The base addresses for the code and data segments are set to 0x0000, which may cause issues.
The ES, FS, and GS segment registers are set to DATA_SEG, but their usage is not clear.
The kmain function is called without checking if it exists or is properly defined.
The cli and hlt instructions are used without ensuring interrupts are properly set up.
The transition to 32-bit mode is not explicitly verified.
Multiboot compliance?
you might want to add a null descriptor at the end of the GDT for consistency in gdt_end: dq 0x0000000000000000
In the kernel part, add some buffer overflow protection, as in, check if ebx exceeds the screen dimensions before writing.
Consider using a loop counter instead of jumping to the start of the string repeatedly.