When I use my boot loader inline strings(char pointers) don't work, same with global variables
I've seen this issue with grub here https://stackoverflow.com/questions/186 ... e-accessed at stack overflow
but it does not work for me
I tried everything
What i know:
- pointers are pointing to a wrong memory address
- this only occurs when I use my own boot loader, it does not when I use qemu with -kernel flag
- probably something wrong with the linker
What I don't know is how to fix it
To reproduce run make
os does print "OS booted successfully", but only because it is stored in a char array, and not an inline string
those hex values are:
first one is a test if the function does it's thing - it should be 0x79F
second is the memory address of a char pointer, which is not pointing where it should
and the last one is where the rodata section starts, according to linker
I'm new to os development and c++ development (previously wrote mainly in c#), so please question every line of code I wrote
code available here: https://github.com/imicz-a/MyOs
Thanks for your help
Problem with my custom boot loader, tried everything
-
- Member
- Posts: 5560
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Problem with my custom boot loader, tried everything
You're telling the linker to produce an ELF executable, but your bootloader is expecting a flat binary. Try telling the linker to produce a flat binary.
Also, you have a Multiboot header at the beginning of your binary, and once you tell the linker to produce a flat binary you'll jump to that header and execute it, which certainly won't do anything useful.
Also, your bootloader has some bugs related to segmentation. For example, you have no idea where your stack is.
Are you sure you want to write your own bootloader?
Also, you have a Multiboot header at the beginning of your binary, and once you tell the linker to produce a flat binary you'll jump to that header and execute it, which certainly won't do anything useful.
Also, your bootloader has some bugs related to segmentation. For example, you have no idea where your stack is.
Are you sure you want to write your own bootloader?