GRUB: free magic is broken
Posted: Sat Jan 29, 2011 5:12 am
Hello,
I tried to bring my AMD64 kernel into higher half (at 0xFFFFFF0000000000) using the following build script (Don't complain about the .text64 stuff, GRUB2 did not detect my kernel with the multiboot header
outside of .text):
As you see, I have two different loader binaries: loader32 and loader64. While the first sets up long mode and far jumps into the 64 bit loader (which is in lower half two), the latter one calls the kernel's main function. But I can't even get to this point: Booting the kernel GRUB dies with the following error message:
free magic is broken at 0x100100: 0x6db08fa4
That's kind of strange, as the lower memory part ends at 0x1000e4, and there's actually no 0x6db08fa4 in my kernel (at least not on a DWORD boundary)... Has someone of you guys already experienced this issue?
I tried to bring my AMD64 kernel into higher half (at 0xFFFFFF0000000000) using the following build script (Don't complain about the .text64 stuff, GRUB2 did not detect my kernel with the multiboot header
outside of .text):
Code: Select all
ENTRY(loader32)
OUTPUT_FORMAT(elf64-x86-64)
KERNEL_LMA = 0x100000;
KERNEL_VMA = 0xFFFFFF0000000000;
SECTIONS
{
. = KERNEL_LMA;
.text :
{
*amd64/boot/loader32.o (.multiboot);
*amd64/boot/loader32.o (.text);
*amd64/boot/loader64.o (.text);
}
. += KERNEL_VMA;
.text64 : AT(ADDR(.text) - KERNEL_VMA)
{
code = .; _code = .; __code = .;
*(.multiboot)
*(EXCLUDE_FILE(*amd64/boot/loader32.o *amd64/boot/loader64.o) .text)
. = ALIGN(4096);
}
.data : AT(ADDR(.data) - KERNEL_VMA)
{
__CTOR_LIST__ = .;
LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__CTOR_END__ = .;
__DTOR_LIST__ = .;
LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
*(.ctors)
LONG(0)
__DTOR_END__ = .;
data = .; _data = .; __data = .;
*(.data)
*(.rodata)
. = ALIGN(4096);
}
.ehframe : AT(ADDR(.ehframe) - KERNEL_VMA)
{
ehframe = .;
*(.ehframe)
. = ALIGN(4096);
}
.bss : AT(ADDR(.bss) - KERNEL_VMA)
{
bss = .; _bss = .; __bss = .;
*(.bss)
*(COMMON)
. = ALIGN(4096);
}
end = .; _end = .; __end = .;
/DISCARD/ :
{
*(.comment)
}
}
free magic is broken at 0x100100: 0x6db08fa4
That's kind of strange, as the lower memory part ends at 0x1000e4, and there's actually no 0x6db08fa4 in my kernel (at least not on a DWORD boundary)... Has someone of you guys already experienced this issue?