This is the first time I post on this forum, pardon me if this is a noob question
Iv'e got a very tiny OS that boots with Grub in 64 bits mode, with higher-half paging enabled, inspired by this : http://wiki.osdev.org/64-bit_Higher_Hal ... ith_GRUB_2
You can see most of my code here : https://github.com/LeoTestard/Quasar/tr ... 7c052d4f86
The main difference is that my kernel is written in Rust instead of C. I think the interesting parts for this problem are the loader (arch/x86_64/boot/loader.s), and the linker script (linker.ld).
When booting with Grub, I notice something strange, the location where my Rust code (the .text section) is loaded in memory is 8 octets higher from where it should be :
Code: Select all
(qemu) x/32hb 0xFFFFFFFF8010C000
ffffffff8010c000: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
ffffffff8010c008: 0x64 0x48 0x3b 0x24 0x25 0x70 0x00 0x00
ffffffff8010c010: 0x00 0x77 0x1a 0x49 0xba 0x08 0x00 0x00
ffffffff8010c018: 0x00 0x00 0x00 0x00 0x00 0x49 0xbb 0x00
Code: Select all
ffffffff8010c000 <main>:
ffffffff8010c000: 64 48 3b 24 25 70 00 cmp %fs:0x70,%rsp
I didn't notice this problem initially because the 8 octets that were located before the code of main where zeroes, so main was run just fine. But now, I have another function located just before it, and jumping to main jumps in fact... to the return of that function, and this prevents my OS to boot. :/
Thanks for your help