Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _VM_H_
- #define _VM_H_
- #include <machine/vm.h>
- #include "opt-dumbvm.h"
- #include <thread.h>
- /*
- * VM system-related definitions.
- *
- * You'll probably want to add stuff here.
- */
- struct Coremap_struct {
- int id:7;
- struct addrspace* addspace;
- int state; // freed = 0, fixed = 1, dirty = 2
- paddr_t phy_addspace;
- vaddr_t vir_addspace;
- int free:1; // adding this cause it takes up less space than 32 bit int
- int fixed:1;
- int dirty:1;
- int last:1; // set this if its the last entry in a block
- int length;
- };
- /*
- struct page {
- paddr_t paddr; // physical address of this page
- off_t swap_addr; //swap address (in case its swapped to disk)
- // add a spinlock, so no one can modify this page if it's being used
- struct lock *page_lock;
- };
- //Page size is 4k, so use lower pits of paddr for flags
- struct core_entry {
- // u_int32_t status; // bit mask this to figure out if dirty, free, fixed clean
- // struct core_entry *next; // should I make core_entry a linked list?
- //Some stuff from vid
- struct page *page;
- unsigned cpu_index:4;
- int tlb_index:7; //Have 64 entries in the TLB, index inside the TLB, if not in TLB, -1
- int kernel:1;
- int last_page:1;
- int allocated:1;
- int pinned:1;
- };
- */
- /* Fault-type arguments to vm_fault() */
- #define VM_FAULT_READ 0 /* A read was attempted */
- #define VM_FAULT_WRITE 1 /* A write was attempted */
- #define VM_FAULT_READONLY 2 /* A write to a readonly page was attempted*/
- /* Initialization function */
- void vm_bootstrap(void);
- /* Fault handling function called by trap code */
- int vm_fault(int faulttype, vaddr_t faultaddress);
- /* Allocate/free kernel heap pages (called by kmalloc/kfree) */
- vaddr_t alloc_kpages(int npages);
- void free_kpages(vaddr_t addr);
- vaddr_t alloc_oneormorepgs(int numofpgs);
- #endif /* _VM_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement