Rev 2007 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2007 | Rev 2015 | ||
|---|---|---|---|
| Line 68... | Line 68... | ||
| 68 | 68 | ||
| 69 | 69 | ||
| 70 | /** |
70 | /** |
| 71 | * Macro for computing page color. |
71 | * Macro for computing page color. |
| 72 | */ |
72 | */ |
| 73 | #define PAGE_COLOR(va) (((va) >> PAGE_WIDTH) & ((1 << PAGE_COLOR_BITS) - 1)) |
73 | #define PAGE_COLOR(va) (((va) >> PAGE_WIDTH) & ((1 << PAGE_COLOR_BITS) - 1)) |
| 74 | 74 | ||
| 75 | /** Page fault access type. */ |
75 | /** Page fault access type. */ |
| 76 | enum pf_access { |
76 | enum pf_access { |
| 77 | PF_ACCESS_READ, |
77 | PF_ACCESS_READ, |
| 78 | PF_ACCESS_WRITE, |
78 | PF_ACCESS_WRITE, |
| Line 80... | Line 80... | ||
| 80 | }; |
80 | }; |
| 81 | typedef enum pf_access pf_access_t; |
81 | typedef enum pf_access pf_access_t; |
| 82 | 82 | ||
| 83 | /** Operations to manipulate page mappings. */ |
83 | /** Operations to manipulate page mappings. */ |
| 84 | struct page_mapping_operations { |
84 | struct page_mapping_operations { |
| 85 | void (* mapping_insert)(as_t *as, uintptr_t page, uintptr_t frame, int flags); |
85 | void (* mapping_insert)(as_t *as, uintptr_t page, uintptr_t frame, int |
| - | 86 | flags); |
|
| 86 | void (* mapping_remove)(as_t *as, uintptr_t page); |
87 | void (* mapping_remove)(as_t *as, uintptr_t page); |
| 87 | pte_t *(* mapping_find)(as_t *as, uintptr_t page); |
88 | pte_t *(* mapping_find)(as_t *as, uintptr_t page); |
| 88 | }; |
89 | }; |
| 89 | typedef struct page_mapping_operations page_mapping_operations_t; |
90 | typedef struct page_mapping_operations page_mapping_operations_t; |
| 90 | 91 | ||
| 91 | extern page_mapping_operations_t *page_mapping_operations; |
92 | extern page_mapping_operations_t *page_mapping_operations; |
| 92 | 93 | ||
| 93 | extern void page_init(void); |
94 | extern void page_init(void); |
| 94 | extern void page_table_lock(as_t *as, bool lock); |
95 | extern void page_table_lock(as_t *as, bool lock); |
| 95 | extern void page_table_unlock(as_t *as, bool unlock); |
96 | extern void page_table_unlock(as_t *as, bool unlock); |
| 96 | extern void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int flags); |
97 | extern void page_mapping_insert(as_t *as, uintptr_t page, uintptr_t frame, int |
| - | 98 | flags); |
|
| 97 | extern void page_mapping_remove(as_t *as, uintptr_t page); |
99 | extern void page_mapping_remove(as_t *as, uintptr_t page); |
| 98 | extern pte_t *page_mapping_find(as_t *as, uintptr_t page); |
100 | extern pte_t *page_mapping_find(as_t *as, uintptr_t page); |
| 99 | extern pte_t *page_table_create(int flags); |
101 | extern pte_t *page_table_create(int flags); |
| 100 | extern void page_table_destroy(pte_t *page_table); |
102 | extern void page_table_destroy(pte_t *page_table); |
| 101 | extern void map_structure(uintptr_t s, size_t size); |
103 | extern void map_structure(uintptr_t s, size_t size); |