Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
piranha wrote:I was working on my OS for a while, but then I updated my system to 64 bit.
Now when I load grub and select my OS, it says Unrecognized File Format. WHAT IS GOING ON HERE!?!
I don't know how GRUB works on x86-64, but my guess is that it tries to find the ELF headers for 64-bits executables, since it detects the presence of a 64-bit CPU...
But I have no idea of the operating environment after booting a multiboot kernel on a x86-64... does it start directly in long mode?
Doesn't look like a good idea because of the backwards compatibility...
GRUB (at least the current version of it) does not support elf64 multiboot images; in fact the current multiboot standard states that it is intended for 32-bit kernels.
With that being said, nothing prevents you from creating a 32-bit "loader" kernel that simply loads your 64-bit kernel into memory, sets up long mode, and jumps into your 64-bit code. For that matter, you could pass your 64-bit kernel as a module.
My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
piranha wrote:
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
You have to parse the elf64-specific fields, of course!
My boot loader does support 64-bit ELF images but doesn't even come close to GRUB for features. It's not that hard to add, but for the level of complexity of GRUB, it's not easy.
Can I have a look at your code to get an idea? You don't have to give it to me if you don't want, but since i am not that great at assembly I would have no idea where to begin
The idea is, the boot loader (directory above this) loads all the files and such, then switches into the right mode (so the long mode switch is in that directory too), and then passes control to this code. This code loads an elf file of the type of which it itself is compiled.