Rev 2125 | Rev 2133 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2125 | Rev 2126 | ||
|---|---|---|---|
| Line 85... | Line 85... | ||
| 85 | /** |
85 | /** |
| 86 | * Each architecture decides what functions will be used to carry out |
86 | * Each architecture decides what functions will be used to carry out |
| 87 | * address space operations such as creating or locking page tables. |
87 | * address space operations such as creating or locking page tables. |
| 88 | */ |
88 | */ |
| 89 | as_operations_t *as_operations = NULL; |
89 | as_operations_t *as_operations = NULL; |
| 90 | #endif |
- | |
| 91 | 90 | ||
| 92 | /** |
91 | /** |
| 93 | * Slab for as_t objects. |
92 | * Slab for as_t objects. |
| 94 | */ |
93 | */ |
| 95 | static slab_cache_t *as_slab; |
94 | static slab_cache_t *as_slab; |
| - | 95 | #endif |
|
| 96 | 96 | ||
| 97 | /** |
97 | /** |
| 98 | * This lock protects inactive_as_with_asid_head list. It must be acquired |
98 | * This lock protects inactive_as_with_asid_head list. It must be acquired |
| 99 | * before as_t mutex. |
99 | * before as_t mutex. |
| 100 | */ |
100 | */ |
| Line 113... | Line 113... | ||
| 113 | static as_area_t *find_area_and_lock(as_t *as, uintptr_t va); |
113 | static as_area_t *find_area_and_lock(as_t *as, uintptr_t va); |
| 114 | static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, |
114 | static bool check_area_conflicts(as_t *as, uintptr_t va, size_t size, |
| 115 | as_area_t *avoid_area); |
115 | as_area_t *avoid_area); |
| 116 | static void sh_info_remove_reference(share_info_t *sh_info); |
116 | static void sh_info_remove_reference(share_info_t *sh_info); |
| 117 | 117 | ||
| - | 118 | #ifndef __OBJC__ |
|
| 118 | static int as_constructor(void *obj, int flags) |
119 | static int as_constructor(void *obj, int flags) |
| 119 | { |
120 | { |
| 120 | as_t *as = (as_t *) obj; |
121 | as_t *as = (as_t *) obj; |
| 121 | int rc; |
122 | int rc; |
| 122 | 123 | ||
| Line 132... | Line 133... | ||
| 132 | { |
133 | { |
| 133 | as_t *as = (as_t *) obj; |
134 | as_t *as = (as_t *) obj; |
| 134 | 135 | ||
| 135 | return as_destructor_arch(as); |
136 | return as_destructor_arch(as); |
| 136 | } |
137 | } |
| - | 138 | #endif |
|
| 137 | 139 | ||
| 138 | /** Initialize address space subsystem. */ |
140 | /** Initialize address space subsystem. */ |
| 139 | void as_init(void) |
141 | void as_init(void) |
| 140 | { |
142 | { |
| 141 | as_arch_init(); |
143 | as_arch_init(); |
| 142 | 144 | ||
| - | 145 | #ifndef __OBJC__ |
|
| 143 | as_slab = slab_cache_create("as_slab", sizeof(as_t), 0, |
146 | as_slab = slab_cache_create("as_slab", sizeof(as_t), 0, |
| 144 | as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED); |
147 | as_constructor, as_destructor, SLAB_CACHE_MAGDEFERRED); |
| - | 148 | #endif |
|
| 145 | 149 | ||
| 146 | AS_KERNEL = as_create(FLAG_AS_KERNEL); |
150 | AS_KERNEL = as_create(FLAG_AS_KERNEL); |
| 147 | if (!AS_KERNEL) |
151 | if (!AS_KERNEL) |
| 148 | panic("can't create kernel address space\n"); |
152 | panic("can't create kernel address space\n"); |
| 149 | 153 | ||
| Line 155... | Line 159... | ||
| 155 | */ |
159 | */ |
| 156 | as_t *as_create(int flags) |
160 | as_t *as_create(int flags) |
| 157 | { |
161 | { |
| 158 | as_t *as; |
162 | as_t *as; |
| 159 | 163 | ||
| - | 164 | #ifdef __OBJC__ |
|
| - | 165 | as = [as_t new]; |
|
| - | 166 | link_initialize(&as->inactive_as_with_asid_link); |
|
| - | 167 | mutex_initialize(&as->lock); |
|
| - | 168 | (void) as_constructor_arch(as, flags); |
|
| - | 169 | #else |
|
| 160 | as = (as_t *) slab_alloc(as_slab, 0); |
170 | as = (as_t *) slab_alloc(as_slab, 0); |
| - | 171 | #endif |
|
| 161 | (void) as_create_arch(as, 0); |
172 | (void) as_create_arch(as, 0); |
| 162 | 173 | ||
| 163 | btree_create(&as->as_area_btree); |
174 | btree_create(&as->as_area_btree); |
| 164 | 175 | ||
| 165 | if (flags & FLAG_AS_KERNEL) |
176 | if (flags & FLAG_AS_KERNEL) |
| Line 226... | Line 237... | ||
| 226 | #else |
237 | #else |
| 227 | page_table_destroy(NULL); |
238 | page_table_destroy(NULL); |
| 228 | #endif |
239 | #endif |
| 229 | 240 | ||
| 230 | interrupts_restore(ipl); |
241 | interrupts_restore(ipl); |
| 231 | 242 | ||
| - | 243 | #ifdef __OBJC__ |
|
| - | 244 | [as free]; |
|
| - | 245 | #else |
|
| 232 | slab_free(as_slab, as); |
246 | slab_free(as_slab, as); |
| - | 247 | #endif |
|
| 233 | } |
248 | } |
| 234 | 249 | ||
| 235 | /** Create address space area of common attributes. |
250 | /** Create address space area of common attributes. |
| 236 | * |
251 | * |
| 237 | * The created address space area is added to the target address space. |
252 | * The created address space area is added to the target address space. |