Changeset eec616b in mainline for kernel/generic/src/console/console.c
- Timestamp:
- 2009-03-24T14:43:25Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8f29e336
- Parents:
- 74c8da2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/console/console.c
r74c8da2c reec616b 47 47 #include <func.h> 48 48 #include <print.h> 49 #include <putchar.h> 49 50 #include <atomic.h> 50 51 #include <syscall/copy.h> 51 52 #include <errno.h> 52 53 53 #define KLOG_SIZE PAGE_SIZE54 #define KLOG_LATENCY 854 #define KLOG_SIZE PAGE_SIZE 55 #define KLOG_LATENCY 8 55 56 56 57 /** Kernel log cyclic buffer */ 57 static charklog[KLOG_SIZE] __attribute__ ((aligned (PAGE_SIZE)));58 static wchar_t klog[KLOG_SIZE] __attribute__ ((aligned (PAGE_SIZE))); 58 59 59 60 /** Kernel log initialized */ … … 96 97 97 98 klog_parea.pbase = (uintptr_t) faddr; 98 klog_parea.frames = SIZE2FRAMES( KLOG_SIZE);99 klog_parea.frames = SIZE2FRAMES(sizeof(klog)); 99 100 ddi_parea_register(&klog_parea); 100 101 101 102 sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr); 102 sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES( KLOG_SIZE));103 sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(sizeof(klog))); 103 104 104 105 spinlock_lock(&klog_lock); … … 246 247 } 247 248 248 void putchar(c har c)249 void putchar(const wchar_t ch) 249 250 { 250 251 spinlock_lock(&klog_lock); … … 259 260 260 261 /* Store character in the cyclic kernel log */ 261 klog[(klog_start + klog_len) % KLOG_SIZE] = c ;262 klog[(klog_start + klog_len) % KLOG_SIZE] = ch; 262 263 if (klog_len < KLOG_SIZE) 263 264 klog_len++; … … 266 267 267 268 if ((stdout) && (stdout->op->write)) 268 stdout->op->write(stdout, c , silent);269 stdout->op->write(stdout, ch, silent); 269 270 else { 270 271 /* The character is just in the kernel log */ … … 279 280 /* Check notify uspace to update */ 280 281 bool update; 281 if ((klog_uspace > KLOG_LATENCY) || (c == '\n'))282 if ((klog_uspace > KLOG_LATENCY) || (ch == '\n')) 282 283 update = true; 283 284 else … … 295 296 * 296 297 */ 297 unative_t sys_klog(int fd, const void * buf, size_t count) 298 unative_t sys_klog(int fd, const void * buf, size_t count) 298 299 { 299 300 char *data; 300 301 int rc; 301 302 302 303 if (count > PAGE_SIZE) 303 304 return ELIMIT;
Note:
See TracChangeset
for help on using the changeset viewer.