OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 4:51 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Multiboot header not found (x86_64)
PostPosted: Tue Jul 04, 2017 3:34 am 
Offline
Member
Member

Joined: Sun Mar 01, 2015 7:58 am
Posts: 51
Hi, I am trying to get into 64 bit mode, but I can't get OS to boot. At the moment, I don't want efectively to enable 64 bit mode, I just want to boot the OS when it is compiled with x86_64 compiles. Using similar link script and boot file, on 32-bit compiler, it works, but when I compile with 64 bit compiler I get "multiboot header not found" error. I decompiled the elf file and the multiboot header seems to be the same as in 32-bit elf, but it doesn't work. How could I get it working?

This is the linker script:
Code:
KERNEL_VMA = 0x100000;
KERNEL_LMA = 0x100000;
ALIGN_VAL = 0x1000;

OUTPUT_FORMAT("elf32-x86-64")
ENTRY(_start64)
SECTIONS
{
    . = KERNEL_LMA;

    linker_kernelStart = .;

    _boot = .;
    .boot :
    {
        CMakeFiles/phios.elf.dir/kernel/src/arch/x86/boot64.s.o (.text)
    }
    _eboot = .;

    _text = .;
    .text :
    {
        *(EXCLUDE_FILE(CMakeFiles/phios.elf.dir/kernel/src/arch/x86/boot64.s.o) .text)
    }
    _etext = .;

    _data = .;
    .data :
    {
        *(.data)
    }
    _edata = .;

    _eh_frame = .;
    .eh_frame :
    {
        *(.eh_frame)
    }
    _eeh_frame = .;

    _bss = .;
    .bss :
    {
        *(.bss)
        *(COMMON)
    }
    _ebss = .;

    linker_kernelEnd = .;

    .comment :
    {
        *(.comment)
    }
}



And this is the boot64.s file:
Code:
.section .text
.code32

multiboot_header_begin:
    .align 4
    .long 0xe85250d6
    .long 0
    .long multiboot_header_end - multiboot_header_begin
    .long -(0xe85250d6 + (multiboot_header_end - multiboot_header_begin))
    .short 0
    .short 0
    .long 8
multiboot_header_end:

.global _start64
.type _start64, @function
_start64:
    # 64-bit initialization should go here
    # and jump...
1:
    hlt
    jmp 1b

.size _start64, . - _start64

.section .bss
.align 16
stack_bottom:
.skip 16384 # 16 KiB
stack_top:



Thanks!


Top
 Profile  
 
 Post subject: Re: Multiboot header not found (x86_64)
PostPosted: Tue Jul 04, 2017 3:50 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
You haven't set up entry point in multiboot header. Also, you should check if the header's magic is properly aligned in your elf file. Your checksum doesn't seem to be correct either. Read again the spec carefully.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 806 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group