Page 1 of 1
page fault handler
Posted: Fri Jan 23, 2004 3:51 am
by mr. x
What shall I do to prevent my page fault handler to not start recursing? (When setting the present bit)
Re:page fault handler
Posted: Fri Jan 23, 2004 4:13 am
by mr. x
I'm getting page faults when I try to read from memory, even when I haven't enabled paging.
The address I'm trying to read is 0x9C0000.
When I try to read 0x200000 it crashes without a page fault.
Re:page fault handler
Posted: Fri Jan 23, 2004 5:36 am
by Pype.Clicker
well, one possible thing is to have something like
Code: Select all
pf_handler() {
static int nested_pagefault=0;
if (nested_pagefault) panic("Cannot handle page fault ...");
nested_pagefault++;
do_the_job();
nested_pagefault--;
}
if a 'static' nested_pagefault doesn't suit your needs, you may try a thread_local one (but that supposes your OS has thread_local storage already)
if the PG bit of CR0 is cleared, then you shouldn't be receiving page faults (exception 0E). Are you sure your interrupt system is reliable ?
Re:page fault handler
Posted: Fri Jan 23, 2004 6:11 am
by mr. x
Well, floppy and keyboard are using interrupts and both are working correctly.
Re:page fault handler
Posted: Sat Jan 24, 2004 8:59 am
by mr. x
btw, here's my linking script:
Code: Select all
OUTPUT_FORMAT("binary")
ENTRY(_start)
OUTPUT("kernel.bin")
INPUT(kinit.o)
INPUT(kints.o)
INPUT(ints.o)
INPUT(driver_keyboard.o)
INPUT(driver_floppy.o)
INPUT(kernel.o)
INPUT(app_console.o)
INPUT(io.o)
INPUT(pic.o)
INPUT(idt.o)
INPUT(panic.o)
INPUT(doprintf.o)
INPUT(queue.o)
INPUT(string.o)
INPUT(memory.o)
INPUT(math.o)
INPUT(dma.o)
INPUT(driver_pefs.o)
INPUT(timer.o)
INPUT(mem_manager.o)
SECTIONS
{
.text 0xFF800000 : {
*(.text)
}
.data : {
*(.data)
}
.bss :
{
*(.bss)
}
}
Re:page fault handler
Posted: Mon Jan 26, 2004 7:17 am
by Pager
Is it the 0xFFC'th entry or the 0xFFF'th entry which is used to point to the PageDirectory itself when we map the PageTables into the current address space? and can anyone clearly explain how this mapping the PageTables into the current address space works (in simple english).
Re:page fault handler
Posted: Mon Jan 26, 2004 7:43 am
by Pype.Clicker
<timbot mode engaged>
Tim already did in one of its memory management tutorials on Bona Fide, iirc
<timbot mode disabled>