Kernel Print problems
Kernel Print problems
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
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
Sorry ;D
Bootloader code - http://avnet.sytes.net/~vladas/boot.asm
Bootloader code - http://avnet.sytes.net/~vladas/boot.asm
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel Print problems
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...
On the other side, if you could provide the BOCHS error messages (like CPU:panic ...) we could help you better...
Re:Kernel Print problems
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
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
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel Print problems
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 ...
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.
Code: Select all
pos = row * column * 2;
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
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.
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
Try this, in link.ld:
That's what Pype recommends above...
Code: Select all
...
.text 0x100000 : {
*(.text)
*(.rodata)
}
...
Every good solution is obvious once you've found it.
Re:Kernel Print problems
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)
Only Human
Re:Kernel Print problems
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)
try it out and let us know.
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)
}
}
Only Human
Re:Kernel Print problems
the other problem is with your print function here's the correct one
the rest you should be abe to figure out by urself.
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
};
};
Only Human