Changeset bf61d3a in mainline for kernel/generic/src
- Timestamp:
- 2010-11-26T01:34:21Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 273b958
- Parents:
- 4b9a410 (diff), 7e752b2 (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. - Location:
- kernel/generic/src
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/cmd.c
r4b9a410 rbf61d3a 554 554 } 555 555 556 unsigned int _len = (unsigned int) len; 557 if ((_len != len) || (((int) _len) < 0)) { 558 printf("Command length overflow\n"); 559 return 1; 560 } 561 556 562 for (cur = cmd_head.next; cur != &cmd_head; cur = cur->next) { 557 563 cmd_info_t *hlp; … … 559 565 560 566 spinlock_lock(&hlp->lock); 561 printf("%-*s %s\n", len, hlp->name, hlp->description);567 printf("%-*s %s\n", _len, hlp->name, hlp->description); 562 568 spinlock_unlock(&hlp->lock); 563 569 } … … 668 674 fnc = (unative_t (*)(void)) arch_construct_function(&fptr, 669 675 (void *) symaddr, (void *) cmd_call0); 670 printf("Calling %s() (%p)\n", symbol, symaddr);676 printf("Calling %s() (%p)\n", symbol, (void *) symaddr); 671 677 printf("Result: %#" PRIxn "\n", fnc()); 672 678 interrupts_restore(ipl); … … 685 691 */ 686 692 687 size_t i;693 unsigned int i; 688 694 for (i = 0; i < config.cpu_count; i++) { 689 695 if (!cpus[i].active) … … 697 703 irq_spinlock_unlock(&thread->lock, true); 698 704 699 printf("cpu% " PRIs ": ", i);705 printf("cpu%u: ", i); 700 706 701 707 thread_ready(thread); … … 703 709 thread_detach(thread); 704 710 } else 705 printf("Unable to create thread for cpu% " PRIs "\n", i);711 printf("Unable to create thread for cpu%u\n", i); 706 712 } 707 713 … … 731 737 732 738 ipl = interrupts_disable(); 733 fnc = (unative_t (*)(unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call1); 734 printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol); 739 fnc = (unative_t (*)(unative_t, ...)) 740 arch_construct_function(&fptr, (void *) symaddr, 741 (void *) cmd_call1); 742 printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, 743 (void *) symaddr, symbol); 735 744 printf("Result: %#" PRIxn "\n", fnc(arg1)); 736 745 interrupts_restore(ipl); … … 765 774 766 775 ipl = interrupts_disable(); 767 fnc = (unative_t (*)(unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call2); 776 fnc = (unative_t (*)(unative_t, unative_t, ...)) 777 arch_construct_function(&fptr, (void *) symaddr, 778 (void *) cmd_call2); 768 779 printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n", 769 arg1, arg2, symaddr, symbol);780 arg1, arg2, (void *) symaddr, symbol); 770 781 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2)); 771 782 interrupts_restore(ipl); … … 800 811 801 812 ipl = interrupts_disable(); 802 fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) arch_construct_function(&fptr, (void *) symaddr, (void *) cmd_call3); 803 printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 804 arg1, arg2, arg3, symaddr, symbol); 813 fnc = (unative_t (*)(unative_t, unative_t, unative_t, ...)) 814 arch_construct_function(&fptr, (void *) symaddr, 815 (void *) cmd_call3); 816 printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 817 arg1, arg2, arg3, (void *) symaddr, symbol); 805 818 printf("Result: %#" PRIxn "\n", fnc(arg1, arg2, arg3)); 806 819 interrupts_restore(ipl); … … 875 888 876 889 if (rc == ENOENT) 877 printf("Symbol %s not found.\n", argv->buffer);890 printf("Symbol %s not found.\n", (char *) argv->buffer); 878 891 else if (rc == EINVAL) 879 892 printf("Invalid address.\n"); … … 884 897 if (pointer) 885 898 addr = *(uintptr_t *) addr; 886 printf("Writing %#" PRIx 64 " -> %p\n", arg1,addr);899 printf("Writing %#" PRIx32" -> %p\n", arg1, (void *) addr); 887 900 *(uint32_t *) addr = arg1; 888 901 } else … … 1172 1185 } 1173 1186 1187 unsigned int _len = (unsigned int) len; 1188 if ((_len != len) || (((int) _len) < 0)) { 1189 printf("Command length overflow\n"); 1190 return; 1191 } 1192 1174 1193 for (test = tests; test->name != NULL; test++) 1175 printf("%-*s %s%s\n", len, test->name, test->desc, (test->safe ? "" : " (unsafe)")); 1176 1177 printf("%-*s Run all safe tests\n", len, "*"); 1194 printf("%-*s %s%s\n", _len, test->name, test->desc, 1195 (test->safe ? "" : " (unsafe)")); 1196 1197 printf("%-*s Run all safe tests\n", _len, "*"); 1178 1198 } 1179 1199 -
kernel/generic/src/cpu/cpu.c
r4b9a410 rbf61d3a 107 107 void cpu_list(void) 108 108 { 109 size_t i;109 unsigned int i; 110 110 111 111 for (i = 0; i < config.cpu_count; i++) { -
kernel/generic/src/debug/debug.c
r4b9a410 rbf61d3a 52 52 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 53 53 &call_site_off) == EOK) 54 printf("%s +%" PRIp "->%s\n", call_site_sym, call_site_off,55 fn_sym);54 printf("%s()+%p->%s()\n", call_site_sym, 55 (void *) call_site_off, fn_sym); 56 56 else 57 printf("->%s \n", fn_sym);57 printf("->%s()\n", fn_sym); 58 58 } 59 59 … … 67 67 if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym, 68 68 &call_site_off) == EOK) 69 printf("%s +%" PRIp "<-%s\n", call_site_sym, call_site_off,70 fn_sym);69 printf("%s()+%p<-%s()\n", call_site_sym, 70 (void *) call_site_off, fn_sym); 71 71 else 72 printf("<-%s \n", fn_sym);72 printf("<-%s()\n", fn_sym); 73 73 } 74 74 -
kernel/generic/src/debug/panic.c
r4b9a410 rbf61d3a 42 42 #include <interrupt.h> 43 43 44 #define BANNER_LEFT "######>" 45 #define BANNER_RIGHT "<######" 46 44 47 void panic_common(panic_category_t cat, istate_t *istate, int access, 45 48 uintptr_t address, const char *fmt, ...) 46 49 { 47 50 va_list args; 48 51 49 52 silent = false; 50 51 printf("\n KERNEL PANIC ");53 54 printf("\n%s Kernel panic ", BANNER_LEFT); 52 55 if (CPU) 53 printf(" ON cpu%d", CPU->id);54 printf(" DUE TO");55 56 printf("on cpu%u ", CPU->id); 57 printf("due to "); 58 56 59 va_start(args, fmt); 57 60 if (cat == PANIC_ASSERT) { 58 printf(" A FAILED ASSERTION:\n");61 printf("a failed assertion: %s\n", BANNER_RIGHT); 59 62 vprintf(fmt, args); 60 63 printf("\n"); 61 64 } else if (cat == PANIC_BADTRAP) { 62 printf("BAD TRAP %ld.\n", address); 65 printf("bad trap %" PRIun ". %s\n", address, 66 BANNER_RIGHT); 63 67 if (fmt) { 64 68 vprintf(fmt, args); … … 66 70 } 67 71 } else if (cat == PANIC_MEMTRAP) { 68 printf(" A BAD MEMORY ACCESS WHILE");72 printf("a bad memory access while "); 69 73 if (access == PF_ACCESS_READ) 70 printf(" LOADING FROM");74 printf("loading from"); 71 75 else if (access == PF_ACCESS_WRITE) 72 printf(" STORING TO");76 printf("storing to"); 73 77 else if (access == PF_ACCESS_EXEC) 74 printf(" BRANCHING TO");78 printf("branching to"); 75 79 else 76 printf("REFERENCING"); 77 printf(" ADDRESS %p.\n", address); 80 printf("referencing"); 81 printf(" address %p. %s\n", (void *) address, 82 BANNER_RIGHT); 78 83 if (fmt) { 79 84 vprintf(fmt, args); … … 81 86 } 82 87 } else { 83 printf("THE FOLLOWING REASON:\n"); 88 printf("the following reason: %s\n", 89 BANNER_RIGHT); 84 90 vprintf(fmt, args); 85 91 printf("\n"); 86 92 } 87 93 va_end(args); 88 94 89 95 printf("\n"); 90 96 91 97 if (istate) { 92 98 istate_decode(istate); 93 99 printf("\n"); 94 100 } 95 101 96 102 stack_trace(); 97 103 halt(); -
kernel/generic/src/debug/stacktrace.c
r4b9a410 rbf61d3a 41 41 #define STACK_FRAMES_MAX 20 42 42 43 void 44 stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx) 43 void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx) 45 44 { 46 45 int cnt = 0; … … 54 53 if (ops->symbol_resolve && 55 54 ops->symbol_resolve(ctx->pc, &symbol, &offset)) { 56 57 printf("%p: %s +%" PRIp "()\n",58 ctx->fp, symbol,offset);55 if (offset) 56 printf("%p: %s()+%p\n", (void *) ctx->fp, 57 symbol, (void *) offset); 59 58 else 60 printf("%p: %s()\n", 61 ctx->fp, symbol); 62 } else { 63 printf("%p: %p()\n", ctx->fp, ctx->pc); 64 } 59 printf("%p: %s()\n", (void *) ctx->fp, symbol); 60 } else 61 printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc); 62 65 63 if (!ops->return_address_get(ctx, &pc)) 66 64 break; 65 67 66 if (!ops->frame_pointer_prev(ctx, &fp)) 68 67 break; 68 69 69 ctx->fp = fp; 70 70 ctx->pc = pc; -
kernel/generic/src/debug/symtab.c
r4b9a410 rbf61d3a 192 192 uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le); 193 193 char *realname = symbol_table[pos].symbol_name; 194 printf("%p: %s\n", addr, realname);194 printf("%p: %s\n", (void *) addr, realname); 195 195 pos++; 196 196 } -
kernel/generic/src/interrupt/interrupt.c
r4b9a410 rbf61d3a 176 176 printf("Task %s (%" PRIu64 ") killed due to an exception at " 177 177 "program counter %p.\n", TASK->name, TASK->taskid, 178 istate_get_pc(istate));178 (void *) istate_get_pc(istate)); 179 179 180 180 stack_trace_istate(istate); -
kernel/generic/src/ipc/ipc.c
r4b9a410 rbf61d3a 702 702 for (i = 0; i < IPC_MAX_PHONES; i++) { 703 703 if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) { 704 printf("% d: mutex busy\n", i);704 printf("%zu: mutex busy\n", i); 705 705 continue; 706 706 } 707 707 708 708 if (task->phones[i].state != IPC_PHONE_FREE) { 709 printf("% " PRIs ": ", i);709 printf("%zu: ", i); 710 710 711 711 switch (task->phones[i].state) { -
kernel/generic/src/main/kinit.c
r4b9a410 rbf61d3a 129 129 * For each CPU, create its load balancing thread. 130 130 */ 131 size_t i;131 unsigned int i; 132 132 133 133 for (i = 0; i < config.cpu_count; i++) { … … 139 139 thread_ready(thread); 140 140 } else 141 printf("Unable to create kcpulb thread for cpu " PRIs "\n", i);141 printf("Unable to create kcpulb thread for cpu%u\n", i); 142 142 } 143 143 } … … 179 179 for (i = 0; i < init.cnt; i++) { 180 180 if (init.tasks[i].addr % FRAME_SIZE) { 181 printf("init[% " PRIs "].addr is not frame aligned\n", i);181 printf("init[%zu].addr is not frame aligned\n", i); 182 182 programs[i].task = NULL; 183 183 continue; … … 219 219 220 220 if (rd != RE_OK) 221 printf("Init binary % " PRIs "not used (error %d)\n", i, rd);221 printf("Init binary %zu not used (error %d)\n", i, rd); 222 222 } 223 223 } -
kernel/generic/src/main/main.c
r4b9a410 rbf61d3a 183 183 version_print(); 184 184 185 LOG("\nconfig.base=%p config.kernel_size=% " PRIs186 "\nconfig.stack_base=%p config.stack_size=% " PRIs,185 LOG("\nconfig.base=%p config.kernel_size=%zu" 186 "\nconfig.stack_base=%p config.stack_size=%zu", 187 187 config.base, config.kernel_size, config.stack_base, 188 188 config.stack_size); … … 225 225 slab_enable_cpucache(); 226 226 227 printf("Detected % " PRIs " CPU(s), %" PRIu64" MiB free memory\n",227 printf("Detected %u CPU(s), %" PRIu64 " MiB free memory\n", 228 228 config.cpu_count, SIZE2MB(zones_total_size())); 229 229 … … 241 241 size_t i; 242 242 for (i = 0; i < init.cnt; i++) 243 LOG("init[%" PRIs "].addr=%p, init[%" PRIs 244 "].size=%" PRIs, i, init.tasks[i].addr, i, 245 init.tasks[i].size); 243 LOG("init[%zu].addr=%p, init[%zu].size=%zu", 244 i, init.tasks[i].addr, i, init.tasks[i].size); 246 245 } else 247 246 printf("No init binaries found.\n"); -
kernel/generic/src/mm/as.c
r4b9a410 rbf61d3a 1811 1811 } 1812 1812 1813 panic("Inconsistency detected while adding % " PRIs "pages of used "1814 "space at %p.", count, page);1813 panic("Inconsistency detected while adding %zu pages of used " 1814 "space at %p.", count, (void *) page); 1815 1815 } 1816 1816 … … 1991 1991 1992 1992 error: 1993 panic("Inconsistency detected while removing % " PRIs "pages of used "1994 "space from %p.", count, page);1993 panic("Inconsistency detected while removing %zu pages of used " 1994 "space from %p.", count, (void *) page); 1995 1995 } 1996 1996 … … 2105 2105 2106 2106 mutex_lock(&area->lock); 2107 printf("as_area: %p, base=%p, pages=%" PRIs 2108 " (%p - %p)\n", area, area->base, area->pages, 2109 area->base, area->base + FRAMES2SIZE(area->pages)); 2107 printf("as_area: %p, base=%p, pages=%zu" 2108 " (%p - %p)\n", area, (void *) area->base, 2109 area->pages, (void *) area->base, 2110 (void *) (area->base + FRAMES2SIZE(area->pages))); 2110 2111 mutex_unlock(&area->lock); 2111 2112 } -
kernel/generic/src/mm/frame.c
r4b9a410 rbf61d3a 145 145 (!iswithin(zones.info[i].base, zones.info[i].count, 146 146 base, count))) { 147 printf("Zone (%p, %p) overlaps with previous zone (%p, %p)!\n", 148 PFN2ADDR(base), PFN2ADDR(count), 149 PFN2ADDR(zones.info[i].base), 150 PFN2ADDR(zones.info[i].count)); 147 printf("Zone (%p, %p) overlaps " 148 "with previous zone (%p %p)!\n", 149 (void *) PFN2ADDR(base), (void *) PFN2ADDR(count), 150 (void *) PFN2ADDR(zones.info[i].base), 151 (void *) PFN2ADDR(zones.info[i].count)); 151 152 } 152 153 … … 1049 1050 1050 1051 #ifdef CONFIG_DEBUG 1051 printf("Thread %" PRIu64 " waiting for % " PRIs "frames, "1052 "% " PRIs "available.\n", THREAD->tid, size, avail);1052 printf("Thread %" PRIu64 " waiting for %zu frames, " 1053 "%zu available.\n", THREAD->tid, size, avail); 1053 1054 #endif 1054 1055 … … 1297 1298 bool available = zone_flags_available(flags); 1298 1299 1299 printf("%-4 " PRIs, i);1300 printf("%-4zu", i); 1300 1301 1301 1302 #ifdef __32_BITS__ 1302 printf(" % 10p",base);1303 printf(" %p", (void *) base); 1303 1304 #endif 1304 1305 1305 1306 #ifdef __64_BITS__ 1306 printf(" % 18p",base);1307 printf(" %p", (void *) base); 1307 1308 #endif 1308 1309 1309 printf(" %12 " PRIs "%c%c%c ", count,1310 printf(" %12zu %c%c%c ", count, 1310 1311 available ? 'A' : ' ', 1311 1312 (flags & ZONE_RESERVED) ? 'R' : ' ', … … 1313 1314 1314 1315 if (available) 1315 printf("%14 " PRIs " %14" PRIs,1316 printf("%14zu %14zu", 1316 1317 free_count, busy_count); 1317 1318 … … 1354 1355 bool available = zone_flags_available(flags); 1355 1356 1356 printf("Zone number: % " PRIs "\n", znum);1357 printf("Zone base address: %p\n", base);1358 printf("Zone size: % " PRIs " frames (%" PRIs "KiB)\n", count,1357 printf("Zone number: %zu\n", znum); 1358 printf("Zone base address: %p\n", (void *) base); 1359 printf("Zone size: %zu frames (%zu KiB)\n", count, 1359 1360 SIZE2KB(FRAMES2SIZE(count))); 1360 1361 printf("Zone flags: %c%c%c\n", … … 1364 1365 1365 1366 if (available) { 1366 printf("Allocated space: % " PRIs " frames (%" PRIs "KiB)\n",1367 printf("Allocated space: %zu frames (%zu KiB)\n", 1367 1368 busy_count, SIZE2KB(FRAMES2SIZE(busy_count))); 1368 printf("Available space: % " PRIs " frames (%" PRIs "KiB)\n",1369 printf("Available space: %zu frames (%zu KiB)\n", 1369 1370 free_count, SIZE2KB(FRAMES2SIZE(free_count))); 1370 1371 } -
kernel/generic/src/mm/slab.c
r4b9a410 rbf61d3a 890 890 irq_spinlock_unlock(&slab_cache_lock, true); 891 891 892 printf("%-18s %8 " PRIs " %8u %8" PRIs "%8ld %8ld %8ld %-5s\n",892 printf("%-18s %8zu %8u %8zu %8ld %8ld %8ld %-5s\n", 893 893 name, size, (1 << order), objects, allocated_slabs, 894 894 cached_objs, allocated_objs, -
kernel/generic/src/printf/printf_core.c
r4b9a410 rbf61d3a 83 83 PrintfQualifierLong, 84 84 PrintfQualifierLongLong, 85 PrintfQualifierPointer 85 PrintfQualifierPointer, 86 PrintfQualifierSize 86 87 } qualifier_t; 87 88 … … 553 554 * - "" Signed or unsigned int (default value).@n 554 555 * - "l" Signed or unsigned long int.@n 555 * If conversion is "c", the character is w char_t (wide character).@n556 * If conversion is "c", the character is wint_t (wide character).@n 556 557 * If conversion is "s", the string is wchar_t * (wide string).@n 557 558 * - "ll" Signed or unsigned long long int.@n 559 * - "z" Signed or unsigned ssize_t or site_t.@n 558 560 * 559 561 * CONVERSION:@n … … 737 739 } 738 740 break; 741 case 'z': 742 qualifier = PrintfQualifierSize; 743 i = nxt; 744 uc = str_decode(fmt, &nxt, STR_NO_LIMIT); 745 break; 739 746 default: 740 747 /* Default type */ … … 764 771 case 'c': 765 772 if (qualifier == PrintfQualifierLong) 766 retval = print_wchar(va_arg(ap, w char_t), width, flags, ps);773 retval = print_wchar(va_arg(ap, wint_t), width, flags, ps); 767 774 else 768 775 retval = print_char(va_arg(ap, unsigned int), width, flags, ps); … … 850 857 precision = size << 1; 851 858 number = (uint64_t) (uintptr_t) va_arg(ap, void *); 859 break; 860 case PrintfQualifierSize: 861 size = sizeof(size_t); 862 number = (uint64_t) va_arg(ap, size_t); 852 863 break; 853 864 default: -
kernel/generic/src/proc/program.c
r4b9a410 rbf61d3a 145 145 146 146 program_loader = image_addr; 147 LOG("Registered program loader at 0x%" PRIp,148 image_addr);147 LOG("Registered program loader at %p", 148 (void *) image_addr); 149 149 150 150 return EOK; -
kernel/generic/src/proc/scheduler.c
r4b9a410 rbf61d3a 727 727 irq_spinlock_lock(&cpus[cpu].lock, true); 728 728 729 printf("cpu%u: address=%p, nrdy=% ld, needs_relink=%" PRIs "\n",729 printf("cpu%u: address=%p, nrdy=%" PRIua ", needs_relink=%zu\n", 730 730 cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), 731 731 cpus[cpu].needs_relink); -
kernel/generic/src/proc/task.c
r4b9a410 rbf61d3a 478 478 #ifdef __32_BITS__ 479 479 if (*additional) 480 printf("%-8" PRIu64 " %9 lu %7lu", task->taskid,480 printf("%-8" PRIu64 " %9" PRIua " %7" PRIua, task->taskid, 481 481 atomic_get(&task->refcount), atomic_get(&task->active_calls)); 482 482 else … … 489 489 #ifdef __64_BITS__ 490 490 if (*additional) 491 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9lu %7lu", 491 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c " 492 "%9" PRIua " %7" PRIua, 492 493 task->taskid, ucycles, usuffix, kcycles, ksuffix, 493 494 atomic_get(&task->refcount), atomic_get(&task->active_calls)); … … 501 502 for (i = 0; i < IPC_MAX_PHONES; i++) { 502 503 if (task->phones[i].callee) 503 printf(" % " PRIs ":%p", i, task->phones[i].callee);504 printf(" %zu:%p", i, task->phones[i].callee); 504 505 } 505 506 printf("\n"); -
kernel/generic/src/synch/spinlock.c
r4b9a410 rbf61d3a 102 102 103 103 if (i++ > DEADLOCK_THRESHOLD) { 104 printf("cpu%u: looping on spinlock % " PRIp ":%s, "105 "caller=% " PRIp "(%s)\n", CPU->id, lock, lock->name,106 CALLER, symtab_fmt_name_lookup(CALLER));104 printf("cpu%u: looping on spinlock %p:%s, " 105 "caller=%p (%s)\n", CPU->id, lock, lock->name, 106 (void *) CALLER, symtab_fmt_name_lookup(CALLER)); 107 107 108 108 i = 0; -
kernel/generic/src/sysinfo/sysinfo.c
r4b9a410 rbf61d3a 494 494 break; 495 495 case SYSINFO_VAL_DATA: 496 printf("+ %s (% " PRIs"bytes)\n", cur->name,496 printf("+ %s (%zu bytes)\n", cur->name, 497 497 cur->val.data.size); 498 498 break; … … 505 505 /* N.B.: No data was actually returned (only a dry run) */ 506 506 (void) cur->val.fn_data(cur, &size, true); 507 printf("+ %s (% " PRIs"bytes) [generated]\n", cur->name,507 printf("+ %s (%zu bytes) [generated]\n", cur->name, 508 508 size); 509 509 break;
Note:
See TracChangeset
for help on using the changeset viewer.