Page 1 of 1
Problem with ISR handling
Posted: Fri Mar 15, 2019 12:44 pm
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??
Re: Problem with ISR handling
Posted: Fri Mar 15, 2019 1:07 pm
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:
Has too many zeros....One too many.
Ben
-
http://www.fysnet.net/osdesign_book_series.htm
Re: Problem with ISR handling
Posted: Fri Mar 15, 2019 1:19 pm
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:
Has too many zeros....One too many.
Ben
-
http://www.fysnet.net/osdesign_book_series.htm
i wrote it especially for test.
Re: Problem with ISR handling
Posted: Sat Mar 16, 2019 12:56 am
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.
Re: Problem with ISR handling
Posted: Sat Mar 16, 2019 1:23 am
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