Changeset 7242a78e in mainline
- Timestamp:
- 2006-05-11T16:05:02Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d4f2ae
- Parents:
- cfffb000
- Location:
- generic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/errno.h
rcfffb000 r7242a78e 32 32 /* 1-255 are kernel error codes, 256-512 are user error codes */ 33 33 34 #define ENOENT -1 /* No such entry */ 35 #define ENOMEM -2 /* Not enough memory */ 36 #define ELIMIT -3 /* Limit exceeded */ 37 #define EREFUSED -4 /* Connection refused */ 38 #define EFORWARD -5 /* Forward error */ 39 #define EPERM -6 /* Permission denied */ 40 #define EHANGUP -7 /* Answerbox closed connection, call sys_ipc_hangup 41 * to close the connection. Used by answerbox 42 * to close the connection. */ 43 #define EEXISTS -8 /* Entry already exists */ 44 #define EBADMEM -9 /* Bad memory pointer */ 34 #define ENOENT -1 /* No such entry */ 35 #define ENOMEM -2 /* Not enough memory */ 36 #define ELIMIT -3 /* Limit exceeded */ 37 #define EREFUSED -4 /* Connection refused */ 38 #define EFORWARD -5 /* Forward error */ 39 #define EPERM -6 /* Permission denied */ 40 #define EHANGUP -7 /* Answerbox closed connection, call sys_ipc_hangup 41 * to close the connection. Used by answerbox 42 * to close the connection. */ 43 #define EEXISTS -8 /* Entry already exists */ 44 #define EBADMEM -9 /* Bad memory pointer */ 45 #define ENOTSUP -10 /* Not supported */ 46 #define EADDRNOTAVAIL -11 /* Address not available. */ 45 47 46 48 #endif -
generic/include/mm/as.h
rcfffb000 r7242a78e 123 123 extern as_t *as_create(int flags); 124 124 extern as_area_t *as_area_create(as_t *as, int flags, size_t size, __address base, int attrs); 125 extern __address as_area_resize(as_t *as, __address address, size_t size, int flags); 125 extern int as_area_resize(as_t *as, __address address, size_t size, int flags); 126 extern int as_area_destroy(as_t *as, __address address); 126 127 int as_area_send(task_id_t dst_id, __address base); 127 128 extern void as_set_mapping(as_t *as, __address page, __address frame); … … 138 139 extern __native sys_as_area_create(__address address, size_t size, int flags); 139 140 extern __native sys_as_area_resize(__address address, size_t size, int flags); 141 extern __native sys_as_area_destroy(__address address); 140 142 extern __native sys_as_area_accept(as_area_acptsnd_arg_t *uspace_accept_arg); 141 143 extern __native sys_as_area_send(as_area_acptsnd_arg_t *uspace_send_arg); -
generic/include/syscall/syscall.h
rcfffb000 r7242a78e 40 40 SYS_AS_AREA_CREATE, 41 41 SYS_AS_AREA_RESIZE, 42 SYS_AS_AREA_DESTROY, 42 43 SYS_AS_AREA_ACCEPT, 43 44 SYS_AS_AREA_SEND, -
generic/src/mm/as.c
rcfffb000 r7242a78e 195 195 * @param flags Flags influencing the remap operation. Currently unused. 196 196 * 197 * @return address on success, (__address) -1otherwise.197 * @return Zero on success or a value from @ref errno.h otherwise. 198 198 */ 199 __addressas_area_resize(as_t *as, __address address, size_t size, int flags)200 { 201 as_area_t *area = NULL;199 int as_area_resize(as_t *as, __address address, size_t size, int flags) 200 { 201 as_area_t *area; 202 202 ipl_t ipl; 203 203 size_t pages; … … 213 213 spinlock_unlock(&as->lock); 214 214 interrupts_restore(ipl); 215 return (__address) -1;215 return ENOENT; 216 216 } 217 217 … … 224 224 spinlock_unlock(&as->lock); 225 225 interrupts_restore(ipl); 226 return (__address) -1;226 return ENOTSUP; 227 227 } 228 228 … … 235 235 spinlock_unlock(&as->lock); 236 236 interrupts_restore(ipl); 237 return (__address) -1;237 return EPERM; 238 238 } 239 239 … … 282 282 spinlock_unlock(&as->lock); 283 283 interrupts_restore(ipl); 284 return (__address) -1;284 return EADDRNOTAVAIL; 285 285 } 286 286 } … … 292 292 interrupts_restore(ipl); 293 293 294 return address; 294 return 0; 295 } 296 297 /** Destroy address space area. 298 * 299 * @param as Address space. 300 * @param address Address withing the area to be deleted. 301 * 302 * @return Zero on success or a value from @ref errno.h on failure. 303 */ 304 int as_area_destroy(as_t *as, __address address) 305 { 306 as_area_t *area; 307 __address base; 308 ipl_t ipl; 309 int i; 310 311 ipl = interrupts_disable(); 312 spinlock_lock(&as->lock); 313 314 area = find_area_and_lock(as, address); 315 if (!area) { 316 spinlock_unlock(&as->lock); 317 interrupts_restore(ipl); 318 return ENOENT; 319 } 320 321 base = area->base; 322 for (i = 0; i < area->pages; i++) { 323 pte_t *pte; 324 325 /* 326 * Releasing physical memory. 327 * Areas mapping memory-mapped devices are treated differently than 328 * areas backing frame_alloc()'ed memory. 329 */ 330 page_table_lock(as, false); 331 pte = page_mapping_find(as, area->base + i*PAGE_SIZE); 332 if (pte && PTE_VALID(pte)) { 333 ASSERT(PTE_PRESENT(pte)); 334 page_mapping_remove(as, area->base + i*PAGE_SIZE); 335 if (area->flags & AS_AREA_DEVICE) { 336 __address frame; 337 frame = PTE_GET_FRAME(pte); 338 frame_free(ADDR2PFN(frame)); 339 } 340 page_table_unlock(as, false); 341 } else { 342 page_table_unlock(as, false); 343 } 344 } 345 /* 346 * Invalidate TLB's. 347 */ 348 tlb_shootdown_start(TLB_INVL_PAGES, AS->asid, area->base, area->pages); 349 tlb_invalidate_pages(AS->asid, area->base, area->pages); 350 tlb_shootdown_finalize(); 351 352 spinlock_unlock(&area->lock); 353 354 /* 355 * Remove the empty area from address space. 356 */ 357 btree_remove(&AS->as_area_btree, base, NULL); 358 359 spinlock_unlock(&AS->lock); 360 interrupts_restore(ipl); 361 return 0; 295 362 } 296 363 … … 308 375 * @param src_base Base address of the source address space area. 309 376 * 310 * @return 0on success or ENOENT if there is no such task or377 * @return Zero on success or ENOENT if there is no such task or 311 378 * if there is no such address space area, 312 379 * EPERM if there was a problem in accepting the area or … … 892 959 __native sys_as_area_resize(__address address, size_t size, int flags) 893 960 { 894 return as_area_resize(AS, address, size, 0); 961 return (__native) as_area_resize(AS, address, size, 0); 962 } 963 964 /** Wrapper for as_area_destroy. */ 965 __native sys_as_area_destroy(__address address) 966 { 967 return (__native) as_area_destroy(AS, address); 895 968 } 896 969 -
generic/src/syscall/syscall.c
rcfffb000 r7242a78e 85 85 sys_as_area_create, 86 86 sys_as_area_resize, 87 sys_as_area_destroy, 87 88 sys_as_area_accept, 88 89 sys_as_area_send,
Note:
See TracChangeset
for help on using the changeset viewer.