Hi all!
It's first post in this forum, I'm beginner Os programmers. My English isn't good.
I trying to write my first kernel, and i encountered problem when i try to enable interrupts using sti.
Of course "cli" is first instruction of my kernel.
Then I'm creating GDT & IDT,setting protected mode, reprogram PIC, and "sti".
On Bochs all working fine,emulator hang in never ending loop but on real PC crash and triple fault...
The problem does not occur when:
-without "sti" execute, computer hang in loop
-when i only mask interrupts in PIC, not reprogramming PIC.
Soft generated interrupts ("int $xxx") works good.
Do you have any ideas ?
Maybe I must disable APIC ?
Problem with IRQ, PIC,APIC or I don't know what
Problem with IRQ, PIC,APIC or I don't know what
Sorry about my english.
Host OS: Linux Debian
Kernel type: microkernel
Kernel format: now flat binary, in future ELF.
Host OS: Linux Debian
Kernel type: microkernel
Kernel format: now flat binary, in future ELF.
Re: Problem with IRQ, PIC,APIC or I don't know what
What tutorial did you use for interrupts? I bet your code has a bug, you may wish to post some of your code in a pastebin or link to your online source code repository if you have one.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Problem with IRQ, PIC,APIC or I don't know what
Well, since it triple faults, your error handling is broken so you should fix that in the first place.
Start with addingjust before where you would normally do STI, and make sure that prints an error message on the screen - on both real hardware and emulators.
Start with adding
Code: Select all
mov ax, 0xdead
mov gs, ax
Re: Problem with IRQ, PIC,APIC or I don't know what
Shouldn't we first set APIC to legacy PIC mode?
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Problem with IRQ, PIC,APIC or I don't know what
No, because of backwards compatibility the APIC can be ignored until you actively start tinkering with it.
Re: Problem with IRQ, PIC,APIC or I don't know what
I solved my probelm by filling all IDT table vector to empty interrupt void before "sti".
Now I have another problem with debugging.
Now I have another problem with debugging.
Sorry about my english.
Host OS: Linux Debian
Kernel type: microkernel
Kernel format: now flat binary, in future ELF.
Host OS: Linux Debian
Kernel type: microkernel
Kernel format: now flat binary, in future ELF.