I'm using nasm and ld for my OS. Now, at the very end of the OS I would like to reserve some memory. I do this in the .bss section as follows:
Code: Select all
[section .bss]
memory_start:
resb 100*1024
kernel_end:
Code: Select all
[section .bss]
some_variable resd 1
My linker script is as follows:
Code: Select all
OUTPUT_FORMAT("elf32-i386")
ENTRY(start)
SECTIONS
{
. = 0x100000;
.setup :
{
*(.setup)
}
. += 0xC0000000;
.text : AT(ADDR(.text) - 0xC0000000)
{
*(.text)
}
.data ALIGN (4096) : AT(ADDR(.data) - 0xC0000000)
{
*(.data)
*(.rodata*)
}
.bss ALIGN (4096) : AT(ADDR(.bss) - 0xC0000000)
{
*(COMMON*)
*(.bss*)
}
}