Changeset 17aca1c in mainline for uspace/lib/c/generic/as.c
- Timestamp:
- 2011-02-04T20:56:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0397e5a4, e29e09cf
- Parents:
- e778543 (diff), 0b37882 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/as.c
re778543 r17aca1c 41 41 #include <bitops.h> 42 42 #include <malloc.h> 43 44 /** Last position allocated by as_get_mappable_page */ 45 static uintptr_t last_allocated = 0; 43 #include "private/libc.h" 46 44 47 45 /** Create address space area. … … 104 102 } 105 103 106 /** Return pointer to some unmapped area, where fits new as_area104 /** Return pointer to unmapped address space area 107 105 * 108 106 * @param size Requested size of the allocation. 109 107 * 110 * @return pointer to the beginning108 * @return Pointer to the beginning of unmapped address space area. 111 109 * 112 110 */ 113 111 void *as_get_mappable_page(size_t size) 114 112 { 115 if (size == 0) 116 return NULL; 117 118 size_t sz = 1 << (fnzb(size - 1) + 1); 119 if (last_allocated == 0) 120 last_allocated = get_max_heap_addr(); 121 122 /* 123 * Make sure we allocate from naturally aligned address. 124 */ 125 uintptr_t res = ALIGN_UP(last_allocated, sz); 126 last_allocated = res + ALIGN_UP(size, PAGE_SIZE); 127 128 return ((void *) res); 113 return (void *) __SYSCALL2(SYS_AS_GET_UNMAPPED_AREA, 114 (sysarg_t) __entry, (sysarg_t) size); 129 115 } 130 116
Note:
See TracChangeset
for help on using the changeset viewer.