I've changed my kernel a bit, but when I boot it with Bochs, it doesn't work properly (no "counter" message is printed out, as you will see soon)...
bochout.txt sais:
Code: Select all
00023657526i[CPU ] BxError: instruction with op1=0xfe
00023657526i[CPU ] nnn was 4
00023657526i[CPU ] WARNING: Encountered an unknown instruction (signalling illegal instruction):
That's my code:
Code: Select all
/* setup_interrupts()
* sets up some IRQ handlers, etc.
*/
void setup_interrupts(void)
{
disable_ints(); /* no interruptions */
/* init the PICs and remap them so they start at 0x20 */
init_pics(0x20, 0x28);
/* and now set up some interrupt handlers */
changeISR(0x21, (void *)int_irq1);
enable_irq(1);
enable_ints();
printk("Keyboard enabled\n");
printk("Interrupts enabled\n");
}
void kmain(void)
{
...
...
/* set up interrupt stuff */
printk("Setting up interrupts...\n");
setup_interrupts();
printk("Remapped the PICs: IRQs starting at 0x20\n");
idle(); /* keep doing nothing */
}
/* idle()
* function does nothing
*/
void idle(void)
{
printk("\nidling...\n");
while(1)
{
if (counter > 10)
{
printk("\ncounter\n");
counter = 0;
}
}
}
Code: Select all
int_irq1:
EXTERN kbd_handler
cli ; disable interrupts while processing
call save ; save registers
call kbd_handler ; call the handler
call masterEOI ; send EOI to master
call restore ; restore registers
sti ; reenable interrupts
iretd
save:
; save some registers
pushad
push ds
push es
push fs
push gs
mov eax, DS_SELECTOR
mov ds, eax
mov es, eax
mov fs, eax
mov gs, eax
ret
restore:
; restore saved registers
pop gs
pop fs
pop es
pop ds
popad
ret
Code: Select all
int counter = 0;
void kbd_handler(void)
{
int i;
i = inb(0x60);
counter++;
}
So there is no "counter" message printed out in idle...
Why? Can somebody help me please?