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.
Ok please bear with me, I have been struggling with this for about 2 days now. All i want to do is just print a string on the screen, I have my bootloader all setup and it boots me into pmode i then execute my kernel and try to print the string with this function:
I originally got this from a tutorial and it didnt work so i kept changing things and trying to figure it out but, i'm stuck now i have tried everything i can think of.
Please help me out with this, Thanks in advance, Deathkillspt.
It would be helpful if you told us what happened when you boot your kernel.
If you're compiling with gcc and then linking as binary the string will probably end up before the code, which isn't a good idea. To fix this you use a linker script.
oh yea i forgot that part, it's very strange when i boot it up it does in fact print but it prints an "S" and thats it. i have a clearscreen function and that works fine. so i don't know why this isn't working. and i am using a linker script and also using the gcc option -fwritable-strings, here is my linker script if it is of any help:
hold on you said do a dump of your object file, but this function is in a separate video header file, could that be the problem? do i have to do some special thing if i'm calling this from a header file?
Do you have bochs? Maybe you could try stepping though the function in the debugger mode and checking to see if everything looks ok. Also maybe try this:
hold on you said do a dump of your object file, but this function is in a separate video header file, could that be the problem? do i have to do some special thing if i'm calling this from a header file?
EDIT:
I was saying do a dump of the object file that had the call to prints in it.
frank wrote:Do you have bochs? Maybe you could try stepping though the function in the debugger mode and checking to see if everything looks ok. Also maybe try this:
I did have bochs but i could never get it to work right it would always say >>PANIC<< and then something about the rom and bios. As of now i am testing on an old laptop, but i guess i could give bochs another shot, and i will try that.
EDIT: yes that is a dump of the object file that had the call to prints in it
Well the answer is that there is nothing wrong with your prints function. Somehow the linker messes up the address of the string "Hello" but it works just fine with the address of string. This normally means that you are missing the section for strings in your linker script but it doesn't seem to be the problem this time. Okay one last thing to try, add .rdata to your linker script.