Rev 2107 | Rev 2126 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2107 | Rev 2125 | ||
---|---|---|---|
Line 78... | Line 78... | ||
78 | /** The page fault was resolved by as_page_fault(). */ |
78 | /** The page fault was resolved by as_page_fault(). */ |
79 | #define AS_PF_OK 1 |
79 | #define AS_PF_OK 1 |
80 | /** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */ |
80 | /** The page fault was caused by memcpy_from_uspace() or memcpy_to_uspace(). */ |
81 | #define AS_PF_DEFER 2 |
81 | #define AS_PF_DEFER 2 |
82 | 82 | ||
- | 83 | #ifdef __OBJC__ |
|
- | 84 | @interface as_t { |
|
- | 85 | @public |
|
- | 86 | /** Protected by asidlock. */ |
|
- | 87 | link_t inactive_as_with_asid_link; |
|
- | 88 | ||
- | 89 | mutex_t lock; |
|
- | 90 | ||
- | 91 | /** Number of references (i.e tasks that reference this as). */ |
|
- | 92 | count_t refcount; |
|
- | 93 | ||
- | 94 | /** Number of processors on wich is this address space active. */ |
|
- | 95 | count_t cpu_refcount; |
|
- | 96 | ||
- | 97 | /** B+tree of address space areas. */ |
|
- | 98 | btree_t as_area_btree; |
|
- | 99 | ||
- | 100 | /** |
|
- | 101 | * Address space identifier. |
|
- | 102 | * Constant on architectures that do not support ASIDs. |
|
- | 103 | */ |
|
- | 104 | asid_t asid; |
|
- | 105 | ||
- | 106 | /** Non-generic content. */ |
|
- | 107 | as_genarch_t genarch; |
|
- | 108 | ||
- | 109 | /** Architecture specific content. */ |
|
- | 110 | as_arch_t arch; |
|
- | 111 | } |
|
- | 112 | + (pte_t *) page_table_create: (int) flags; |
|
- | 113 | + (void) page_table_destroy: (pte_t *) page_table; |
|
- | 114 | - (void) page_table_lock: (bool) _lock; |
|
- | 115 | - (void) page_table_unlock: (bool) unlock; |
|
- | 116 | @end |
|
- | 117 | ||
- | 118 | #else |
|
- | 119 | ||
83 | /** Address space structure. |
120 | /** Address space structure. |
84 | * |
121 | * |
85 | * as_t contains the list of as_areas of userspace accessible |
122 | * as_t contains the list of as_areas of userspace accessible |
86 | * pages for one or more tasks. Ranges of kernel memory pages are not |
123 | * pages for one or more tasks. Ranges of kernel memory pages are not |
87 | * supposed to figure in the list as they are shared by all tasks and |
124 | * supposed to figure in the list as they are shared by all tasks and |
Line 119... | Line 156... | ||
119 | pte_t *(* page_table_create)(int flags); |
156 | pte_t *(* page_table_create)(int flags); |
120 | void (* page_table_destroy)(pte_t *page_table); |
157 | void (* page_table_destroy)(pte_t *page_table); |
121 | void (* page_table_lock)(as_t *as, bool lock); |
158 | void (* page_table_lock)(as_t *as, bool lock); |
122 | void (* page_table_unlock)(as_t *as, bool unlock); |
159 | void (* page_table_unlock)(as_t *as, bool unlock); |
123 | } as_operations_t; |
160 | } as_operations_t; |
- | 161 | #endif |
|
124 | 162 | ||
125 | /** |
163 | /** |
126 | * This structure contains information associated with the shared address space |
164 | * This structure contains information associated with the shared address space |
127 | * area. |
165 | * area. |
128 | */ |
166 | */ |
Line 199... | Line 237... | ||
199 | void (* frame_free)(as_area_t *area, uintptr_t page, uintptr_t frame); |
237 | void (* frame_free)(as_area_t *area, uintptr_t page, uintptr_t frame); |
200 | void (* share)(as_area_t *area); |
238 | void (* share)(as_area_t *area); |
201 | } mem_backend_t; |
239 | } mem_backend_t; |
202 | 240 | ||
203 | extern as_t *AS_KERNEL; |
241 | extern as_t *AS_KERNEL; |
- | 242 | ||
- | 243 | #ifndef __OBJC__ |
|
204 | extern as_operations_t *as_operations; |
244 | extern as_operations_t *as_operations; |
- | 245 | #endif |
|
205 | 246 | ||
206 | SPINLOCK_EXTERN(inactive_as_with_asid_lock); |
247 | SPINLOCK_EXTERN(inactive_as_with_asid_lock); |
207 | extern link_t inactive_as_with_asid_head; |
248 | extern link_t inactive_as_with_asid_head; |
208 | 249 | ||
209 | extern void as_init(void); |
250 | extern void as_init(void); |