Changeset c859753 in mainline
- Timestamp:
- 2008-06-03T14:55:09Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 419886f6
- Parents:
- aa48a9d
- Location:
- kernel/generic/src/console
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/chardev.c
raa48a9d rc859753 43 43 * @param op Implementation of character device operations. 44 44 */ 45 void chardev_initialize(char *name, chardev_t *chardev,45 void chardev_initialize(char *name, chardev_t *chardev, 46 46 chardev_operations_t *op) 47 47 { -
kernel/generic/src/console/cmd.c
raa48a9d rc859753 564 564 unative_t sec = uptime->seconds1; 565 565 566 printf("Up % u days, %u hours, %u minutes, %useconds\n",566 printf("Up %" PRIun " days, %" PRIun " hours, %" PRIun " minutes, %" PRIun " seconds\n", 567 567 sec / 86400, (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60); 568 568 … … 633 633 } else { 634 634 symbol = get_symtab_entry(symaddr); 635 printf("Calling %s() (% .*p)\n", symbol, sizeof(uintptr_t) * 2, symaddr);635 printf("Calling %s() (%p)\n", symbol, symaddr); 636 636 #ifdef ia64 637 637 fptr.f = symaddr; … … 641 641 f = (unative_t (*)(void)) symaddr; 642 642 #endif 643 printf("Result: %# zx\n", f());643 printf("Result: %#" PRIxn "\n", f()); 644 644 } 645 645 … … 687 687 unative_t f; 688 688 unative_t gp; 689 } fptr;689 } fptr; 690 690 #endif 691 691 … … 699 699 symbol = get_symtab_entry(symaddr); 700 700 701 printf("Calling f(%# zx): %.*p: %s\n", arg1, sizeof(uintptr_t) * 2, symaddr, symbol);701 printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol); 702 702 #ifdef ia64 703 703 fptr.f = symaddr; … … 707 707 f = (unative_t (*)(unative_t,...)) symaddr; 708 708 #endif 709 printf("Result: %# zx\n", f(arg1));709 printf("Result: %#" PRIxn "\n", f(arg1)); 710 710 } 711 711 … … 736 736 } else { 737 737 symbol = get_symtab_entry(symaddr); 738 printf("Calling f( 0x%zx,0x%zx): %.*p: %s\n",739 arg1, arg2, s izeof(uintptr_t) * 2, symaddr, symbol);738 printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n", 739 arg1, arg2, symaddr, symbol); 740 740 #ifdef ia64 741 741 fptr.f = symaddr; … … 745 745 f = (unative_t (*)(unative_t,unative_t,...)) symaddr; 746 746 #endif 747 printf("Result: %# zx\n", f(arg1, arg2));747 printf("Result: %#" PRIxn "\n", f(arg1, arg2)); 748 748 } 749 749 … … 775 775 } else { 776 776 symbol = get_symtab_entry(symaddr); 777 printf("Calling f( 0x%zx,0x%zx, 0x%zx): %.*p: %s\n",778 arg1, arg2, arg3, s izeof(uintptr_t) * 2, symaddr, symbol);777 printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n", 778 arg1, arg2, arg3, symaddr, symbol); 779 779 #ifdef ia64 780 780 fptr.f = symaddr; … … 784 784 f = (unative_t (*)(unative_t,unative_t,unative_t,...)) symaddr; 785 785 #endif 786 printf("Result: %# zx\n", f(arg1, arg2, arg3));786 printf("Result: %#" PRIxn "\n", f(arg1, arg2, arg3)); 787 787 } 788 788 … … 857 857 if (pointer) 858 858 addr = (uint32_t *)(*(unative_t *)addr); 859 printf("Writing 0x%x -> %.*p\n", arg1, sizeof(uintptr_t) * 2, addr);859 printf("Writing %#" PRIx64 " -> %p\n", arg1, addr); 860 860 *addr = arg1; 861 861 … … 1026 1026 order(dt, &cycles, &suffix); 1027 1027 1028 printf("Time: % llu%c cycles\n", cycles, suffix);1028 printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix); 1029 1029 1030 1030 if (ret == NULL) { … … 1054 1054 1055 1055 for (i = 0; i < cnt; i++) { 1056 printf("%s (% d/%d) ... ", test->name, i + 1, cnt);1056 printf("%s (%u/%u) ... ", test->name, i + 1, cnt); 1057 1057 1058 1058 /* Update and read thread accounting … … 1082 1082 data[i] = dt; 1083 1083 order(dt, &cycles, &suffix); 1084 printf("OK (% llu%c cycles)\n", cycles, suffix);1084 printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix); 1085 1085 } 1086 1086 … … 1095 1095 1096 1096 order(sum / (uint64_t) cnt, &cycles, &suffix); 1097 printf("Average\t\t% llu%c\n", cycles, suffix);1097 printf("Average\t\t%" PRIu64 "%c\n", cycles, suffix); 1098 1098 } 1099 1099 -
kernel/generic/src/console/console.c
raa48a9d rc859753 44 44 #include <atomic.h> 45 45 46 #define BUFLEN 2048 47 static char debug_buffer[BUFLEN]; 48 static size_t offset = 0; 49 /** Initialize stdout to something that does not print, but does not fail 50 * 51 * Save data in some buffer so that it could be retrieved in the debugger 52 */ 53 static void null_putchar(chardev_t *d, const char ch) 54 { 55 if (offset >= BUFLEN) 56 offset = 0; 57 debug_buffer[offset++] = ch; 58 } 46 #define KLOG_SIZE 4096 47 48 /**< Kernel log cyclic buffer */ 49 static char klog[KLOG_SIZE]; 50 51 /**< First kernel log characters */ 52 static index_t klog_start = 0; 53 /**< Number of valid kernel log characters */ 54 static size_t klog_len = 0; 55 /**< Number of stored (not printed) kernel log characters */ 56 static size_t klog_stored = 0; 59 57 60 58 static chardev_operations_t null_stdout_ops = { 61 .write = null_putchar 59 .suspend = NULL, 60 .resume = NULL, 61 .write = NULL, 62 .read = NULL 62 63 }; 63 64 … … 91 92 /* no other way of interacting with user, halt */ 92 93 if (CPU) 93 printf("cpu% d: ", CPU->id);94 printf("cpu%u: ", CPU->id); 94 95 else 95 96 printf("cpu: "); … … 162 163 void putchar(char c) 163 164 { 165 if ((klog_stored > 0) && (stdout->op->write)) { 166 /* Print charaters stored in kernel log */ 167 index_t i; 168 for (i = klog_len - klog_stored; i < klog_len; i++) 169 stdout->op->write(stdout, klog[(klog_start + i) % KLOG_SIZE]); 170 klog_stored = 0; 171 } 172 173 /* Store character in the cyclic kernel log */ 174 klog[(klog_start + klog_len) % KLOG_SIZE] = c; 175 if (klog_len < KLOG_SIZE) 176 klog_len++; 177 else 178 klog_start = (klog_start + 1) % KLOG_SIZE; 179 164 180 if (stdout->op->write) 165 181 stdout->op->write(stdout, c); 182 else { 183 /* The character is just in the kernel log */ 184 if (klog_stored < klog_len) 185 klog_stored++; 186 } 166 187 } 167 188
Note:
See TracChangeset
for help on using the changeset viewer.