Page 1 of 2
Strange Problem of my OS only with Bochs [SOLVED]
Posted: Sun Jan 11, 2009 8:45 am
by finarfin
I have a problem with my OS, that happen only in bochs.
In real Hardware and in qemu it works without problems.
Here the problem, after some time that i use my OS in bochs it hangs with one of the following problems:
- A loop of General protection Exception
- A loop of Bound Exception
- Os Freeze
And sometimes the problem is different using two bochs on two different pc's.
I don't understand when it happen, if in IRQ handling, MMU, or i don't know .
Now i have only a CLI, there isn't a GUI or particular drivers (except for keyboard and timer and obviously PIC).
Thanks ^_^
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 8:53 am
by Love4Boobies
Could you give us some more info? Like what Bochs has to say about this?
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 8:58 am
by finarfin
in bochsout.txt i found that informations:
Code: Select all
00012229459i[BIOS ] *** int 15h function AX=00c0, BX=0000 not yet supported!
00163740890e[DEV ] write to port 0x0020 with len 4 ignored
00163755296i[CPU0 ] BOUND_GdMa: fails bounds test
00163885030i[CPU0 ] BOUND_GdMa: fails bounds test
00164014764i[CPU0 ] BOUND_GdMa: fails bounds test
00164144498i[CPU0 ] BOUND_GdMa: fails bounds test
00164274232i[CPU0 ] BOUND_GdMa: fails bounds test
00164403966i[CPU0 ] BOUND_GdMa: fails bounds test
00164533700i[CPU0 ] BOUND_GdMa: fails bounds test
Now my bochs isn't compiled with debug support.
And this time a bound exception happens!!
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 11:01 am
by Combuster
You're executing random code. That usually means you have a corrupt stack somewhere.
The question is: is the dword write to port 0x20 part of that random code or part of your OS (which is very bad!)
Try getting the debugger version. That can help you to see where execution goes where you don't expect it.
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 11:36 am
by finarfin
Looking at my code,
I send 0x20 value on port 0x20 (wich is master port of PIC8259) for the end of interrupt.
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 11:52 am
by Combuster
that didn't answer the question: is that a byte or a dword out?
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 2:21 pm
by finarfin
Yeah the data that i send are bytes.
I send bytes through that function:
Code: Select all
void outportb (int data, int portnum)
{
asm("outb %%al, %%dx" :: "a" (data),"d" (portnum));
}
i tried to change the type of data and portnum in char, but i have the same problem (one of the three in list, every time seems to be different).
Now i'll go to download bochs and compile it with debug support
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 3:33 pm
by bewing
If you download the CVS version, you can even get a full GUI debugger with bochs now.
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 3:39 pm
by finarfin
oh i donwloaded the cvs version and stable version, and they wont compile if i use the:
./configure --enable-iodebug --enable-disasm --enable-debugger
for enable debug, i receive that make error:
Code: Select all
...
enh_dbg.cc:3045: error: ‘VK_RETURN’ was not declared in this scope
....
enh_dbg.cc:3375: warning: deprecated conversion from string constant to ‘char*’
make[1]: *** [enh_dbg.o] Error 1
make[1]: Leaving directory `/home/crowley/bochs-20090111/gui'
make: *** [gui/libgui.a] Error 2
Going back to my problem, i noticed, that when the OS freeze bochsout has that output:
Code: Select all
00716358000i[KBD ] internal keyboard buffer full, ignoring scancode.(a3)
00717974000i[KBD ] internal keyboard buffer full, ignoring scancode.(23)
00718548000i[KBD ] internal keyboard buffer full, ignoring scancode.(a3)
apparently i can't find any connection between #GPE, Bound Exception and that problem, please help meeee ^_^
Re: Strange Problem of my OS only with Bochs
Posted: Sun Jan 11, 2009 7:00 pm
by bewing
Dang, it looks like Stanislav broke the gtk version of the debugger in CVS.
If you want, I can send you exactly the files that you need to get it fixed and running. It's trivial to do. Send me a PM, or post a message here to let me know.
Re: Strange Problem of my OS only with Bochs
Posted: Mon Jan 12, 2009 3:33 am
by Combuster
apparently i can't find any connection between #GPE, Bound Exception and that problem
#GP means the code did something stupid. The exception handler can tell you where it is.
Bound exception means that the bound instruction is used in code. Since that instruction isn't used by GCC, it means that it is not your code that is executing, but something else like random memory.
The keyboard buffer full means that there is no driver that is getting the data from the keyboard, and as a consequence the PS/2 controller runs out of memory. Likely you have been poking keys in a futile attempt to revive your dead bios. Gimme a minute and I can even tell you which key now suffers from PTSD
.
In any case, there's a big bug causing your OS to execute something other than itself.
Re: Strange Problem of my OS only with Bochs
Posted: Mon Jan 12, 2009 3:46 am
by finarfin
but the weird fact, is why only with bochs?
Real hardware everithing work ok (3 different pc's), qemu is ok. Only bochs.
Now i noticed one thing, i don't know if that is connected to the problem, if i empty the irq handler routine of all code and put a silly printf of the irqnumber, i saw a loop of 1, and i expect myself that if i don't press any key, and have the PIT disabled, that doesn't have to happen, i'm right? (it happens also in qemu).
Is possible that the problem is inside the irq handler?
Re: Strange Problem of my OS only with Bochs
Posted: Mon Jan 12, 2009 9:10 am
by stlw
bewing wrote:Dang, it looks like Stanislav broke the gtk version of the debugger in CVS.
If you want, I can send you exactly the files that you need to get it fixed and running. It's trivial to do. Send me a PM, or post a message here to let me know.
CVS never had Gtk version of GUI debugger ...
What are you talking about ?
Stanislav
Re: Strange Problem of my OS only with Bochs
Posted: Mon Jan 12, 2009 2:16 pm
by finarfin
When i have the #GP i found that in bochsout.txt
Code: Select all
00111496588e[CPU0 ] write_virtual_checks(): no write access to seg
00111500177e[CPU0 ] check_cs(0x009d): conforming code seg descriptor dpl > cpl, dpl=3, cpl=1
00111503766e[CPU0 ] check_cs(0x2595): not a valid code segment !
00111507355e[CPU0 ] check_cs(0x2595): not a valid code segment !
Re: Strange Problem of my OS only with Bochs
Posted: Tue Jan 13, 2009 6:09 am
by finarfin
i found where the problem start.
It seems to be in timer irq. I disabled it and now it seems to work.
Now i investigate why, the timer has that problem!
But i don't understand why! I have that problem.
If someone has any idea please help me!!
I repeat, that the problem happens only with bochs!