So I've been developing this kernel for a bit and focussed on the standard C library. Now I started adding functionalities to the kernel, starting with a generic idt support handling just the keyboard interrupt. It seemmed to work just fine but when the file exceed 67KB, when is loaded by the bootloader instantly crush with "received signal SIGQUIT, Quit." on what seems to be a random address in code (depending on how much exceeds). The codebase is too large to copy all here so I'll link the github repository at the end of the post.
Anyway I'll post what i think are the most important stuffs:
linker script:
Code:
OUTPUT_FORMAT(elf64-x86-64)
ENTRY(_start)
SECTIONS
{
KERNEL_VMA = 0x00301000;
. = KERNEL_VMA;
.text : ALIGN(0x1000)
{
*(.start)
*(.text)
}
.data : ALIGN(0x1000)
{
*(.data)
}
.rodata : ALIGN(0x1000)
{
*(.rodata)
}
.idt BLOCK(0x1000) : ALIGN(0x1000)
{
_idt = .;
. = . + 0x1000;
}
.bss : ALIGN(0x1000)
{
_BSS_START = ABSOLUTE(.);
*(COMMON)
*(.bss)
}
_BSS_SIZE = ABSOLUTE(.) - _BSS_START;
}
And the kernel and bootloader are used within a floppy img file created as so:
(with BonsOS.img being the output img, loader.bin the second stage bootloader, kernel.sys the kernel file generated wit the linker script above, boot.bin the first stage bootloader)
Code:
dd if=/dev/zero of=BonsOS.img bs=1024 count=1440
/sbin/mkfs.msdos BonsOS.img
mcopy -i BonsOS.img ./bin/boot/loader.bin ::/
mcopy -i BonsOS.img ./bin/kernel/kernel.sys ::/
dd if=./bin/boot/boot.bin of=BonsOS.img seek=0 count=1 conv=notrunc
Github repo:
https://github.com/DefEnge/test-kernel/tree/testingPS: If you need help navigating the repository to find a file feel free to ask