After a lot of work and rewriting, Ive hit another problem.
This time its not a bug, its part of the MM_VM components design.
Problem is simply this :
The Zenobit kernel is *completely* virtualized, every address it uses to access any of its structures etc, are not physical addresses - they are all virtual. This is done so that the Kernel 'space' can exist at 0xC0000000 in any userspace address space, the reason why I dont use any physical addresses is so that I dont have to change the address space just to call a system call or something like that, because the kernel is fully operational in any context and doesnt rely upon any addresses except inside of its own 'virtual zone'.
Problem explanation, proper:
When I virtual allocate a page, I allocate a physical page and a Virtual page, then alias them together. If no PDE for the virtual alias exists, I create a PDE for it and plug it into the PDIR At the right location and fill in the neccessary page.
In the Physical world, this all works fine and nicely. In the fully virtualized world, the problem is that while I can access the Page directory itself (Since its in the Kernels aliased zone), I cant access the Directories PDEs to add new aliases. I cant add a new PDE, since that requires me to initialize the PDE, which I Cant do because its a physical address and I cant virtualize it immediately, since to place a virtual address is what probably caused the need to create a new PDE

Also, the way the MM system works in Zenobit is slightly weird.
Basically : You select a "space" from which to allocate or free a page from.
Space structures track a few things, these things make sure the addresses you get back from the allocation functions are correct for the zone you are allocating for, also track whats in use/free. Explaining the exact operation of the allocation/free system would take sometime, so ill do sometime else.
VM allocations are simply wrappers with support for certain paging things, that automate the needed switches.
My idea:
initial idea : Just page them in when you need them and page htem back out...
more refined idea (after two cups of coffee and some cigarettes, actually... ill be right back, I need more... ... okay, back). :
Basically, we have a centralized pass-through point for Directory operations. I Will call this the Sentinel, since that what I thought of when I coined this.
Anywho, the idea is we have a structure, that has a pointer and 1024 uint32s. pointer is originally primed to whatever page directory we have, it must be a virtualized address to that page directory.
When we say, want to examine a PDE of that directory. We say, EXAMINE(ENTRY_INDEX).
What this does, is first it looks in the structure, to see if the physical addr of that entry is cached. If it is, it uses that to alias the directories virtual page to the entry we want. then it returns the address of the virtual page used as a pass through.
Then we can look through the PDE. If no address is in the Sentinel's list, it will set it first through the Directory.
Second thought, might not need the entry list since we can always just reset back to the originating directory to find the address ourselves.
This idea so far sounds decent to me because :
a) It lets me keep most of the same operation and code as the system I have just spent a week writing.
b) In concept atleast, it doesnt seem too bad.
c) Instead of having to waste a bunch of virtual pages to point to PDEs and stuff, I just have one page that is used for Directory modification and PDE operations (aliasing, sense addr, etc). I care about this especially, since hte Kernels 'virtualized zone' is FINITE. It can use whatever physical address is handed to it for a virtual page, but it only has so many virtual pages. (262,144 pages, infact).
d) We can have a 'prime_directory' function that sets the Sentinel's directory address to the right physical location, so that when we want to examine something, the directory link can be aliased correctly.
Thats my idea to solve this problem.
Suggestions/Criticisms/Ideas of your own/Advice/Thoughts are all welcome.
~Zeii.