Page 1 of 1

need help with text in pmode

Posted: Wed Sep 06, 2006 4:19 pm
by thoover
ok, i checked the OSFAQ and followed all instruction and did the osdever sample c. and it just put weird symbles on all of my computers.

;==P and then the pi symble is what was displayed when it was supose to be "Hello Booting....Done"

Re:need help with text in pmode

Posted: Wed Sep 06, 2006 7:27 pm
by Kevin McGuire
What compiler and linker options did you use, and what does a small code snipplet of the printing routines look like?

It sounds like the "Hello Booting.. Done" string is being stored in what is called the data section of the ELF32. The linker normaly gets told where the text, data, and other sections will be so it creates hard links instead of using position independant code that would instead create a relative link such as a relative to the current EIP. If the data section is instead loaded somewhere else you can end up with that problem. This is also just one of many possible problems, but it is the first I would check.

A possible solution could be to use a linker script such as in this post.
http://www.mega-tokyo.com/forum/index.p ... adid=10144

Re:need help with text in pmode

Posted: Thu Sep 07, 2006 4:26 pm
by thoover
im using FASM, and DJGPP with link.ld. FASM is just for the int 10h and boot code. DJGPP for the K_PRINT functin and K_MAIN function.

Re:need help with text in pmode

Posted: Thu Sep 07, 2006 5:20 pm
by GLneo
can we see your code? ;)

Re:need help with text in pmode

Posted: Thu Sep 07, 2006 5:33 pm
by Kevin McGuire
http://www.mega-tokyo.com/osfaq/How%20d ... %20my%20OS

Make the kernel print the address of the string you are trying to display. Check that with the kernel image. See if it is trying to load something outside of the kernel image or from the wrong place.

Use objdump or whatever program you have to dump out the sections and find where the string is stored and use that to debug it.

Re:need help with text in pmode

Posted: Fri Sep 08, 2006 7:06 am
by thoover
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++;
        }
}
all i added was k_main

Re:need help with text in pmode

Posted: Fri Sep 08, 2006 8:18 pm
by Kevin McGuire
Check the linker script, or how you specify the physical address of the data section.

If you use an a-out kludge check the address fields of the Multiboot header.
http://www.gnu.org/software/grub/manual ... cification

Try writting some code to do a binary search in memory for the string, then write a routine to print the address pointed to by "Hello Booting..Done", see if they match up or do not.

char *str = "Hello Booting..Done";
k_printnum((unsigned int)str);
Find 'h' 'e' 'l' 'l' 'o' in memory, print address.