#include <mm/vmm.h>
#include <ubixos/sched.h>
#include <ubixos/kpanic.h>

void LoadPageIntoMemory(mMap *page);

void mm_pageFault(uInt32 memAddr, uInt32 eip, uInt32 esp)
{
	/* WARNING: this is not SMP safe to use _current! */
	kTask_t *tmp = _current;
	mMap *m = tmp->FirstPage;

	kprintf("Page fault! woop\n");

	for( ; m != NULL ; m = m->Next)
	{
		if(m->pageAddr == memAddr)
		{
			LoadPageIntoMemory(m);
			return;
		}
	}
	kpanic("pagefault: Requested a page which does not exist\n");
	
}

void LoadPageIntoMemory(mMap *page)
{
	/* Load page->physicalAddr */
	return;
}
