Virtual Memory (Paging Specfically)
Posted: Sun Apr 03, 2011 7:46 pm
In my operating systems class, we're on project 4, and we're adding Virtual Memory to GeekOS.
The specs are right here (http://www.cs.umd.edu/class/spring2011/ ... /project4/)
For part1 of this project, we don't need to have the backstore to the hard disk setup (That is part2 of the project).
In part1, we're simply setting up the page directory, and page tables to all the physical memory. We're also letting user programs access
kernel memory temporarily, that way we know it's working correctly (all we need to do is run a program, and not crash ).
Now when I go to call Enable_Paging with the pointer to the g_kernelDirectory. QEMU keeps resetting! (anyone know why this is?)
All Enable_Paging is doing is setting the cr3 register to the base of the page directory, and setting the bit in the cr0 register that paging is enabled.
Also, Since the memory is still static (given I can't swap between main memory and the hard disk), I can only create 32 page tables. This is because for each page table, I'm creating 1024 entries (note a page is 4K), and each entry has a 4K physical frame. This means each page table is allocating 2^12(2^10) = 2^22 = 4M of physical memory. When ever I try to make more then 32 page tables, GeekOS freezes up, and the Alloc_Page (method given to us that allocs 4K, and sets relevant flags, pageable etc.) is returning null. So anyway, the page directory only contains 32 page tables at the moment.
Questions
1. Why is QEMU resetting?
1a. Could this be happening, because of invalidly setting data in the entries? I have read over the table in 4-5/4-6 in the intel IA32 manual that explains everything.
Here are prototypes of the structs (pde_t is page directory entry type/pte_t is page table entry type)
1b. Could it be messing up because I haven't set the page fault interrupt yet? (Everything should be in memory though I think)
2. What do you master, professionals think?
Any help is greatly appreciated! I've been stuck for a couple days now, and neither the professors or TA's are helping on the class forums.
(https://forum.cs.umd.edu/forumdisplay.php?f=229)
The specs are right here (http://www.cs.umd.edu/class/spring2011/ ... /project4/)
For part1 of this project, we don't need to have the backstore to the hard disk setup (That is part2 of the project).
In part1, we're simply setting up the page directory, and page tables to all the physical memory. We're also letting user programs access
kernel memory temporarily, that way we know it's working correctly (all we need to do is run a program, and not crash ).
Now when I go to call Enable_Paging with the pointer to the g_kernelDirectory. QEMU keeps resetting! (anyone know why this is?)
All Enable_Paging is doing is setting the cr3 register to the base of the page directory, and setting the bit in the cr0 register that paging is enabled.
Also, Since the memory is still static (given I can't swap between main memory and the hard disk), I can only create 32 page tables. This is because for each page table, I'm creating 1024 entries (note a page is 4K), and each entry has a 4K physical frame. This means each page table is allocating 2^12(2^10) = 2^22 = 4M of physical memory. When ever I try to make more then 32 page tables, GeekOS freezes up, and the Alloc_Page (method given to us that allocs 4K, and sets relevant flags, pageable etc.) is returning null. So anyway, the page directory only contains 32 page tables at the moment.
Questions
1. Why is QEMU resetting?
1a. Could this be happening, because of invalidly setting data in the entries? I have read over the table in 4-5/4-6 in the intel IA32 manual that explains everything.
Here are prototypes of the structs (pde_t is page directory entry type/pte_t is page table entry type)
Code: Select all
typedef struct {
uint_t present:1;
uint_t flags:4;
uint_t accesed:1;
uint_t reserved:1;
uint_t largePages:1;
uint_t globalPage:1;
uint_t kernelInfo:3;
uint_t pageTableBaseAddr:20;
} pde_t;
typedef struct {
uint_t present:1;
uint_t flags:4;
uint_t accesed:1;
uint_t dirty:1;
uint_t pteAttribute:1;
uint_t globalPage:1;
uint_t kernelInfo:3;
uint_t pageBaseAddr:20;
} pte_t;
2. What do you master, professionals think?
Any help is greatly appreciated! I've been stuck for a couple days now, and neither the professors or TA's are helping on the class forums.
(https://forum.cs.umd.edu/forumdisplay.php?f=229)