My PIT ISR code looks like this (I don't use inline functions because I use TCC, which just ignores the inline attribute):
Code: Select all
// pushf is defined as asm volatile("pushf"), etc.
#define enter_int() {\
/*pushf();*/\
pusha();\
asm volatile("sub $4, %ebp");\
}
#define ireturn {
asm volatile("add $4, %ebp");\
popa();\
/*popf();*/\
leave();\
iret();\ // BLACK MAGIC!
}
#define ack_irq_master() outb(0x20, 0x20);
#define ack_irq_slave() outb(0xA0, 0x20);ack_irq_master();
void pit_isr () {
enter_int();
for (unsigned char i = 0; i < 10; i++);
ack_irq_master();
ireturn;
}
Code: Select all
unsigned char a = 0;
while (a == 0);
shutdown();
BTW this is my first post, so I'm not too experienced with this forum.
Sorry if this was worded weird, I don't ask questions online often.