Rev 3222 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3222 | Rev 3240 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | #include <synch/mutex.h> |
51 | #include <synch/mutex.h> |
52 | #include <adt/list.h> |
52 | #include <adt/list.h> |
53 | #include <adt/btree.h> |
53 | #include <adt/btree.h> |
54 | #include <lib/elf.h> |
54 | #include <lib/elf.h> |
55 | 55 | ||
56 | #ifdef __OBJC__ |
- | |
57 | #include <lib/objc.h> |
- | |
58 | #endif |
- | |
59 | - | ||
60 | /** |
56 | /** |
61 | * Defined to be true if user address space and kernel address space shadow each |
57 | * Defined to be true if user address space and kernel address space shadow each |
62 | * other. |
58 | * other. |
63 | */ |
59 | */ |
64 | #define KERNEL_ADDRESS_SPACE_SHADOWED KERNEL_ADDRESS_SPACE_SHADOWED_ARCH |
60 | #define KERNEL_ADDRESS_SPACE_SHADOWED KERNEL_ADDRESS_SPACE_SHADOWED_ARCH |
Line 82... | Line 78... | ||
82 | /** The page fault was resolved by as_page_fault(). */ |
78 | /** The page fault was resolved by as_page_fault(). */ |
83 | #define AS_PF_OK 1 |
79 | #define AS_PF_OK 1 |
84 | /** 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(). */ |
85 | #define AS_PF_DEFER 2 |
81 | #define AS_PF_DEFER 2 |
86 | 82 | ||
87 | #ifdef __OBJC__ |
- | |
88 | @interface as_t : base_t { |
- | |
89 | @public |
- | |
90 | /** Protected by asidlock. */ |
- | |
91 | link_t inactive_as_with_asid_link; |
- | |
92 | /** |
- | |
93 | * Number of processors on wich is this address space active. |
- | |
94 | * Protected by asidlock. |
- | |
95 | */ |
- | |
96 | count_t cpu_refcount; |
- | |
97 | /** |
- | |
98 | * Address space identifier. |
- | |
99 | * Constant on architectures that do not support ASIDs. |
- | |
100 | * Protected by asidlock. |
- | |
101 | */ |
- | |
102 | asid_t asid; |
- | |
103 | - | ||
104 | /** Number of references (i.e tasks that reference this as). */ |
- | |
105 | atomic_t refcount; |
- | |
106 | - | ||
107 | mutex_t lock; |
- | |
108 | - | ||
109 | /** B+tree of address space areas. */ |
- | |
110 | btree_t as_area_btree; |
- | |
111 | - | ||
112 | /** Non-generic content. */ |
- | |
113 | as_genarch_t genarch; |
- | |
114 | - | ||
115 | /** Architecture specific content. */ |
- | |
116 | as_arch_t arch; |
- | |
117 | } |
- | |
118 | - | ||
119 | + (pte_t *) page_table_create: (int) flags; |
- | |
120 | + (void) page_table_destroy: (pte_t *) page_table; |
- | |
121 | - (void) page_table_lock: (bool) _lock; |
- | |
122 | - (void) page_table_unlock: (bool) unlock; |
- | |
123 | - | ||
124 | @end |
- | |
125 | - | ||
126 | #else |
- | |
127 | - | ||
128 | /** Address space structure. |
83 | /** Address space structure. |
129 | * |
84 | * |
130 | * as_t contains the list of as_areas of userspace accessible |
85 | * as_t contains the list of as_areas of userspace accessible |
131 | * pages for one or more tasks. Ranges of kernel memory pages are not |
86 | * pages for one or more tasks. Ranges of kernel memory pages are not |
132 | * supposed to figure in the list as they are shared by all tasks and |
87 | * supposed to figure in the list as they are shared by all tasks and |
Line 166... | Line 121... | ||
166 | pte_t *(* page_table_create)(int flags); |
121 | pte_t *(* page_table_create)(int flags); |
167 | void (* page_table_destroy)(pte_t *page_table); |
122 | void (* page_table_destroy)(pte_t *page_table); |
168 | void (* page_table_lock)(as_t *as, bool lock); |
123 | void (* page_table_lock)(as_t *as, bool lock); |
169 | void (* page_table_unlock)(as_t *as, bool unlock); |
124 | void (* page_table_unlock)(as_t *as, bool unlock); |
170 | } as_operations_t; |
125 | } as_operations_t; |
171 | #endif |
- | |
172 | 126 | ||
173 | /** |
127 | /** |
174 | * This structure contains information associated with the shared address space |
128 | * This structure contains information associated with the shared address space |
175 | * area. |
129 | * area. |
176 | */ |
130 | */ |
Line 247... | Line 201... | ||
247 | void (* share)(as_area_t *area); |
201 | void (* share)(as_area_t *area); |
248 | } mem_backend_t; |
202 | } mem_backend_t; |
249 | 203 | ||
250 | extern as_t *AS_KERNEL; |
204 | extern as_t *AS_KERNEL; |
251 | 205 | ||
252 | #ifndef __OBJC__ |
- | |
253 | extern as_operations_t *as_operations; |
206 | extern as_operations_t *as_operations; |
254 | #endif |
- | |
255 | - | ||
256 | extern link_t inactive_as_with_asid_head; |
207 | extern link_t inactive_as_with_asid_head; |
257 | 208 | ||
258 | extern void as_init(void); |
209 | extern void as_init(void); |
259 | 210 | ||
260 | extern as_t *as_create(int flags); |
211 | extern as_t *as_create(int flags); |