Changeset 1433ecda in mainline for uspace/lib/c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- Location:
- uspace/lib/c
- Files:
-
- 57 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/abs32le/include/libarch/elf_linux.h
r47b2d7e3 r1433ecda 43 43 static inline void istate_to_elf_regs(istate_t *istate, elf_regs_t *elf_regs) 44 44 { 45 (void) istate; (void) elf_regs; 45 (void) istate; 46 (void) elf_regs; 46 47 } 47 48 -
uspace/lib/c/arch/abs32le/src/entryjmp.c
r47b2d7e3 r1433ecda 36 36 void entry_point_jmp(void *entry_point, void *pcb) 37 37 { 38 while (true); 38 while (true) 39 ; 39 40 } 40 41 -
uspace/lib/c/arch/abs32le/src/fibril.c
r47b2d7e3 r1433ecda 40 40 void __longjmp(context_t *ctx, int val) 41 41 { 42 while (true); 42 while (true) 43 ; 43 44 } 44 45 -
uspace/lib/c/arch/abs32le/src/tls.c
r47b2d7e3 r1433ecda 34 34 #include <stdint.h> 35 35 36 tcb_t * 36 tcb_t *tls_alloc_arch(void **data, size_t size) 37 37 { 38 38 return tls_alloc_variant_2(data, size); -
uspace/lib/c/arch/amd64/include/libarch/atomic.h
r47b2d7e3 r1433ecda 46 46 #ifdef __PCC__ 47 47 asm volatile ( 48 49 48 "lock incq %0\n" 49 : "+m" (val->count) 50 50 ); 51 51 #else 52 52 asm volatile ( 53 54 53 "lock incq %[count]\n" 54 : [count] "+m" (val->count) 55 55 ); 56 56 #endif … … 61 61 #ifdef __PCC__ 62 62 asm volatile ( 63 64 63 "lock decq %0\n" 64 : "+m" (val->count) 65 65 ); 66 66 #else 67 67 asm volatile ( 68 69 68 "lock decq %[count]\n" 69 : [count] "+m" (val->count) 70 70 ); 71 71 #endif … … 78 78 #ifdef __PCC__ 79 79 asm volatile ( 80 81 82 80 "lock xaddq %1, %0\n" 81 : "+m" (val->count), 82 "+r" (r) 83 83 ); 84 84 #else 85 85 asm volatile ( 86 87 88 86 "lock xaddq %[r], %[count]\n" 87 : [count] "+m" (val->count), 88 [r] "+r" (r) 89 89 ); 90 90 #endif … … 99 99 #ifdef __PCC__ 100 100 asm volatile ( 101 102 103 101 "lock xaddq %1, %0\n" 102 : "+m" (val->count), 103 "+r" (r) 104 104 ); 105 105 #else 106 106 asm volatile ( 107 108 109 107 "lock xaddq %[r], %[count]\n" 108 : [count] "+m" (val->count), 109 [r] "+r" (r) 110 110 ); 111 111 #endif -
uspace/lib/c/arch/arm32/include/libarch/atomic.h
r47b2d7e3 r1433ecda 56 56 */ 57 57 asm volatile ( 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 58 "1:\n" 59 " adr %[ret], 1b\n" 60 " str %[ret], %[rp0]\n" 61 " adr %[ret], 2f\n" 62 " str %[ret], %[rp1]\n" 63 " ldr %[ret], %[addr]\n" 64 " cmp %[ret], %[ov]\n" 65 " streq %[nv], %[addr]\n" 66 "2:\n" 67 " moveq %[ret], #1\n" 68 " movne %[ret], #0\n" 69 : [ret] "+&r" (ret), 70 [rp0] "=m" (ras_page[0]), 71 [rp1] "=m" (ras_page[1]), 72 [addr] "+m" (val->count) 73 : [ov] "r" (ov), 74 [nv] "r" (nv) 75 : "memory" 76 76 ); 77 77 78 78 ras_page[0] = 0; 79 79 asm volatile ( 80 80 "" ::: "memory" 81 81 ); 82 82 ras_page[1] = 0xffffffff; … … 103 103 */ 104 104 asm volatile ( 105 106 107 108 109 110 111 112 113 114 115 116 117 118 105 "1:\n" 106 " adr %[ret], 1b\n" 107 " str %[ret], %[rp0]\n" 108 " adr %[ret], 2f\n" 109 " str %[ret], %[rp1]\n" 110 " ldr %[ret], %[addr]\n" 111 " add %[ret], %[ret], %[imm]\n" 112 " str %[ret], %[addr]\n" 113 "2:\n" 114 : [ret] "+&r" (ret), 115 [rp0] "=m" (ras_page[0]), 116 [rp1] "=m" (ras_page[1]), 117 [addr] "+m" (val->count) 118 : [imm] "r" (i) 119 119 ); 120 120 121 121 ras_page[0] = 0; 122 122 asm volatile ( 123 123 "" ::: "memory" 124 124 ); 125 125 ras_page[1] = 0xffffffff; -
uspace/lib/c/arch/arm32/src/syscall.c
r47b2d7e3 r1433ecda 62 62 63 63 asm volatile ( 64 65 66 67 68 69 70 71 72 64 "swi 0" 65 : "=r" (__arm_reg_r0) 66 : "r" (__arm_reg_r0), 67 "r" (__arm_reg_r1), 68 "r" (__arm_reg_r2), 69 "r" (__arm_reg_r3), 70 "r" (__arm_reg_r4), 71 "r" (__arm_reg_r5), 72 "r" (__arm_reg_r6) 73 73 ); 74 74 -
uspace/lib/c/arch/ia32/include/libarch/atomic.h
r47b2d7e3 r1433ecda 44 44 #ifdef __PCC__ 45 45 asm volatile ( 46 47 46 "lock incl %0\n" 47 : "+m" (val->count) 48 48 ); 49 49 #else 50 50 asm volatile ( 51 52 51 "lock incl %[count]\n" 52 : [count] "+m" (val->count) 53 53 ); 54 54 #endif … … 59 59 #ifdef __PCC__ 60 60 asm volatile ( 61 62 61 "lock decl %0\n" 62 : "+m" (val->count) 63 63 ); 64 64 #else 65 65 asm volatile ( 66 67 66 "lock decl %[count]\n" 67 : [count] "+m" (val->count) 68 68 ); 69 69 #endif … … 76 76 #ifdef __PCC__ 77 77 asm volatile ( 78 79 80 78 "lock xaddl %1, %0\n" 79 : "+m" (val->count), 80 "+r" (r) 81 81 ); 82 82 #else 83 83 asm volatile ( 84 85 86 84 "lock xaddl %[r], %[count]\n" 85 : [count] "+m" (val->count), 86 [r] "+r" (r) 87 87 ); 88 88 #endif … … 97 97 #ifdef __PCC__ 98 98 asm volatile ( 99 100 101 99 "lock xaddl %1, %0\n" 100 : "+m" (val->count), 101 "+r" (r) 102 102 ); 103 103 #else 104 104 asm volatile ( 105 106 107 105 "lock xaddl %[r], %[count]\n" 106 : [count] "+m" (val->count), 107 [r] "+r" (r) 108 108 ); 109 109 #endif -
uspace/lib/c/arch/ia32/include/libarch/ddi.h
r47b2d7e3 r1433ecda 44 44 45 45 asm volatile ( 46 47 48 46 "inb %w[port], %b[val]\n" 47 : [val] "=a" (val) 48 : [port] "d" (port) 49 49 ); 50 50 … … 60 60 61 61 asm volatile ( 62 63 64 62 "inw %w[port], %w[val]\n" 63 : [val] "=a" (val) 64 : [port] "d" (port) 65 65 ); 66 66 … … 76 76 77 77 asm volatile ( 78 79 80 78 "inl %w[port], %[val]\n" 79 : [val] "=a" (val) 80 : [port] "d" (port) 81 81 ); 82 82 … … 95 95 if (port < (ioport8_t *) IO_SPACE_BOUNDARY) { 96 96 asm volatile ( 97 98 97 "outb %b[val], %w[port]\n" 98 :: [val] "a" (val), [port] "d" (port) 99 99 ); 100 100 } else … … 106 106 if (port < (ioport16_t *) IO_SPACE_BOUNDARY) { 107 107 asm volatile ( 108 109 108 "outw %w[val], %w[port]\n" 109 :: [val] "a" (val), [port] "d" (port) 110 110 ); 111 111 } else … … 117 117 if (port < (ioport32_t *) IO_SPACE_BOUNDARY) { 118 118 asm volatile ( 119 120 119 "outl %[val], %w[port]\n" 120 :: [val] "a" (val), [port] "d" (port) 121 121 ); 122 122 } else -
uspace/lib/c/arch/ia32/src/rtld/reloc.c
r47b2d7e3 r1433ecda 207 207 { 208 208 /* Unused */ 209 (void)m; (void)rt; (void)rt_size; 209 (void)m; 210 (void)rt; 211 (void)rt_size; 210 212 } 211 213 -
uspace/lib/c/arch/ia32/src/tls.c
r47b2d7e3 r1433ecda 64 64 } tls_index; 65 65 66 void __attribute__ ((__regparm__(1)))66 void __attribute__((__regparm__(1))) 67 67 *___tls_get_addr(tls_index *ti); 68 68 69 void __attribute__ ((__regparm__(1)))69 void __attribute__((__regparm__(1))) 70 70 *___tls_get_addr(tls_index *ti) 71 71 { -
uspace/lib/c/arch/ia64/include/libarch/atomic.h
r47b2d7e3 r1433ecda 45 45 46 46 asm volatile ( 47 48 49 47 "fetchadd8.rel %[v] = %[count], 1\n" 48 : [v] "=r" (v), 49 [count] "+m" (val->count) 50 50 ); 51 51 } … … 56 56 57 57 asm volatile ( 58 59 60 58 "fetchadd8.rel %[v] = %[count], -1\n" 59 : [v] "=r" (v), 60 [count] "+m" (val->count) 61 61 ); 62 62 } … … 67 67 68 68 asm volatile ( 69 70 71 69 "fetchadd8.rel %[v] = %[count], 1\n" 70 : [v] "=r" (v), 71 [count] "+m" (val->count) 72 72 ); 73 73 … … 80 80 81 81 asm volatile ( 82 83 84 82 "fetchadd8.rel %[v] = %[count], -1\n" 83 : [v] "=r" (v), 84 [count] "+m" (val->count) 85 85 ); 86 86 … … 93 93 94 94 asm volatile ( 95 96 97 95 "fetchadd8.rel %[v] = %[count], 1\n" 96 : [v] "=r" (v), 97 [count] "+m" (val->count) 98 98 ); 99 99 … … 106 106 107 107 asm volatile ( 108 109 110 108 "fetchadd8.rel %[v] = %[count], -1\n" 109 : [v] "=r" (v), 110 [count] "+m" (val->count) 111 111 ); 112 112 -
uspace/lib/c/arch/ia64/src/stacktrace.c
r47b2d7e3 r1433ecda 43 43 bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp) 44 44 { 45 (void) st; (void) fp; 45 (void) st; 46 (void) fp; 46 47 return false; 47 48 } … … 49 50 errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev) 50 51 { 51 (void) st; (void) fp; (void) prev; 52 (void) st; 53 (void) fp; 54 (void) prev; 52 55 return ENOTSUP; 53 56 } … … 55 58 errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra) 56 59 { 57 (void) st; (void) fp; (void) ra; 60 (void) st; 61 (void) fp; 62 (void) ra; 58 63 return ENOTSUP; 59 64 } -
uspace/lib/c/arch/mips32/include/libarch/atomic.h
r47b2d7e3 r1433ecda 64 64 65 65 asm volatile ( 66 67 68 69 70 71 72 73 74 75 76 77 66 "1:\n" 67 " ll %0, %1\n" 68 " addu %0, %0, %3\n" /* same as add, but never traps on overflow */ 69 " move %2, %0\n" 70 " sc %0, %1\n" 71 " beq %0, %4, 1b\n" /* if the atomic operation failed, try again */ 72 " nop\n" 73 : "=&r" (tmp), 74 "+m" (val->count), 75 "=&r" (v) 76 : "r" (i), 77 "i" (0) 78 78 ); 79 79 -
uspace/lib/c/arch/mips32/src/stacktrace.c
r47b2d7e3 r1433ecda 43 43 bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp) 44 44 { 45 (void) st; (void) fp; 45 (void) st; 46 (void) fp; 46 47 return false; 47 48 } … … 49 50 errno_t stacktrace_fp_prev(stacktrace_t *st, uintptr_t fp, uintptr_t *prev) 50 51 { 51 (void) st; (void) fp; (void) prev; 52 (void) st; 53 (void) fp; 54 (void) prev; 52 55 return ENOTSUP; 53 56 } … … 55 58 errno_t stacktrace_ra_get(stacktrace_t *st, uintptr_t fp, uintptr_t *ra) 56 59 { 57 (void) st; (void) fp; (void) ra; 60 (void) st; 61 (void) fp; 62 (void) ra; 58 63 return ENOTSUP; 59 64 } -
uspace/lib/c/arch/mips32/src/syscall.c
r47b2d7e3 r1433ecda 48 48 49 49 asm volatile ( 50 51 52 53 54 55 56 57 58 50 "syscall\n" 51 : "=r" (__mips_reg_v0) 52 : "r" (__mips_reg_a0), 53 "r" (__mips_reg_a1), 54 "r" (__mips_reg_a2), 55 "r" (__mips_reg_a3), 56 "r" (__mips_reg_t0), 57 "r" (__mips_reg_t1), 58 "r" (__mips_reg_v0) 59 59 /* 60 60 * We are a function call, although C 61 61 * does not know it. 62 62 */ 63 63 : "%ra" 64 64 ); 65 65 -
uspace/lib/c/arch/mips32/src/tls.c
r47b2d7e3 r1433ecda 37 37 #include <stddef.h> 38 38 39 tcb_t * 39 tcb_t *tls_alloc_arch(void **data, size_t size) 40 40 { 41 41 return tls_alloc_variant_1(data, size); -
uspace/lib/c/arch/ppc32/include/libarch/atomic.h
r47b2d7e3 r1433ecda 45 45 46 46 asm volatile ( 47 48 49 50 51 52 53 54 55 56 47 "1:\n" 48 "lwarx %0, 0, %2\n" 49 "addic %0, %0, 1\n" 50 "stwcx. %0, 0, %2\n" 51 "bne- 1b" 52 : "=&r" (tmp), 53 "=m" (val->count) 54 : "r" (&val->count), 55 "m" (val->count) 56 : "cc" 57 57 ); 58 58 } … … 63 63 64 64 asm volatile ( 65 66 67 68 69 70 71 72 73 74 65 "1:\n" 66 "lwarx %0, 0, %2\n" 67 "addic %0, %0, -1\n" 68 "stwcx. %0, 0, %2\n" 69 "bne- 1b" 70 : "=&r" (tmp), 71 "=m" (val->count) 72 : "r" (&val->count), 73 "m" (val->count) 74 : "cc" 75 75 ); 76 76 } -
uspace/lib/c/arch/ppc32/include/libarch/tls.h
r47b2d7e3 r1433ecda 50 50 51 51 asm volatile ( 52 53 54 52 "mr %%r2, %0\n" 53 : 54 : "r" (tp) 55 55 ); 56 56 } 57 57 58 static inline tcb_t * 58 static inline tcb_t *__tcb_get(void) 59 59 { 60 void * 60 void *retval; 61 61 62 62 asm volatile ( 63 64 63 "mr %0, %%r2\n" 64 : "=r" (retval) 65 65 ); 66 66 -
uspace/lib/c/arch/ppc32/src/syscall.c
r47b2d7e3 r1433ecda 49 49 50 50 asm volatile ( 51 52 53 54 55 56 57 58 59 51 "sc\n" 52 : "=r" (__ppc32_reg_r3) 53 : "r" (__ppc32_reg_r3), 54 "r" (__ppc32_reg_r4), 55 "r" (__ppc32_reg_r5), 56 "r" (__ppc32_reg_r6), 57 "r" (__ppc32_reg_r7), 58 "r" (__ppc32_reg_r8), 59 "r" (__ppc32_reg_r9) 60 60 ); 61 61 -
uspace/lib/c/arch/riscv64/src/entryjmp.c
r47b2d7e3 r1433ecda 36 36 void entry_point_jmp(void *entry_point, void *pcb) 37 37 { 38 while (true); 38 while (true) 39 ; 39 40 } 40 41 -
uspace/lib/c/arch/riscv64/src/fibril.c
r47b2d7e3 r1433ecda 40 40 void __longjmp(context_t *ctx, int ret) 41 41 { 42 while (true); 42 while (true) 43 ; 43 44 } 44 45 -
uspace/lib/c/arch/sparc64/include/libarch/atomic.h
r47b2d7e3 r1433ecda 63 63 64 64 asm volatile ( 65 66 67 68 65 "casx %0, %2, %1\n" 66 : "+m" (*((atomic_count_t *) ptr)), 67 "+r" (b) 68 : "r" (a) 69 69 ); 70 70 } while (a != b); -
uspace/lib/c/arch/sparc64/include/libarch/ddi.h
r47b2d7e3 r1433ecda 39 39 { 40 40 asm volatile ( 41 42 41 "membar #LoadLoad | #StoreStore\n" 42 ::: "memory" 43 43 ); 44 44 } -
uspace/lib/c/arch/sparc64/include/libarch/elf_linux.h
r47b2d7e3 r1433ecda 47 47 { 48 48 /* TODO */ 49 (void) istate; (void) elf_regs; 49 (void) istate; 50 (void) elf_regs; 50 51 } 51 52 -
uspace/lib/c/generic/assert.c
r47b2d7e3 r1433ecda 39 39 #include <stdint.h> 40 40 41 static atomic_t failed_asserts = { 0};41 static atomic_t failed_asserts = { 0 }; 42 42 43 43 void __helenos_assert_quick_abort(const char *cond, const char *file, unsigned int line) -
uspace/lib/c/generic/cap.c
r47b2d7e3 r1433ecda 211 211 { 212 212 switch (c) { 213 case '0': *val = 0; break; 214 case '1': *val = 1; break; 215 case '2': *val = 2; break; 216 case '3': *val = 3; break; 217 case '4': *val = 4; break; 218 case '5': *val = 5; break; 219 case '6': *val = 6; break; 220 case '7': *val = 7; break; 221 case '8': *val = 8; break; 222 case '9': *val = 9; break; 213 case '0': 214 *val = 0; 215 break; 216 case '1': 217 *val = 1; 218 break; 219 case '2': 220 *val = 2; 221 break; 222 case '3': 223 *val = 3; 224 break; 225 case '4': 226 *val = 4; 227 break; 228 case '5': 229 *val = 5; 230 break; 231 case '6': 232 *val = 6; 233 break; 234 case '7': 235 *val = 7; 236 break; 237 case '8': 238 *val = 8; 239 break; 240 case '9': 241 *val = 9; 242 break; 223 243 default: 224 244 return EINVAL; … … 275 295 276 296 return EINVAL; 277 found:297 found: 278 298 cap->cunit = i; 279 299 } -
uspace/lib/c/generic/elf/elf_load.c
r47b2d7e3 r1433ecda 77 77 DPRINTF("Binary is dynamically linked.\n"); 78 78 #ifdef CONFIG_RTLD 79 DPRINTF( 79 DPRINTF("- prog dynamic: %p\n", info->finfo.dynamic); 80 80 81 81 errno_t rc2 = rtld_prog_process(&info->finfo, &env); -
uspace/lib/c/generic/fibril_synch.c
r47b2d7e3 r1433ecda 77 77 context_get_pc(&oi->owned_by->ctx)); 78 78 printf("Fibril %p waits for primitive %p.\n", 79 79 oi->owned_by, oi->owned_by->waits_for); 80 80 oi = oi->owned_by->waits_for; 81 81 } … … 354 354 355 355 errno_t 356 fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm,356 fibril_condvar_wait_timeout(fibril_condvar_t *fcv, fibril_mutex_t *fm, 357 357 suseconds_t timeout) 358 358 { -
uspace/lib/c/generic/inet/addr.c
r47b2d7e3 r1433ecda 49 49 50 50 #if !(defined(__BE__) ^ defined(__LE__)) 51 51 #error The architecture must be either big-endian or little-endian. 52 52 #endif 53 53 … … 69 69 static const inet_addr_t inet_addr_any_addr6 = { 70 70 .version = ip_v6, 71 .addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}71 .addr6 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 72 72 }; 73 73 -
uspace/lib/c/generic/io/printf_core.c
r47b2d7e3 r1433ecda 593 593 /** Prints a special double (ie NaN, infinity) padded to width characters. */ 594 594 static int print_special(ieee_double_t val, int width, uint32_t flags, 595 595 printf_spec_t *ps) 596 596 { 597 597 assert(val.is_special); … … 702 702 */ 703 703 static int print_double_str_fixed(double_str_t *val_str, int precision, int width, 704 704 uint32_t flags, printf_spec_t *ps) 705 705 { 706 706 int len = val_str->len; … … 840 840 */ 841 841 static int print_double_fixed(double g, int precision, int width, uint32_t flags, 842 842 printf_spec_t *ps) 843 843 { 844 844 if (flags & __PRINTF_FLAG_LEFTALIGNED) { … … 869 869 */ 870 870 val_str.len = double_to_fixed_str(val, -1, precision + 1, buf, buf_size, 871 871 &val_str.dec_exp); 872 872 873 873 /* … … 919 919 920 920 exp_str[0] = '0' + exp_val / 100; 921 exp_str[1] = '0' + (exp_val % 100) / 10 921 exp_str[1] = '0' + (exp_val % 100) / 10; 922 922 exp_str[2] = '0' + (exp_val % 10); 923 923 … … 938 938 */ 939 939 static int print_double_str_scient(double_str_t *val_str, int precision, 940 940 int width, uint32_t flags, printf_spec_t *ps) 941 941 { 942 942 int len = val_str->len; … … 1062 1062 */ 1063 1063 static int print_double_scientific(double g, int precision, int width, 1064 1064 uint32_t flags, printf_spec_t *ps) 1065 1065 { 1066 1066 if (flags & __PRINTF_FLAG_LEFTALIGNED) { … … 1088 1088 */ 1089 1089 val_str.len = double_to_fixed_str(val, precision + 2, -1, buf, buf_size, 1090 1090 &val_str.dec_exp); 1091 1091 1092 1092 /* … … 1129 1129 */ 1130 1130 static int print_double_generic(double g, int precision, int width, 1131 1131 uint32_t flags, printf_spec_t *ps) 1132 1132 { 1133 1133 ieee_double_t val = extract_ieee_double(g); … … 1156 1156 precision = precision - (dec_exp + 1); 1157 1157 return print_double_fixed(g, precision, width, 1158 1158 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1159 1159 } else { 1160 1160 --precision; 1161 1161 return print_double_scientific(g, precision, width, 1162 1162 flags | __PRINTF_FLAG_NOFRACZEROS, ps); 1163 1163 } 1164 1164 } else { … … 1214 1214 */ 1215 1215 static int print_double(double g, char spec, int precision, int width, 1216 1216 uint32_t flags, printf_spec_t *ps) 1217 1217 { 1218 1218 switch (spec) { … … 1543 1543 case 'e': 1544 1544 retval = print_double(va_arg(ap, double), uc, precision, 1545 1545 width, flags, ps); 1546 1546 1547 1547 if (retval < 0) { -
uspace/lib/c/generic/io/visualizer.c
r47b2d7e3 r1433ecda 174 174 errno_t visualizer_update_damaged_region(async_sess_t *sess, 175 175 sysarg_t x, sysarg_t y, sysarg_t width, sysarg_t height, 176 176 sysarg_t x_offset, sysarg_t y_offset) 177 177 { 178 178 assert(x_offset <= UINT16_MAX); -
uspace/lib/c/generic/io/vsnprintf.c
r47b2d7e3 r1433ecda 170 170 }; 171 171 printf_spec_t ps = { 172 (int (*) (const char *, size_t, void *)) vsnprintf_str_write,173 (int (*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write,172 (int (*) (const char *, size_t, void *)) vsnprintf_str_write, 173 (int (*) (const wchar_t *, size_t, void *)) vsnprintf_wstr_write, 174 174 &data 175 175 }; -
uspace/lib/c/generic/l18n/langs.c
r47b2d7e3 r1433ecda 54 54 */ 55 55 switch (locale) { 56 57 58 59 60 61 62 63 64 65 66 67 68 69 56 case L18N_WIN_LOCALE_AFRIKAANS: 57 return "Afrikaans"; 58 case L18N_WIN_LOCALE_CZECH: 59 return "Czech"; 60 case L18N_WIN_LOCALE_ENGLISH_UNITED_STATES: 61 return "English (US)"; 62 case L18N_WIN_LOCALE_SLOVAK: 63 return "Slovak"; 64 case L18N_WIN_LOCALE_SPANISH_TRADITIONAL: 65 return "Spanish (traditional)"; 66 case L18N_WIN_LOCALE_ZULU: 67 return "Zulu"; 68 default: 69 break; 70 70 } 71 71 -
uspace/lib/c/generic/libc.c
r47b2d7e3 r1433ecda 138 138 139 139 /* Unreachable */ 140 while (1); 140 while (1) 141 ; 141 142 } 142 143 … … 146 147 147 148 /* Unreachable */ 148 while (1); 149 while (1) 150 ; 149 151 } 150 152 -
uspace/lib/c/generic/mem.c
r47b2d7e3 r1433ecda 54 54 word_size = sizeof(unsigned long); 55 55 fill = word_size - ((uintptr_t) dest & (word_size - 1)); 56 if (fill > n) fill = n; 56 if (fill > n) 57 fill = n; 57 58 58 59 pb = dest; … … 64 65 /* Compute remaining size. */ 65 66 n -= fill; 66 if (n == 0) return dest; 67 if (n == 0) 68 return dest; 67 69 68 70 n_words = n / word_size; … … 93 95 struct along { 94 96 unsigned long n; 95 } __attribute__ 97 } __attribute__((packed)); 96 98 97 99 static void *unaligned_memcpy(void *dst, const void *src, size_t n) … … 133 135 if (((uintptr_t) dst & (word_size - 1)) != 134 136 ((uintptr_t) src & (word_size - 1))) 135 137 return unaligned_memcpy(dst, src, n); 136 138 137 139 /* … … 143 145 mod = (uintptr_t) dst & (word_size - 1); 144 146 fill = word_size - mod; 145 if (fill > n) fill = n; 147 if (fill > n) 148 fill = n; 146 149 147 150 /* Copy the initial segment. */ … … 157 160 158 161 n -= fill; 159 if (n == 0) return dst; 162 if (n == 0) 163 return dst; 160 164 161 165 /* Pointers to aligned segment. */ -
uspace/lib/c/generic/pio_trace.c
r47b2d7e3 r1433ecda 50 50 } region_t; 51 51 52 static inline region_t * 52 static inline region_t *region_instance(link_t *l) 53 53 { 54 54 return list_get_instance(l, region_t, link); 55 55 } 56 56 57 static inline region_t * region_create(volatile void*base, size_t size,58 trace_fnc log, void *data)57 static inline region_t *region_create(volatile void *base, size_t size, 58 trace_fnc log, void *data) 59 59 { 60 60 region_t *new_reg = malloc(sizeof(region_t)); … … 79 79 } pio_regions_t; 80 80 81 static pio_regions_t * 81 static pio_regions_t *get_regions(void) 82 82 { 83 83 static pio_regions_t regions = { -
uspace/lib/c/generic/rcu.c
r47b2d7e3 r1433ecda 340 340 list_foreach_safe(rcu.fibrils_list, fibril_it, next_fibril) { 341 341 fibril_rcu_data_t *fib = member_to_inst(fibril_it, 342 342 fibril_rcu_data_t, link); 343 343 344 344 if (is_preexisting_reader(fib, reader_group)) { … … 405 405 if (!list_empty(&rcu.sync_lock.blocked_fibrils)) { 406 406 blocked_fibril_t *blocked_fib = member_to_inst( 407 407 list_first(&rcu.sync_lock.blocked_fibrils), blocked_fibril_t, link); 408 408 409 409 if (!blocked_fib->is_ready) { -
uspace/lib/c/generic/rtld/dynamic.c
r47b2d7e3 r1433ecda 65 65 d_val = dp->d_un.d_val; 66 66 DPRINTF("tag=%u ptr=0x%x val=%u\n", (unsigned)dp->d_tag, 67 67 (unsigned)d_ptr, (unsigned)d_val); 68 68 69 69 switch (dp->d_tag) { 70 70 71 case DT_PLTRELSZ: info->plt_rel_sz = d_val; break; 72 case DT_PLTGOT: info->plt_got = d_ptr; break; 73 case DT_HASH: info->hash = d_ptr; break; 74 case DT_STRTAB: info->str_tab = d_ptr; break; 75 case DT_SYMTAB: info->sym_tab = d_ptr; break; 76 case DT_RELA: info->rela = d_ptr; break; 77 case DT_RELASZ: info->rela_sz = d_val; break; 78 case DT_RELAENT: info->rela_ent = d_val; break; 79 case DT_STRSZ: info->str_sz = d_val; break; 80 case DT_SYMENT: info->sym_ent = d_val; break; 81 case DT_INIT: info->init = d_ptr; break; 82 case DT_FINI: info->fini = d_ptr; break; 83 case DT_SONAME: soname_idx = d_val; break; 84 case DT_RPATH: rpath_idx = d_val; break; 85 case DT_SYMBOLIC: info->symbolic = true; break; 86 case DT_REL: info->rel = d_ptr; break; 87 case DT_RELSZ: info->rel_sz = d_val; break; 88 case DT_RELENT: info->rel_ent = d_val; break; 89 case DT_PLTREL: info->plt_rel = d_val; break; 90 case DT_TEXTREL: info->text_rel = true; break; 91 case DT_JMPREL: info->jmp_rel = d_ptr; break; 92 case DT_BIND_NOW: info->bind_now = true; break; 71 case DT_PLTRELSZ: 72 info->plt_rel_sz = d_val; 73 break; 74 case DT_PLTGOT: 75 info->plt_got = d_ptr; 76 break; 77 case DT_HASH: 78 info->hash = d_ptr; 79 break; 80 case DT_STRTAB: 81 info->str_tab = d_ptr; 82 break; 83 case DT_SYMTAB: 84 info->sym_tab = d_ptr; 85 break; 86 case DT_RELA: 87 info->rela = d_ptr; 88 break; 89 case DT_RELASZ: 90 info->rela_sz = d_val; 91 break; 92 case DT_RELAENT: 93 info->rela_ent = d_val; 94 break; 95 case DT_STRSZ: 96 info->str_sz = d_val; 97 break; 98 case DT_SYMENT: 99 info->sym_ent = d_val; 100 break; 101 case DT_INIT: 102 info->init = d_ptr; 103 break; 104 case DT_FINI: 105 info->fini = d_ptr; 106 break; 107 case DT_SONAME: 108 soname_idx = d_val; 109 break; 110 case DT_RPATH: 111 rpath_idx = d_val; 112 break; 113 case DT_SYMBOLIC: 114 info->symbolic = true; 115 break; 116 case DT_REL: 117 info->rel = d_ptr; 118 break; 119 case DT_RELSZ: 120 info->rel_sz = d_val; 121 break; 122 case DT_RELENT: 123 info->rel_ent = d_val; 124 break; 125 case DT_PLTREL: 126 info->plt_rel = d_val; 127 break; 128 case DT_TEXTREL: 129 info->text_rel = true; 130 break; 131 case DT_JMPREL: 132 info->jmp_rel = d_ptr; 133 break; 134 case DT_BIND_NOW: 135 info->bind_now = true; 136 break; 93 137 94 138 default: … … 108 152 109 153 DPRINTF("str_tab=0x%" PRIxPTR ", soname_idx=0x%x, soname=0x%" PRIxPTR "\n", 110 154 (uintptr_t)info->soname, soname_idx, (uintptr_t)info->soname); 111 155 DPRINTF("soname='%s'\n", info->soname); 112 156 DPRINTF("rpath='%s'\n", info->rpath); … … 134 178 break; 135 179 136 default: break; 180 default: 181 break; 137 182 } 138 183 -
uspace/lib/c/generic/rtld/module.c
r47b2d7e3 r1433ecda 91 91 92 92 /* Do not relocate twice. */ 93 if (m->relocated) return; 93 if (m->relocated) 94 return; 94 95 95 96 module_process_pre_arch(m); … … 246 247 247 248 while (dp->d_tag != DT_NULL) { 248 if (dp->d_tag == DT_NEEDED) ++n; 249 if (dp->d_tag == DT_NEEDED) 250 ++n; 249 251 ++dp; 250 252 } -
uspace/lib/c/generic/rtld/rtld.c
r47b2d7e3 r1433ecda 186 186 * Ascending addresses 187 187 */ 188 offset = 0; i = 1; 188 offset = 0; 189 i = 1; 189 190 list_foreach(rtld->imodules, imodules_link, module_t, m) { 190 191 assert(i == m->id); … … 200 201 * Descending addresses 201 202 */ 202 offset = 0; i = 1; 203 offset = 0; 204 i = 1; 203 205 list_foreach(rtld->imodules, imodules_link, module_t, m) { 204 206 assert(i == m->id); -
uspace/lib/c/generic/rtld/symbol.c
r47b2d7e3 r1433ecda 55 55 h = (h << 4) + *name++; 56 56 g = h & 0xf0000000; 57 if (g != 0) h ^= g >> 24; 57 if (g != 0) 58 h ^= g >> 24; 58 59 h &= ~g; 59 60 } -
uspace/lib/c/generic/str.c
r47b2d7e3 r1433ecda 49 49 /** Check the condition if wchar_t is signed */ 50 50 #ifdef __WCHAR_UNSIGNED__ 51 51 #define WCHAR_SIGNED_CHECK(cond) (true) 52 52 #else 53 53 #define WCHAR_SIGNED_CHECK(cond) (cond) 54 54 #endif 55 55 … … 164 164 /* 0xxxxxxx (Plain ASCII) */ 165 165 return b & 0x7f; 166 } 167 else if ((b & 0xe0) == 0xc0 || (b & 0xf0) == 0xe0 || 166 } else if ((b & 0xe0) == 0xc0 || (b & 0xf0) == 0xe0 || 168 167 (b & 0xf8) == 0xf0) { 169 168 /* Start byte */ 170 169 size_t start_offset = *offset; 171 170 return str_decode(str, &start_offset, size); 172 } 173 else if ((b & 0xc0) != 0x80) { 171 } else if ((b & 0xc0) != 0x80) { 174 172 /* Not a continuation byte */ 175 173 return U_SPECIAL; … … 936 934 ch += (src[idx + 1] & 0x03FF); 937 935 idx += 2; 938 } 939 else 936 } else 940 937 break; 941 938 } else { … … 983 980 idx++; 984 981 } else { 985 982 dest[idx] = c; 986 983 } 987 984 … … 1110 1107 size_t len = str_length(str); 1111 1108 1112 wchar_t *wstr = calloc(len +1, sizeof(wchar_t));1109 wchar_t *wstr = calloc(len + 1, sizeof(wchar_t)); 1113 1110 if (wstr == NULL) 1114 1111 return NULL; -
uspace/lib/c/generic/str_error.c
r47b2d7e3 r1433ecda 57 57 #define __errno_entry(name, num, desc) #name, 58 58 59 static const char *err_name[] = {59 static const char *err_name[] = { 60 60 #include <abi/errno.in> 61 61 }; … … 64 64 #define __errno_entry(name, num, desc) "[" #name "]" desc, 65 65 66 static const char *err_desc[] = {66 static const char *err_desc[] = { 67 67 #include <abi/errno.in> 68 68 }; -
uspace/lib/c/generic/task.c
r47b2d7e3 r1433ecda 346 346 * @param wait task_wait_t previously initialized by task_setup_wait. 347 347 */ 348 void task_cancel_wait(task_wait_t *wait) { 348 void task_cancel_wait(task_wait_t *wait) 349 { 349 350 async_forget(wait->aid); 350 351 } -
uspace/lib/c/generic/thread.c
r47b2d7e3 r1433ecda 105 105 * @return Zero on success or a code from @ref errno.h on failure. 106 106 */ 107 errno_t thread_create(void (* 107 errno_t thread_create(void (*function)(void *), void *arg, const char *name, 108 108 thread_id_t *tid) 109 109 { … … 157 157 158 158 /* Unreachable */ 159 while (1); 159 while (1) 160 ; 160 161 } 161 162 -
uspace/lib/c/generic/vfs/canonify.c
r47b2d7e3 r1433ecda 119 119 typedef struct { 120 120 state_t s; 121 void (* 121 void (*f)(token_t *, token_t *, token_t *); 122 122 } change_state_t; 123 123 -
uspace/lib/c/generic/vfs/vfs.c
r47b2d7e3 r1433ecda 1317 1317 *pos += cnt; 1318 1318 rc = vfs_write_short(file, *pos, bp, nbyte - nwr, &cnt); 1319 } while (rc == EOK && ((ssize_t 1319 } while (rc == EOK && ((ssize_t)nbyte - nwr - cnt) > 0); 1320 1320 1321 1321 if (rc != EOK) { -
uspace/lib/c/include/atomicdflt.h
r47b2d7e3 r1433ecda 37 37 38 38 #ifndef LIBC_ARCH_ATOMIC_H_ 39 39 #error This file cannot be included directly, include atomic.h instead. 40 40 #endif 41 41 -
uspace/lib/c/include/byteorder.h
r47b2d7e3 r1433ecda 39 39 40 40 #if !(defined(__BE__) ^ defined(__LE__)) 41 41 #error The architecture must be either big-endian or little-endian. 42 42 #endif 43 43 -
uspace/lib/c/include/ddi.h
r47b2d7e3 r1433ecda 69 69 70 70 typedef void (*trace_fnc)(const volatile void *place, uint64_t val, 71 volatile void *base, size_t size, void *data, bool write);71 volatile void *base, size_t size, void *data, bool write); 72 72 73 73 extern errno_t pio_trace_enable(void *, size_t, trace_fnc, void *); -
uspace/lib/c/include/getopt.h
r47b2d7e3 r1433ecda 61 61 extern int optreset; 62 62 63 int getopt_long(int, char * 63 int getopt_long(int, char *const *, const char *, 64 64 const struct option *, int *); 65 65 66 66 /* HelenOS Port : Expose legacy getopt() */ 67 int getopt(int, char * 67 int getopt(int, char *const [], const char *); 68 68 69 69 #endif /* !_GETOPT_H_ */ -
uspace/lib/c/include/io/pixelmap.h
r47b2d7e3 r1433ecda 81 81 82 82 static inline void pixelmap_put_pixel( 83 pixelmap_t * 83 pixelmap_t *pixelmap, 84 84 sysarg_t x, 85 85 sysarg_t y, … … 112 112 x %= pixmap->width; 113 113 y %= pixmap->height; 114 } 115 else if (extend == PIXELMAP_EXTEND_SIDES || 114 } else if (extend == PIXELMAP_EXTEND_SIDES || 116 115 extend == PIXELMAP_EXTEND_TRANSPARENT_SIDES) { 117 116 bool transparent_outside = … … 120 119 x = 0; 121 120 transparent = transparent_outside; 122 } 123 else if (((sysarg_t) x) >= pixmap->width) { 121 } else if (((sysarg_t) x) >= pixmap->width) { 124 122 x = pixmap->width - 1; 125 123 transparent = transparent_outside; … … 129 127 y = 0; 130 128 transparent = transparent_outside; 131 } 132 else if (((sysarg_t) y) >= pixmap->height) { 129 } else if (((sysarg_t) y) >= pixmap->height) { 133 130 y = pixmap->height - 1; 134 131 transparent = transparent_outside; -
uspace/lib/c/include/ipc/devman.h
r47b2d7e3 r1433ecda 112 112 113 113 while (link != &ids->ids.head) { 114 mid = list_get_instance(link, match_id_t, link);114 mid = list_get_instance(link, match_id_t, link); 115 115 if (mid->score < id->score) { 116 116 break; -
uspace/lib/c/include/nic/nic.h
r47b2d7e3 r1433ecda 444 444 * @return true or false 445 445 */ 446 static inline int nic_wv_is_multi(nic_wv_type_t type) { 446 static inline int nic_wv_is_multi(nic_wv_type_t type) 447 { 447 448 switch (type) { 448 449 case NIC_WV_FULL_MATCH: -
uspace/lib/c/include/stdio.h
r47b2d7e3 r1433ecda 44 44 45 45 #ifndef SEEK_SET 46 46 #define SEEK_SET 0 47 47 #endif 48 48 49 49 #ifndef SEEK_CUR 50 50 #define SEEK_CUR 1 51 51 #endif 52 52 53 53 #ifndef SEEK_END 54 54 #define SEEK_END 2 55 55 #endif 56 56 … … 82 82 83 83 /* Formatted string output functions */ 84 extern int fprintf(FILE *, const char *, ...)84 extern int fprintf(FILE *, const char *, ...) 85 85 _HELENOS_PRINTF_ATTRIBUTE(2, 3); 86 86 extern int vfprintf(FILE *, const char *, va_list); … … 90 90 extern int vprintf(const char *, va_list); 91 91 92 extern int snprintf(char *, size_t 92 extern int snprintf(char *, size_t, const char *, ...) 93 93 _HELENOS_PRINTF_ATTRIBUTE(3, 4); 94 94 extern int vasprintf(char **, const char *, va_list); -
uspace/lib/c/include/unaligned.h
r47b2d7e3 r1433ecda 38 38 #include <stdint.h> 39 39 40 typedef int16_t unaligned_int16_t __attribute__ 41 typedef int32_t unaligned_int32_t __attribute__ 42 typedef int64_t unaligned_int64_t __attribute__ 40 typedef int16_t unaligned_int16_t __attribute__((aligned(1))); 41 typedef int32_t unaligned_int32_t __attribute__((aligned(1))); 42 typedef int64_t unaligned_int64_t __attribute__((aligned(1))); 43 43 44 typedef uint16_t unaligned_uint16_t __attribute__ 45 typedef uint32_t unaligned_uint32_t __attribute__ 46 typedef uint64_t unaligned_uint64_t __attribute__ 44 typedef uint16_t unaligned_uint16_t __attribute__((aligned(1))); 45 typedef uint32_t unaligned_uint32_t __attribute__((aligned(1))); 46 typedef uint64_t unaligned_uint64_t __attribute__((aligned(1))); 47 47 48 48 #endif
Note:
See TracChangeset
for help on using the changeset viewer.