I'm trying to learn the internals of an OS so I thought I woudl write a kernel. This has proven to be a difficult project. I'm using bootmaker to boot my elf kernel but am having difficuly setting up my Timer isr.
The first thing I do is intialize the PIC
init_pic() {
cli();
/* Initialize Master 8259 PIC */
outportb(0x20, 0x11); /* ICW1 - Edge Triggered Mode, Cascaded PIC, */
/* ICW4 required to define uPM */
outportb(0x21, 0x08); /* ICW2 - Set PIC offset to 08h, the PC's */
/* Master PIC IVT base address */
outportb(0x21, 0x04); /* ICW3 - Slave PIC attached to IR2 Input */
outportb(0x21, 0x01); /* ICW4 - Set PIC operation to 8086/8088 Mode */
outportb(0x21, 0xFe); /* OCW1 - Disable interrupts for all IRQs */
/* Intialize Slave 8259 PIC */
outportb(0xa0, 0x11); /* ICW1 - Edge Triggered Mode, Cascaded PIC, */
/* ICW4 required to define uPM */
outportb(0xa1, 0x70); /* ICW2 - Set PIC offset to 70h, the PC's */
/* Slave PIC IVT base address */
outportb(0xa1, 0x02); /* ICW3 - Slave PIC ID = 2, the IRx level it */
/* occupies on the Master PIC */
outportb(0xa1, 0x01); /* ICW4 - Set PIC operation to 8086/8088 Mode */
outportb(0xa1, 0xFF); /* OCW1 - Disable interrupts for all IRQs */
// Debugging info
printf("Interrutps enabled on PIC1: 0x%x\n", inb(0x21));
printf("Interrutps enabled on PIC2: 0x%x\n", inb(0xA1));
sti();
}
I'm getting error handlers to work but whenever I try to setup the timer isr, I get a boud exception
Im the remap_pics example aove I set the offset to 0x08 but I'm not sure if I have anythnig there. Is there somthing I'm totally missing here? I started out with the DemoOS.
Thanks,
Chris
Having problem setting up my timer ISR
RE:Having problem setting up my timer ISR
I'm also new to this stuff. Correct me if I'm wrong, but I think that the PIC should usually not overlap first 32 ints, which are exceptions.
Instead of
outportb(0x21, 0x08); /* ICW2 - Set PIC offset to 08h, the PC's */
/* Master PIC IVT base address */
try outportb(0x21, 0x20);
Hope this helps,
Adrian.
Instead of
outportb(0x21, 0x08); /* ICW2 - Set PIC offset to 08h, the PC's */
/* Master PIC IVT base address */
try outportb(0x21, 0x20);
Hope this helps,
Adrian.