Determining the size of the kernel
Posted: Sat Feb 17, 2007 5:58 pm
Hello,
Having been involved into OS development for almost a week now, I have finally reached the memory management part )
Parts present (thanks to the well-known tutorial) : GDT, IDT, IRQ0-1, simple shell, bootloader - GRUB.
The question is : how can I locate the start and the end of the kernel?
Linker source:
Is there a way to pass variables from linker to kernel? Would x=phys+SIZEOF(.text)+SIZEOF(.data)+SIZEOF(.bss) contain the address of the end of the kernel part?
Having been involved into OS development for almost a week now, I have finally reached the memory management part )
Parts present (thanks to the well-known tutorial) : GDT, IDT, IRQ0-1, simple shell, bootloader - GRUB.
The question is : how can I locate the start and the end of the kernel?
Linker source:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000; /* 1 mb */
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
. = ALIGN(0x1000);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(0x1000);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(0x1000);
}
end = .;
}