[SOLVED] Strings

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.
Post Reply
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

[SOLVED] Strings

Post by t0xic »

Hey, I'm new to OS design and I had a quick question

Why can I not use:

Code: Select all

kprint("Hello, World!",0,0x2);
^^^ This code just resets bochs

Instead of:

Code: Select all

char *msg = "Hello, World!";
kprint(msg,0,0x2);
^^^ This code works

--Thanks
Michael
Last edited by t0xic on Mon May 07, 2007 3:48 pm, edited 1 time in total.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

do you have a .rodata in your linker script?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

I'm not using a linker script...


I'm just using

Code: Select all

tools\ld -i -e _main -Ttext 0x1000 -o kernel.o main.o video.o ports.o mem.o read.o
How would I set up a linker script?

--Thanks
Michael
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

You are doing incremental linking. The output of this command is not suitable for being run directly as kernel binary.

There's a decent tutorial on how to compile and link a kernel, which includes linker scripts.

EDIT: If you solved it yourself, could you please post your solution for reference?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
t0xic
Member
Member
Posts: 216
Joined: Sat May 05, 2007 3:16 pm
Location: VA
Contact:

Post by t0xic »

Thanks for your help,

I found the bkerndev link.ld file earlier but just hadn't used it.

Thanks again

--Michael
Post Reply