Page 1 of 1
Reprogramming the PIC in Bochs
Posted: Thu Aug 30, 2007 11:51 am
by vhg119
When I execute my code to reprogram the PIC, Bochs popped up a dialog box telling me [PIC] >>PANIC<< write to port 20h = 21.
Then, it lets me choose to continue. Did I do something wrong?
Clicking continue proceeds and everything else looks fine.
Vince
Posted: Thu Aug 30, 2007 3:23 pm
by Combuster
The message says that you are writing an incorrect value to the first PIC port. The only values you should be sending are the ICW1 (0x11) or an EOI (0x20) The value of 0x21 or 0x15 (21 decimal) is not supported. Try to find the offending write and check its purpose.
Posted: Thu Aug 30, 2007 4:19 pm
by vhg119
Thank you, I got my port/value parameters mixed up.
I'm trying to setup my IDT so I was remapping the IRQs to different Interrupts.
Now I'm getting alot of these errors:
[CPU0] BxError: instruction with opcode=0xff
[CPU0] mod was c0, nnn was 7, rm was 7
[CPU0] WARNING: Encountered an unkown instruction (signalling illegal instruction)
Bochs repeats that for about 10 seconds and then it'll reset itself.
I probably messed up my IDT entries.
Thanks for your help.
Posted: Thu Aug 30, 2007 4:32 pm
by vhg119
I don't have a TSS set up yet so that's what I'm working on.
I have a question about the ss0 field of the TSS. Does this just point to the same SS location that the rest of the kernel uses?
Posted: Fri Aug 31, 2007 2:40 am
by JamesM
ss0 is the stack segment to be set on a switch to ring 0. So yes, it should be your kernel SS. Which is usually 0x10. (Notice RPL of 0).
Posted: Fri Aug 31, 2007 10:44 am
by vhg119
Thanks JamesM, I got my TSS loaded and everything seems to be ok. I'm going to be doing software task switching. Do I still need to initialize all the fields of the TSS? Since I'm basically only going to use it for RING3->RING0 PL changes, is initializing only SS0 and ESP0 sufficient?
Furthermore, I assume it's a good idea to point ESP0 to a place that won't interfere with any RING0 tasks. Am I right?
My interrupts are still misbehaving with Bochs reporting many instances of:
[CPU0] BxError: instruction with opcode=0xff
[CPU0] mod was c0, nnn was 7, rm was 7
[CPU0] WARNING: Encountered an unkown instruction (signalling illegal instruction)
Posted: Fri Aug 31, 2007 7:26 pm
by pcmattman
Show us how you setup your IDT entries. It may be an invalid IDT entry causing unwanted code to execute (ie. a null value would cause the real mode interrupt vector to try to be executed
)
Edit: just noticed the second thread about the exact same thing, with the IDT setup code...
Posted: Sat Sep 01, 2007 11:48 am
by vhg119
pcmattman wrote:Show us how you setup your IDT entries. It may be an invalid IDT entry causing unwanted code to execute (ie. a null value would cause the real mode interrupt vector to try to be executed
)
Edit: just noticed the second thread about the exact same thing, with the IDT setup code...
Yeah, sorry. I created another thread because it was a separate topic. Consider this one case closed.... Solved.