Changeset fd07e57b in mainline
- Timestamp:
- 2014-01-05T21:25:41Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4aa2a27
- Parents:
- aacdb8e (diff), ca05e9b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 8 added
- 62 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
raacdb8e rfd07e57b 33 33 uspace/app/kill/kill 34 34 uspace/app/killall/killall 35 uspace/app/k log/klog35 uspace/app/kio/kio 36 36 uspace/app/loc/loc 37 37 uspace/app/logset/logset … … 82 82 uspace/dist/app/kill 83 83 uspace/dist/app/killall 84 uspace/dist/app/k log84 uspace/dist/app/kio 85 85 uspace/dist/app/loc 86 86 uspace/dist/app/logset … … 285 285 uspace/lib/posix/redefs-hide-libc-symbols.list 286 286 uspace/lib/posix/redefs-show-posix-symbols.list 287 uspace/srv/klog/klog 288 uspace/dist/srv/klog -
abi/include/abi/ipc/event.h
raacdb8e rfd07e57b 38 38 /** Global events */ 39 39 typedef enum event_type { 40 /** New data available in kernel log*/41 EVENT_K LOG= 0,40 /** New data available in kernel character buffer */ 41 EVENT_KIO = 0, 42 42 /** Returning from kernel console to uspace */ 43 43 EVENT_KCONSOLE, 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; -
abi/include/abi/klog.h
raacdb8e rfd07e57b 1 1 /* 2 * Copyright (c) 201 2 Jakub Jermar2 * Copyright (c) 2014 Martin Sucha 3 3 * All rights reserved. 4 4 * … … 36 36 #define ABI_KLOG_H_ 37 37 38 enum { 39 KLOG_UNKNOW, 38 typedef enum { 40 39 KLOG_WRITE, 41 KLOG_UPDATE, 42 KLOG_COMMAND 43 }; 40 KLOG_READ 41 } klog_operation_t; 44 42 45 43 #endif -
abi/include/abi/syscall.h
raacdb8e rfd07e57b 37 37 38 38 typedef enum { 39 SYS_K LOG= 0,39 SYS_KIO = 0, 40 40 SYS_TLS_SET = 1, /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */ 41 41 … … 99 99 SYS_DEBUG_ACTIVATE_CONSOLE, 100 100 101 SYS_KLOG, 102 101 103 SYSCALL_END 102 104 } syscall_t; -
boot/Makefile.common
raacdb8e rfd07e57b 96 96 $(USPACE_PATH)/srv/devman/devman \ 97 97 $(USPACE_PATH)/srv/fs/locfs/locfs \ 98 $(USPACE_PATH)/srv/hid/compositor/compositor 98 $(USPACE_PATH)/srv/hid/compositor/compositor \ 99 $(USPACE_PATH)/srv/klog/klog 99 100 100 101 RD_SRVS_NON_ESSENTIAL = \ … … 161 162 $(USPACE_PATH)/app/bdsh/bdsh \ 162 163 $(USPACE_PATH)/app/getterm/getterm \ 163 $(USPACE_PATH)/app/k log/klog\164 $(USPACE_PATH)/app/kio/kio \ 164 165 $(USPACE_PATH)/app/vlaunch/vlaunch \ 165 166 $(USPACE_PATH)/app/vterm/vterm -
contrib/arch/HelenOS.adl
raacdb8e rfd07e57b 22 22 23 23 /* Kernel log */ 24 inst k log klog;24 inst kio kio; 25 25 26 26 [/uspace/lib/libc/bind%ns] … … 30 30 [/uspace/lib/libc/bind%vfs] 31 31 [/uspace/lib/libc/bind%console] 32 [/uspace/lib/libc/bind%k log]32 [/uspace/lib/libc/bind%kio] 33 33 34 34 bind ns:kbd to console:kbd; … … 58 58 bind console:sys_console to kernel:sys_console; 59 59 60 bind k log:ns to ns:ns;60 bind kio:ns to ns:ns; 61 61 }; -
contrib/arch/kernel/kernel.adl
raacdb8e rfd07e57b 3 3 *****************************/ 4 4 5 interface sys_k log{5 interface sys_kio { 6 6 /* Print using kernel facility */ 7 sysarg_t sys_k log(int fd, const void *buf, size_t size);8 protocol: 9 ?sys_k log*7 sysarg_t sys_kio(int fd, const void *buf, size_t size); 8 protocol: 9 ?sys_kio* 10 10 }; 11 11 … … 251 251 frame sys_console { 252 252 provides: 253 sys_k log sys_klog;253 sys_kio sys_kio; 254 254 sys_console sys_console; 255 255 }; … … 316 316 inst sys_debug sys_debug; 317 317 318 delegate sys_k log to sys_console:sys_klog;318 delegate sys_kio to sys_console:sys_kio; 319 319 delegate sys_console to sys_console:sys_console; 320 320 delegate sys_tls to sys_proc:sys_tls; -
contrib/arch/uspace/app/kio/kio.adl
raacdb8e rfd07e57b 1 frame k log{1 frame kio { 2 2 requires: 3 3 naming_service ns; 4 4 [/uspace/lib/libc/requires] 5 5 initialization: 6 !ns.ipc_m_share_in /* SERVICE_MEM_K LOG*/6 !ns.ipc_m_share_in /* SERVICE_MEM_KIO */ 7 7 protocol: 8 8 [/uspace/lib/libc/protocol] -
contrib/arch/uspace/lib/libc/bind
raacdb8e rfd07e57b 1 1 /* Bind %% to kernel interfaces */ 2 bind %%:sys_k log to kernel:sys_klog;2 bind %%:sys_kio to kernel:sys_kio; 3 3 bind %%:sys_tls to kernel:sys_tls; 4 4 bind %%:sys_thread to kernel:sys_thread; -
contrib/arch/uspace/lib/libc/protocol
raacdb8e rfd07e57b 1 1 /* Protocol according to which libc uses kernel syscalls */ 2 2 ( 3 !sys_k log.sys_klog+3 !sys_kio.sys_kio + 4 4 !sys_tls.sys_tls_set + 5 5 !sys_thread.sys_thread_create + -
contrib/arch/uspace/lib/libc/requires
raacdb8e rfd07e57b 1 1 /* Kernel interfaces required by libc */ 2 sys_k log sys_klog;2 sys_kio sys_kio; 3 3 sys_tls sys_tls; 4 4 sys_thread sys_thread; -
contrib/arch/uspace/lib/libc/subsume
raacdb8e rfd07e57b 1 1 /* Subsume %% to kernel interfaces */ 2 subsume %%:sys_k log to sys_klog;2 subsume %%:sys_kio to sys_kio; 3 3 subsume %%:sys_tls to sys_tls; 4 4 subsume %%:sys_thread to sys_thread; -
contrib/arch/uspace/srv/ns/ns.adl
raacdb8e rfd07e57b 6 6 sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags); 7 7 8 /* Share real-time clock page or k logpage */8 /* Share real-time clock page or kio page */ 9 9 sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service); 10 10 -
kernel/Makefile
raacdb8e rfd07e57b 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/arch/amd64/src/interrupt.c
raacdb8e rfd07e57b 35 35 #include <arch/interrupt.h> 36 36 #include <print.h> 37 #include <log.h> 37 38 #include <debug.h> 38 39 #include <panic.h> … … 66 67 void istate_decode(istate_t *istate) 67 68 { 68 printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t"69 log_printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t" 69 70 "rfl=%0#18" PRIx64 "\terr=%0#18" PRIx64 "\n", 70 71 istate->cs, istate->rip, istate->rflags, istate->error_word); 71 72 72 73 if (istate_from_uspace(istate)) 73 printf("ss =%0#18" PRIx64 "\n", istate->ss);74 75 printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t"74 log_printf("ss =%0#18" PRIx64 "\n", istate->ss); 75 76 log_printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t" 76 77 "rcx=%0#18" PRIx64 "\trdx=%0#18" PRIx64 "\n", 77 78 istate->rax, istate->rbx, istate->rcx, istate->rdx); 78 79 79 printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t"80 log_printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t" 80 81 "rbp=%0#18" PRIx64 "\trsp=%0#18" PRIx64 "\n", 81 82 istate->rsi, istate->rdi, istate->rbp, … … 83 84 (uintptr_t) &istate->rsp); 84 85 85 printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t"86 log_printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t" 86 87 "r10=%0#18" PRIx64 "\tr11=%0#18" PRIx64 "\n", 87 88 istate->r8, istate->r9, istate->r10, istate->r11); 88 89 89 printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t"90 log_printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t" 90 91 "r14=%0#18" PRIx64 "\tr15=%0#18" PRIx64 "\n", 91 92 istate->r12, istate->r13, istate->r14, istate->r15); … … 193 194 */ 194 195 #ifdef CONFIG_DEBUG 195 printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum); 196 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)", 197 CPU->id, inum); 196 198 #endif 197 199 } -
kernel/arch/arm32/src/mach/gta02/gta02.c
raacdb8e rfd07e57b 49 49 #include <ddi/ddi.h> 50 50 #include <ddi/device.h> 51 #include <log.h> 51 52 52 53 #define GTA02_MEMORY_START 0x30000000 /* physical */ … … 149 150 } else { 150 151 /* Spurious interrupt.*/ 151 printf("cpu%d: spurious interrupt (inum=%d)\n",152 log(LF_ARCH, LVL_DEBUG, "cpu%d: spurious interrupt (inum=%d)", 152 153 CPU->id, inum); 153 154 } -
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
raacdb8e rfd07e57b 43 43 #include <console/console.h> 44 44 #include <sysinfo/sysinfo.h> 45 #include <print.h>46 45 #include <ddi/device.h> 47 46 #include <mm/page.h> … … 53 52 #include <abi/fb/visuals.h> 54 53 #include <ddi/ddi.h> 55 #include <print.h> 54 #include <log.h> 55 56 56 57 57 … … 275 275 } else { 276 276 /* Spurious interrupt.*/ 277 printf("cpu%d: spurious interrupt (inum=%d)\n", 277 log(LF_ARCH, LVL_DEBUG, 278 "cpu%d: spurious interrupt (inum=%d)", 278 279 CPU->id, i); 279 280 } -
kernel/arch/ia32/src/drivers/i8259.c
raacdb8e rfd07e57b 42 42 #include <arch/asm.h> 43 43 #include <arch.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <interrupt.h> 46 46 … … 129 129 { 130 130 #ifdef CONFIG_DEBUG 131 printf("cpu%u: PIC spurious interrupt\n", CPU->id);131 log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id); 132 132 #endif 133 133 } -
kernel/arch/ia32/src/smp/apic.c
raacdb8e rfd07e57b 42 42 #include <interrupt.h> 43 43 #include <arch/interrupt.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <arch/asm.h> 46 46 #include <arch.h> … … 135 135 { 136 136 #ifdef CONFIG_DEBUG 137 printf("cpu%u: APIC spurious interrupt\n", CPU->id);137 log(LF_ARCH, LVL_DEBUG, "cpu%u: APIC spurious interrupt", CPU->id); 138 138 #endif 139 139 } … … 241 241 esr.value = l_apic[ESR]; 242 242 243 if (esr.send_checksum_error) 244 printf("Send Checksum Error\n"); 245 if (esr.receive_checksum_error) 246 printf("Receive Checksum Error\n"); 247 if (esr.send_accept_error) 248 printf("Send Accept Error\n"); 249 if (esr.receive_accept_error) 250 printf("Receive Accept Error\n"); 251 if (esr.send_illegal_vector) 252 printf("Send Illegal Vector\n"); 253 if (esr.received_illegal_vector) 254 printf("Received Illegal Vector\n"); 255 if (esr.illegal_register_address) 256 printf("Illegal Register Address\n"); 243 if (esr.err_bitmap) { 244 log_begin(LF_ARCH, LVL_ERROR); 245 log_printf("APIC errors detected:"); 246 if (esr.send_checksum_error) 247 log_printf("\nSend Checksum Error"); 248 if (esr.receive_checksum_error) 249 log_printf("\nReceive Checksum Error"); 250 if (esr.send_accept_error) 251 log_printf("\nSend Accept Error"); 252 if (esr.receive_accept_error) 253 log_printf("\nReceive Accept Error"); 254 if (esr.send_illegal_vector) 255 log_printf("\nSend Illegal Vector"); 256 if (esr.received_illegal_vector) 257 log_printf("\nReceived Illegal Vector"); 258 if (esr.illegal_register_address) 259 log_printf("\nIllegal Register Address"); 260 log_end(); 261 } 257 262 258 263 return !esr.err_bitmap; … … 270 275 retries = 0; 271 276 #ifdef CONFIG_DEBUG 272 printf("IPI is pending.\n");277 log(LF_ARCH, LVL_DEBUG, "IPI is pending."); 273 278 #endif 274 279 delay(20); … … 489 494 { 490 495 #ifdef LAPIC_VERBOSE 491 printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n", 496 log_begin(LF_ARCH, LVL_DEBUG); 497 log_printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n", 492 498 CPU->id, l_apic_id()); 493 499 494 500 lvt_tm_t tm; 495 501 tm.value = l_apic[LVT_Tm]; 496 printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n",502 log_printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n", 497 503 tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], 498 504 tm_mode_str[tm.mode]); … … 500 506 lvt_lint_t lint; 501 507 lint.value = l_apic[LVT_LINT0]; 502 printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",508 log_printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n", 503 509 tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], 504 510 intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], … … 506 512 507 513 lint.value = l_apic[LVT_LINT1]; 508 printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",514 log_printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n", 509 515 tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], 510 516 intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], … … 513 519 lvt_error_t error; 514 520 error.value = l_apic[LVT_Err]; 515 printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector,521 log_printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector, 516 522 delivs_str[error.delivs], mask_str[error.masked]); 523 log_end(); 517 524 #endif 518 525 } -
kernel/arch/ia32/src/smp/mps.c
raacdb8e rfd07e57b 36 36 37 37 #include <config.h> 38 #include < print.h>38 #include <log.h> 39 39 #include <debug.h> 40 40 #include <arch/smp/mps.h> … … 181 181 buf[6] = 0; 182 182 183 printf("MPS: bus=%" PRIu8 " (%s)\n", bus->bus_id, buf);183 log(LF_ARCH, LVL_DEBUG, "MPS: bus=%" PRIu8 " (%s)", bus->bus_id, buf); 184 184 #endif 185 185 } … … 205 205 { 206 206 #ifdef MPSCT_VERBOSE 207 printf("MPS: "); 207 log_begin(LF_ARCH, LVL_DEBUG); 208 log_printf("MPS: "); 208 209 209 210 switch (iointr->intr_type) { 210 211 case 0: 211 printf("INT");212 break; 213 case 1: 214 printf("NMI");215 break; 216 case 2: 217 printf("SMI");218 break; 219 case 3: 220 printf("ExtINT");221 break; 222 } 223 224 printf(", ");212 log_printf("INT"); 213 break; 214 case 1: 215 log_printf("NMI"); 216 break; 217 case 2: 218 log_printf("SMI"); 219 break; 220 case 3: 221 log_printf("ExtINT"); 222 break; 223 } 224 225 log_printf(", "); 225 226 226 227 switch (iointr->poel & 3) { 227 228 case 0: 228 printf("bus-like");229 break; 230 case 1: 231 printf("active high");232 break; 233 case 2: 234 printf("reserved");235 break; 236 case 3: 237 printf("active low");238 break; 239 } 240 241 printf(", ");229 log_printf("bus-like"); 230 break; 231 case 1: 232 log_printf("active high"); 233 break; 234 case 2: 235 log_printf("reserved"); 236 break; 237 case 3: 238 log_printf("active low"); 239 break; 240 } 241 242 log_printf(", "); 242 243 243 244 switch ((iointr->poel >> 2) & 3) { 244 245 case 0: 245 printf("bus-like");246 break; 247 case 1: 248 printf("edge-triggered");249 break; 250 case 2: 251 printf("reserved");252 break; 253 case 3: 254 printf("level-triggered");255 break; 256 } 257 258 printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8" pin=%"259 PRIu8 "\n", iointr->src_bus_id, iointr->src_bus_irq,246 log_printf("bus-like"); 247 break; 248 case 1: 249 log_printf("edge-triggered"); 250 break; 251 case 2: 252 log_printf("reserved"); 253 break; 254 case 3: 255 log_printf("level-triggered"); 256 break; 257 } 258 259 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " io_apic=%" PRIu8" pin=%" 260 PRIu8, iointr->src_bus_id, iointr->src_bus_irq, 260 261 iointr->dst_io_apic_id, iointr->dst_io_apic_pin); 262 log_end(); 261 263 #endif 262 264 } … … 266 268 { 267 269 #ifdef MPSCT_VERBOSE 268 printf("MPS: "); 270 log_begin(LF_ARCH, LVL_DEBUG); 271 log_printf("MPS: "); 269 272 270 273 switch (lintr->intr_type) { 271 274 case 0: 272 printf("INT");273 break; 274 case 1: 275 printf("NMI");276 break; 277 case 2: 278 printf("SMI");279 break; 280 case 3: 281 printf("ExtINT");282 break; 283 } 284 285 printf(", ");275 log_printf("INT"); 276 break; 277 case 1: 278 log_printf("NMI"); 279 break; 280 case 2: 281 log_printf("SMI"); 282 break; 283 case 3: 284 log_printf("ExtINT"); 285 break; 286 } 287 288 log_printf(", "); 286 289 287 290 switch (lintr->poel & 3) { 288 291 case 0: 289 printf("bus-like");290 break; 291 case 1: 292 printf("active high");293 break; 294 case 2: 295 printf("reserved");296 break; 297 case 3: 298 printf("active low");299 break; 300 } 301 302 printf(", ");292 log_printf("bus-like"); 293 break; 294 case 1: 295 log_printf("active high"); 296 break; 297 case 2: 298 log_printf("reserved"); 299 break; 300 case 3: 301 log_printf("active low"); 302 break; 303 } 304 305 log_printf(", "); 303 306 304 307 switch ((lintr->poel >> 2) & 3) { 305 308 case 0: 306 printf("bus-like");307 break; 308 case 1: 309 printf("edge-triggered");310 break; 311 case 2: 312 printf("reserved");313 break; 314 case 3: 315 printf("level-triggered");316 break; 317 } 318 319 printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8" pin=%"320 PRIu8 "\n", lintr->src_bus_id, lintr->src_bus_irq,309 log_printf("bus-like"); 310 break; 311 case 1: 312 log_printf("edge-triggered"); 313 break; 314 case 2: 315 log_printf("reserved"); 316 break; 317 case 3: 318 log_printf("level-triggered"); 319 break; 320 } 321 322 log_printf(", bus=%" PRIu8 " irq=%" PRIu8 " l_apic=%" PRIu8" pin=%" 323 PRIu8, lintr->src_bus_id, lintr->src_bus_irq, 321 324 lintr->dst_l_apic_id, lintr->dst_l_apic_pin); 325 log_end(); 322 326 #endif 323 327 } … … 332 336 switch (cur[CT_EXT_ENTRY_TYPE]) { 333 337 default: 334 printf("MPS: Skipping MP Configuration Table extended " 335 "entry type %" PRIu8 "\n", cur[CT_EXT_ENTRY_TYPE]); 338 log(LF_ARCH, LVL_NOTE, "MPS: Skipping MP Configuration" 339 " Table extended entry type %" PRIu8, 340 cur[CT_EXT_ENTRY_TYPE]); 336 341 } 337 342 } … … 341 346 { 342 347 if (ct->signature != CT_SIGNATURE) { 343 printf("MPS: Wrong ct->signature\n");348 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct->signature"); 344 349 return; 345 350 } 346 351 347 352 if (!mps_ct_check()) { 348 printf("MPS: Wrong ct checksum\n");353 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct checksum"); 349 354 return; 350 355 } 351 356 352 357 if (ct->oem_table) { 353 printf("MPS: ct->oem_table not supported\n");358 log(LF_ARCH, LVL_WARN, "MPS: ct->oem_table not supported"); 354 359 return; 355 360 } … … 402 407 * Something is wrong. Fallback to UP mode. 403 408 */ 404 printf("MPS: ct badness %" PRIu8 "\n", *cur);409 log(LF_ARCH, LVL_WARN, "MPS: ct badness %" PRIu8, *cur); 405 410 return; 406 411 } … … 418 423 * Not yet implemented. 419 424 */ 420 printf("MPS: Default configuration not supported\n");425 log(LF_ARCH, LVL_WARN, "MPS: Default configuration not supported"); 421 426 } 422 427 … … 449 454 450 455 fs_found: 451 printf("%p: MPS Floating Pointer Structure\n", fs);456 log(LF_ARCH, LVL_NOTE, "%p: MPS Floating Pointer Structure", fs); 452 457 453 458 if ((fs->config_type == 0) && (fs->configuration_table)) { 454 459 if (fs->mpfib2 >> 7) { 455 printf("MPS: PIC mode not supported\n");460 log(LF_ARCH, LVL_WARN, "MPS: PIC mode not supported\n"); 456 461 return; 457 462 } -
kernel/arch/ia32/src/smp/smp.c
raacdb8e rfd07e57b 52 52 #include <mm/slab.h> 53 53 #include <mm/as.h> 54 #include < print.h>54 #include <log.h> 55 55 #include <memstr.h> 56 56 #include <arch/drivers/i8259.h> … … 129 129 130 130 if (ops->cpu_apic_id(i) == bsp_l_apic) { 131 printf("kmp: bad processor entry #%u, will not send IPI"132 " to myself\n", i);131 log(LF_ARCH, LVL_ERROR, "kmp: bad processor entry #%u, " 132 "will not send IPI to myself", i); 133 133 continue; 134 134 } … … 162 162 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, 163 163 SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) { 164 printf("%s: waiting for cpu%u (APIC ID = %d)"165 " timed out\n", __FUNCTION__, i,166 ops->cpu_apic_id(i));164 log(LF_ARCH, LVL_NOTE, "%s: waiting for cpu%u " 165 "(APIC ID = %d) timed out", __FUNCTION__, 166 i, ops->cpu_apic_id(i)); 167 167 } 168 168 } else 169 printf("INIT IPI for l_apic%d failed\n",169 log(LF_ARCH, LVL_ERROR, "INIT IPI for l_apic%d failed", 170 170 ops->cpu_apic_id(i)); 171 171 } -
kernel/arch/mips32/src/debugger.c
raacdb8e rfd07e57b 39 39 #include <console/cmd.h> 40 40 #include <print.h> 41 #include <log.h> 41 42 #include <panic.h> 42 43 #include <arch.h> … … 294 295 cmd_initialize(&bkpts_info); 295 296 if (!cmd_register(&bkpts_info)) 296 printf("Cannot register command %s\n", bkpts_info.name); 297 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 298 bkpts_info.name); 297 299 298 300 cmd_initialize(&delbkpt_info); 299 301 if (!cmd_register(&delbkpt_info)) 300 printf("Cannot register command %s\n", delbkpt_info.name); 302 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 303 delbkpt_info.name); 301 304 302 305 cmd_initialize(&addbkpt_info); 303 306 if (!cmd_register(&addbkpt_info)) 304 printf("Cannot register command %s\n", addbkpt_info.name); 307 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 308 addbkpt_info.name); 305 309 306 310 cmd_initialize(&addbkpte_info); 307 311 if (!cmd_register(&addbkpte_info)) 308 printf("Cannot register command %s\n", addbkpte_info.name); 312 log(LF_OTHER, LVL_WARN, "Cannot register command %s", 313 addbkpte_info.name); 309 314 #endif /* CONFIG_KCONSOLE */ 310 315 } -
kernel/arch/mips32/src/exception.c
raacdb8e rfd07e57b 48 48 #include <arch/debugger.h> 49 49 #include <symtab.h> 50 #include <log.h> 50 51 51 52 static const char *exctable[] = { … … 74 75 void istate_decode(istate_t *istate) 75 76 { 76 printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t"77 log_printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t" 77 78 "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n", 78 79 istate->epc, istate->status, istate->lo, istate->hi); 79 80 80 printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"81 log_printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t" 81 82 "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n", 82 83 istate->a0, istate->a1, istate->a2, istate->a3); 83 84 84 printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"85 log_printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t" 85 86 "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n", 86 87 istate->t0, istate->t1, istate->t2, istate->t3); 87 88 88 printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"89 log_printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t" 89 90 "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n", 90 91 istate->t4, istate->t5, istate->t6, istate->t7); 91 92 92 printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"93 log_printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t" 93 94 "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n", 94 95 istate->t8, istate->t9, istate->v0, istate->v1); 95 96 96 printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"97 log_printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t" 97 98 "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n", 98 99 istate->s0, istate->s1, istate->s2, istate->s3); 99 100 100 printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"101 log_printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t" 101 102 "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n", 102 103 istate->s4, istate->s5, istate->s6, istate->s7); 103 104 104 printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"105 log_printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t" 105 106 "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n", 106 107 istate->s8, istate->at, istate->kt0, istate->kt1); 107 108 108 printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"109 log_printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t" 109 110 "gp =%#010" PRIx32 "\n", 110 111 istate->sp, istate->ra, istate->gp); … … 194 195 */ 195 196 #ifdef CONFIG_DEBUG 196 printf("cpu%u: spurious interrupt (inum=%u)\n", 197 log(LF_ARCH, LVL_DEBUG, 198 "cpu%u: spurious interrupt (inum=%u)", 197 199 CPU->id, i); 198 200 #endif -
kernel/arch/mips32/src/mm/tlb.c
raacdb8e rfd07e57b 43 43 #include <synch/mutex.h> 44 44 #include <print.h> 45 #include <log.h> 45 46 #include <debug.h> 46 47 #include <align.h> … … 217 218 */ 218 219 if (index.p) { 219 printf("%s: TLBP failed in exception handler (badvaddr=%#"220 log(LF_ARCH, LVL_WARN, "%s: TLBP failed in exception handler (badvaddr=%#" 220 221 PRIxn ", ASID=%d).\n", __func__, badvaddr, 221 222 AS ? AS->asid : -1); -
kernel/arch/ppc32/src/interrupt.c
raacdb8e rfd07e57b 44 44 #include <arch/mm/pht.h> 45 45 #include <print.h> 46 #include <log.h> 46 47 47 48 void start_decrementer(void) … … 55 56 void istate_decode(istate_t *istate) 56 57 { 57 printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"58 log_printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t" 58 59 "r2 =%0#10" PRIx32 "\n", istate->r0, istate->sp, istate->r2); 59 60 60 printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"61 log_printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t" 61 62 "r5 =%0#10" PRIx32 "\n", istate->r3, istate->r4, istate->r5); 62 63 63 printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"64 log_printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t" 64 65 "r8 =%0#10" PRIx32 "\n", istate->r6, istate->r7, istate->r8); 65 66 66 printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"67 log_printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t" 67 68 "r11=%0#10" PRIx32 "\n", istate->r9, istate->r10, istate->r11); 68 69 69 printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"70 log_printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t" 70 71 "r14=%0#10" PRIx32 "\n", istate->r12, istate->r13, istate->r14); 71 72 72 printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"73 log_printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t" 73 74 "r17=%0#10" PRIx32 "\n", istate->r15, istate->r16, istate->r17); 74 75 75 printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"76 log_printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t" 76 77 "r20=%0#10" PRIx32 "\n", istate->r18, istate->r19, istate->r20); 77 78 78 printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"79 log_printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t" 79 80 "r23=%0#10" PRIx32 "\n", istate->r21, istate->r22, istate->r23); 80 81 81 printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"82 log_printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t" 82 83 "r26=%0#10" PRIx32 "\n", istate->r24, istate->r25, istate->r26); 83 84 84 printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"85 log_printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t" 85 86 "r29=%0#10" PRIx32 "\n", istate->r27, istate->r28, istate->r29); 86 87 87 printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",88 log_printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n", 88 89 istate->r30, istate->r31); 89 90 90 printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"91 log_printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t" 91 92 "lr =%0#10" PRIx32 "\n", istate->cr, istate->pc, istate->lr); 92 93 93 printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"94 log_printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t" 94 95 "dar=%0#10" PRIx32 "\n", istate->ctr, istate->xer, istate->dar); 95 96 96 printf("srr1=%0#10" PRIx32 "\n", istate->srr1);97 log_printf("srr1=%0#10" PRIx32 "\n", istate->srr1); 97 98 } 98 99 … … 130 131 */ 131 132 #ifdef CONFIG_DEBUG 132 printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",133 CPU->id, inum);133 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt" 134 " (inum=%" PRIu8 ")", CPU->id, inum); 134 135 #endif 135 136 } -
kernel/arch/sparc64/src/drivers/kbd.c
raacdb8e rfd07e57b 44 44 #include <align.h> 45 45 #include <str.h> 46 #include < print.h>46 #include <log.h> 47 47 #include <sysinfo/sysinfo.h> 48 48 … … 71 71 ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts"); 72 72 if ((!prop) || (!prop->value)) { 73 printf("ns16550: Unable to find interrupts property\n"); 73 log(LF_ARCH, LVL_ERROR, 74 "ns16550: Unable to find interrupts property"); 74 75 return false; 75 76 } … … 82 83 prop = ofw_tree_getprop(node, "reg"); 83 84 if ((!prop) || (!prop->value)) { 84 printf("ns16550: Unable to find reg property\n"); 85 log(LF_ARCH, LVL_ERROR, 86 "ns16550: Unable to find reg property"); 85 87 return false; 86 88 } … … 91 93 if (!ofw_ebus_apply_ranges(node->parent, 92 94 ((ofw_ebus_reg_t *) prop->value), &pa)) { 93 printf("ns16550: Failed to determine address\n"); 95 log(LF_ARCH, LVL_ERROR, 96 "ns16550: Failed to determine address"); 94 97 return false; 95 98 } … … 101 104 ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir, 102 105 &cir_arg)) { 103 printf("ns16550: Failed to determine interrupt\n"); 106 log(LF_ARCH, LVL_ERROR, 107 "ns16550: Failed to determine interrupt"); 104 108 return false; 105 109 } … … 117 121 PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset); 118 122 119 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, cir_arg); 123 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, 124 cir_arg, NULL); 120 125 if (ns16550_instance) { 121 126 kbrd_instance_t *kbrd_instance = kbrd_init(); -
kernel/arch/sparc64/src/drivers/pci.c
raacdb8e rfd07e57b 43 43 #include <typedefs.h> 44 44 #include <debug.h> 45 #include < print.h>45 #include <log.h> 46 46 #include <str.h> 47 47 #include <arch/asm.h> … … 213 213 * Unsupported model. 214 214 */ 215 printf("Unsupported PCI controller model (%s).\n",215 log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).", 216 216 (char *) prop->value); 217 217 } -
kernel/arch/sparc64/src/drivers/scr.c
raacdb8e rfd07e57b 81 81 82 82 if (scr_type == SCR_UNKNOWN) { 83 printf("Unknown screen device.\n");83 log(LF_ARCH, LVL_ERROR, "Unknown screen device."); 84 84 return; 85 85 } … … 117 117 case SCR_ATYFB: 118 118 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 119 printf("Too few screen registers.\n");119 log(LF_ARCH, LVL_ERROR, "Too few screen registers."); 120 120 return; 121 121 } … … 124 124 125 125 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 126 printf("Failed to absolutize fb register.\n"); 126 log(LF_ARCH, LVL_ERROR, 127 "Failed to absolutize fb register."); 127 128 return; 128 129 } … … 130 131 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 131 132 &fb_addr)) { 132 printf("Failed to determine screen address.\n"); 133 log(LF_ARCH, LVL_ERROR, 134 "Failed to determine screen address."); 133 135 return; 134 136 } … … 152 154 break; 153 155 default: 154 printf("Unsupported bits per pixel.\n"); 156 log(LF_ARCH, LVL_ERROR, 157 "Unsupported bits per pixel."); 155 158 return; 156 159 } … … 159 162 case SCR_XVR: 160 163 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 161 printf("Too few screen registers.\n"); 164 log(LF_ARCH, LVL_ERROR, 165 "Too few screen registers."); 162 166 return; 163 167 } … … 166 170 167 171 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 168 printf("Failed to absolutize fb register.\n"); 172 log(LF_ARCH, LVL_ERROR, 173 "Failed to absolutize fb register."); 169 174 return; 170 175 } … … 172 177 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 173 178 &fb_addr)) { 174 printf("Failed to determine screen address.\n"); 179 log(LF_ARCH, LVL_ERROR, 180 "Failed to determine screen address."); 175 181 return; 176 182 } … … 196 202 break; 197 203 default: 198 printf("Unsupported bits per pixel.\n"); 204 log(LF_ARCH, LVL_ERROR, 205 "Unsupported bits per pixel."); 199 206 return; 200 207 } … … 207 214 upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; 208 215 if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) { 209 printf("Failed to determine screen address.\n"); 216 log(LF_ARCH, LVL_ERROR, 217 "Failed to determine screen address."); 210 218 return; 211 219 } … … 219 227 break; 220 228 default: 221 printf("Not implemented.\n");229 log(LF_ARCH, LVL_WARN, "Not implemented."); 222 230 return; 223 231 } … … 225 233 sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0]; 226 234 if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) { 227 printf("Failed to determine screen address.\n"); 235 log(LF_ARCH, LVL_ERROR, 236 "Failed to determine screen address."); 228 237 return; 229 238 } … … 233 242 case SCR_QEMU_VGA: 234 243 if (prop->size / sizeof(ofw_pci_reg_t) < 2) { 235 printf("Too few screen registers.\n");244 log(LF_ARCH, LVL_ERROR, "Too few screen registers."); 236 245 return; 237 246 } … … 240 249 241 250 if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) { 242 printf("Failed to absolutize fb register.\n"); 251 log(LF_ARCH, LVL_ERROR, 252 "Failed to absolutize fb register."); 243 253 return; 244 254 } … … 246 256 if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg, 247 257 &fb_addr)) { 248 printf("Failed to determine screen address.\n"); 258 log(LF_ARCH, LVL_ERROR, 259 "Failed to determine screen address."); 249 260 return; 250 261 } … … 268 279 break; 269 280 default: 270 printf("Unsupported bits per pixel.\n");281 log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel."); 271 282 return; 272 283 } -
kernel/arch/sparc64/src/mm/sun4v/tlb.c
raacdb8e rfd07e57b 46 46 #include <arch.h> 47 47 #include <print.h> 48 #include <log.h> 48 49 #include <typedefs.h> 49 50 #include <config.h> … … 335 336 void tlb_print(void) 336 337 { 337 printf("Operation not possible on Niagara.\n");338 log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara."); 338 339 } 339 340 -
kernel/arch/sparc64/src/smp/sun4u/smp.c
raacdb8e rfd07e57b 43 43 #include <typedefs.h> 44 44 #include <synch/waitq.h> 45 #include < print.h>45 #include <log.h> 46 46 #include <arch/cpu_node.h> 47 47 … … 108 108 if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) == 109 109 ESYNCH_TIMEOUT) 110 printf("%s: waiting for processor (mid = %" PRIu32111 ") timed out \n", __func__, mid);110 log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32 111 ") timed out", __func__, mid); 112 112 } 113 113 -
kernel/arch/sparc64/src/sun4v/md.c
raacdb8e rfd07e57b 36 36 #include <panic.h> 37 37 #include <func.h> 38 #include < print.h>38 #include <log.h> 39 39 #include <str.h> 40 40 #include <arch/sun4v/md.h> … … 310 310 retval = retval; 311 311 if (retval != HV_EOK) { 312 printf("Could not retrieve machine description,"313 " error=%" PRIu64 ".\n", retval);312 log(LF_ARCH, LVL_ERROR, "Could not retrieve machine " 313 "description, error=%" PRIu64 ".", retval); 314 314 } 315 315 } -
kernel/arch/sparc64/src/trap/sun4u/interrupt.c
raacdb8e rfd07e57b 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 96 96 */ 97 97 #ifdef CONFIG_DEBUG 98 printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64 99 ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0); 98 log(LF_ARCH, LVL_DEBUG, 99 "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#" 100 PRIx64 ")", CPU->id, intrcv, data0); 100 101 #else 101 102 (void) intrcv; -
kernel/arch/sparc64/src/trap/sun4v/interrupt.c
raacdb8e rfd07e57b 42 42 #include <arch/asm.h> 43 43 #include <arch/barrier.h> 44 #include < print.h>44 #include <log.h> 45 45 #include <arch.h> 46 46 #include <mm/tlb.h> … … 111 111 ((void (*)(void)) data1)(); 112 112 } else { 113 printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",114 CPU->arch.id, data1);113 log(LF_ARCH, LVL_DEBUG, "Spurious interrupt on %" PRIu64 114 ", data = %" PRIx64 ".", CPU->arch.id, data1); 115 115 } 116 116 } -
kernel/doc/doxygroups.h
raacdb8e rfd07e57b 167 167 */ 168 168 169 /** @defgroup generick log KLog170 * @brief Kernel loggingfacility169 /** @defgroup generickio KIO 170 * @brief Kernel character input/output facility 171 171 * @ingroup genericconsole 172 172 */ -
kernel/genarch/src/acpi/acpi.c
raacdb8e rfd07e57b 41 41 #include <mm/page.h> 42 42 #include <mm/km.h> 43 #include < print.h>43 #include <log.h> 44 44 45 45 #define RSDP_SIGNATURE "RSD PTR " … … 211 211 212 212 if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) { 213 printf("RSDT: bad checksum\n");213 log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum"); 214 214 return; 215 215 } 216 216 217 217 if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) { 218 printf("XSDT: bad checksum\n");218 log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum"); 219 219 return; 220 220 } -
kernel/genarch/src/acpi/madt.c
raacdb8e rfd07e57b 43 43 #include <debug.h> 44 44 #include <config.h> 45 #include < print.h>45 #include <log.h> 46 46 #include <mm/slab.h> 47 47 #include <memstr.h> … … 236 236 case MADT_L_SAPIC: 237 237 case MADT_PLATFORM_INTR_SRC: 238 printf("MADT: Skipping %s entry (type=%" PRIu8 ")\n", 238 log(LF_ARCH, LVL_WARN, 239 "MADT: Skipping %s entry (type=%" PRIu8 ")", 239 240 entry[hdr->type], hdr->type); 240 241 break; … … 242 243 if ((hdr->type >= MADT_RESERVED_SKIP_BEGIN) 243 244 && (hdr->type <= MADT_RESERVED_SKIP_END)) 244 printf("MADT: Skipping reserved entry (type=%" PRIu8 ")\n", 245 log(LF_ARCH, LVL_NOTE, 246 "MADT: Skipping reserved entry (type=%" PRIu8 ")", 245 247 hdr->type); 246 248 247 249 if (hdr->type >= MADT_RESERVED_OEM_BEGIN) 248 printf("MADT: Skipping OEM entry (type=%" PRIu8 ")\n", 250 log(LF_ARCH, LVL_NOTE, 251 "MADT: Skipping OEM entry (type=%" PRIu8 ")", 249 252 hdr->type); 250 253 -
kernel/genarch/src/drivers/via-cuda/cuda.c
raacdb8e rfd07e57b 118 118 } 119 119 120 #include < print.h>120 #include <log.h> 121 121 void cuda_wire(cuda_instance_t *instance, indev_t *kbrdin) 122 122 { … … 197 197 198 198 if ((b & TREQ) != 0) { 199 printf("cuda_irq_listen: no TREQ?!\n");199 log(LF_OTHER, LVL_ERROR, "cuda_irq_listen: no TREQ?!"); 200 200 return; 201 201 } -
kernel/generic/include/console/console.h
raacdb8e rfd07e57b 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) \ … … 62 63 extern void console_init(void); 63 64 64 extern void klog_init(void); 65 extern void klog_update(void *); 65 extern void kio_init(void); 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); 68 72 extern size_t gets(indev_t *indev, char *buf, size_t buflen); 69 extern sysarg_t sys_k log(int cmd, const void *buf, size_t size);73 extern sysarg_t sys_kio(int cmd, const void *buf, size_t size); 70 74 71 75 extern void grab_console(void); -
kernel/generic/include/debug.h
raacdb8e rfd07e57b 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/include/synch/spinlock.h
raacdb8e rfd07e57b 137 137 #ifdef CONFIG_DEBUG_SPINLOCK 138 138 139 #include < print.h>139 #include <log.h> 140 140 141 141 #define DEADLOCK_THRESHOLD 100000000 … … 146 146 if ((pname)++ > (value)) { \ 147 147 (pname) = 0; \ 148 printf("Deadlock probe %s: exceeded threshold %u\n" \ 148 log(LF_OTHER, LVL_WARN, \ 149 "Deadlock probe %s: exceeded threshold %u\n" \ 149 150 "cpu%u: function=%s, line=%u\n", \ 150 151 #pname, (value), CPU->id, __func__, __LINE__); \ -
kernel/generic/src/console/cmd.c
raacdb8e rfd07e57b 45 45 #include <console/kconsole.h> 46 46 #include <print.h> 47 #include <log.h> 47 48 #include <panic.h> 48 49 #include <typedefs.h> … … 639 640 for (i = 0; basic_commands[i]; i++) { 640 641 if (!cmd_register(basic_commands[i])) { 641 printf("Cannot register command %s\n", 642 log(LF_OTHER, LVL_ERROR, 643 "Cannot register command %s", 642 644 basic_commands[i]->name); 643 645 } … … 665 667 unsigned int _len = (unsigned int) len; 666 668 if ((_len != len) || (((int) _len) < 0)) { 667 printf("Command length overflow\n");669 log(LF_OTHER, LVL_ERROR, "Command length overflow"); 668 670 return 1; 669 671 } -
kernel/generic/src/console/console.c
raacdb8e rfd07e57b 52 52 #include <errno.h> 53 53 #include <str.h> 54 #include <abi/k log.h>55 56 #define K LOG_PAGES 857 #define K LOG_LENGTH (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))54 #include <abi/kio.h> 55 56 #define KIO_PAGES 8 57 #define KIO_LENGTH (KIO_PAGES * PAGE_SIZE / sizeof(wchar_t)) 58 58 59 59 /** Kernel log cyclic buffer */ 60 wchar_t k log[KLOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));60 wchar_t kio[KIO_LENGTH] __attribute__((aligned(PAGE_SIZE))); 61 61 62 62 /** Kernel log initialized */ 63 static atomic_t k log_inited = {false};63 static atomic_t kio_inited = {false}; 64 64 65 65 /** First kernel log characters */ 66 static size_t k log_start = 0;66 static size_t kio_start = 0; 67 67 68 68 /** Number of valid kernel log characters */ 69 static size_t k log_len = 0;69 static size_t kio_len = 0; 70 70 71 71 /** Number of stored (not printed) kernel log characters */ 72 static size_t k log_stored = 0;72 static size_t kio_stored = 0; 73 73 74 74 /** Number of stored kernel log characters for uspace */ 75 static size_t k log_uspace = 0;75 static size_t kio_uspace = 0; 76 76 77 77 /** Kernel log spinlock */ 78 SPINLOCK_ STATIC_INITIALIZE_NAME(klog_lock, "klog_lock");79 80 /** Physical memory area used for k logbuffer */81 static parea_t k log_parea;78 SPINLOCK_INITIALIZE_NAME(kio_lock, "kio_lock"); 79 80 /** Physical memory area used for kio buffer */ 81 static parea_t kio_parea; 82 82 83 83 static indev_t stdin_sink; … … 146 146 * 147 147 */ 148 void k log_init(void)149 { 150 void *faddr = (void *) KA2PA(k log);148 void kio_init(void) 149 { 150 void *faddr = (void *) KA2PA(kio); 151 151 152 152 ASSERT((uintptr_t) faddr % FRAME_SIZE == 0); 153 153 154 k log_parea.pbase = (uintptr_t) faddr;155 k log_parea.frames = SIZE2FRAMES(sizeof(klog));156 k log_parea.unpriv = false;157 k log_parea.mapped = false;158 ddi_parea_register(&k log_parea);159 160 sysinfo_set_item_val("k log.faddr", NULL, (sysarg_t) faddr);161 sysinfo_set_item_val("k log.pages", NULL, KLOG_PAGES);162 163 event_set_unmask_callback(EVENT_K LOG, klog_update);164 atomic_set(&k log_inited, true);154 kio_parea.pbase = (uintptr_t) faddr; 155 kio_parea.frames = SIZE2FRAMES(sizeof(kio)); 156 kio_parea.unpriv = false; 157 kio_parea.mapped = false; 158 ddi_parea_register(&kio_parea); 159 160 sysinfo_set_item_val("kio.faddr", NULL, (sysarg_t) faddr); 161 sysinfo_set_item_val("kio.pages", NULL, KIO_PAGES); 162 163 event_set_unmask_callback(EVENT_KIO, kio_update); 164 atomic_set(&kio_inited, true); 165 165 } 166 166 … … 247 247 } 248 248 249 void k log_update(void *event)250 { 251 if (!atomic_get(&k log_inited))249 void kio_update(void *event) 250 { 251 if (!atomic_get(&kio_inited)) 252 252 return; 253 253 254 spinlock_lock(&klog_lock); 255 256 if (klog_uspace > 0) { 257 if (event_notify_3(EVENT_KLOG, true, klog_start, klog_len, 258 klog_uspace) == EOK) 259 klog_uspace = 0; 260 } 261 262 spinlock_unlock(&klog_lock); 254 spinlock_lock(&kio_lock); 255 256 if (kio_uspace > 0) { 257 if (event_notify_3(EVENT_KIO, true, kio_start, kio_len, 258 kio_uspace) == EOK) 259 kio_uspace = 0; 260 } 261 262 spinlock_unlock(&kio_lock); 263 } 264 265 /** Flush characters that are stored in the output buffer 266 * 267 */ 268 void kio_flush(void) 269 { 270 bool ordy = ((stdout) && (stdout->op->write)); 271 272 if (!ordy) 273 return; 274 275 spinlock_lock(&kio_lock); 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 { 301 kio[(kio_start + kio_len) % KIO_LENGTH] = ch; 302 if (kio_len < KIO_LENGTH) 303 kio_len++; 304 else 305 kio_start = (kio_start + 1) % KIO_LENGTH; 306 307 if (kio_stored < kio_len) 308 kio_stored++; 309 310 /* The character is stored for uspace */ 311 if (kio_uspace < kio_len) 312 kio_uspace++; 263 313 } 264 314 … … 267 317 bool ordy = ((stdout) && (stdout->op->write)); 268 318 269 spinlock_lock(&klog_lock); 270 271 /* Print charaters stored in kernel log */ 272 if (ordy) { 273 while (klog_stored > 0) { 274 wchar_t tmp = klog[(klog_start + klog_len - klog_stored) % KLOG_LENGTH]; 275 klog_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(&klog_lock); 283 stdout->op->write(stdout, tmp); 284 spinlock_lock(&klog_lock); 285 } 286 } 287 288 /* Store character in the cyclic kernel log */ 289 klog[(klog_start + klog_len) % KLOG_LENGTH] = ch; 290 if (klog_len < KLOG_LENGTH) 291 klog_len++; 292 else 293 klog_start = (klog_start + 1) % KLOG_LENGTH; 319 spinlock_lock(&kio_lock); 320 kio_push_char(ch); 321 spinlock_unlock(&kio_lock); 322 323 /* Output stored characters */ 324 kio_flush(); 294 325 295 326 if (!ordy) { 296 if (klog_stored < klog_len)297 klog_stored++;298 }299 300 /* The character is stored for uspace */301 if (klog_uspace < klog_len)302 klog_uspace++;303 304 spinlock_unlock(&klog_lock);305 306 if (ordy) {307 /*308 * Output the character. In this case309 * it should be no longer buffered.310 */311 stdout->op->write(stdout, ch);312 } else {313 327 /* 314 328 * No standard output routine defined yet. … … 326 340 /* Force notification on newline */ 327 341 if (ch == '\n') 328 k log_update(NULL);342 kio_update(NULL); 329 343 } 330 344 … … 334 348 * 335 349 */ 336 sysarg_t sys_k log(int cmd, const void *buf, size_t size)350 sysarg_t sys_kio(int cmd, const void *buf, size_t size) 337 351 { 338 352 char *data; … … 340 354 341 355 switch (cmd) { 342 case K LOG_UPDATE:343 k log_update(NULL);356 case KIO_UPDATE: 357 kio_update(NULL); 344 358 return EOK; 345 case K LOG_WRITE:346 case K LOG_COMMAND:359 case KIO_WRITE: 360 case KIO_COMMAND: 347 361 break; 348 362 default: … … 366 380 367 381 switch (cmd) { 368 case K LOG_WRITE:382 case KIO_WRITE: 369 383 printf("%s", data); 370 384 break; 371 case K LOG_COMMAND:385 case KIO_COMMAND: 372 386 if (!stdin) 373 387 break; -
kernel/generic/src/lib/func.c
raacdb8e rfd07e57b 37 37 38 38 #include <func.h> 39 #include < print.h>39 #include <log.h> 40 40 #include <cpu.h> 41 41 #include <arch/asm.h> … … 72 72 73 73 if (CPU) 74 printf("cpu%u: halted\n", CPU->id);74 log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id); 75 75 else 76 printf("cpu: halted\n");76 log(LF_OTHER, LVL_NOTE, "cpu: halted"); 77 77 78 78 cpu_halt(); -
kernel/generic/src/lib/rd.c
raacdb8e rfd07e57b 38 38 */ 39 39 40 #include < print.h>40 #include <log.h> 41 41 #include <lib/rd.h> 42 42 #include <mm/frame.h> … … 68 68 sysinfo_set_item_val("rd.address.physical", NULL, (sysarg_t) base); 69 69 70 printf("RAM disk at %p (size %zu bytes)\n", (void *) base, size); 70 log(LF_OTHER, LVL_NOTE, "RAM disk at %p (size %zu bytes)", (void *) base, 71 size); 71 72 } 72 73 -
kernel/generic/src/main/kinit.c
raacdb8e rfd07e57b 59 59 #include <mm/km.h> 60 60 #include <print.h> 61 #include <log.h> 61 62 #include <memstr.h> 62 63 #include <console/console.h> … … 140 141 thread_ready(thread); 141 142 } else 142 printf("Unable to create kcpulb thread for cpu%u\n", i); 143 log(LF_OTHER, LVL_ERROR, 144 "Unable to create kcpulb thread for cpu%u", i); 143 145 } 144 146 } … … 156 158 thread_ready(thread); 157 159 else 158 printf("Unable to create kload thread\n");160 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread"); 159 161 160 162 #ifdef CONFIG_KCONSOLE … … 168 170 thread_ready(thread); 169 171 else 170 printf("Unable to create kconsole thread\n"); 172 log(LF_OTHER, LVL_ERROR, 173 "Unable to create kconsole thread"); 171 174 } 172 175 #endif /* CONFIG_KCONSOLE */ … … 210 213 for (i = 0; i < init.cnt; i++) { 211 214 if (init.tasks[i].paddr % FRAME_SIZE) { 212 printf("init[%zu]: Address is not frame aligned\n", i); 215 log(LF_OTHER, LVL_ERROR, 216 "init[%zu]: Address is not frame aligned", i); 213 217 programs[i].task = NULL; 214 218 continue; … … 273 277 init_rd((void *) init.tasks[i].paddr, init.tasks[i].size); 274 278 } else 275 printf("init[%zu]: Init binary load failed " 276 "(error %d, loader status %u)\n", i, rc, 279 log(LF_OTHER, LVL_ERROR, 280 "init[%zu]: Init binary load failed " 281 "(error %d, loader status %u)", i, rc, 277 282 programs[i].loader_status); 278 283 } -
kernel/generic/src/main/main.c
raacdb8e rfd07e57b 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> … … 281 282 ipc_init(); 282 283 event_init(); 283 klog_init(); 284 kio_init(); 285 log_init(); 284 286 stats_init(); 285 287 -
kernel/generic/src/main/shutdown.c
raacdb8e rfd07e57b 39 39 #include <func.h> 40 40 #include <print.h> 41 #include <log.h> 41 42 42 43 void reboot(void) … … 45 46 46 47 #ifdef CONFIG_DEBUG 47 printf("Rebooting the system\n");48 log(LF_OTHER, LVL_DEBUG, "Rebooting the system"); 48 49 #endif 49 50 -
kernel/generic/src/mm/frame.c
raacdb8e rfd07e57b 54 54 #include <arch.h> 55 55 #include <print.h> 56 #include <log.h> 56 57 #include <align.h> 57 58 #include <mm/slab.h> … … 121 122 { 122 123 if (zones.count + 1 == ZONES_MAX) { 123 printf("Maximum zone count %u exceeded!\n", ZONES_MAX); 124 log(LF_OTHER, LVL_ERROR, "Maximum zone count %u exceeded!", 125 ZONES_MAX); 124 126 return (size_t) -1; 125 127 } … … 141 143 (!iswithin(zones.info[i].base, zones.info[i].count, 142 144 base, count))) { 143 printf("Zone (%p, %p) overlaps " 144 "with previous zone (%p %p)!\n", 145 log(LF_OTHER, LVL_WARN, 146 "Zone (%p, %p) overlaps " 147 "with previous zone (%p %p)!", 145 148 (void *) PFN2ADDR(base), (void *) PFN2ADDR(count), 146 149 (void *) PFN2ADDR(zones.info[i].base), … … 913 916 914 917 #ifdef CONFIG_DEBUG 915 printf("Thread %" PRIu64 " waiting for %zu frames " 916 "(%zu available).\n", THREAD->tid, count, avail); 918 log(LF_OTHER, LVL_DEBUG, 919 "Thread %" PRIu64 " waiting for %zu frames " 920 "%zu available.", THREAD->tid, count, avail); 917 921 #endif 918 922 … … 938 942 939 943 #ifdef CONFIG_DEBUG 940 printf("Thread %" PRIu64 " woken up.\n", THREAD->tid); 944 log(LF_OTHER, LVL_DEBUG, "Thread %" PRIu64 " woken up.", 945 THREAD->tid); 941 946 #endif 942 947 -
kernel/generic/src/proc/program.c
raacdb8e rfd07e57b 49 49 #include <lib/elf_load.h> 50 50 #include <errno.h> 51 #include < print.h>51 #include <log.h> 52 52 #include <syscall/copy.h> 53 53 #include <proc/program.h> … … 155 155 156 156 program_loader = image_addr; 157 printf("Program loader at %p\n", (void *) image_addr);157 log(LF_OTHER, LVL_NOTE, "Program loader at %p", (void *) image_addr); 158 158 159 159 return EOK; … … 181 181 if (!loader) { 182 182 as_destroy(as); 183 printf("Cannot spawn loader as none was registered\n"); 183 log(LF_OTHER, LVL_ERROR, 184 "Cannot spawn loader as none was registered"); 184 185 return ENOENT; 185 186 } … … 189 190 if (prg->loader_status != EE_OK) { 190 191 as_destroy(as); 191 printf("Cannot spawn loader (%s)\n",192 log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)", 192 193 elf_error(prg->loader_status)); 193 194 return ENOENT; -
kernel/generic/src/proc/scheduler.c
raacdb8e rfd07e57b 61 61 #include <cpu.h> 62 62 #include <print.h> 63 #include <log.h> 63 64 #include <debug.h> 64 65 #include <stacktrace.h> … … 517 518 518 519 #ifdef SCHEDULER_VERBOSE 519 printf("cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64 520 ", nrdy=%" PRIua ")\n", CPU->id, THREAD->tid, THREAD->priority, 520 log(LF_OTHER, LVL_DEBUG, 521 "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64 522 ", nrdy=%" PRIua ")", CPU->id, THREAD->tid, THREAD->priority, 521 523 THREAD->ticks, atomic_get(&CPU->nrdy)); 522 524 #endif … … 663 665 664 666 #ifdef KCPULB_VERBOSE 665 printf("kcpulb%u: TID %" PRIu64 " -> cpu%u, " 666 "nrdy=%ld, avg=%ld\n", CPU->id, t->tid, 667 log(LF_OTHER, LVL_DEBUG, 668 "kcpulb%u: TID %" PRIu64 " -> cpu%u, " 669 "nrdy=%ld, avg=%ld", CPU->id, t->tid, 667 670 CPU->id, atomic_get(&CPU->nrdy), 668 671 atomic_get(&nrdy) / config.cpu_active); -
kernel/generic/src/syscall/syscall.c
raacdb8e rfd07e57b 56 56 #include <console/console.h> 57 57 #include <udebug/udebug.h> 58 #include <log.h> 58 59 59 60 /** Dispatch system call */ … … 86 87 rc = syscall_table[id](a1, a2, a3, a4, a5, a6); 87 88 } else { 88 printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 89 log(LF_OTHER, LVL_ERROR, 90 "Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id); 89 91 task_kill_self(true); 90 92 } … … 120 122 syshandler_t syscall_table[SYSCALL_END] = { 121 123 /* System management syscalls. */ 122 (syshandler_t) sys_k log,124 (syshandler_t) sys_kio, 123 125 (syshandler_t) sys_tls_set, 124 126 … … 190 192 191 193 /* Kernel console syscalls. */ 192 (syshandler_t) sys_debug_activate_console 194 (syshandler_t) sys_debug_activate_console, 195 196 (syshandler_t) sys_klog, 193 197 }; 194 198 -
uspace/Makefile
raacdb8e rfd07e57b 50 50 app/kill \ 51 51 app/killall \ 52 app/k log\52 app/kio \ 53 53 app/loc \ 54 54 app/logset \ … … 92 92 srv/locsrv \ 93 93 srv/logger \ 94 srv/klog \ 94 95 srv/devman \ 95 96 srv/loader \ -
uspace/app/init/init.c
raacdb8e rfd07e57b 336 336 srv_start("/srv/tmpfs"); 337 337 338 srv_start("/srv/klog"); 338 339 srv_start("/srv/locfs"); 339 340 srv_start("/srv/taskmon"); -
uspace/app/kio/Makefile
raacdb8e rfd07e57b 31 31 LIBS = $(LIBCLUI_PREFIX)/libclui.a 32 32 EXTRA_CFLAGS = -I$(LIBCLUI_PREFIX) 33 BINARY = k log33 BINARY = kio 34 34 35 35 SOURCES = \ 36 k log.c36 kio.c 37 37 38 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/app/kio/kio.c
raacdb8e rfd07e57b 27 27 */ 28 28 29 /** @addtogroup k log KLog30 * @brief HelenOS K Log29 /** @addtogroup kio KIO 30 * @brief HelenOS KIO 31 31 * @{ 32 32 */ … … 42 42 #include <errno.h> 43 43 #include <str_error.h> 44 #include <io/k log.h>44 #include <io/kio.h> 45 45 #include <sysinfo.h> 46 46 #include <malloc.h> … … 50 50 #include <tinput.h> 51 51 52 #define NAME "k log"53 #define LOG_FNAME "/log/k log"52 #define NAME "kio" 53 #define LOG_FNAME "/log/kio" 54 54 55 55 /* Producer/consumer buffers */ … … 62 62 static prodcons_t pc; 63 63 64 /* Pointer to k logarea */65 static wchar_t *k log;66 static size_t k log_length;64 /* Pointer to kio area */ 65 static wchar_t *kio; 66 static size_t kio_length; 67 67 68 68 /* Notification mutex */ … … 75 75 * 76 76 * @param length Number of characters to copy. 77 * @param data Pointer to the kernel k logbuffer.77 * @param data Pointer to the kernel kio buffer. 78 78 * 79 79 */ … … 142 142 /** Kernel notification handler 143 143 * 144 * Receives kernel k lognotifications.144 * Receives kernel kio notifications. 145 145 * 146 146 * @param callid IPC call ID … … 156 156 * starving. 157 157 * 158 * Note: Usually the automatic masking of the k log158 * Note: Usually the automatic masking of the kio 159 159 * notifications on the kernel side does the trick 160 160 * of limiting the chance of accidentally copying 161 161 * the same data multiple times. However, due to 162 * the non-blocking architecture of k lognotifications,162 * the non-blocking architecture of kio notifications, 163 163 * this possibility cannot be generally avoided. 164 164 */ … … 166 166 fibril_mutex_lock(&mtx); 167 167 168 size_t k log_start = (size_t) IPC_GET_ARG1(*call);169 size_t k log_len = (size_t) IPC_GET_ARG2(*call);170 size_t k log_stored = (size_t) IPC_GET_ARG3(*call);171 172 size_t offset = (k log_start + klog_len - klog_stored) % klog_length;168 size_t kio_start = (size_t) IPC_GET_ARG1(*call); 169 size_t kio_len = (size_t) IPC_GET_ARG2(*call); 170 size_t kio_stored = (size_t) IPC_GET_ARG3(*call); 171 172 size_t offset = (kio_start + kio_len - kio_stored) % kio_length; 173 173 174 174 /* Copy data from the ring buffer */ 175 if (offset + k log_stored >= klog_length) {176 size_t split = k log_length - offset;177 178 producer(split, k log+ offset);179 producer(k log_stored - split, klog);175 if (offset + kio_stored >= kio_length) { 176 size_t split = kio_length - offset; 177 178 producer(split, kio + offset); 179 producer(kio_stored - split, kio); 180 180 } else 181 producer(k log_stored, klog+ offset);182 183 event_unmask(EVENT_K LOG);181 producer(kio_stored, kio + offset); 182 183 event_unmask(EVENT_KIO); 184 184 fibril_mutex_unlock(&mtx); 185 185 } … … 188 188 { 189 189 size_t pages; 190 int rc = sysinfo_get_value("k log.pages", &pages);191 if (rc != EOK) { 192 fprintf(stderr, "%s: Unable to get number of k logpages\n",190 int rc = sysinfo_get_value("kio.pages", &pages); 191 if (rc != EOK) { 192 fprintf(stderr, "%s: Unable to get number of kio pages\n", 193 193 NAME); 194 194 return rc; … … 196 196 197 197 uintptr_t faddr; 198 rc = sysinfo_get_value("k log.faddr", &faddr);199 if (rc != EOK) { 200 fprintf(stderr, "%s: Unable to get k logphysical address\n",198 rc = sysinfo_get_value("kio.faddr", &faddr); 199 if (rc != EOK) { 200 fprintf(stderr, "%s: Unable to get kio physical address\n", 201 201 NAME); 202 202 return rc; … … 204 204 205 205 size_t size = pages * PAGE_SIZE; 206 k log_length = size / sizeof(wchar_t);206 kio_length = size / sizeof(wchar_t); 207 207 208 208 rc = physmem_map(faddr, pages, AS_AREA_READ | AS_AREA_CACHEABLE, 209 (void *) &k log);210 if (rc != EOK) { 211 fprintf(stderr, "%s: Unable to map k log\n", NAME);209 (void *) &kio); 210 if (rc != EOK) { 211 fprintf(stderr, "%s: Unable to map kio\n", NAME); 212 212 return rc; 213 213 } … … 215 215 prodcons_initialize(&pc); 216 216 async_set_interrupt_received(notification_received); 217 rc = event_subscribe(EVENT_K LOG, 0);218 if (rc != EOK) { 219 fprintf(stderr, "%s: Unable to register k lognotifications\n",217 rc = event_subscribe(EVENT_KIO, 0); 218 if (rc != EOK) { 219 fprintf(stderr, "%s: Unable to register kio notifications\n", 220 220 NAME); 221 221 return rc; … … 236 236 237 237 fibril_add_ready(fid); 238 event_unmask(EVENT_K LOG);239 k log_update();240 241 tinput_set_prompt(input, "k log> ");238 event_unmask(EVENT_KIO); 239 kio_update(); 240 241 tinput_set_prompt(input, "kio> "); 242 242 243 243 char *str; … … 248 248 } 249 249 250 k log_command(str, str_size(str));250 kio_command(str, str_size(str)); 251 251 free(str); 252 252 } -
uspace/app/trace/syscalls.c
raacdb8e rfd07e57b 38 38 39 39 const sc_desc_t syscall_desc[] = { 40 [SYS_K LOG] ={ "klog",3, V_INT_ERRNO },40 [SYS_KIO] ={ "kio", 3, V_INT_ERRNO }, 41 41 [SYS_TLS_SET] = { "tls_set", 1, V_ERRNO }, 42 42 -
uspace/lib/c/Makefile
raacdb8e rfd07e57b 107 107 generic/io/log.c \ 108 108 generic/io/logctl.c \ 109 generic/io/kio.c \ 109 110 generic/io/klog.c \ 110 111 generic/io/snprintf.c \ -
uspace/lib/c/generic/assert.c
raacdb8e rfd07e57b 33 33 #include <assert.h> 34 34 #include <stdio.h> 35 #include <io/k log.h>35 #include <io/kio.h> 36 36 #include <stdlib.h> 37 37 #include <atomic.h> … … 44 44 { 45 45 /* 46 * Send the message safely to k log. Nested asserts should not occur.46 * Send the message safely to kio. Nested asserts should not occur. 47 47 */ 48 k log_printf("Assertion failed (%s) in file \"%s\", line %u.\n",48 kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n", 49 49 cond, file, line); 50 50 -
uspace/lib/c/generic/io/io.c
raacdb8e rfd07e57b 42 42 #include <malloc.h> 43 43 #include <async.h> 44 #include <io/k log.h>44 #include <io/kio.h> 45 45 #include <vfs/vfs.h> 46 46 #include <vfs/vfs_sess.h> … … 57 57 .error = true, 58 58 .eof = true, 59 .k log= false,59 .kio = false, 60 60 .sess = NULL, 61 61 .btype = _IONBF, … … 67 67 }; 68 68 69 static FILE stdout_k log= {69 static FILE stdout_kio = { 70 70 .fd = -1, 71 71 .error = false, 72 72 .eof = false, 73 .k log= true,73 .kio = true, 74 74 .sess = NULL, 75 75 .btype = _IOLBF, … … 81 81 }; 82 82 83 static FILE stderr_k log= {83 static FILE stderr_kio = { 84 84 .fd = -1, 85 85 .error = false, 86 86 .eof = false, 87 .k log= true,87 .kio = true, 88 88 .sess = NULL, 89 89 .btype = _IONBF, … … 113 113 stdout = fdopen(1, "w"); 114 114 } else { 115 stdout = &stdout_k log;115 stdout = &stdout_kio; 116 116 list_append(&stdout->link, &files); 117 117 } … … 120 120 stderr = fdopen(2, "w"); 121 121 } else { 122 stderr = &stderr_k log;122 stderr = &stderr_kio; 123 123 list_append(&stderr->link, &files); 124 124 } … … 267 267 stream->error = false; 268 268 stream->eof = false; 269 stream->k log= false;269 stream->kio = false; 270 270 stream->sess = NULL; 271 271 stream->need_sync = false; … … 289 289 stream->error = false; 290 290 stream->eof = false; 291 stream->k log= false;291 stream->kio = false; 292 292 stream->sess = NULL; 293 293 stream->need_sync = false; … … 314 314 315 315 if ((stream != &stdin_null) 316 && (stream != &stdout_k log)317 && (stream != &stderr_k log))316 && (stream != &stdout_kio) 317 && (stream != &stderr_kio)) 318 318 free(stream); 319 319 … … 382 382 ssize_t wr; 383 383 384 if (stream->k log)385 wr = k log_write(buf + done, left);384 if (stream->kio) 385 wr = kio_write(buf + done, left); 386 386 else 387 387 wr = write(stream->fd, buf + done, left); … … 705 705 _fflushbuf(stream); 706 706 707 if (stream->k log) {708 k log_update();707 if (stream->kio) { 708 kio_update(); 709 709 return EOK; 710 710 } … … 740 740 int fileno(FILE *stream) 741 741 { 742 if (stream->k log) {742 if (stream->kio) { 743 743 errno = EBADF; 744 744 return -1; -
uspace/lib/c/generic/io/klog.c
raacdb8e rfd07e57b 1 1 /* 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2006 Jakub Vana 2 * Copyright (c) 2013 Martin Sucha 4 3 * All rights reserved. 5 4 * … … 41 40 #include <abi/klog.h> 42 41 #include <io/klog.h> 43 #include < io/printf_core.h>42 #include <abi/log.h> 44 43 45 size_t klog_write( const void *buf, size_t size)44 size_t klog_write(log_level_t lvl, const void *buf, size_t size) 46 45 { 47 ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, size); 46 ssize_t ret = (ssize_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, 47 size, lvl); 48 48 49 49 if (ret >= 0) … … 53 53 } 54 54 55 void klog_update(void)55 int klog_read(void *data, size_t size) 56 56 { 57 (void) __SYSCALL3(SYS_KLOG, KLOG_UPDATE, (uintptr_t) NULL, 0); 58 } 59 60 void klog_command(const void *buf, size_t size) 61 { 62 (void) __SYSCALL3(SYS_KLOG, KLOG_COMMAND, (sysarg_t) buf, (sysarg_t) size); 63 } 64 65 /** Print formatted text to klog. 66 * 67 * @param fmt Format string 68 * 69 * \see For more details about format string see printf_core. 70 * 71 */ 72 int klog_printf(const char *fmt, ...) 73 { 74 va_list args; 75 va_start(args, fmt); 76 77 int ret = klog_vprintf(fmt, args); 78 79 va_end(args); 80 81 return ret; 82 } 83 84 static int klog_vprintf_str_write(const char *str, size_t size, void *data) 85 { 86 size_t wr = klog_write(str, size); 87 return str_nlength(str, wr); 88 } 89 90 static int klog_vprintf_wstr_write(const wchar_t *str, size_t size, void *data) 91 { 92 size_t offset = 0; 93 size_t chars = 0; 94 95 while (offset < size) { 96 char buf[STR_BOUNDS(1)]; 97 size_t sz = 0; 98 99 if (chr_encode(str[chars], buf, &sz, STR_BOUNDS(1)) == EOK) 100 klog_write(buf, sz); 101 102 chars++; 103 offset += sizeof(wchar_t); 104 } 105 106 return chars; 107 } 108 109 /** Print formatted text to klog. 110 * 111 * @param fmt Format string 112 * @param ap Format parameters 113 * 114 * \see For more details about format string see printf_core. 115 * 116 */ 117 int klog_vprintf(const char *fmt, va_list ap) 118 { 119 printf_spec_t ps = { 120 klog_vprintf_str_write, 121 klog_vprintf_wstr_write, 122 NULL 123 }; 124 125 return printf_core(fmt, &ps, ap); 57 return (int) __SYSCALL4(SYS_KLOG, KLOG_READ, (uintptr_t) data, size, 0); 126 58 } 127 59 -
uspace/lib/c/generic/private/stdio.h
raacdb8e rfd07e57b 53 53 int eof; 54 54 55 /** K logindicator */56 int k log;55 /** KIO indicator */ 56 int kio; 57 57 58 58 /** Session to the file provider */ -
uspace/lib/c/include/io/klog.h
raacdb8e rfd07e57b 1 1 /* 2 * Copyright (c) 20 06 Jakub Vana2 * Copyright (c) 2013 Martin Sucha 3 3 * All rights reserved. 4 4 * … … 39 39 #include <stdarg.h> 40 40 #include <io/verify.h> 41 #include <stdio.h> 42 #include <stdlib.h> 43 #include <str.h> 44 #include <abi/log.h> 41 45 42 extern size_t klog_write(const void *, size_t); 43 extern void klog_update(void); 44 extern void klog_command(const void *, size_t); 45 extern int klog_printf(const char *, ...) 46 PRINTF_ATTRIBUTE(1, 2); 47 extern int klog_vprintf(const char *, va_list); 46 extern size_t klog_write(log_level_t, const void *, size_t); 47 extern int klog_read(void *, size_t); 48 49 #define KLOG_PRINTF(lvl, fmt, ...) ({ \ 50 char *_fmt = str_dup(fmt); \ 51 size_t _fmtsize = str_size(_fmt); \ 52 if (_fmtsize > 0 && _fmt[_fmtsize - 1] == '\n') \ 53 _fmt[_fmtsize - 1] = 0; \ 54 char *_s; \ 55 int _c = asprintf(&_s, _fmt, ##__VA_ARGS__); \ 56 free(_fmt); \ 57 if (_c >= 0) { \ 58 _c = klog_write((lvl), _s, str_size(_s)); \ 59 free(_s); \ 60 }; \ 61 (_c >= 0); \ 62 }) 48 63 49 64 #endif -
uspace/lib/c/include/io/log.h
raacdb8e rfd07e57b 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). */ -
uspace/lib/c/include/stdio.h
raacdb8e rfd07e57b 40 40 #include <str.h> 41 41 #include <io/verify.h> 42 #include <abi/k log.h>42 #include <abi/kio.h> 43 43 44 44 #define EOF (-1) … … 52 52 int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \ 53 53 if (_n > 0) \ 54 (void) __SYSCALL3(SYS_K LOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \54 (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \ 55 55 } 56 56 -
uspace/srv/logger/writer.c
raacdb8e rfd07e57b 40 40 #include <io/log.h> 41 41 #include <io/logctl.h> 42 #include <io/klog.h> 42 43 #include <ns.h> 43 44 #include <async.h> … … 79 80 } 80 81 81 printf("[%s] %s: %s\n",82 KLOG_PRINTF(level, "[%s] %s: %s\n", 82 83 log->full_name, log_level_str(level), 83 84 (const char *) message);
Note:
See TracChangeset
for help on using the changeset viewer.