Problem with ISR handling

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Shvets04
Member
Member
Posts: 28
Joined: Wed Feb 13, 2019 3:07 pm

Problem with ISR handling

Post by Shvets04 »

When i get a page fault i get continuous printing error(https://ibb.co/1bPsH5Z), but i need a one print about a page fault.

(isr.c - https://github.com/s04v/locOS/blob/master/cpu/isr.c)
(interrupt.asm - https://github.com/s04v/locOS/blob/mast ... errupt.asm)


The code that cause a page fault, I wrote it just for test.

Code: Select all

initialise_paging();
print_s("Hello, paging world!\n");

u32 *ptr = (u32*)0xA00000;
u32 do_page_fault = *ptr;
/* next code is not executed*/
How to fix it??
User avatar
BenLunt
Member
Member
Posts: 941
Joined: Sat Nov 22, 2014 6:33 pm
Location: USA
Contact:

Re: Problem with ISR handling

Post by BenLunt »

Shvets04 wrote:

Code: Select all

initialise_paging();
print_s("Hello, paging world!\n");

u32 *ptr = (u32*)0xA00000;
u32 do_page_fault = *ptr;
/* next code is not executed*/
Without looking at your code, I bet that it is a simple mistake of:

Code: Select all

u32 *ptr = (u32*)0xA00000;
Has too many zeros....One too many.

Ben
- http://www.fysnet.net/osdesign_book_series.htm
Shvets04
Member
Member
Posts: 28
Joined: Wed Feb 13, 2019 3:07 pm

Re: Problem with ISR handling

Post by Shvets04 »

BenLunt wrote:
Shvets04 wrote:

Code: Select all

initialise_paging();
print_s("Hello, paging world!\n");

u32 *ptr = (u32*)0xA00000;
u32 do_page_fault = *ptr;
/* next code is not executed*/
Without looking at your code, I bet that it is a simple mistake of:

Code: Select all

u32 *ptr = (u32*)0xA00000;
Has too many zeros....One too many.

Ben
- http://www.fysnet.net/osdesign_book_series.htm
i wrote it especially for test.
MichaelPetch
Member
Member
Posts: 798
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Problem with ISR handling

Post by MichaelPetch »

Because you aren't rectifying the page fault when your interrupt handler is executed it will return back to the same instruction,fault again, and repeat the cycle continuously. If you get a page fault you could temporarily issue a `hlt` instruction. This will of course effectively stop your kernel since it is being done in an interrupt handler with interrupts off.
MichaelPetch
Member
Member
Posts: 798
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Problem with ISR handling

Post by MichaelPetch »

The tutorial on which some of your IRQ code is based on is flawed with regards to passing registers_t by value and not by reference. I've recently wrote a post on reddit about it (and a fix): https://www.reddit.com/r/osdev/comments ... _interrupt .This bug is also mentioned on OSDev wiki here: https://wiki.osdev.org/James_Molloy%27s ... pted_state
Post Reply