Changeset 571cc2d in mainline
- Timestamp:
- 2025-04-17T15:14:03Z (5 days ago)
- Branches:
- master
- Children:
- d5b37b6
- Parents:
- af77459
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-11 15:56:15)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2025-04-17 15:14:03)
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/console/console.h
raf77459 r571cc2d 67 67 extern void kio_flush(void); 68 68 extern void kio_push_char(const char32_t); 69 SPINLOCK_EXTERN(kio_lock);69 extern irq_spinlock_t kio_lock; 70 70 71 71 extern sys_errno_t sys_kio(int cmd, uspace_addr_t buf, size_t size); -
kernel/generic/src/console/console.c
raf77459 r571cc2d 86 86 87 87 /** Kernel log spinlock */ 88 SPINLOCK_INITIALIZE_NAME(kio_lock, "kio_lock");88 IRQ_SPINLOCK_INITIALIZE(kio_lock); 89 89 90 90 /** Physical memory area used for kio buffer */ … … 254 254 return; 255 255 256 spinlock_lock(&kio_lock);256 irq_spinlock_lock(&kio_lock, true); 257 257 258 258 if (kio_notified != kio_written) { … … 261 261 } 262 262 263 spinlock_unlock(&kio_lock);263 irq_spinlock_unlock(&kio_lock, true); 264 264 } 265 265 … … 274 274 return; 275 275 276 spinlock_lock(&kio_lock);276 irq_spinlock_lock(&kio_lock, true); 277 277 278 278 /* Print characters that weren't printed earlier */ … … 286 286 * the character. 287 287 */ 288 spinlock_unlock(&kio_lock);288 irq_spinlock_unlock(&kio_lock, true); 289 289 stdout->op->write(stdout, tmp); 290 spinlock_lock(&kio_lock);291 } 292 293 spinlock_unlock(&kio_lock);290 irq_spinlock_lock(&kio_lock, true); 291 } 292 293 irq_spinlock_unlock(&kio_lock, true); 294 294 } 295 295 … … 308 308 bool ordy = ((stdout) && (stdout->op->write)); 309 309 310 spinlock_lock(&kio_lock);310 irq_spinlock_lock(&kio_lock, true); 311 311 kio_push_char(ch); 312 spinlock_unlock(&kio_lock);312 irq_spinlock_unlock(&kio_lock, true); 313 313 314 314 /* Output stored characters */ -
kernel/generic/src/log/log.c
raf77459 r571cc2d 60 60 61 61 /** Cyclic buffer holding the data for kernel log */ 62 uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));62 static uint8_t log_buffer[LOG_LENGTH] __attribute__((aligned(PAGE_SIZE))); 63 63 64 64 /** Kernel log initialized */ … … 66 66 67 67 /** Position in the cyclic buffer where the first log entry starts */ 68 s ize_t log_start = 0;68 static size_t log_start = 0; 69 69 70 70 /** Sum of length of all log entries currently stored in the cyclic buffer */ 71 s ize_t log_used = 0;71 static size_t log_used = 0; 72 72 73 73 /** Log spinlock */ 74 SPINLOCK_STATIC_INITIALIZE_NAME(log_lock, "log_lock");74 static IRQ_SPINLOCK_INITIALIZE(log_lock); 75 75 76 76 /** Overall count of logged messages, which may overflow as needed */ … … 152 152 { 153 153 console_lock(); 154 spinlock_lock(&log_lock);155 spinlock_lock(&kio_lock);154 irq_spinlock_lock(&log_lock, true); 155 irq_spinlock_lock(&kio_lock, true); 156 156 157 157 log_current_start = (log_start + log_used) % LOG_LENGTH; … … 180 180 181 181 kio_push_char('\n'); 182 spinlock_unlock(&kio_lock);183 spinlock_unlock(&log_lock);182 irq_spinlock_unlock(&kio_lock, true); 183 irq_spinlock_unlock(&log_lock, true); 184 184 185 185 /* This has to be called after we released the locks above */ … … 195 195 return; 196 196 197 spinlock_lock(&log_lock);197 irq_spinlock_lock(&log_lock, true); 198 198 if (next_for_uspace < log_used) 199 199 event_notify_0(EVENT_KLOG, true); 200 spinlock_unlock(&log_lock);200 irq_spinlock_unlock(&log_lock, true); 201 201 } 202 202 … … 307 307 rc = EOK; 308 308 309 spinlock_lock(&log_lock);309 irq_spinlock_lock(&log_lock, true); 310 310 311 311 while (next_for_uspace < log_used) { … … 337 337 } 338 338 339 spinlock_unlock(&log_lock);339 irq_spinlock_unlock(&log_lock, true); 340 340 341 341 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.