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.
Hi there,
this is my first post here so I'm sorry if I do something wrong. And another thing: I'm not an native English and my english isn't the best.
ok, now my problems:
Problem 1, strings: I can only use strings if they are declared in the function with char string[] = "...". Global ones and just "..." (forgot the name) can't be displayed. I read that I have to include the .rodata section what I've tried but this hasn't solved the problem. I found out that the strings can only be found if they are in the .text section. And this drives me crazy.
Here is my current linker script if that helps:
Problem 2, page allocation: It's a simpler question. Must I pass the page entry to the pointer if I want to store some structs there or the physical address? My memory management is based on this tutorial: http://www.brokenthorn.com/Resources/OSDev18.html
English isn't my mother tongue so please correct me if something is wrong.
If strings don't work as expected, you are either following a crappy tutorial or have a broken toolchain. The default recommendation of forum.osdev.org is to follow the http://wiki.osdev.org/Bare_Bones tutorial using a http://wiki.osdev.org/GCC_Cross-Compiler for i686-elf. I can personally confirm that strings and other language features work as expected using this Linker Script. Please let me know if you have any trouble with this configuration. Note that Bare Bones is not a higher half tutorial kernel, there are some additional wiki tutorials that cover this but they are not fully up to date with the current recommendations. If you are developing on Windows or OS X and you are not using a cross-compiler, this could very well be the root cause.
This subsequent tutorial covers the recommended way of calling global constructors in a kernel: http://wiki.osdev.org/Calling_Global_Constructors - I'm not sure this approach on x86 and x86_64 work correctly with the Bare Bones linker script. I need to research and verify that.
(This is not a full answer that promises to fix your problem, just a boilerplate answer with common recommendations. Your problem may be unrelated.)
Thank you for your reply,
but unfortunately rebuilding the cross compiler for i686-elf hasn't solved my problem.
I also tried the linker script from the bare bones tutorial (adjusted to my needs) but it didn't work.
English isn't my mother tongue so please correct me if something is wrong.
Does your kernel make sense if you objdump -d it? Use tools like objdump and readelf to investigate your kernel. Try to find out where the strings ended up and where it thought they were.