OSDev.org https://forum.osdev.org/ |
|
RTC interruption https://forum.osdev.org/viewtopic.php?f=1&t=32481 |
Page 1 of 1 |
Author: | pedrodemargomes [ Mon Oct 09, 2017 8:19 pm ] |
Post subject: | RTC interruption |
I am trying to set rtc interruptions, but it is not working(triple fault). I have already setted PIC1 and PIC2 and their interruption masks. This is the code that sets the rtc interruptions: Code: /* Ports * PIC1 PIC2 *Command 0x20 0xA0 *Data 0x21 0xA1 */ asm volatile ( "cli" ); uint8_t rate = 0x05; outb(0x70, 0x8B); char prev = inb(0x71); outb(0x70, 0x8B); outb(0x71, prev | 0x40); outb(0x70, 0x8A); prev = inb(0x71); outb(0x70, 0x8A); outb(0x71, (prev & 0xF0) | rate ); outb(0x70, 0x0C); inb(0x71); // PIC 2 /* 0xFE is 11111110 - enables IRQ0 (rtc)*/ uint8_t prevIrq = inb(0xA1); outb(0xA1 , 0xFE & prevIrq ); // PIC 1 /* 0xFB is 11111011 - enables IRQ2 (rtc)*/ prevIrq = inb(0x21); outb(0x21 , 0xFB & prevIrq ); asm volatile ( "sti" ); This is the rtc interruption handler: Code: /* Ports
* PIC1 PIC2 *Command 0x20 0xA0 *Data 0x21 0xA1 */ outb(0xA1, 0x20); outb(0x20, 0x20); /* do something */ |
Author: | iansjack [ Mon Oct 09, 2017 11:41 pm ] |
Post subject: | Re: RTC interruption |
No "RTI" instruction? |
Author: | Octocontrabass [ Tue Oct 10, 2017 9:59 am ] |
Post subject: | Re: RTC interruption |
pedrodemargomes wrote: I am trying to set rtc interruptions, but it is not working(triple fault). Have you figured out where in your code the triple fault occurs? pedrodemargomes wrote: Code: outb(0xA1, 0x20); I don't think this line of code does what you want. |
Author: | pedrodemargomes [ Tue Oct 10, 2017 6:21 pm ] |
Post subject: | Re: RTC interruption |
Octocontrabass wrote: pedrodemargomes wrote: I am trying to set rtc interruptions, but it is not working(triple fault). Have you figured out where in your code the triple fault occurs? Yes, it occurs at the first rtc interruption. Octocontrabass wrote: Code: outb(0xA1, 0x20); I don't think this line of code does what you want. It supossed to be 0xA0, i fixed that . But the problem is that the program does not get there, it fails before that. I will let my git repository here: https://gitlab.com/pedrodemargomes/BootTeste_OS |
Author: | Brendan [ Tue Oct 10, 2017 6:38 pm ] |
Post subject: | Re: RTC interruption |
Hi, pedrodemargomes wrote: I am trying to set rtc interruptions, but it is not working(triple fault). In that case it's probably a problem with your GDT, IDT or stack (and not a problem with any of the code you posted). You should be able to get some information about what caused the triple fault from an emulator's logs (e.g. if the first exception was a general protection fault or page fault, etc). pedrodemargomes wrote: I will let my git repository here: https://gitlab.com/pedrodemargomes/BootTeste_OS I couldn't find any source code there. Cheers, Brendan |
Author: | pedrodemargomes [ Wed Oct 11, 2017 5:51 am ] |
Post subject: | Re: RTC interruption |
Brendan wrote: Hi, pedrodemargomes wrote: I am trying to set rtc interruptions, but it is not working(triple fault). In that case it's probably a problem with your GDT, IDT or stack (and not a problem with any of the code you posted). You should be able to get some information about what caused the triple fault from an emulator's logs (e.g. if the first exception was a general protection fault or page fault, etc). pedrodemargomes wrote: I will let my git repository here: https://gitlab.com/pedrodemargomes/BootTeste_OS I couldn't find any source code there. Cheers, Brendan Sorry, i forgot to change the permissions , now it is right. I could not find any usefull information in the log files about the the faults . |
Author: | MichaelPetch [ Wed Oct 11, 2017 12:23 pm ] |
Post subject: | Re: RTC interruption |
Where in your code do you set up the IDT entry for your RTC Interrupt handler? I see you set up an entry for the keyboard at IDT[0x21] to handle IRQ1. To handle IRQ8 (RTC) you would need an IDT entry at IDT[0x28] with the way you set up the PICs and then point it at your rtc_handler function. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |