Page 1 of 2
Kernel Print problems
Posted: Sat Jul 03, 2004 8:04 am
by Vladaz
Hello. When I end with bootloader, I started programming kernel. I found some bugs in kernel, then worked on them some days, trying to fix it. But I don't know where are the problems. Can you help me?
http://avnet.sytes.net/~vladas/a.txt - kernel source. I put all files to one file for you. Maybe it would be easier if you don't want to download or something.
Now when I run it on Bochs, it in about 5 seconds turn off bochs.Thanks in advance
Re:Kernel Print problems
Posted: Sun Jul 04, 2004 12:29 am
by jinksys
You forgot to include boot.asm , we cant compile without it.
Re:Kernel Print problems
Posted: Sun Jul 04, 2004 1:24 pm
by Vladaz
Re:Kernel Print problems
Posted: Wed Jul 07, 2004 1:21 pm
by Vladaz
So? Have anybody idea about my kernel's problem?
Re:Kernel Print problems
Posted: Thu Jul 15, 2004 7:41 am
by Pype.Clicker
i'd suggest you use Bochs' internal debugger and run step by step. (e.g. does the "a' or 'b' character got displayed on screen ?)
On the other side, if you could provide the BOCHS error messages (like CPU:panic ...) we could help you better...
Re:Kernel Print problems
Posted: Fri Jul 16, 2004 2:53 am
by Vladaz
I ran my OS from bochsdbg.exe and it wrote me:
00000000000i[ ] installing win32 module as the Bochs GUI
00000000000i[ ] Warning: no rc file specified.
00000000000i[ ] using log file bochsout.txt
Next at t=0
(0) context not implemented because BX_HAVE_HASH_MAP=0
[0x000ffff0] f000:fff0 (unk. ctxt): jmp f000:e05b ; ea5be000f0
<bochs:1>
When I start through bochs.exe it writes me 'a' and 'b' int top left corner. But it don't write my the code that is in kernel.c
Re:Kernel Print problems
Posted: Fri Jul 16, 2004 3:23 am
by Pype.Clicker
okay. your bochsdbg.exe is simply waiting for you to tell it what to do, now that the virtual machine is ready.
Try to put a breakpoint at 0:0x7c00 and then
continue the execution. Then you'll be able to request a step-by-step behaviour with 's'
if both 'a' and 'b' displayed, there are chances your C code is buggy more than your environment.
will certainly not behave as well as pos= row * 160 + column * 2 woud have ...
also make sure your strings have been integrated in kernel.bin (depending on your compiler, they may be in some .rodata section) and that your whole kernel has not grown too large for your partcopy commands ...
Re:Kernel Print problems
Posted: Thu Jul 22, 2004 6:36 pm
by Vladaz
Hmm. Im so lame :'(
I still can't solve that problem. And i didn't understood what you told me. I put the code in kernel.c that should put a char in video memory and set its attribute. But it still doesn't work for me. Can you fix my code, that i wrote in this post's end ? I would be very thankful.
My OS source:
http://avnet.sytes.net/~vladas/boot.asm - my bootloader.
http://avnet.sytes.net/~vladas/kernel.txt - my kernel.asm kernel.c video.c video.h and compile.bat files' sources.
Thanks in advance.
Re:Kernel Print problems
Posted: Fri Jul 23, 2004 12:33 am
by Solar
link.ld is missing...
Re:Kernel Print problems
Posted: Fri Jul 23, 2004 5:45 am
by Vladaz
OK. I have inserted link.ld source in kernel.txt.
Re:Kernel Print problems
Posted: Fri Jul 23, 2004 6:21 am
by Solar
Try this, in link.ld:
Code: Select all
...
.text 0x100000 : {
*(.text)
*(.rodata)
}
...
That's what Pype recommends above...
Re:Kernel Print problems
Posted: Fri Jul 23, 2004 2:10 pm
by Vladaz
It still don't work ???
Re:Kernel Print problems
Posted: Sun Jul 25, 2004 11:52 am
by Neo
i think theres something wrong with your print routine, or something wrong with the link and load addresses of your code. (not too sure though)
Re:Kernel Print problems
Posted: Sun Jul 25, 2004 12:55 pm
by Neo
yeah i really think that is the problem.
Your code is linked to run at 0x100000 but is loaded by your boot loader to the address 60000 (decimal) i.e. 0xEA60. changing your linker script to this may get it working (although it may not be what you actually intended)
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(start)
SECTIONS
{
.text 0xEA60 : {
*(.text)
}
.data : {
*(.data)
}
.bss : {
*(.bss)
}
}
try it out and let us know.
Re:Kernel Print problems
Posted: Sun Jul 25, 2004 11:35 pm
by Neo
the other problem is with your print function here's the correct one
Code: Select all
void print(char *message, char color) {
char *vidmem = (char *) 0xB8000;
pos= row * 160 + column * 2;
while (*message != 0)
{
if (*message == '\n')
{
++row;
}
else {
vidmem[pos++] = *message;
vidmem[pos++] = color;
++column;
};
++message; //this comes here not inside
};
};
the rest you should be abe to figure out by urself.