Help with text in pmode
Help with text in pmode
OK i followed all instructions in the mega-tokyo.com osfaq and the osdever.net a simple c kernel, and it will not work on any of my computers it prints only 4 to 5 chars and on what i wanted my exact string, only one of the 5 of them, was "Pleaz wait booting....DONE!" it put the paragraph and pi simbly withe =. can anyone help me out.
here is my code:
Code: Select all
K_main()
{
k_print(0x07, “Hello Booting....Done”);
for(;;);
}
k_print(int colour, char *string)
{
char *video=(char*)0xB8000;
while(*string!=0)
{
*video=*string;
string++;
video++;
*video=colour;
video++;
}
}
You did include rodata in your linker-script ?
cheers,
gaf
Code: Select all
SECTIONS
{
.text 0xDEADBEEF :
{
*(.text)
*(.rodata*)
}
.data :
{
*(.data)
}
.bss :
{
*(.bss*)
*(.comment*)
}
}
gaf
@Buback: It probably compiles, so that can't be the problem (I think )
@Gaf:
What does that extra statement do exactly?
I shall try to explain why I ask this. Since I first compiled my kernel, I was always using the following compiler option: "-fwritable-strings", to make sure that all strings were included in the data section, instead of the code section. Cause, before I did this, I passed a string and only the offset was passed to the called function. The called function however, thought that this offset was related to the data segment and the only thing I got was garbage on screen, just like dhacker14 does.
If this is resolving that problem I had, I would sure like to know more about this .rodata section...
Sorry for this long and boring story...
@Gaf:
What does that extra statement do exactly?
I shall try to explain why I ask this. Since I first compiled my kernel, I was always using the following compiler option: "-fwritable-strings", to make sure that all strings were included in the data section, instead of the code section. Cause, before I did this, I passed a string and only the offset was passed to the called function. The called function however, thought that this offset was related to the data segment and the only thing I got was garbage on screen, just like dhacker14 does.
If this is resolving that problem I had, I would sure like to know more about this .rodata section...
Sorry for this long and boring story...
The rodata section (read-only data) includes all constant global data that the executable uses. As string literals are constant by definition, they also get put into this section. If your linker-script doesn't include the rodata section, the linker can't add the strings to the binary and all strings pointers are invalid. The garbage that does get printed is just some data/code that happends to be at the wrong place at the wrong time..
regards,
gaf
It solves 9 out of 10 problems related to string output. I actually already thought about putting it into my signatureIf this is resolving that problem I had..
regards,
gaf
Basically, I am not sure yet whether I use full segmentation or a flat memory model (paging only). But, since my kernel will use code segment and data segment, I need the strings to be in the data segment (just because pointers are always offsets to the dseg).
But thanks anyways, I can die happy now.
I wasn't beware of that option and you teached me.
Thnx dude!
But thanks anyways, I can die happy now.
I wasn't beware of that option and you teached me.
Thnx dude!
didnt help
I put in all the things i didnt have in the link.ld file, but the output was:
' }
any other ideas?
' }
any other ideas?
Well, you could try the following:
- Look at your datasegment. If you are in protected mode, make sure that the datasegment you are writing to for screen output has base 0. In real mode your code should actualy work.
- Try to put .rodata in your data section. Memory operations are always executed on ds/es. If your string is included in code section (cs), than your string can never be found in ds...
Hope this helps...
- Look at your datasegment. If you are in protected mode, make sure that the datasegment you are writing to for screen output has base 0. In real mode your code should actualy work.
- Try to put .rodata in your data section. Memory operations are always executed on ds/es. If your string is included in code section (cs), than your string can never be found in ds...
Hope this helps...