Changeset 0d2f805 in mainline for src/debug/print.c
- Timestamp:
- 2005-05-06T12:58:44Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75e5a8a
- Parents:
- 47d78c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/debug/print.c
r47d78c6 r0d2f805 30 30 #include <print.h> 31 31 #include <synch/spinlock.h> 32 #include <arch/arg.h> 33 32 34 33 35 static char digits[] = "0123456789abcdef"; … … 80 82 void printf(char *fmt, ...) 81 83 { 82 int irqpri, i = 0, pos = 0; 83 char c; 84 int irqpri, i = 0; 85 va_list ap; 86 char c; 87 88 va_start(ap, fmt); 84 89 85 90 irqpri = cpu_priority_high(); 86 91 spinlock_lock(&printflock); 92 87 93 while (c = fmt[i++]) { 88 94 switch (c) { … … 100 106 */ 101 107 case 's': 102 print_str( (char *) *(((__address *) &fmt + (++pos))));108 print_str(va_arg(ap, char_ptr)); 103 109 goto loop; 104 110 105 111 case 'c': 106 c = *((char *) ((__address *)(&fmt + (++pos))));112 c = va_arg(ap, char); 107 113 break; 108 114 … … 113 119 print_str("0x"); 114 120 case 'l': 115 print_fixed_hex( *((__address *)(&fmt + (++pos))),INT32);121 print_fixed_hex(va_arg(ap, __native), INT32); 116 122 goto loop; 117 123 … … 119 125 print_str("0x"); 120 126 case 'w': 121 print_fixed_hex( *((__address *)(&fmt + (++pos))),INT16);127 print_fixed_hex(va_arg(ap, __native), INT16); 122 128 goto loop; 123 129 … … 125 131 print_str("0x"); 126 132 case 'b': 127 print_fixed_hex( *((__address *)(&fmt + (++pos))),INT8);133 print_fixed_hex(va_arg(ap, __native), INT8); 128 134 goto loop; 129 135 … … 132 138 */ 133 139 case 'd': 134 print_number( *((__address *)(&fmt + (++pos))), 10);140 print_number(va_arg(ap, __native), 10); 135 141 goto loop; 136 142 … … 138 144 print_str("0x"); 139 145 case 'x': 140 print_number( *((__address *)(&fmt + (++pos))), 16);146 print_number(va_arg(ap, __native), 16); 141 147 goto loop; 142 148 … … 158 164 spinlock_unlock(&printflock); 159 165 cpu_priority_restore(irqpri); 166 167 va_end(ap); 160 168 }
Note:
See TracChangeset
for help on using the changeset viewer.