1. Declare this at the end of your linker script:
Code: Select all
.endkernel ALIGN(0x1000) : AT(ADDR(.endkernel) - 0xC0000000)
{
__kernel_end = .;
LONG(0xCAFEBABE);
}
2. To actually retrieve the value & position, call the following ASM method:
Code: Select all
extern __kernel_end
mov eax,[__kernel_end]
3. The C-function, with a layout like this:
Code: Select all
extern unsigned long __kernel_end;
void kernel_end()
{
kprint("__kernel_end = %x\n",__kernel_end);
kprint("kernel ends at %x\n",&__kernel_end);
}
After studying this code, I came up with a question: Wouldn't it be possible to skip the ASM step in some way? Of course, this only applies if the above code works as I think it does...
Thanks,
Candamir