Changes in kernel/generic/src/log/log.c [690ad20:163e34c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/log/log.c
r690ad20 r163e34c 46 46 #include <print.h> 47 47 #include <printf_core.h> 48 #include <putchar.h> 48 49 #include <stdarg.h> 49 50 #include <stdlib.h> … … 59 60 60 61 /** Cyclic buffer holding the data for kernel log */ 61 staticuint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));62 uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE))); 62 63 63 64 /** Kernel log initialized */ … … 65 66 66 67 /** Position in the cyclic buffer where the first log entry starts */ 67 s tatic size_t log_start = 0;68 size_t log_start = 0; 68 69 69 70 /** Sum of length of all log entries currently stored in the cyclic buffer */ 70 s tatic size_t log_used = 0;71 size_t log_used = 0; 71 72 72 73 /** Log spinlock */ 73 static IRQ_SPINLOCK_INITIALIZE(log_lock);74 SPINLOCK_STATIC_INITIALIZE_NAME(log_lock, "log_lock"); 74 75 75 76 /** Overall count of logged messages, which may overflow as needed */ … … 151 152 { 152 153 console_lock(); 153 irq_spinlock_lock(&log_lock, true);154 irq_spinlock_lock(&kio_lock, true);154 spinlock_lock(&log_lock); 155 spinlock_lock(&kio_lock); 155 156 156 157 log_current_start = (log_start + log_used) % LOG_LENGTH; … … 178 179 log_used += log_current_len; 179 180 180 kio_push_ bytes("\n", 1);181 irq_spinlock_unlock(&kio_lock, true);182 irq_spinlock_unlock(&log_lock, true);181 kio_push_char('\n'); 182 spinlock_unlock(&kio_lock); 183 spinlock_unlock(&log_lock); 183 184 184 185 /* This has to be called after we released the locks above */ … … 194 195 return; 195 196 196 irq_spinlock_lock(&log_lock, true);197 spinlock_lock(&log_lock); 197 198 if (next_for_uspace < log_used) 198 199 event_notify_0(EVENT_KLOG, true); 199 irq_spinlock_unlock(&log_lock, true);200 spinlock_unlock(&log_lock); 200 201 } 201 202 202 203 static int log_printf_str_write(const char *str, size_t size, void *data) 203 204 { 204 kio_push_bytes(str, size); 205 size_t offset = 0; 206 207 while (offset < size) 208 kio_push_char(str_decode(str, &offset, size)); 209 205 210 log_append((const uint8_t *)str, size); 211 206 212 return EOK; 207 213 } … … 301 307 rc = EOK; 302 308 303 irq_spinlock_lock(&log_lock, true);309 spinlock_lock(&log_lock); 304 310 305 311 while (next_for_uspace < log_used) { … … 331 337 } 332 338 333 irq_spinlock_unlock(&log_lock, true);339 spinlock_unlock(&log_lock); 334 340 335 341 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.