Rev 4218 | Rev 4252 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4218 | Rev 4226 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | #include <syscall/copy.h> |
51 | #include <syscall/copy.h> |
52 | #include <errno.h> |
52 | #include <errno.h> |
53 | #include <string.h> |
53 | #include <string.h> |
54 | 54 | ||
55 | #define KLOG_SIZE PAGE_SIZE |
55 | #define KLOG_SIZE PAGE_SIZE |
- | 56 | #define KLOG_LENGTH (KLOG_SIZE / sizeof(wchar_t)) |
|
56 | #define KLOG_LATENCY 8 |
57 | #define KLOG_LATENCY 8 |
57 | 58 | ||
58 | /** Kernel log cyclic buffer */ |
59 | /** Kernel log cyclic buffer */ |
59 | static wchar_t klog[KLOG_SIZE] __attribute__ ((aligned (PAGE_SIZE))); |
60 | static wchar_t klog[KLOG_LENGTH] __attribute__ ((aligned (PAGE_SIZE))); |
60 | 61 | ||
61 | /** Kernel log initialized */ |
62 | /** Kernel log initialized */ |
62 | static bool klog_inited = false; |
63 | static bool klog_inited = false; |
63 | /** First kernel log characters */ |
64 | /** First kernel log characters */ |
64 | static index_t klog_start = 0; |
65 | static index_t klog_start = 0; |
Line 255... | Line 256... | ||
255 | 256 | ||
256 | if ((klog_stored > 0) && (stdout) && (stdout->op->write)) { |
257 | if ((klog_stored > 0) && (stdout) && (stdout->op->write)) { |
257 | /* Print charaters stored in kernel log */ |
258 | /* Print charaters stored in kernel log */ |
258 | index_t i; |
259 | index_t i; |
259 | for (i = klog_len - klog_stored; i < klog_len; i++) |
260 | for (i = klog_len - klog_stored; i < klog_len; i++) |
260 | stdout->op->write(stdout, klog[(klog_start + i) % KLOG_SIZE], silent); |
261 | stdout->op->write(stdout, klog[(klog_start + i) % KLOG_LENGTH], silent); |
261 | klog_stored = 0; |
262 | klog_stored = 0; |
262 | } |
263 | } |
263 | 264 | ||
264 | /* Store character in the cyclic kernel log */ |
265 | /* Store character in the cyclic kernel log */ |
265 | klog[(klog_start + klog_len) % KLOG_SIZE] = ch; |
266 | klog[(klog_start + klog_len) % KLOG_LENGTH] = ch; |
266 | if (klog_len < KLOG_SIZE) |
267 | if (klog_len < KLOG_LENGTH) |
267 | klog_len++; |
268 | klog_len++; |
268 | else |
269 | else |
269 | klog_start = (klog_start + 1) % KLOG_SIZE; |
270 | klog_start = (klog_start + 1) % KLOG_LENGTH; |
270 | 271 | ||
271 | if ((stdout) && (stdout->op->write)) |
272 | if ((stdout) && (stdout->op->write)) |
272 | stdout->op->write(stdout, ch, silent); |
273 | stdout->op->write(stdout, ch, silent); |
273 | else { |
274 | else { |
274 | /* The character is just in the kernel log */ |
275 | /* The character is just in the kernel log */ |