Changeset 91db0280 in mainline
- Timestamp:
- 2014-01-05T19:59:56Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 927cd9c
- Parents:
- 6fa9a99d
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/abi/ipc/event.h
r6fa9a99d r91db0280 44 44 /** A task/thread has faulted and will be terminated */ 45 45 EVENT_FAULT, 46 /** New data available in kernel log */ 47 EVENT_KLOG, 46 48 EVENT_END 47 49 } event_type_t; -
kernel/Makefile
r6fa9a99d r91db0280 212 212 generic/src/debug/debug.c \ 213 213 generic/src/interrupt/interrupt.c \ 214 generic/src/log/log.c \ 214 215 generic/src/main/main.c \ 215 216 generic/src/main/kinit.c \ -
kernel/generic/include/console/console.h
r6fa9a99d r91db0280 39 39 #include <print.h> 40 40 #include <console/chardev.h> 41 #include <synch/spinlock.h> 41 42 42 43 #define PAGING(counter, increment, before, after) \ … … 64 65 extern void kio_init(void); 65 66 extern void kio_update(void *); 67 extern void kio_flush(void); 68 extern void kio_push_char(const wchar_t); 69 SPINLOCK_EXTERN(kio_lock); 66 70 67 71 extern wchar_t getc(indev_t *indev); -
kernel/generic/include/debug.h
r6fa9a99d r91db0280 107 107 #define LOG(format, ...) \ 108 108 do { \ 109 printf("%s() from %s at %s:%u: " format "\n", __func__, \ 109 log(LF_OTHER, LVL_DEBUG, \ 110 "%s() from %s at %s:%u: " format,__func__, \ 110 111 symtab_fmt_name_lookup(CALLER), __FILE__, __LINE__, \ 111 112 ##__VA_ARGS__); \ -
kernel/generic/src/console/console.c
r6fa9a99d r91db0280 76 76 77 77 /** Kernel log spinlock */ 78 SPINLOCK_ STATIC_INITIALIZE_NAME(kio_lock, "kio_lock");78 SPINLOCK_INITIALIZE_NAME(kio_lock, "kio_lock"); 79 79 80 80 /** Physical memory area used for kio buffer */ … … 263 263 } 264 264 265 void putchar(const wchar_t ch) 265 /** Flush characters that are stored in the output buffer 266 * 267 */ 268 void kio_flush(void) 266 269 { 267 270 bool ordy = ((stdout) && (stdout->op->write)); 268 271 272 if (!ordy) 273 return; 274 269 275 spinlock_lock(&kio_lock); 270 271 /* Print charaters stored in kernel log */ 272 if (ordy) { 273 while (kio_stored > 0) { 274 wchar_t tmp = kio[(kio_start + kio_len - kio_stored) % KIO_LENGTH]; 275 kio_stored--; 276 277 /* 278 * We need to give up the spinlock for 279 * the physical operation of writting out 280 * the character. 281 */ 282 spinlock_unlock(&kio_lock); 283 stdout->op->write(stdout, tmp); 284 spinlock_lock(&kio_lock); 285 } 286 } 287 288 /* Store character in the cyclic kernel log */ 276 277 /* Print characters that weren't printed earlier */ 278 while (kio_stored > 0) { 279 wchar_t tmp = kio[(kio_start + kio_len - kio_stored) % KIO_LENGTH]; 280 kio_stored--; 281 282 /* 283 * We need to give up the spinlock for 284 * the physical operation of writing out 285 * the character. 286 */ 287 spinlock_unlock(&kio_lock); 288 stdout->op->write(stdout, tmp); 289 spinlock_lock(&kio_lock); 290 } 291 292 spinlock_unlock(&kio_lock); 293 } 294 295 /** Put a character into the output buffer. 296 * 297 * The caller is required to hold kio_lock 298 */ 299 void kio_push_char(const wchar_t ch) 300 { 289 301 kio[(kio_start + kio_len) % KIO_LENGTH] = ch; 290 302 if (kio_len < KIO_LENGTH) … … 293 305 kio_start = (kio_start + 1) % KIO_LENGTH; 294 306 295 if (!ordy) { 296 if (kio_stored < kio_len) 297 kio_stored++; 298 } 307 if (kio_stored < kio_len) 308 kio_stored++; 299 309 300 310 /* The character is stored for uspace */ 301 311 if (kio_uspace < kio_len) 302 312 kio_uspace++; 303 313 } 314 315 void putchar(const wchar_t ch) 316 { 317 bool ordy = ((stdout) && (stdout->op->write)); 318 319 spinlock_lock(&kio_lock); 320 kio_push_char(ch); 304 321 spinlock_unlock(&kio_lock); 305 322 306 if (ordy) { 307 /* 308 * Output the character. In this case 309 * it should be no longer buffered. 310 */ 311 stdout->op->write(stdout, ch); 312 } else { 323 /* Output stored characters */ 324 kio_flush(); 325 326 if (!ordy) { 313 327 /* 314 328 * No standard output routine defined yet. -
kernel/generic/src/main/main.c
r6fa9a99d r91db0280 62 62 #include <console/kconsole.h> 63 63 #include <console/console.h> 64 #include <log.h> 64 65 #include <cpu.h> 65 66 #include <align.h> … … 282 283 event_init(); 283 284 kio_init(); 285 log_init(); 284 286 stats_init(); 285 287 -
uspace/lib/c/include/io/log.h
r6fa9a99d r91db0280 39 39 #include <io/verify.h> 40 40 41 /** Log message level. */ 42 typedef enum { 43 /** Fatal error, program is not able to recover at all. */ 44 LVL_FATAL, 45 /** Serious error but the program can recover from it. */ 46 LVL_ERROR, 47 /** Easily recoverable problem. */ 48 LVL_WARN, 49 /** Information message that ought to be printed by default. */ 50 LVL_NOTE, 51 /** Debugging purpose message. */ 52 LVL_DEBUG, 53 /** More detailed debugging message. */ 54 LVL_DEBUG2, 55 56 /** For checking range of values */ 57 LVL_LIMIT 58 } log_level_t; 41 #include <abi/log.h> 59 42 60 43 /** Log itself (logging target). */
Note:
See TracChangeset
for help on using the changeset viewer.