Changeset 280a27e in mainline
- Timestamp:
- 2006-04-16T13:16:44Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 50de918
- Parents:
- c624b96
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/src/debugger.c
rc624b96 r280a27e 106 106 if (breakpoints[i].address) { 107 107 symbol = get_symtab_entry(breakpoints[i].address); 108 printf("%d. 0x%p in %s\n",i,108 printf("%d. %p in %s\n",i, 109 109 breakpoints[i].address, symbol); 110 110 printf(" Count(%d) ", breakpoints[i].counter); -
arch/amd64/src/interrupt.c
rc624b96 r280a27e 52 52 53 53 printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n, __FUNCTION__); 54 printf("%%rip: % Q(%s)\n",istate->rip, symbol);55 printf("ERROR_WORD=% Q\n", istate->error_word);56 printf("%%rcs=% Q, flags=%Q, %%cr0=%Q\n", istate->cs, istate->rflags,read_cr0());57 printf("%%rax=% Q, %%rcx=%Q, %%rdx=%Q\n",istate->rax,istate->rcx,istate->rdx);58 printf("%%rsi=% Q, %%rdi=%Q, %%r8 =%Q\n",istate->rsi,istate->rdi,istate->r8);59 printf("%%r9 =% Q, %%r10 =%Q, %%r11=%Q\n",istate->r9,istate->r10,istate->r11);54 printf("%%rip: %#llX (%s)\n",istate->rip, symbol); 55 printf("ERROR_WORD=%#llX\n", istate->error_word); 56 printf("%%rcs=%#llX, flags=%#llX, %%cr0=%#llX\n", istate->cs, istate->rflags,read_cr0()); 57 printf("%%rax=%#llX, %%rcx=%#llX, %%rdx=%#llX\n",istate->rax,istate->rcx,istate->rdx); 58 printf("%%rsi=%#llX, %%rdi=%#llX, %%r8 =%#llX\n",istate->rsi,istate->rdi,istate->r8); 59 printf("%%r9 =%#llX, %%r10 =%#llX, %%r11=%#llX\n",istate->r9,istate->r10,istate->r11); 60 60 #ifdef CONFIG_DEBUG_ALLREGS 61 printf("%%r12=% Q, %%r13=%Q, %%r14=%Q\n",istate->r12,istate->r13,istate->r14);62 printf("%%r15=% Q, %%rbx=%Q, %%rbp=%Q\n",istate->r15,istate->rbx,&istate->rbp);61 printf("%%r12=%#llX, %%r13=%#llX, %%r14=%#llX\n",istate->r12,istate->r13,istate->r14); 62 printf("%%r15=%#llX, %%rbx=%#llX, %%rbp=%#llX\n",istate->r15,istate->rbx,&istate->rbp); 63 63 #endif 64 printf("%%rsp=% Q\n",&istate->stack[0]);64 printf("%%rsp=%#llX\n",&istate->stack[0]); 65 65 } 66 66 -
arch/amd64/src/mm/memory_init.c
rc624b96 r280a27e 46 46 47 47 for (i=0;i<e820counter;i++) { 48 printf("E820 base: % Q size: %Qtype: ", e820table[i].base_address, e820table[i].size);48 printf("E820 base: %#llX size: %#llX type: ", e820table[i].base_address, e820table[i].size); 49 49 switch (e820table[i].type) { 50 50 case MEMMAP_MEMORY_AVAILABLE: -
arch/ia32/Makefile.inc
rc624b96 r280a27e 103 103 endif 104 104 105 ## Compile with support for software integer division. 106 # 107 108 CONFIG_SOFTINT = y 109 105 110 ARCH_SOURCES = \ 106 111 arch/$(ARCH)/src/context.s \ -
arch/ia32/src/interrupt.c
rc624b96 r280a27e 62 62 printf("----------------EXCEPTION OCCURED----------------\n"); 63 63 64 printf("%%eip: % X (%s)\n",istate->eip,symbol);65 printf("ERROR_WORD=% X\n", istate->error_word);66 printf("%%cs=% X,flags=%X\n", istate->cs, istate->eflags);67 printf("%%eax=% X, %%ecx=%X, %%edx=%X, %%esp=%X\n", istate->eax,istate->ecx,istate->edx,&istate->stack[0]);64 printf("%%eip: %#X (%s)\n",istate->eip,symbol); 65 printf("ERROR_WORD=%#X\n", istate->error_word); 66 printf("%%cs=%#X,flags=%#X\n", istate->cs, istate->eflags); 67 printf("%%eax=%#X, %%ecx=%#X, %%edx=%#X, %%esp=%#X\n", istate->eax,istate->ecx,istate->edx,&istate->stack[0]); 68 68 #ifdef CONFIG_DEBUG_ALLREGS 69 printf("%%esi=% X, %%edi=%X, %%ebp=%X, %%ebx=%X\n", istate->esi,istate->edi,istate->ebp,istate->ebx);69 printf("%%esi=%#X, %%edi=%#X, %%ebp=%#X, %%ebx=%#X\n", istate->esi,istate->edi,istate->ebp,istate->ebx); 70 70 #endif 71 printf("stack: % X, %X, %X, %X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]);72 printf(" % X, %X, %X, %X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]);71 printf("stack: %#X, %#X, %#X, %#X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); 72 printf(" %#X, %#X, %#X, %#X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); 73 73 } 74 74 … … 101 101 :"=m"(mxcsr) 102 102 ); 103 printf("MXCSR: % X\n",(__native)(mxcsr));103 printf("MXCSR: %#zX\n",(__native)(mxcsr)); 104 104 panic("SIMD FP exception(19)\n"); 105 105 } … … 121 121 if (!as_page_fault(page)) { 122 122 PRINT_INFO_ERRCODE(istate); 123 printf("page fault address: % X\n", page);123 printf("page fault address: %#X\n", page); 124 124 panic("page fault\n"); 125 125 } -
arch/ia32/src/mm/frame.c
rc624b96 r280a27e 92 92 else 93 93 name = "invalid"; 94 printf("%P % QB %s\n",94 printf("%P %#llXB %s\n", 95 95 (__native) e820table[i].base_address, 96 96 (__u64) e820table[i].size, -
arch/ia32/src/mm/memory_init.c
rc624b96 r280a27e 46 46 47 47 for (i=0;i<e820counter;i++) { 48 printf("E820 base: % Q size: %Qtype: ", e820table[i].base_address, e820table[i].size);48 printf("E820 base: %#llX size: %lld type: ", e820table[i].base_address, e820table[i].size); 49 49 switch (e820table[i].type) { 50 50 case MEMMAP_MEMORY_AVAILABLE: -
arch/ia32/src/smp/apic.c
rc624b96 r280a27e 413 413 414 414 tm.value = l_apic[LVT_Tm]; 415 printf("LVT Tm: vector=% B, %s, %s, %s\n", tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], tm_mode_str[tm.mode]);415 printf("LVT Tm: vector=%hhd, %s, %s, %s\n", tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], tm_mode_str[tm.mode]); 416 416 lint.value = l_apic[LVT_LINT0]; 417 printf("LVT LINT0: vector=% B, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]);417 printf("LVT LINT0: vector=%hhd, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); 418 418 lint.value = l_apic[LVT_LINT1]; 419 printf("LVT LINT1: vector=% B, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]);419 printf("LVT LINT1: vector=%hhd, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); 420 420 error.value = l_apic[LVT_Err]; 421 printf("LVT Err: vector=% B, %s, %s\n", error.vector, delivs_str[error.delivs], mask_str[error.masked]);421 printf("LVT Err: vector=%hhd, %s, %s\n", error.vector, delivs_str[error.delivs], mask_str[error.masked]); 422 422 #endif 423 423 } -
arch/ia64/src/interrupt.c
rc624b96 r280a27e 133 133 printf("Interrupted context dump:\n"); 134 134 printf("ar.bsp=%P\tar.bspstore=%P\n", istate->ar_bsp, istate->ar_bspstore); 135 printf("ar.rnat=% Q\tar.rsc=%Q\n", istate->ar_rnat, istate->ar_rsc);136 printf("ar.ifs=% Q\tar.pfs=%Q\n", istate->ar_ifs, istate->ar_pfs);137 printf("cr.isr=% Q\tcr.ipsr=%Q\t\n", istate->cr_isr.value, istate->cr_ipsr);135 printf("ar.rnat=%#llX\tar.rsc=%$llX\n", istate->ar_rnat, istate->ar_rsc); 136 printf("ar.ifs=%#llX\tar.pfs=%#llX\n", istate->ar_ifs, istate->ar_pfs); 137 printf("cr.isr=%#llX\tcr.ipsr=%#llX\t\n", istate->cr_isr.value, istate->cr_ipsr); 138 138 139 printf("cr.iip=% Q, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?");140 printf("cr.iipa=% Q\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?");141 printf("cr.ifa=% Q\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?");139 printf("cr.iip=%#llX, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?"); 140 printf("cr.iipa=%#llX\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?"); 141 printf("cr.ifa=%#llX\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?"); 142 142 } 143 143 … … 183 183 #else 184 184 dump_interrupted_context(istate); 185 panic("Interruption: % W(%s)\n", (__u16) vector, vector_to_string(vector));185 panic("Interruption: %#hX (%s)\n", (__u16) vector, vector_to_string(vector)); 186 186 #endif 187 187 } … … 218 218 { 219 219 dump_interrupted_context(istate); 220 panic("Interruption: % W(%s)\n", (__u16) vector, vector_to_string(vector));220 panic("Interruption: %#hX (%s)\n", (__u16) vector, vector_to_string(vector)); 221 221 } 222 222 -
arch/mips32/Makefile.inc
rc624b96 r280a27e 107 107 endif 108 108 109 ## Compile with support for software integer division. 110 # 111 112 CONFIG_SOFTINT = y 113 109 114 110 115 ARCH_SOURCES = \ -
arch/mips32/src/debugger.c
rc624b96 r280a27e 243 243 if (breakpoints[i].address) { 244 244 symbol = get_symtab_entry(breakpoints[i].address); 245 printf("%d. 0x%p in %s\n",i,245 printf("%d. %p in %s\n",i, 246 246 breakpoints[i].address, symbol); 247 247 printf(" Count(%d) ", breakpoints[i].counter); … … 329 329 330 330 if (!(cur->flags & BKPOINT_FUNCCALL)) 331 printf("***Breakpoint %d: 0x%p in %s.\n", i,331 printf("***Breakpoint %d: %p in %s.\n", i, 332 332 fireaddr, get_symtab_entry(istate->epc)); 333 333 … … 342 342 cur->flags |= BKPOINT_INPROG; 343 343 } else { 344 printf("***Breakpoint 0x%p in %s.\n", fireaddr,344 printf("***Breakpoint %p in %s.\n", fireaddr, 345 345 get_symtab_entry(fireaddr)); 346 346 /* Move on to next instruction */ -
arch/mips32/src/exception.c
rc624b96 r280a27e 74 74 rasymbol = s; 75 75 76 printf("PC: % X(%s) RA: %X(%s), SP(%P)\n",istate->epc,pcsymbol,76 printf("PC: %#X(%s) RA: %#X(%s), SP(%P)\n",istate->epc,pcsymbol, 77 77 istate->ra,rasymbol, istate->sp); 78 78 } -
arch/mips32/src/mm/tlb.c
rc624b96 r280a27e 410 410 lo1.value = cp0_entry_lo1_read(); 411 411 412 printf("%d: asid=%d, vpn2=%d, mask=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=% B, pfn[0]=%d\n"413 "\t\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=% B, pfn[1]=%d\n",412 printf("%d: asid=%d, vpn2=%d, mask=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=%hhd, pfn[0]=%d\n" 413 "\t\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=%hhd, pfn[1]=%d\n", 414 414 i, hi.asid, hi.vpn2, mask.mask, lo0.g, lo0.v, lo0.d, lo0.c, lo0.pfn, 415 415 lo1.g, lo1.v, lo1.d, lo1.c, lo1.pfn); -
arch/ppc32/Makefile.inc
rc624b96 r280a27e 56 56 DEFS += -DCONFIG_PAGE_PT 57 57 58 ## Compile with support for software integer division. 59 # 60 61 CONFIG_SOFTINT = y 62 58 63 ARCH_SOURCES = \ 59 64 arch/$(ARCH)/src/console.c \ -
arch/ppc32/src/mm/memory_init.c
rc624b96 r280a27e 44 44 45 45 for (i = 0; i < bootinfo.memmap.count; i++) 46 printf("base: % L size: %L\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size);46 printf("base: %#X size: %#X\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); 47 47 } -
arch/ppc64/src/mm/memory_init.c
rc624b96 r280a27e 44 44 45 45 for (i = 0; i < bootinfo.memmap.count; i++) 46 printf("base: % L size: %L\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size);46 printf("base: %P size: %#X\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); 47 47 } -
arch/sparc64/src/mm/tlb.c
rc624b96 r280a27e 202 202 t.value = itlb_tag_read_read(i); 203 203 204 printf("%d: vpn=% Q, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%X, diag=%X, pfn=%X, soft=%X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n",204 printf("%d: vpn=%#llX, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#X, diag=%#X, pfn=%#X, soft=%#X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", 205 205 i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 206 206 } … … 211 211 t.value = dtlb_tag_read_read(i); 212 212 213 printf("%d: vpn=% Q, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%X, diag=%X, pfn=%X, soft=%X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n",213 printf("%d: vpn=%#llX, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#X, diag=%#X, pfn=%#X, soft=%#X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", 214 214 i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); 215 215 } -
genarch/include/softint/division.h
rc624b96 r280a27e 35 35 36 36 /* 64bit integer division */ 37 long __divdi3(long a,long b);37 long long __divdi3(long long a, long long b); 38 38 39 39 /* 32bit unsigned integer division */ … … 41 41 42 42 /* 64bit unsigned integer division */ 43 unsigned long __udivdi3(unsigned long a, unsignedlong b);43 unsigned long long __udivdi3(unsigned long long a, unsigned long long b); 44 44 45 45 /* 32bit remainder of the signed division */ … … 47 47 48 48 /* 64bit remainder of the signed division */ 49 long __moddi3(long a,long b);49 long long __moddi3(long long a, long long b); 50 50 51 51 /* 32bit remainder of the unsigned division */ … … 53 53 54 54 /* 64bit remainder of the unsigned division */ 55 unsigned long __umoddi3(unsigned long a, unsignedlong b);55 unsigned long long __umoddi3(unsigned long long a, unsigned long long b); 56 56 57 unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsignedlong *c);57 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c); 58 58 59 59 #endif -
genarch/src/acpi/acpi.c
rc624b96 r280a27e 97 97 goto next; 98 98 *signature_map[j].sdt_ptr = h; 99 printf("% P: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);99 printf("%#zX: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); 100 100 } 101 101 } … … 118 118 goto next; 119 119 *signature_map[j].sdt_ptr = h; 120 printf("% P: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);120 printf("%#zX: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); 121 121 } 122 122 } … … 152 152 153 153 rsdp_found: 154 printf("% P: ACPI Root System Description Pointer\n", acpi_rsdp);154 printf("%#zX: ACPI Root System Description Pointer\n", acpi_rsdp); 155 155 156 156 acpi_rsdt = (struct acpi_rsdt *) (__native) acpi_rsdp->rsdt_address; -
genarch/src/acpi/matd.c
rc624b96 r280a27e 177 177 case MADT_L_SAPIC: 178 178 case MADT_PLATFORM_INTR_SRC: 179 printf("MADT: skipping %s entry (type=% d)\n", entry[h->type], h->type);179 printf("MADT: skipping %s entry (type=%zd)\n", entry[h->type], h->type); 180 180 break; 181 181 182 182 default: 183 183 if (h->type >= MADT_RESERVED_SKIP_BEGIN && h->type <= MADT_RESERVED_SKIP_END) { 184 printf("MADT: skipping reserved entry (type=% d)\n", h->type);184 printf("MADT: skipping reserved entry (type=%zd)\n", h->type); 185 185 } 186 186 if (h->type >= MADT_RESERVED_OEM_BEGIN) { 187 printf("MADT: skipping OEM entry (type=% d)\n", h->type);187 printf("MADT: skipping OEM entry (type=%zd)\n", h->type); 188 188 } 189 189 break; … … 229 229 { 230 230 ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int)); 231 printf("MADT: ignoring %s entry: bus=% d, source=%d, global_int=%d, flags=%W\n",231 printf("MADT: ignoring %s entry: bus=%zd, source=%zd, global_int=%zd, flags=%#hX\n", 232 232 entry[override->header.type], override->bus, override->source, 233 233 override->global_int, override->flags); -
genarch/src/i8042/i8042.c
rc624b96 r280a27e 33 33 #include <arch/asm.h> 34 34 #include <arch.h> 35 #include <print.h>36 35 #include <synch/spinlock.h> 37 36 #include <typedefs.h> -
genarch/src/softint/division.c
rc624b96 r280a27e 66 66 67 67 68 static unsigned long divandmod64(unsigned long a, unsigned long b, unsignedlong *remainder)68 static unsigned long long divandmod64(unsigned long long a, unsigned long long b, unsigned long long *remainder) 69 69 { 70 unsigned long result;71 int steps = sizeof(unsigned long ) * 8;70 unsigned long long result; 71 int steps = sizeof(unsigned long long) * 8; 72 72 73 73 *remainder = 0; … … 112 112 113 113 /* 64bit integer division */ 114 long __divdi3(long a,long b)114 long long __divdi3(long long a, long long b) 115 115 { 116 unsigned long rem;117 long result;116 unsigned long long rem; 117 long long result; 118 118 119 result = (long )divandmod64(ABSVAL(a), ABSVAL(b), &rem);119 result = (long long)divandmod64(ABSVAL(a), ABSVAL(b), &rem); 120 120 121 121 if ( SGN(a) == SGN(b)) return result; … … 131 131 132 132 /* 64bit unsigned integer division */ 133 unsigned long __udivdi3(unsigned long a, unsignedlong b)133 unsigned long long __udivdi3(unsigned long long a, unsigned long long b) 134 134 { 135 unsigned long rem;135 unsigned long long rem; 136 136 return divandmod64(a, b, &rem); 137 137 } … … 152 152 153 153 /* 64bit remainder of the signed division */ 154 long __moddi3(long a,long b)154 long long __moddi3(long long a,long long b) 155 155 { 156 unsigned long rem;156 unsigned long long rem; 157 157 divandmod64(a, b, &rem); 158 158 159 159 /* if divident is negative, remainder must be too */ 160 160 if (!(SGN(a))) { 161 return -((long )rem);161 return -((long long)rem); 162 162 } 163 163 164 return (long )rem;164 return (long long)rem; 165 165 } 166 166 … … 174 174 175 175 /* 64bit remainder of the unsigned division */ 176 unsigned long __umoddi3(unsigned long a, unsignedlong b)176 unsigned long long __umoddi3(unsigned long long a, unsigned long long b) 177 177 { 178 unsigned long rem;178 unsigned long long rem; 179 179 divandmod64(a, b, &rem); 180 180 return rem; 181 181 } 182 182 183 unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsignedlong *c)183 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c) 184 184 { 185 185 return divandmod64(a, b, c); -
generic/include/print.h
rc624b96 r280a27e 38 38 #define INT64 8 39 39 40 extern voidprintf(const char *fmt, ...);40 extern int printf(const char *fmt, ...); 41 41 42 42 /* We need this address in spinlock to avoid deadlock in deadlock detection */ 43 43 extern spinlock_t printflock; 44 44 45 #define EOF (-1) 46 45 47 #endif -
generic/src/adt/btree.c
rc624b96 r280a27e 946 946 printf("("); 947 947 for (i = 0; i < node->keys; i++) { 948 printf("% d%s", node->key[i], i < node->keys - 1 ? "," : "");948 printf("%lld%s", node->key[i], i < node->keys - 1 ? "," : ""); 949 949 if (node->depth && node->subtree[i]) { 950 950 list_append(&node->subtree[i]->bfs_link, &head); … … 968 968 printf("("); 969 969 for (i = 0; i < node->keys; i++) 970 printf("% d%s", node->key[i], i < node->keys - 1 ? "," : "");970 printf("%lld%s", node->key[i], i < node->keys - 1 ? "," : ""); 971 971 printf(")"); 972 972 } -
generic/src/console/cmd.c
rc624b96 r280a27e 459 459 } else { 460 460 symbol = get_symtab_entry(symaddr); 461 printf("Calling f(): 0x%p: %s\n", symaddr, symbol);461 printf("Calling f(): %p: %s\n", symaddr, symbol); 462 462 f = (__native (*)(void)) symaddr; 463 printf("Result: 0x%p\n", f());463 printf("Result: %p\n", f()); 464 464 } 465 465 … … 483 483 } else { 484 484 symbol = get_symtab_entry(symaddr); 485 printf("Calling f(0x% x): 0x%p: %s\n", arg1, symaddr, symbol);485 printf("Calling f(0x%zX): %p: %s\n", arg1, symaddr, symbol); 486 486 f = (__native (*)(__native,...)) symaddr; 487 printf("Result: 0x%p\n", f(arg1));487 printf("Result: %p\n", f(arg1)); 488 488 } 489 489 … … 508 508 } else { 509 509 symbol = get_symtab_entry(symaddr); 510 printf("Calling f(0x% x,0x%x): 0x%p: %s\n",510 printf("Calling f(0x%zx,0x%zx): %p: %s\n", 511 511 arg1, arg2, symaddr, symbol); 512 512 f = (__native (*)(__native,__native,...)) symaddr; 513 printf("Result: 0x%p\n", f(arg1, arg2));513 printf("Result: %p\n", f(arg1, arg2)); 514 514 } 515 515 … … 535 535 } else { 536 536 symbol = get_symtab_entry(symaddr); 537 printf("Calling f(0x% x,0x%x, 0x%x): 0x%p: %s\n",537 printf("Calling f(0x%zx,0x%zx, 0x%zx): %p: %s\n", 538 538 arg1, arg2, arg3, symaddr, symbol); 539 539 f = (__native (*)(__native,__native,__native,...)) symaddr; 540 printf("Result: 0x%p\n", f(arg1, arg2, arg3));540 printf("Result: %p\n", f(arg1, arg2, arg3)); 541 541 } 542 542 … … 599 599 if (pointer) 600 600 addr = (__u32 *)(*(__native *)addr); 601 printf("Writing 0x%x -> 0x%p\n", arg1, addr);601 printf("Writing 0x%x -> %p\n", arg1, addr); 602 602 *addr = arg1; 603 603 -
generic/src/debug/print.c
rc624b96 r280a27e 1 1 /* 2 2 * Copyright (C) 2001-2004 Jakub Jermar 3 * Copyright (C) 2006 Josef Cejka 3 4 * All rights reserved. 4 5 * … … 35 36 #include <arch.h> 36 37 37 static char digits[] = "0123456789abcdef"; /**< Hexadecimal characters */38 38 SPINLOCK_INITIALIZE(printflock); /**< printf spinlock */ 39 39 40 41 /** Print NULL terminated string 42 * 43 * Print characters from str using putchar() until 44 * \\0 character is reached. 45 * 46 * @param str Characters to print. 40 #define __PRINTF_FLAG_PREFIX 0x00000001 /* show prefixes 0x or 0*/ 41 #define __PRINTF_FLAG_SIGNED 0x00000002 /* signed / unsigned number */ 42 #define __PRINTF_FLAG_ZEROPADDED 0x00000004 /* print leading zeroes */ 43 #define __PRINTF_FLAG_LEFTALIGNED 0x00000010 /* align to left */ 44 #define __PRINTF_FLAG_SHOWPLUS 0x00000020 /* always show + sign */ 45 #define __PRINTF_FLAG_SPACESIGN 0x00000040 /* print space instead of plus */ 46 #define __PRINTF_FLAG_BIGCHARS 0x00000080 /* show big characters */ 47 #define __PRINTF_FLAG_NEGATIVE 0x00000100 /* number has - sign */ 48 49 #define PRINT_NUMBER_BUFFER_SIZE (64+5) /* Buffer big enought for 64 bit number 50 * printed in base 2, sign, prefix and 51 * 0 to terminate string.. (last one is only for better testing 52 * end of buffer by zero-filling subroutine) 53 */ 54 typedef enum { 55 PrintfQualifierByte = 0, 56 PrintfQualifierShort, 57 PrintfQualifierInt, 58 PrintfQualifierLong, 59 PrintfQualifierLongLong, 60 PrintfQualifierNative, 61 PrintfQualifierPointer 62 } qualifier_t; 63 64 static char digits_small[] = "0123456789abcdef"; /* Small hexadecimal characters */ 65 static char digits_big[] = "0123456789ABCDEF"; /* Big hexadecimal characters */ 66 67 static inline int isdigit(int c) 68 { 69 return ((c >= '0' )&&( c <= '9')); 70 } 71 72 static __native strlen(const char *str) 73 { 74 __native counter = 0; 75 76 while (str[counter] != 0) { 77 counter++; 78 } 79 80 return counter; 81 } 82 83 /** Print one string without adding \n at end 84 * Dont use this function directly - printflock is not locked here 85 * */ 86 static int putstr(const char *str) 87 { 88 int count; 89 if (str == NULL) { 90 str = "(NULL)"; 91 } 92 93 for (count = 0; str[count] != 0; count++) { 94 putchar(str[count]); 95 } 96 return count; 97 } 98 99 /** Print count characters from buffer to output 47 100 * 48 101 */ 49 static void print_str(const char *str) 50 { 51 int i = 0; 52 char c; 53 char errstr[] = "(NULL)"; 54 55 if (str == NULL) { 56 while ((c = errstr[i++])) 57 putchar(c); 58 return; 59 } 60 61 while ((c = str[i++])) 62 putchar(c); 63 } 64 65 66 /** Print hexadecimal digits 67 * 68 * Print fixed count of hexadecimal digits from 69 * the number num. The digits are printed in 70 * natural left-to-right order starting with 71 * the width-th digit. 72 * 73 * @param num Number containing digits. 74 * @param width Count of digits to print. 75 * 102 static int putnchars(const char *buffer, __native count) 103 { 104 int i; 105 if (buffer == NULL) { 106 buffer = "(NULL)"; 107 count = 6; 108 } 109 110 for (i = 0; i < count; i++) { 111 putchar(buffer[i]); 112 } 113 114 return count; 115 } 116 117 /** Print one formatted character 118 * @param c character to print 119 * @param width 120 * @param flags 121 * @return number of printed characters or EOF 76 122 */ 77 static void print_fixed_hex(const __u64 num, const int width) 78 { 79 int i; 80 81 for (i = width*8 - 4; i >= 0; i -= 4) 82 putchar(digits[(num>>i) & 0xf]); 123 static int print_char(char c, int width, __u64 flags) 124 { 125 int counter = 0; 126 127 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { 128 while (--width > 0) { /* one space is consumed by character itself hence predecrement */ 129 /* FIXME: painful slow */ 130 putchar(' '); 131 ++counter; 132 } 133 } 134 135 putchar(c); 136 ++counter; 137 138 while (--width > 0) { /* one space is consumed by character itself hence predecrement */ 139 putchar(' '); 140 ++counter; 141 } 142 143 return counter; 144 } 145 146 /** Print one string 147 * @param s string 148 * @param width 149 * @param precision 150 * @param flags 151 * @return number of printed characters or EOF 152 */ 153 154 static int print_string(char *s, int width, int precision, __u64 flags) 155 { 156 int counter = 0; 157 __native size; 158 159 if (s == NULL) { 160 return putstr("(NULL)"); 161 } 162 163 size = strlen(s); 164 165 /* print leading spaces */ 166 167 if (precision == 0) 168 precision = size; 169 170 width -= precision; 171 172 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { 173 while (width-- > 0) { 174 putchar(' '); 175 counter++; 176 } 177 } 178 179 while (precision > size) { 180 precision--; 181 putchar(' '); 182 ++counter; 183 } 184 185 if (putnchars(s, precision) == EOF) { 186 return EOF; 187 } 188 189 counter += precision; 190 191 while (width-- > 0) { 192 putchar(' '); 193 ++counter; 194 } 195 196 return ++counter; 83 197 } 84 198 … … 90 204 * 91 205 * @param num Number to print. 206 * @param width 207 * @param precision 92 208 * @param base Base to print the number in (should 93 209 * be in range 2 .. 16). 210 * @param flags output modifiers 211 * @return number of written characters or EOF 94 212 * 95 213 */ 96 static void print_number(const __native num, const unsigned int base) 97 { 98 int val = num; 99 char d[sizeof(__native)*8+1]; /* this is good enough even for base == 2 */ 100 int i = sizeof(__native)*8-1; 101 102 do { 103 d[i--] = digits[val % base]; 104 } while (val /= base); 105 106 d[sizeof(__native)*8] = 0; 107 print_str(&d[i + 1]); 214 static int print_number(__u64 num, int width, int precision, int base , __u64 flags) 215 { 216 char *digits = digits_small; 217 char d[PRINT_NUMBER_BUFFER_SIZE]; /* this is good enough even for base == 2, prefix and sign */ 218 char *ptr = &d[PRINT_NUMBER_BUFFER_SIZE - 1]; 219 int size = 0; 220 int written = 0; 221 char sgn; 222 223 if (flags & __PRINTF_FLAG_BIGCHARS) 224 digits = digits_big; 225 226 *ptr-- = 0; /* Put zero at end of string */ 227 228 if (num == 0) { 229 *ptr-- = '0'; 230 size++; 231 } else { 232 do { 233 *ptr-- = digits[num % base]; 234 size++; 235 } while (num /= base); 236 } 237 238 /* Collect sum of all prefixes/signs/... to calculate padding and leading zeroes */ 239 if (flags & __PRINTF_FLAG_PREFIX) { 240 switch(base) { 241 case 2: /* Binary formating is not standard, but usefull */ 242 size += 2; 243 break; 244 case 8: 245 size++; 246 break; 247 case 16: 248 size += 2; 249 break; 250 } 251 } 252 253 sgn = 0; 254 if (flags & __PRINTF_FLAG_SIGNED) { 255 if (flags & __PRINTF_FLAG_NEGATIVE) { 256 sgn = '-'; 257 size++; 258 } else if (flags & __PRINTF_FLAG_SHOWPLUS) { 259 sgn = '+'; 260 size++; 261 } else if (flags & __PRINTF_FLAG_SPACESIGN) { 262 sgn = ' '; 263 size++; 264 } 265 } 266 267 if (flags & __PRINTF_FLAG_LEFTALIGNED) { 268 flags &= ~__PRINTF_FLAG_ZEROPADDED; 269 } 270 271 /* if number is leftaligned or precision is specified then zeropadding is ignored */ 272 if (flags & __PRINTF_FLAG_ZEROPADDED) { 273 if ((precision == 0) && (width > size)) { 274 precision = width - size; 275 } 276 } 277 278 /* print leading spaces */ 279 if (size > precision) /* We must print whole number not only a part */ 280 precision = size; 281 282 width -= precision; 283 284 if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { 285 while (width-- > 0) { 286 putchar(' '); 287 written++; 288 } 289 } 290 291 /* print sign */ 292 if (sgn) { 293 putchar(sgn); 294 written++; 295 } 296 297 /* print prefix */ 298 299 if (flags & __PRINTF_FLAG_PREFIX) { 300 switch(base) { 301 case 2: /* Binary formating is not standard, but usefull */ 302 putchar('0'); 303 if (flags & __PRINTF_FLAG_BIGCHARS) { 304 putchar('B'); 305 } else { 306 putchar('b'); 307 } 308 written += 2; 309 break; 310 case 8: 311 putchar('o'); 312 written++; 313 break; 314 case 16: 315 putchar('0'); 316 if (flags & __PRINTF_FLAG_BIGCHARS) { 317 putchar('X'); 318 } else { 319 putchar('x'); 320 } 321 written += 2; 322 break; 323 } 324 } 325 326 /* print leading zeroes */ 327 precision -= size; 328 while (precision-- > 0) { 329 putchar('0'); 330 written++; 331 } 332 333 334 /* print number itself */ 335 336 written += putstr(++ptr); 337 338 /* print ending spaces */ 339 340 while (width-- > 0) { 341 putchar(' '); 342 written++; 343 } 344 345 return written; 108 346 } 109 347 … … 165 403 * @param fmt Formatting NULL terminated string. 166 404 */ 167 void printf(const char *fmt, ...) 168 { 169 int irqpri, i = 0; 405 int printf(const char *fmt, ...) 406 { 407 int irqpri; 408 int i = 0, j = 0; /* i is index of currently processed char from fmt, j is index to the first not printed nonformating character */ 409 int end; 410 int counter; /* counter of printed characters */ 411 int retval; /* used to store return values from called functions */ 170 412 va_list ap; 171 char c; 413 char c; 414 qualifier_t qualifier; /* type of argument */ 415 int base; /* base in which will be parameter (numbers only) printed */ 416 __u64 number; /* argument value */ 417 __native size; /* byte size of integer parameter */ 418 int width, precision; 419 __u64 flags; 420 421 counter = 0; 172 422 173 423 va_start(ap, fmt); 174 424 175 425 irqpri = interrupts_disable(); 176 426 spinlock_lock(&printflock); 177 427 178 while ((c = fmt[i++])) { 179 switch (c) { 180 181 /* control character */ 182 case '%': 183 184 switch (c = fmt[i++]) { 185 186 /* percentile itself */ 187 case '%': 188 break; 189 190 /* 191 * String and character conversions. 192 */ 193 case 's': 194 print_str(va_arg(ap, char_ptr)); 195 goto loop; 196 197 case 'c': 198 c = (char) va_arg(ap, int); 199 break; 200 201 /* 202 * Hexadecimal conversions with fixed width. 203 */ 204 case 'P': 205 print_str("0x"); 206 case 'p': 207 print_fixed_hex(va_arg(ap, __native), sizeof(__native)); 208 goto loop; 209 210 case 'Q': 211 print_str("0x"); 212 case 'q': 213 print_fixed_hex(va_arg(ap, __u64), INT64); 214 goto loop; 215 216 case 'L': 217 print_str("0x"); 218 case 'l': 219 print_fixed_hex(va_arg(ap, __native), INT32); 220 goto loop; 221 222 case 'W': 223 print_str("0x"); 224 case 'w': 225 print_fixed_hex(va_arg(ap, __native), INT16); 226 goto loop; 227 228 case 'B': 229 print_str("0x"); 230 case 'b': 231 print_fixed_hex(va_arg(ap, __native), INT8); 232 goto loop; 233 234 /* 235 * Decimal and hexadecimal conversions. 236 */ 237 case 'd': 238 print_number(va_arg(ap, __native), 10); 239 goto loop; 240 241 case 'X': 242 print_str("0x"); 243 case 'x': 244 print_number(va_arg(ap, __native), 16); 245 goto loop; 246 247 /* 248 * Bad formatting. 249 */ 250 default: 428 429 while ((c = fmt[i])) { 430 /* control character */ 431 if (c == '%' ) { 432 /* print common characters if any processed */ 433 if (i > j) { 434 if ((retval = putnchars(&fmt[j], (__native)(i - j))) == EOF) { /* error */ 435 counter = -counter; 436 goto out; 437 } 438 counter += retval; 439 } 440 441 j = i; 442 /* parse modifiers */ 443 flags = 0; 444 end = 0; 445 446 do { 447 ++i; 448 switch (c = fmt[i]) { 449 case '#': flags |= __PRINTF_FLAG_PREFIX; break; 450 case '-': flags |= __PRINTF_FLAG_LEFTALIGNED; break; 451 case '+': flags |= __PRINTF_FLAG_SHOWPLUS; break; 452 case ' ': flags |= __PRINTF_FLAG_SPACESIGN; break; 453 case '0': flags |= __PRINTF_FLAG_ZEROPADDED; break; 454 default: end = 1; 455 }; 456 457 } while (end == 0); 458 459 /* width & '*' operator */ 460 width = 0; 461 if (isdigit(fmt[i])) { 462 while (isdigit(fmt[i])) { 463 width *= 10; 464 width += fmt[i++] - '0'; 465 } 466 } else if (fmt[i] == '*') { 467 /* get width value from argument list*/ 468 i++; 469 width = (int)va_arg(ap, int); 470 if (width < 0) { 471 /* negative width means to set '-' flag */ 472 width *= -1; 473 flags |= __PRINTF_FLAG_LEFTALIGNED; 474 } 475 } 476 477 /* precision and '*' operator */ 478 precision = 0; 479 if (fmt[i] == '.') { 480 ++i; 481 if (isdigit(fmt[i])) { 482 while (isdigit(fmt[i])) { 483 precision *= 10; 484 precision += fmt[i++] - '0'; 485 } 486 } else if (fmt[i] == '*') { 487 /* get precision value from argument list*/ 488 i++; 489 precision = (int)va_arg(ap, int); 490 if (precision < 0) { 491 /* negative precision means to ignore it */ 492 precision = 0; 493 } 494 } 495 } 496 497 switch (fmt[i++]) { 498 /** TODO: unimplemented qualifiers: 499 * t ptrdiff_t - ISO C 99 500 */ 501 case 'h': /* char or short */ 502 qualifier = PrintfQualifierShort; 503 if (fmt[i] == 'h') { 504 i++; 505 qualifier = PrintfQualifierByte; 506 } 507 break; 508 case 'l': /* long or long long*/ 509 qualifier = PrintfQualifierLong; 510 if (fmt[i] == 'l') { 511 i++; 512 qualifier = PrintfQualifierLongLong; 513 } 514 break; 515 case 'z': /* __native */ 516 qualifier = PrintfQualifierNative; 517 break; 518 default: 519 qualifier = PrintfQualifierInt; /* default type */ 520 --i; 521 } 522 523 base = 10; 524 525 switch (c = fmt[i]) { 526 527 /* 528 * String and character conversions. 529 */ 530 case 's': 531 if ((retval = print_string(va_arg(ap, char*), width, precision, flags)) == EOF) { 532 counter = -counter; 533 goto out; 534 }; 535 536 counter += retval; 537 j = i + 1; 538 goto next_char; 539 case 'c': 540 c = va_arg(ap, unsigned int); 541 if ((retval = print_char(c, width, flags )) == EOF) { 542 counter = -counter; 543 goto out; 544 }; 545 546 counter += retval; 547 j = i + 1; 548 goto next_char; 549 550 /* 551 * Integer values 552 */ 553 case 'P': /* pointer */ 554 flags |= __PRINTF_FLAG_BIGCHARS; 555 case 'p': 556 flags |= __PRINTF_FLAG_PREFIX; 557 base = 16; 558 qualifier = PrintfQualifierPointer; 559 break; 560 case 'b': 561 base = 2; 562 break; 563 case 'o': 564 base = 8; 565 break; 566 case 'd': 567 case 'i': 568 flags |= __PRINTF_FLAG_SIGNED; 569 case 'u': 570 break; 571 case 'X': 572 flags |= __PRINTF_FLAG_BIGCHARS; 573 case 'x': 574 base = 16; 575 break; 576 /* percentile itself */ 577 case '%': 578 j = i; 579 goto next_char; 580 /* 581 * Bad formatting. 582 */ 583 default: 584 /* Unknown format 585 * now, the j is index of '%' so we will 586 * print whole bad format sequence 587 */ 588 goto next_char; 589 } 590 591 592 /* Print integers */ 593 /* print number */ 594 switch (qualifier) { 595 case PrintfQualifierByte: 596 size = sizeof(unsigned char); 597 number = (__u64)va_arg(ap, unsigned int); 598 break; 599 case PrintfQualifierShort: 600 size = sizeof(unsigned short); 601 number = (__u64)va_arg(ap, unsigned int); 602 break; 603 case PrintfQualifierInt: 604 size = sizeof(unsigned int); 605 number = (__u64)va_arg(ap, unsigned int); 606 break; 607 case PrintfQualifierLong: 608 size = sizeof(unsigned long); 609 number = (__u64)va_arg(ap, unsigned long); 610 break; 611 case PrintfQualifierLongLong: 612 size = sizeof(unsigned long long); 613 number = (__u64)va_arg(ap, unsigned long long); 614 break; 615 case PrintfQualifierPointer: 616 size = sizeof(void *); 617 number = (__u64)(unsigned long)va_arg(ap, void *); 618 break; 619 case PrintfQualifierNative: 620 size = sizeof(__native); 621 number = (__u64)va_arg(ap, __native); 622 break; 623 default: /* Unknown qualifier */ 624 counter = -counter; 625 goto out; 626 627 } 628 629 if (flags & __PRINTF_FLAG_SIGNED) { 630 if (number & (0x1 << (size*8 - 1))) { 631 flags |= __PRINTF_FLAG_NEGATIVE; 632 633 if (size == sizeof(__u64)) { 634 number = -((__s64)number); 635 } else { 636 number = ~number; 637 number &= (~((0xFFFFFFFFFFFFFFFFll) << (size * 8))); 638 number++; 639 } 640 } 641 } 642 643 if ((retval = print_number(number, width, precision, base, flags)) == EOF ) { 644 counter = -counter; 251 645 goto out; 252 } 253 254 default: putchar(c); 646 }; 647 648 counter += retval; 649 j = i + 1; 650 } 651 next_char: 652 653 ++i; 654 } 655 656 if (i > j) { 657 if ((retval = putnchars(&fmt[j], (__native)(i - j))) == EOF) { /* error */ 658 counter = -counter; 659 goto out; 255 660 } 256 257 loop: 258 ; 259 } 260 661 counter += retval; 662 } 261 663 out: 262 664 spinlock_unlock(&printflock); … … 264 666 265 667 va_end(ap); 266 } 668 return counter; 669 } 670 -
generic/src/debug/symtab.c
rc624b96 r280a27e 133 133 addr = __u64_le2host(symbol_table[i].address_le); 134 134 realname = symbol_table[i].symbol_name; 135 printf(" 0x%p: %s\n", addr, realname);135 printf("%p: %s\n", addr, realname); 136 136 i++; 137 137 } -
generic/src/interrupt/interrupt.c
rc624b96 r280a27e 97 97 if (!symbol) 98 98 symbol = "not found"; 99 printf("%d %s 0x%p(%s)\n", i + IVT_FIRST, exc_table[i].name,99 printf("%d %s %p(%s)\n", i + IVT_FIRST, exc_table[i].name, 100 100 exc_table[i].f,symbol); 101 101 if (!((i+1) % 20)) { -
generic/src/lib/elf.c
rc624b96 r280a27e 34 34 #include <mm/frame.h> 35 35 #include <mm/slab.h> 36 #include <print.h>37 36 #include <align.h> 38 37 #include <memstr.h> -
generic/src/main/kinit.c
rc624b96 r280a27e 154 154 ipc_phone_0 = &utask->answerbox; 155 155 } else 156 printf("Init task % d not started.\n", i);156 printf("Init task %zd not started.\n", i); 157 157 } 158 158 -
generic/src/main/main.c
rc624b96 r280a27e 177 177 178 178 version_print(); 179 printf("% P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n",179 printf("%#zX: hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", 180 180 config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024); 181 181 … … 185 185 slab_enable_cpucache(); /* Slab must be initialized AFTER we know the number of processors */ 186 186 187 printf("config.memory_size=% dM\n", config.memory_size/(1024*1024));188 printf("config.cpu_count=% d\n", config.cpu_count);187 printf("config.memory_size=%zdM\n", config.memory_size/(1024*1024)); 188 printf("config.cpu_count=%zd\n", config.cpu_count); 189 189 cpu_init(); 190 190 … … 197 197 198 198 for (i = 0; i < init.cnt; i++) 199 printf("init[% d].addr=%P, init[%d].size=%d\n", i, init.tasks[i].addr, i, init.tasks[i].size);199 printf("init[%zd].addr=%P, init[%zd].size=%zd\n", i, init.tasks[i].addr, i, init.tasks[i].size); 200 200 201 201 ipc_init(); -
generic/src/main/uinit.c
rc624b96 r280a27e 32 32 #include <userspace.h> 33 33 #include <mm/slab.h> 34 #include <print.h>35 34 36 35 /** Thread used to bring up userspace thread. -
generic/src/mm/buddy.c
rc624b96 r280a27e 292 292 } 293 293 294 printf("#% d\t%d\t%dK\t\t%dK\t\t%d\t", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i);294 printf("#%zd\t%zd\t%zdK\t\t%zdK\t\t%zd\t", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); 295 295 if (!list_empty(&b->order[i])) { 296 296 for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) { … … 305 305 } 306 306 printf("-----\t------\t--------\t----------\t---------------\n"); 307 printf("Buddy system contains % d free elements (%d blocks)\n" , elem_count, block_count);308 309 } 307 printf("Buddy system contains %zd free elements (%zd blocks)\n" , elem_count, block_count); 308 309 } -
generic/src/mm/frame.c
rc624b96 r280a27e 281 281 zone = (zone_t *) b->data; 282 282 index = frame_index(zone, frame); 283 printf("% d", index);283 printf("%zd", index); 284 284 } 285 285 … … 1029 1029 zone = zones.info[i]; 1030 1030 spinlock_lock(&zone->lock); 1031 printf("%d: % L\t%d\t\t%d\n",i,PFN2ADDR(zone->base),1031 printf("%d: %#X \t%zd\t\t%zd\n",i,PFN2ADDR(zone->base), 1032 1032 zone->free_count, zone->busy_count); 1033 1033 spinlock_unlock(&zone->lock); … … 1062 1062 spinlock_lock(&zone->lock); 1063 1063 printf("Memory zone information\n"); 1064 printf("Zone base address: % P\n", PFN2ADDR(zone->base));1065 printf("Zone size: % d frames (%dK)\n", zone->count, ((zone->count) * FRAME_SIZE) >> 10);1066 printf("Allocated space: % d frames (%dK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10);1067 printf("Available space: % d (%dK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10);1064 printf("Zone base address: %#zX\n", PFN2ADDR(zone->base)); 1065 printf("Zone size: %zd frames (%zdK)\n", zone->count, ((zone->count) * FRAME_SIZE) >> 10); 1066 printf("Allocated space: %zd frames (%zdK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); 1067 printf("Available space: %zd (%zdK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); 1068 1068 buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); 1069 1069 -
generic/src/mm/slab.c
rc624b96 r280a27e 793 793 for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) { 794 794 cache = list_get_instance(cur, slab_cache_t, link); 795 printf("%s\t% d\t%d\t%d\t%d\t%d\t%d\t\t%s\n", cache->name, cache->size,795 printf("%s\t%zd\t%zd\t%zd\t%zd\t%zd\t%zd\t\t%s\n", cache->name, cache->size, 796 796 (1 << cache->order), cache->objects, 797 797 atomic_get(&cache->allocated_slabs), -
generic/src/proc/scheduler.c
rc624b96 r280a27e 450 450 451 451 #ifdef SCHEDULER_VERBOSE 452 printf("cpu%d: tid %d (priority=%d,ticks=% d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy));452 printf("cpu%d: tid %d (priority=%d,ticks=%lld,nrdy=%ld)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy)); 453 453 #endif 454 454 … … 570 570 spinlock_lock(&t->lock); 571 571 #ifdef KCPULB_VERBOSE 572 printf("kcpulb%d: TID %d -> cpu%d, nrdy=% d, avg=%d\n", CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy), atomic_get(&nrdy) / config.cpu_active);572 printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, avg=%nd\n", CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy), atomic_get(&nrdy) / config.cpu_active); 573 573 #endif 574 574 t->flags |= X_STOLEN; … … 634 634 635 635 spinlock_lock(&cpus[cpu].lock); 636 printf("cpu%d: address=%P, nrdy=% d, needs_relink=%d\n",636 printf("cpu%d: address=%P, nrdy=%ld, needs_relink=%ld\n", 637 637 cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), cpus[cpu].needs_relink); 638 638 -
generic/src/proc/task.c
rc624b96 r280a27e 213 213 214 214 spinlock_lock(&t->lock); 215 printf("%s: address=% P, taskid=%Q, as=%P, ActiveCalls: %d",215 printf("%s: address=%#zX, taskid=%#llX, as=%#zX, ActiveCalls: %zd", 216 216 t->name, t, t->taskid, t->as, atomic_get(&t->active_calls)); 217 217 for (j=0; j < IPC_MAX_PHONES; j++) { 218 218 if (t->phones[j].callee) 219 printf(" Ph(% d): %P", j, t->phones[j].callee);219 printf(" Ph(%zd): %#zX ", j, t->phones[j].callee); 220 220 } 221 221 printf("\n"); -
generic/src/proc/thread.c
rc624b96 r280a27e 419 419 420 420 t = (thread_t *) node->value[i]; 421 printf("%s: address=% P, tid=%d, state=%s, task=%P, code=%P, stack=%P, cpu=",421 printf("%s: address=%#zX, tid=%zd, state=%s, task=%#zX, code=%#zX, stack=%#zX, cpu=", 422 422 t->name, t, t->tid, thread_states[t->state], t->task, t->thread_code, t->kstack); 423 423 if (t->cpu) 424 printf("cpu% d ", t->cpu->id);424 printf("cpu%zd ", t->cpu->id); 425 425 else 426 426 printf("none"); -
generic/src/time/clock.c
rc624b96 r280a27e 36 36 #include <proc/scheduler.h> 37 37 #include <cpu.h> 38 #include <print.h>39 38 #include <arch.h> 40 39 #include <adt/list.h> -
generic/src/time/timeout.c
rc624b96 r280a27e 35 35 #include <func.h> 36 36 #include <cpu.h> 37 #include <print.h>38 37 #include <arch/asm.h> 39 38 #include <arch.h> 40 #include <print.h>41 39 42 40 -
test/fpu/fpu1/test.c
rc624b96 r280a27e 94 94 95 95 if((int)(100000000*e)!=E_10e8) 96 panic("tid%d: e*10e8=% d should be %d\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8);96 panic("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); 97 97 } 98 98 99 printf("tid%d: e*10e8=% d should be %d\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8);99 printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); 100 100 atomic_inc(&threads_ok); 101 101 } … … 132 132 #ifdef __ia64_ARCH_H__ 133 133 if((int)(1000000*pi)!=PI_10e8) 134 panic("tid%d: pi*10e8=% d should be %d\n", THREAD->tid, (__native) (1000000*pi),(__native) (PI_10e8/100));134 panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (1000000*pi),(__native) (PI_10e8/100)); 135 135 #else 136 136 if((int)(100000000*pi)!=PI_10e8) 137 panic("tid%d: pi*10e8=% d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);137 panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); 138 138 #endif 139 139 140 140 } 141 141 142 printf("tid%d: pi*10e8=% d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8);142 printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); 143 143 atomic_inc(&threads_ok); 144 144 } -
test/mm/falloc1/test.c
rc624b96 r280a27e 60 60 61 61 if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { 62 panic("Test failed. Block at address % X(size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10);62 panic("Test failed. Block at address %P (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); 63 63 } 64 64 -
test/mm/falloc2/test.c
rc624b96 r280a27e 78 78 for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { 79 79 if (((__u8 *) frames[i])[k] != val) { 80 printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset % X\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k);80 printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset %#zX\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); 81 81 failed(); 82 82 } -
test/mm/mapping1/test.c
rc624b96 r280a27e 51 51 frame1 = PA2KA(PFN2ADDR(frame_alloc(ONE_FRAME, FRAME_KA))); 52 52 53 printf("Writing % Lto physical address %P.\n", VALUE0, KA2PA(frame0));53 printf("Writing %#X to physical address %P.\n", VALUE0, KA2PA(frame0)); 54 54 *((__u32 *) frame0) = VALUE0; 55 printf("Writing % Lto physical address %P.\n", VALUE1, KA2PA(frame1));55 printf("Writing %#X to physical address %P.\n", VALUE1, KA2PA(frame1)); 56 56 *((__u32 *) frame1) = VALUE1; 57 57 … … 61 61 page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE); 62 62 63 printf("Value at virtual address %P is % L.\n", PAGE0, v0 = *((__u32 *) PAGE0));64 printf("Value at virtual address %P is % L.\n", PAGE1, v1 = *((__u32 *) PAGE1));63 printf("Value at virtual address %P is %#X.\n", PAGE0, v0 = *((__u32 *) PAGE0)); 64 printf("Value at virtual address %P is %#X.\n", PAGE1, v1 = *((__u32 *) PAGE1)); 65 65 66 66 ASSERT(v0 == VALUE0); 67 67 ASSERT(v1 == VALUE1); 68 68 69 printf("Writing % X to virtual address %P.\n", 0, PAGE0);69 printf("Writing %#X to virtual address %P.\n", 0, PAGE0); 70 70 *((__u32 *) PAGE0) = 0; 71 printf("Writing % X to virtual address %P.\n", 0, PAGE1);71 printf("Writing %#X to virtual address %P.\n", 0, PAGE1); 72 72 *((__u32 *) PAGE1) = 0; 73 73 … … 75 75 v1 = *((__u32 *) PAGE1); 76 76 77 printf("Value at virtual address %P is % X.\n", PAGE0, *((__u32 *) PAGE0));78 printf("Value at virtual address %P is % X.\n", PAGE1, *((__u32 *) PAGE1));77 printf("Value at virtual address %P is %#X.\n", PAGE0, *((__u32 *) PAGE0)); 78 printf("Value at virtual address %P is %#X.\n", PAGE1, *((__u32 *) PAGE1)); 79 79 80 80 ASSERT(v0 == 0); -
test/print/print1/test.c
rc624b96 r280a27e 31 31 void test(void) 32 32 { 33 __native nat = 0x12345678u; 33 34 printf(" Printf test \n"); 34 printf(" Q %Q %q \n",0x1111111111111111ull, 0x2222222222222222ull); 35 printf(" Q,l %Q %l \n", 0x3333333333333333ull, 0x01234567); 36 printf(" l,Q %l %Q \n", 0x01234567, 0x4444444444444444ull); 37 printf(" L %L %l \n",0x01234567 ,0x01234567); 38 printf(" W %W %w \n",0x0123 ,0x0123); 39 printf(" B %B %b \n",0x01 ,0x01); 35 36 printf(" text 10.8s %*.*s \n", 5, 3, "text"); 37 printf(" very long text 10.8s %10.8s \n", "very long text"); 38 printf(" text 8.10s %8.10s \n", "text"); 39 printf(" very long text 8.10s %8.10s \n", "very long text"); 40 41 printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' ); 42 printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 ); 43 printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 ); 44 printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 ); 45 46 printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zX'. '%#llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" ); 47 40 48 printf(" Print to NULL '%s'\n",NULL); 41 49 return; -
test/synch/rwlock4/test.c
rc624b96 r280a27e 133 133 134 134 context_save(&ctx); 135 printf("sp=% X, readers_in=%d\n", ctx.sp, rwlock.readers_in);135 printf("sp=%#X, readers_in=%d\n", ctx.sp, rwlock.readers_in); 136 136 137 137 k = random(7) + 1; -
test/synch/rwlock5/test.c
rc624b96 r280a27e 92 92 writers = (4-i)*WRITERS; 93 93 94 printf("Creating % d readers and %d writers...", readers, writers);94 printf("Creating %ld readers and %ld writers...", readers, writers); 95 95 96 96 for (j=0; j<(READERS+WRITERS)/2; j++) { … … 117 117 118 118 while (items_read.count != readers || items_written.count != writers) { 119 printf("% d readers remaining, %d writers remaining, readers_in=%d\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in);119 printf("%zd readers remaining, %zd writers remaining, readers_in=%zd\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in); 120 120 thread_usleep(100000); 121 121 }
Note:
See TracChangeset
for help on using the changeset viewer.