iProgramInCpp wrote:
I thought it wouldn't be required for grub.
GRUB makes no guarantee about the presence or contents of the GDT. You must define your own GDT before you can do things that rely on the GDT.
iProgramInCpp wrote:
What do you mean?
The
System V ABI guarantees that C functions will preserve EBX, ESI, EDI, EBP, and ESP, but functions can and will change EAX, ECX, and EDX. Since your interrupt handler calls a C function, it can modify EAX/ECX/EDX, potentially corrupting the state of whatever was running at the time the interrupt occurred. You must ensure your interrupt handler saves and restores those registers, or it will cause issues in the future.
Additionally, the ABI requires that the Direction flag is clear when any C function is called. Since your interrupt handler may interrupt a function that was not written in C, you must clear the Direction flag. (However, you don't need to worry about saving or restoring it: the CPU saves the flags when an interrupt occurs, and the IRET instruction restores them.)
iProgramInCpp wrote:
I don't want to bother with Makefiles.
You don't need to use a makefile. You can keep using a batch script, or find another build system.
iProgramInCpp wrote:
Plus, it gives the advantage that you can essentially store all the code in one file (with a few exceptions, such as assembly code)
I don't see how that's an advantage.