Changeset 2057572 in mainline for uspace/libc
- Timestamp:
- 2007-03-27T23:40:25Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 399ece9
- Parents:
- 8d37a06
- Location:
- uspace/libc
- Files:
-
- 7 edited
-
arch/sparc64/_link.ld.in (modified) (3 diffs)
-
arch/sparc64/include/config.h (modified) (1 diff)
-
arch/sparc64/include/stack.h (modified) (1 diff)
-
generic/as.c (modified) (5 diffs)
-
generic/mman.c (modified) (1 diff)
-
generic/time.c (modified) (1 diff)
-
include/as.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/arch/sparc64/_link.ld.in
r8d37a06 r2057572 8 8 9 9 SECTIONS { 10 . = 0x 2000;10 . = 0x4000; 11 11 12 .init ALIGN(0x 2000) : SUBALIGN(0x2000) {12 .init ALIGN(0x4000) : SUBALIGN(0x4000) { 13 13 *(.init); 14 14 } :text … … 18 18 } :text 19 19 20 .got ALIGN(0x 2000) : SUBALIGN(0x2000) {20 .got ALIGN(0x4000) : SUBALIGN(0x4000) { 21 21 _gp = .; 22 22 *(.got*); 23 23 } :data 24 .data ALIGN(0x 2000) : SUBALIGN(0x2000) {24 .data ALIGN(0x4000) : SUBALIGN(0x4000) { 25 25 *(.data); 26 26 *(.sdata); … … 42 42 } :data 43 43 44 . = ALIGN(0x 2000);44 . = ALIGN(0x4000); 45 45 _heap = .; 46 46 -
uspace/libc/arch/sparc64/include/config.h
r8d37a06 r2057572 36 36 #define LIBC_sparc64_CONFIG_H_ 37 37 38 #define PAGE_WIDTH 1 339 #define PAGE_SIZE (1 <<PAGE_WIDTH)40 #define PAGE_COLOR_BITS 1 /**< Bit 13 is the page color. */38 #define PAGE_WIDTH 14 39 #define PAGE_SIZE (1 << PAGE_WIDTH) 40 #define PAGE_COLOR_BITS 0 /**< Only one page color. */ 41 41 42 42 #endif -
uspace/libc/arch/sparc64/include/stack.h
r8d37a06 r2057572 44 44 * 16-extended-word save area for %i[0-7] and %l[0-7] registers. 45 45 */ 46 #define STACK_WINDOW_SAVE_AREA_SIZE (16 *STACK_ITEM_SIZE)46 #define STACK_WINDOW_SAVE_AREA_SIZE (16 * STACK_ITEM_SIZE) 47 47 48 48 /** -
uspace/libc/generic/as.c
r8d37a06 r2057572 56 56 { 57 57 return (void *) __SYSCALL3(SYS_AS_AREA_CREATE, (sysarg_t ) address, 58 (sysarg_t) size, (sysarg_t) flags);58 (sysarg_t) size, (sysarg_t) flags); 59 59 } 60 60 … … 70 70 int as_area_resize(void *address, size_t size, int flags) 71 71 { 72 return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t)73 size, (sysarg_t) flags);72 return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, 73 (sysarg_t) size, (sysarg_t) flags); 74 74 } 75 75 … … 144 144 * 145 145 * @param sz Requested size of the allocation. 146 * @param color Requested virtual color of the allocation.147 146 * 148 147 * @return Pointer to the beginning … … 151 150 * the pointer to last area 152 151 */ 153 void *as_get_mappable_page(size_t sz , int color)152 void *as_get_mappable_page(size_t sz) 154 153 { 155 154 void *res; … … 167 166 168 167 /* 169 * Make sure we allocate from naturally aligned address and a page of 170 * appropriate color. 168 * Make sure we allocate from naturally aligned address. 171 169 */ 172 170 i = 0; 173 do { 174 if (!last_allocated) { 175 last_allocated = (void *) ALIGN_UP((void *) &_heap + 176 maxheapsize, asz); 177 } else { 178 last_allocated = (void *) ALIGN_UP(((uintptr_t) 179 last_allocated) + (int) (i > 0), asz); 180 } 181 } while ((asz < (1 << (PAGE_COLOR_BITS + PAGE_WIDTH))) && 182 (PAGE_COLOR((uintptr_t) last_allocated) != color) && 183 (++i < (1 << PAGE_COLOR_BITS))); 171 if (!last_allocated) { 172 last_allocated = (void *) ALIGN_UP((void *) &_heap + 173 maxheapsize, asz); 174 } else { 175 last_allocated = (void *) ALIGN_UP(((uintptr_t) 176 last_allocated) + (int) (i > 0), asz); 177 } 184 178 185 179 res = last_allocated; -
uspace/libc/generic/mman.c
r8d37a06 r2057572 37 37 #include <unistd.h> 38 38 39 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) 39 void *mmap(void *start, size_t length, int prot, int flags, int fd, 40 off_t offset) 40 41 { 41 42 if (!start) 42 start = as_get_mappable_page(length , 0);43 start = as_get_mappable_page(length); 43 44 44 45 // if (! ((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE))) -
uspace/libc/generic/time.c
r8d37a06 r2057572 73 73 74 74 if (!ktime) { 75 mapping = as_get_mappable_page(PAGE_SIZE, (int) 76 sysinfo_value("clock.fcolor")); 75 mapping = as_get_mappable_page(PAGE_SIZE); 77 76 /* Get the mapping of kernel clock */ 78 res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, (sysarg_t)79 mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, &rights,80 NULL);77 res = ipc_call_sync_3(PHONE_NS, IPC_M_AS_AREA_RECV, 78 (sysarg_t) mapping, PAGE_SIZE, SERVICE_MEM_REALTIME, NULL, 79 &rights, NULL); 81 80 if (res) { 82 81 printf("Failed to initialize timeofday memarea\n"); -
uspace/libc/include/as.h
r8d37a06 r2057572 41 41 #include <libarch/config.h> 42 42 43 #define PAGE_COLOR(va) (((va) >> PAGE_WIDTH) & ((1 << PAGE_COLOR_BITS) - 1))44 45 43 extern void *as_area_create(void *address, size_t size, int flags); 46 44 extern int as_area_resize(void *address, size_t size, int flags); 47 45 extern int as_area_destroy(void *address); 48 46 extern void *set_maxheapsize(size_t mhs); 49 extern void * as_get_mappable_page(size_t sz , int color);47 extern void * as_get_mappable_page(size_t sz); 50 48 51 49 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
