Commit 936d7d6f92e2b6f646ce9bb17dea4350653894b0

Small changes to memory management
  
204204 // Set the current directory to dir
205205 current_directory = dir;
206206
207 // Set CR3 to the physical address of the page tables
207208 asm volatile("mov %0, %%cr3":: "r"(dir->physicalAddress));
208209
209210 // Get the contents of the CR0 register
254254
255255 page_directory_t * clone_directory(page_directory_t * src)
256256 {
257 u32int phys;
257 uintptr phys;
258258
259259 // Make a new directory, and get it's address
260260 page_directory_t * dir = (page_directory_t *)kmalloc(sizeof(page_directory_t), &phys, true);
285285 else
286286 {
287287 // Copy the table
288 u32int addr;
288 uintptr addr;
289289 dir->tables[i] = clone_table(src->tables[i], &addr);
290290 dir->tablesPhysical[i] = addr | 0x07;
291291 }
  
3030 typedef struct page_directory
3131 {
3232 page_table_t * tables[1024]; // An array of pointers to our page tables
33 u32int tablesPhysical[1024]; // Physical addresses of the above tables
34 u32int physicalAddress; // The location of the above location
33 uintptr tablesPhysical[1024]; // Physical addresses of the above tables
34 uintptr physicalAddress; // The location of the above location
3535
3636 } page_directory_t;
3737
  
271271
272272 if(phys != NULL)
273273 {
274 paging::page_t * page = paging::get_page((uintptr) address, 0, kernel_directory);
275 *phys = page->frame * PAGE_SIZE + ((uintptr) address & 0xFFFFF000);
274 paging::page_t * page = paging::get_page((uintptr)address, false, kernel_directory);
275 *phys = (page->frame * PAGE_SIZE) + ((uintptr)address & 0xFFF);
276276 }
277277
278278 return (u32int)address;
402402
403403 // Check if we want to page align the data, and page align it if it is not coincidentally
404404 // already aligned. Also, make a hole in front of the block to not waste space
405 if(page_align && (original_hole_pos & 0xFFFFF000))
405 if(page_align && (original_hole_pos & 0xFFFFF000) == 1)
406406 {
407407 uintptr new_location = original_hole_pos + PAGE_SIZE - (original_hole_pos & 0xFFF) - sizeof(header);
408408