Ledger Nano X - The secure hardware wallet
SHARE
TWEET

vm.h

a guest Apr 4th, 2020 244 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef _VM_H_
  2. #define _VM_H_
  3.  
  4. #include <machine/vm.h>
  5. #include "opt-dumbvm.h"
  6. #include <thread.h>
  7.  
  8. /*
  9.  * VM system-related definitions.
  10.  *
  11.  * You'll probably want to add stuff here.
  12.  */
  13.  
  14. struct Coremap_struct {
  15.     int id:7;  
  16.     struct addrspace* addspace;
  17.     int state;  // freed = 0, fixed = 1, dirty = 2
  18.     paddr_t phy_addspace;
  19.     vaddr_t vir_addspace;
  20.     int free:1; // adding this cause it takes up less space than 32 bit int
  21.     int fixed:1;
  22.     int dirty:1;
  23.     int last:1; // set this if its the last entry in a block
  24.     int length;
  25. };
  26.  
  27. /*
  28. struct page {
  29.     paddr_t paddr; // physical address of this page
  30.     off_t swap_addr; //swap address (in case its swapped to disk)
  31.     // add a spinlock, so no one can modify this page if it's being used
  32.     struct lock *page_lock;
  33. };
  34. //Page size is 4k, so use lower pits of paddr for flags
  35.  
  36. struct core_entry {
  37.     // u_int32_t status; // bit mask this to figure out if dirty, free, fixed clean
  38.     // struct core_entry *next; // should I make core_entry a linked list?
  39.  
  40.     //Some stuff from vid
  41.     struct page *page;
  42.     unsigned cpu_index:4;
  43.     int tlb_index:7; //Have 64 entries in the TLB, index inside the TLB, if not in TLB, -1
  44.     int kernel:1;
  45.     int last_page:1;
  46.     int allocated:1;
  47.     int pinned:1;
  48. };
  49. */
  50.  
  51. /* Fault-type arguments to vm_fault() */
  52. #define VM_FAULT_READ        0    /* A read was attempted */
  53. #define VM_FAULT_WRITE       1    /* A write was attempted */
  54. #define VM_FAULT_READONLY    2    /* A write to a readonly page was attempted*/
  55.  
  56.  
  57. /* Initialization function */
  58. void vm_bootstrap(void);
  59.  
  60. /* Fault handling function called by trap code */
  61. int vm_fault(int faulttype, vaddr_t faultaddress);
  62.  
  63. /* Allocate/free kernel heap pages (called by kmalloc/kfree) */
  64. vaddr_t alloc_kpages(int npages);
  65. void free_kpages(vaddr_t addr);
  66.  
  67. vaddr_t alloc_oneormorepgs(int numofpgs);
  68.  
  69. #endif /* _VM_H_ */
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top