Changes in / [fd07e57b:aacdb8e] in mainline


Ignore:
Files:
3 added
11 deleted
62 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    rfd07e57b raacdb8e  
    3333uspace/app/kill/kill
    3434uspace/app/killall/killall
    35 uspace/app/kio/kio
     35uspace/app/klog/klog
    3636uspace/app/loc/loc
    3737uspace/app/logset/logset
     
    8282uspace/dist/app/kill
    8383uspace/dist/app/killall
    84 uspace/dist/app/kio
     84uspace/dist/app/klog
    8585uspace/dist/app/loc
    8686uspace/dist/app/logset
     
    285285uspace/lib/posix/redefs-hide-libc-symbols.list
    286286uspace/lib/posix/redefs-show-posix-symbols.list
    287 uspace/srv/klog/klog
    288 uspace/dist/srv/klog
  • abi/include/abi/ipc/event.h

    rfd07e57b raacdb8e  
    3838/** Global events */
    3939typedef enum event_type {
    40         /** New data available in kernel character buffer */
    41         EVENT_KIO = 0,
     40        /** New data available in kernel log */
     41        EVENT_KLOG = 0,
    4242        /** Returning from kernel console to uspace */
    4343        EVENT_KCONSOLE,
    4444        /** A task/thread has faulted and will be terminated */
    4545        EVENT_FAULT,
    46         /** New data available in kernel log */
    47         EVENT_KLOG,
    4846        EVENT_END
    4947} event_type_t;
  • abi/include/abi/klog.h

    rfd07e57b raacdb8e  
    11/*
    2  * Copyright (c) 2014 Martin Sucha
     2 * Copyright (c) 2012 Jakub Jermar
    33 * All rights reserved.
    44 *
     
    3636#define ABI_KLOG_H_
    3737
    38 typedef enum {
     38enum {
     39        KLOG_UNKNOW,
    3940        KLOG_WRITE,
    40         KLOG_READ
    41 } klog_operation_t;
     41        KLOG_UPDATE,
     42        KLOG_COMMAND
     43};
    4244
    4345#endif
  • abi/include/abi/syscall.h

    rfd07e57b raacdb8e  
    3737
    3838typedef enum {
    39         SYS_KIO = 0,
     39        SYS_KLOG = 0,
    4040        SYS_TLS_SET = 1,  /* Hardcoded for AMD64, IA-32 (fibril.S in uspace) */
    4141       
     
    9999        SYS_DEBUG_ACTIVATE_CONSOLE,
    100100       
    101         SYS_KLOG,
    102        
    103101        SYSCALL_END
    104102} syscall_t;
  • boot/Makefile.common

    rfd07e57b raacdb8e  
    9696        $(USPACE_PATH)/srv/devman/devman \
    9797        $(USPACE_PATH)/srv/fs/locfs/locfs \
    98         $(USPACE_PATH)/srv/hid/compositor/compositor \
    99         $(USPACE_PATH)/srv/klog/klog
     98        $(USPACE_PATH)/srv/hid/compositor/compositor
    10099
    101100RD_SRVS_NON_ESSENTIAL = \
     
    162161        $(USPACE_PATH)/app/bdsh/bdsh \
    163162        $(USPACE_PATH)/app/getterm/getterm \
    164         $(USPACE_PATH)/app/kio/kio \
     163        $(USPACE_PATH)/app/klog/klog \
    165164        $(USPACE_PATH)/app/vlaunch/vlaunch \
    166165        $(USPACE_PATH)/app/vterm/vterm
  • contrib/arch/HelenOS.adl

    rfd07e57b raacdb8e  
    2222       
    2323        /* Kernel log */
    24         inst kio kio;
     24        inst klog klog;
    2525       
    2626        [/uspace/lib/libc/bind%ns]
     
    3030        [/uspace/lib/libc/bind%vfs]
    3131        [/uspace/lib/libc/bind%console]
    32         [/uspace/lib/libc/bind%kio]
     32        [/uspace/lib/libc/bind%klog]
    3333       
    3434        bind ns:kbd to console:kbd;
     
    5858        bind console:sys_console to kernel:sys_console;
    5959       
    60         bind kio:ns to ns:ns;
     60        bind klog:ns to ns:ns;
    6161};
  • contrib/arch/kernel/kernel.adl

    rfd07e57b raacdb8e  
    33 *****************************/
    44
    5 interface sys_kio {
     5interface sys_klog {
    66                /* Print using kernel facility */
    7                 sysarg_t sys_kio(int fd, const void *buf, size_t size);
    8         protocol:
    9                 ?sys_kio*
     7                sysarg_t sys_klog(int fd, const void *buf, size_t size);
     8        protocol:
     9                ?sys_klog*
    1010};
    1111
     
    251251frame sys_console {
    252252        provides:
    253                 sys_kio sys_kio;
     253                sys_klog sys_klog;
    254254                sys_console sys_console;
    255255};
     
    316316        inst sys_debug sys_debug;
    317317       
    318         delegate sys_kio to sys_console:sys_kio;
     318        delegate sys_klog to sys_console:sys_klog;
    319319        delegate sys_console to sys_console:sys_console;
    320320        delegate sys_tls to sys_proc:sys_tls;
  • contrib/arch/uspace/lib/libc/bind

    rfd07e57b raacdb8e  
    11/* Bind %% to kernel interfaces */
    2 bind %%:sys_kio to kernel:sys_kio;
     2bind %%:sys_klog to kernel:sys_klog;
    33bind %%:sys_tls to kernel:sys_tls;
    44bind %%:sys_thread to kernel:sys_thread;
  • contrib/arch/uspace/lib/libc/protocol

    rfd07e57b raacdb8e  
    11/* Protocol according to which libc uses kernel syscalls */
    22(
    3         !sys_kio.sys_kio +
     3        !sys_klog.sys_klog +
    44        !sys_tls.sys_tls_set +
    55        !sys_thread.sys_thread_create +
  • contrib/arch/uspace/lib/libc/requires

    rfd07e57b raacdb8e  
    11/* Kernel interfaces required by libc */
    2 sys_kio sys_kio;
     2sys_klog sys_klog;
    33sys_tls sys_tls;
    44sys_thread sys_thread;
  • contrib/arch/uspace/lib/libc/subsume

    rfd07e57b raacdb8e  
    11/* Subsume %% to kernel interfaces */
    2 subsume %%:sys_kio to sys_kio;
     2subsume %%:sys_klog to sys_klog;
    33subsume %%:sys_tls to sys_tls;
    44subsume %%:sys_thread to sys_thread;
  • contrib/arch/uspace/srv/ns/ns.adl

    rfd07e57b raacdb8e  
    66                sysarg_t ipc_m_connect_me_to(in sysarg_t service, in sysarg_t arg2, in sysarg_t arg3, in sysarg_t flags);
    77               
    8                 /* Share real-time clock page or kio page */
     8                /* Share real-time clock page or klog page */
    99                sysarg_t ipc_m_share_in(in sysarg_t as_area_base, in sysarg_t as_area_size, in sysarg_t service);
    1010               
  • kernel/Makefile

    rfd07e57b raacdb8e  
    212212        generic/src/debug/debug.c \
    213213        generic/src/interrupt/interrupt.c \
    214         generic/src/log/log.c \
    215214        generic/src/main/main.c \
    216215        generic/src/main/kinit.c \
  • kernel/arch/amd64/src/interrupt.c

    rfd07e57b raacdb8e  
    3535#include <arch/interrupt.h>
    3636#include <print.h>
    37 #include <log.h>
    3837#include <debug.h>
    3938#include <panic.h>
     
    6766void istate_decode(istate_t *istate)
    6867{
    69         log_printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t"
     68        printf("cs =%0#18" PRIx64 "\trip=%0#18" PRIx64 "\t"
    7069            "rfl=%0#18" PRIx64 "\terr=%0#18" PRIx64 "\n",
    7170            istate->cs, istate->rip, istate->rflags, istate->error_word);
    7271       
    7372        if (istate_from_uspace(istate))
    74                 log_printf("ss =%0#18" PRIx64 "\n", istate->ss);
    75        
    76         log_printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t"
     73                printf("ss =%0#18" PRIx64 "\n", istate->ss);
     74       
     75        printf("rax=%0#18" PRIx64 "\trbx=%0#18" PRIx64 "\t"
    7776            "rcx=%0#18" PRIx64 "\trdx=%0#18" PRIx64 "\n",
    7877            istate->rax, istate->rbx, istate->rcx, istate->rdx);
    7978       
    80         log_printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t"
     79        printf("rsi=%0#18" PRIx64 "\trdi=%0#18" PRIx64 "\t"
    8180            "rbp=%0#18" PRIx64 "\trsp=%0#18" PRIx64 "\n",
    8281            istate->rsi, istate->rdi, istate->rbp,
     
    8483            (uintptr_t) &istate->rsp);
    8584       
    86         log_printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t"
     85        printf("r8 =%0#18" PRIx64 "\tr9 =%0#18" PRIx64 "\t"
    8786            "r10=%0#18" PRIx64 "\tr11=%0#18" PRIx64 "\n",
    8887            istate->r8, istate->r9, istate->r10, istate->r11);
    8988       
    90         log_printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t"
     89        printf("r12=%0#18" PRIx64 "\tr13=%0#18" PRIx64 "\t"
    9190            "r14=%0#18" PRIx64 "\tr15=%0#18" PRIx64 "\n",
    9291            istate->r12, istate->r13, istate->r14, istate->r15);
     
    194193                 */
    195194#ifdef CONFIG_DEBUG
    196                 log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt (inum=%u)",
    197                     CPU->id, inum);
     195                printf("cpu%u: spurious interrupt (inum=%u)\n", CPU->id, inum);
    198196#endif
    199197        }
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    rfd07e57b raacdb8e  
    4949#include <ddi/ddi.h>
    5050#include <ddi/device.h>
    51 #include <log.h>
    5251
    5352#define GTA02_MEMORY_START      0x30000000      /* physical */
     
    150149        } else {
    151150                /* Spurious interrupt.*/
    152                 log(LF_ARCH, LVL_DEBUG, "cpu%d: spurious interrupt (inum=%d)",
     151                printf("cpu%d: spurious interrupt (inum=%d)\n",
    153152                    CPU->id, inum);
    154153        }
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    rfd07e57b raacdb8e  
    4343#include <console/console.h>
    4444#include <sysinfo/sysinfo.h>
     45#include <print.h>
    4546#include <ddi/device.h>
    4647#include <mm/page.h>
     
    5253#include <abi/fb/visuals.h>
    5354#include <ddi/ddi.h>
    54 #include <log.h>
    55 
     55#include <print.h>
    5656
    5757
     
    275275                        } else {
    276276                                /* Spurious interrupt.*/
    277                                 log(LF_ARCH, LVL_DEBUG,
    278                                     "cpu%d: spurious interrupt (inum=%d)",
     277                                printf("cpu%d: spurious interrupt (inum=%d)\n",
    279278                                    CPU->id, i);
    280279                        }
  • kernel/arch/ia32/src/drivers/i8259.c

    rfd07e57b raacdb8e  
    4242#include <arch/asm.h>
    4343#include <arch.h>
    44 #include <log.h>
     44#include <print.h>
    4545#include <interrupt.h>
    4646
     
    129129{
    130130#ifdef CONFIG_DEBUG
    131         log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);
     131        printf("cpu%u: PIC spurious interrupt\n", CPU->id);
    132132#endif
    133133}
  • kernel/arch/ia32/src/smp/apic.c

    rfd07e57b raacdb8e  
    4242#include <interrupt.h>
    4343#include <arch/interrupt.h>
    44 #include <log.h>
     44#include <print.h>
    4545#include <arch/asm.h>
    4646#include <arch.h>
     
    135135{
    136136#ifdef CONFIG_DEBUG
    137         log(LF_ARCH, LVL_DEBUG, "cpu%u: APIC spurious interrupt", CPU->id);
     137        printf("cpu%u: APIC spurious interrupt\n", CPU->id);
    138138#endif
    139139}
     
    241241        esr.value = l_apic[ESR];
    242242       
    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         }
     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");
    262257       
    263258        return !esr.err_bitmap;
     
    275270                        retries = 0;
    276271#ifdef CONFIG_DEBUG
    277                         log(LF_ARCH, LVL_DEBUG, "IPI is pending.");
     272                        printf("IPI is pending.\n");
    278273#endif
    279274                        delay(20);
     
    494489{
    495490#ifdef LAPIC_VERBOSE
    496         log_begin(LF_ARCH, LVL_DEBUG);
    497         log_printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n",
     491        printf("LVT on cpu%u, LAPIC ID: %" PRIu8 "\n",
    498492            CPU->id, l_apic_id());
    499493       
    500494        lvt_tm_t tm;
    501495        tm.value = l_apic[LVT_Tm];
    502         log_printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n",
     496        printf("LVT Tm: vector=%" PRIu8 ", %s, %s, %s\n",
    503497            tm.vector, delivs_str[tm.delivs], mask_str[tm.masked],
    504498            tm_mode_str[tm.mode]);
     
    506500        lvt_lint_t lint;
    507501        lint.value = l_apic[LVT_LINT0];
    508         log_printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
     502        printf("LVT LINT0: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
    509503            tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs],
    510504            intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
     
    512506       
    513507        lint.value = l_apic[LVT_LINT1];
    514         log_printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
     508        printf("LVT LINT1: vector=%" PRIu8 ", %s, %s, %s, irr=%u, %s, %s\n",
    515509            tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs],
    516510            intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode],
     
    519513        lvt_error_t error;
    520514        error.value = l_apic[LVT_Err];
    521         log_printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector,
     515        printf("LVT Err: vector=%" PRIu8 ", %s, %s\n", error.vector,
    522516            delivs_str[error.delivs], mask_str[error.masked]);
    523         log_end();
    524517#endif
    525518}
  • kernel/arch/ia32/src/smp/mps.c

    rfd07e57b raacdb8e  
    3636
    3737#include <config.h>
    38 #include <log.h>
     38#include <print.h>
    3939#include <debug.h>
    4040#include <arch/smp/mps.h>
     
    181181        buf[6] = 0;
    182182       
    183         log(LF_ARCH, LVL_DEBUG, "MPS: bus=%" PRIu8 " (%s)", bus->bus_id, buf);
     183        printf("MPS: bus=%" PRIu8 " (%s)\n", bus->bus_id, buf);
    184184#endif
    185185}
     
    205205{
    206206#ifdef MPSCT_VERBOSE
    207         log_begin(LF_ARCH, LVL_DEBUG);
    208         log_printf("MPS: ");
     207        printf("MPS: ");
    209208       
    210209        switch (iointr->intr_type) {
    211210        case 0:
    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(", ");
     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(", ");
    226225       
    227226        switch (iointr->poel & 3) {
    228227        case 0:
    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(", ");
     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(", ");
    243242       
    244243        switch ((iointr->poel >> 2) & 3) {
    245244        case 0:
    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,
     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,
    261260            iointr->dst_io_apic_id, iointr->dst_io_apic_pin);
    262         log_end();
    263261#endif
    264262}
     
    268266{
    269267#ifdef MPSCT_VERBOSE
    270         log_begin(LF_ARCH, LVL_DEBUG);
    271         log_printf("MPS: ");
     268        printf("MPS: ");
    272269       
    273270        switch (lintr->intr_type) {
    274271        case 0:
    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(", ");
     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(", ");
    289286       
    290287        switch (lintr->poel & 3) {
    291288        case 0:
    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(", ");
     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(", ");
    306303       
    307304        switch ((lintr->poel >> 2) & 3) {
    308305        case 0:
    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,
     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,
    324321            lintr->dst_l_apic_id, lintr->dst_l_apic_pin);
    325         log_end();
    326322#endif
    327323}
     
    336332                switch (cur[CT_EXT_ENTRY_TYPE]) {
    337333                default:
    338                         log(LF_ARCH, LVL_NOTE, "MPS: Skipping MP Configuration"
    339                             " Table extended entry type %" PRIu8,
    340                             cur[CT_EXT_ENTRY_TYPE]);
     334                        printf("MPS: Skipping MP Configuration Table extended "
     335                            "entry type %" PRIu8 "\n", cur[CT_EXT_ENTRY_TYPE]);
    341336                }
    342337        }
     
    346341{
    347342        if (ct->signature != CT_SIGNATURE) {
    348                 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct->signature");
     343                printf("MPS: Wrong ct->signature\n");
    349344                return;
    350345        }
    351346       
    352347        if (!mps_ct_check()) {
    353                 log(LF_ARCH, LVL_WARN, "MPS: Wrong ct checksum");
     348                printf("MPS: Wrong ct checksum\n");
    354349                return;
    355350        }
    356351       
    357352        if (ct->oem_table) {
    358                 log(LF_ARCH, LVL_WARN, "MPS: ct->oem_table not supported");
     353                printf("MPS: ct->oem_table not supported\n");
    359354                return;
    360355        }
     
    407402                         * Something is wrong. Fallback to UP mode.
    408403                         */
    409                         log(LF_ARCH, LVL_WARN, "MPS: ct badness %" PRIu8, *cur);
     404                        printf("MPS: ct badness %" PRIu8 "\n", *cur);
    410405                        return;
    411406                }
     
    423418         * Not yet implemented.
    424419         */
    425         log(LF_ARCH, LVL_WARN, "MPS: Default configuration not supported");
     420        printf("MPS: Default configuration not supported\n");
    426421}
    427422
     
    454449       
    455450fs_found:
    456         log(LF_ARCH, LVL_NOTE, "%p: MPS Floating Pointer Structure", fs);
     451        printf("%p: MPS Floating Pointer Structure\n", fs);
    457452       
    458453        if ((fs->config_type == 0) && (fs->configuration_table)) {
    459454                if (fs->mpfib2 >> 7) {
    460                         log(LF_ARCH, LVL_WARN, "MPS: PIC mode not supported\n");
     455                        printf("MPS: PIC mode not supported\n");
    461456                        return;
    462457                }
  • kernel/arch/ia32/src/smp/smp.c

    rfd07e57b raacdb8e  
    5252#include <mm/slab.h>
    5353#include <mm/as.h>
    54 #include <log.h>
     54#include <print.h>
    5555#include <memstr.h>
    5656#include <arch/drivers/i8259.h>
     
    129129               
    130130                if (ops->cpu_apic_id(i) == bsp_l_apic) {
    131                         log(LF_ARCH, LVL_ERROR, "kmp: bad processor entry #%u, "
    132                             "will not send IPI to myself", i);
     131                        printf("kmp: bad processor entry #%u, will not send IPI "
     132                            "to myself\n", i);
    133133                        continue;
    134134                }
     
    162162                        if (waitq_sleep_timeout(&ap_completion_wq, 1000000,
    163163                            SYNCH_FLAGS_NONE) == ESYNCH_TIMEOUT) {
    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));
     164                                printf("%s: waiting for cpu%u (APIC ID = %d) "
     165                                    "timed out\n", __FUNCTION__, i,
     166                                    ops->cpu_apic_id(i));
    167167                        }
    168168                } else
    169                         log(LF_ARCH, LVL_ERROR, "INIT IPI for l_apic%d failed",
     169                        printf("INIT IPI for l_apic%d failed\n",
    170170                            ops->cpu_apic_id(i));
    171171        }
  • kernel/arch/mips32/src/debugger.c

    rfd07e57b raacdb8e  
    3939#include <console/cmd.h>
    4040#include <print.h>
    41 #include <log.h>
    4241#include <panic.h>
    4342#include <arch.h>
     
    295294        cmd_initialize(&bkpts_info);
    296295        if (!cmd_register(&bkpts_info))
    297                 log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    298                     bkpts_info.name);
     296                printf("Cannot register command %s\n", bkpts_info.name);
    299297       
    300298        cmd_initialize(&delbkpt_info);
    301299        if (!cmd_register(&delbkpt_info))
    302                 log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    303                     delbkpt_info.name);
     300                printf("Cannot register command %s\n", delbkpt_info.name);
    304301       
    305302        cmd_initialize(&addbkpt_info);
    306303        if (!cmd_register(&addbkpt_info))
    307                 log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    308                     addbkpt_info.name);
     304                printf("Cannot register command %s\n", addbkpt_info.name);
    309305       
    310306        cmd_initialize(&addbkpte_info);
    311307        if (!cmd_register(&addbkpte_info))
    312                 log(LF_OTHER, LVL_WARN, "Cannot register command %s",
    313                     addbkpte_info.name);
     308                printf("Cannot register command %s\n", addbkpte_info.name);
    314309#endif /* CONFIG_KCONSOLE */
    315310}
  • kernel/arch/mips32/src/exception.c

    rfd07e57b raacdb8e  
    4848#include <arch/debugger.h>
    4949#include <symtab.h>
    50 #include <log.h>
    5150
    5251static const char *exctable[] = {
     
    7574void istate_decode(istate_t *istate)
    7675{
    77         log_printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t"
     76        printf("epc=%#010" PRIx32 "\tsta=%#010" PRIx32 "\t"
    7877            "lo =%#010" PRIx32 "\thi =%#010" PRIx32 "\n",
    7978            istate->epc, istate->status, istate->lo, istate->hi);
    8079       
    81         log_printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"
     80        printf("a0 =%#010" PRIx32 "\ta1 =%#010" PRIx32 "\t"
    8281            "a2 =%#010" PRIx32 "\ta3 =%#010" PRIx32 "\n",
    8382            istate->a0, istate->a1, istate->a2, istate->a3);
    8483       
    85         log_printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"
     84        printf("t0 =%#010" PRIx32 "\tt1 =%#010" PRIx32 "\t"
    8685            "t2 =%#010" PRIx32 "\tt3 =%#010" PRIx32 "\n",
    8786            istate->t0, istate->t1, istate->t2, istate->t3);
    8887       
    89         log_printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"
     88        printf("t4 =%#010" PRIx32 "\tt5 =%#010" PRIx32 "\t"
    9089            "t6 =%#010" PRIx32 "\tt7 =%#010" PRIx32 "\n",
    9190            istate->t4, istate->t5, istate->t6, istate->t7);
    9291       
    93         log_printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"
     92        printf("t8 =%#010" PRIx32 "\tt9 =%#010" PRIx32 "\t"
    9493            "v0 =%#010" PRIx32 "\tv1 =%#010" PRIx32 "\n",
    9594            istate->t8, istate->t9, istate->v0, istate->v1);
    9695       
    97         log_printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"
     96        printf("s0 =%#010" PRIx32 "\ts1 =%#010" PRIx32 "\t"
    9897            "s2 =%#010" PRIx32 "\ts3 =%#010" PRIx32 "\n",
    9998            istate->s0, istate->s1, istate->s2, istate->s3);
    10099       
    101         log_printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"
     100        printf("s4 =%#010" PRIx32 "\ts5 =%#010" PRIx32 "\t"
    102101            "s6 =%#010" PRIx32 "\ts7 =%#010" PRIx32 "\n",
    103102            istate->s4, istate->s5, istate->s6, istate->s7);
    104103       
    105         log_printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"
     104        printf("s8 =%#010" PRIx32 "\tat =%#010" PRIx32 "\t"
    106105            "kt0=%#010" PRIx32 "\tkt1=%#010" PRIx32 "\n",
    107106            istate->s8, istate->at, istate->kt0, istate->kt1);
    108107       
    109         log_printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"
     108        printf("sp =%#010" PRIx32 "\tra =%#010" PRIx32 "\t"
    110109            "gp =%#010" PRIx32 "\n",
    111110            istate->sp, istate->ra, istate->gp);
     
    195194                                 */
    196195#ifdef CONFIG_DEBUG
    197                                 log(LF_ARCH, LVL_DEBUG,
    198                                     "cpu%u: spurious interrupt (inum=%u)",
     196                                printf("cpu%u: spurious interrupt (inum=%u)\n",
    199197                                    CPU->id, i);
    200198#endif
  • kernel/arch/mips32/src/mm/tlb.c

    rfd07e57b raacdb8e  
    4343#include <synch/mutex.h>
    4444#include <print.h>
    45 #include <log.h>
    4645#include <debug.h>
    4746#include <align.h>
     
    218217         */
    219218        if (index.p) {
    220                 log(LF_ARCH, LVL_WARN, "%s: TLBP failed in exception handler (badvaddr=%#"
     219                printf("%s: TLBP failed in exception handler (badvaddr=%#"
    221220                    PRIxn ", ASID=%d).\n", __func__, badvaddr,
    222221                    AS ? AS->asid : -1);
  • kernel/arch/ppc32/src/interrupt.c

    rfd07e57b raacdb8e  
    4444#include <arch/mm/pht.h>
    4545#include <print.h>
    46 #include <log.h>
    4746
    4847void start_decrementer(void)
     
    5655void istate_decode(istate_t *istate)
    5756{
    58         log_printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
     57        printf("r0 =%0#10" PRIx32 "\tr1 =%0#10" PRIx32 "\t"
    5958            "r2 =%0#10" PRIx32 "\n", istate->r0, istate->sp, istate->r2);
    6059       
    61         log_printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"
     60        printf("r3 =%0#10" PRIx32 "\tr4 =%0#10" PRIx32 "\t"
    6261            "r5 =%0#10" PRIx32 "\n", istate->r3, istate->r4, istate->r5);
    6362       
    64         log_printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"
     63        printf("r6 =%0#10" PRIx32 "\tr7 =%0#10" PRIx32 "\t"
    6564            "r8 =%0#10" PRIx32 "\n", istate->r6, istate->r7, istate->r8);
    6665       
    67         log_printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"
     66        printf("r9 =%0#10" PRIx32 "\tr10=%0#10" PRIx32 "\t"
    6867            "r11=%0#10" PRIx32 "\n", istate->r9, istate->r10, istate->r11);
    6968       
    70         log_printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"
     69        printf("r12=%0#10" PRIx32 "\tr13=%0#10" PRIx32 "\t"
    7170            "r14=%0#10" PRIx32 "\n", istate->r12, istate->r13, istate->r14);
    7271       
    73         log_printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"
     72        printf("r15=%0#10" PRIx32 "\tr16=%0#10" PRIx32 "\t"
    7473            "r17=%0#10" PRIx32 "\n", istate->r15, istate->r16, istate->r17);
    7574       
    76         log_printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"
     75        printf("r18=%0#10" PRIx32 "\tr19=%0#10" PRIx32 "\t"
    7776            "r20=%0#10" PRIx32 "\n", istate->r18, istate->r19, istate->r20);
    7877       
    79         log_printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"
     78        printf("r21=%0#10" PRIx32 "\tr22=%0#10" PRIx32 "\t"
    8079            "r23=%0#10" PRIx32 "\n", istate->r21, istate->r22, istate->r23);
    8180       
    82         log_printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"
     81        printf("r24=%0#10" PRIx32 "\tr25=%0#10" PRIx32 "\t"
    8382            "r26=%0#10" PRIx32 "\n", istate->r24, istate->r25, istate->r26);
    8483       
    85         log_printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"
     84        printf("r27=%0#10" PRIx32 "\tr28=%0#10" PRIx32 "\t"
    8685            "r29=%0#10" PRIx32 "\n", istate->r27, istate->r28, istate->r29);
    8786       
    88         log_printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",
     87        printf("r30=%0#10" PRIx32 "\tr31=%0#10" PRIx32 "\n",
    8988            istate->r30, istate->r31);
    9089       
    91         log_printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"
     90        printf("cr =%0#10" PRIx32 "\tpc =%0#10" PRIx32 "\t"
    9291            "lr =%0#10" PRIx32 "\n", istate->cr, istate->pc, istate->lr);
    9392       
    94         log_printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"
     93        printf("ctr=%0#10" PRIx32 "\txer=%0#10" PRIx32 "\t"
    9594            "dar=%0#10" PRIx32 "\n", istate->ctr, istate->xer, istate->dar);
    9695       
    97         log_printf("srr1=%0#10" PRIx32 "\n", istate->srr1);
     96        printf("srr1=%0#10" PRIx32 "\n", istate->srr1);
    9897}
    9998
     
    131130                         */
    132131#ifdef CONFIG_DEBUG
    133                         log(LF_ARCH, LVL_DEBUG, "cpu%u: spurious interrupt"
    134                             " (inum=%" PRIu8 ")", CPU->id, inum);
     132                        printf("cpu%u: spurious interrupt (inum=%" PRIu8 ")\n",
     133                            CPU->id, inum);
    135134#endif
    136135                }
  • kernel/arch/sparc64/src/drivers/kbd.c

    rfd07e57b raacdb8e  
    4444#include <align.h>
    4545#include <str.h>
    46 #include <log.h>
     46#include <print.h>
    4747#include <sysinfo/sysinfo.h>
    4848
     
    7171        ofw_tree_property_t *prop = ofw_tree_getprop(node, "interrupts");
    7272        if ((!prop) || (!prop->value)) {
    73                 log(LF_ARCH, LVL_ERROR,
    74                     "ns16550: Unable to find interrupts property");
     73                printf("ns16550: Unable to find interrupts property\n");
    7574                return false;
    7675        }
     
    8382        prop = ofw_tree_getprop(node, "reg");
    8483        if ((!prop) || (!prop->value)) {
    85                 log(LF_ARCH, LVL_ERROR,
    86                     "ns16550: Unable to find reg property");
     84                printf("ns16550: Unable to find reg property\n");
    8785                return false;
    8886        }
     
    9391        if (!ofw_ebus_apply_ranges(node->parent,
    9492            ((ofw_ebus_reg_t *) prop->value), &pa)) {
    95                 log(LF_ARCH, LVL_ERROR,
    96                     "ns16550: Failed to determine address");
     93                printf("ns16550: Failed to determine address\n");
    9794                return false;
    9895        }
     
    104101            ((ofw_ebus_reg_t *) prop->value), interrupts, &inr, &cir,
    105102            &cir_arg)) {
    106                 log(LF_ARCH, LVL_ERROR,
    107                     "ns16550: Failed to determine interrupt");
     103                printf("ns16550: Failed to determine interrupt\n");
    108104                return false;
    109105        }
     
    121117            PAGE_WRITE | PAGE_NOT_CACHEABLE) + offset);
    122118       
    123         ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir,
    124             cir_arg, NULL);
     119        ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, cir_arg);
    125120        if (ns16550_instance) {
    126121                kbrd_instance_t *kbrd_instance = kbrd_init();
  • kernel/arch/sparc64/src/drivers/pci.c

    rfd07e57b raacdb8e  
    4343#include <typedefs.h>
    4444#include <debug.h>
    45 #include <log.h>
     45#include <print.h>
    4646#include <str.h>
    4747#include <arch/asm.h>
     
    213213                 * Unsupported model.
    214214                 */
    215                 log(LF_ARCH, LVL_WARN, "Unsupported PCI controller model (%s).",
     215                printf("Unsupported PCI controller model (%s).\n",
    216216                    (char *) prop->value);
    217217        }
  • kernel/arch/sparc64/src/drivers/scr.c

    rfd07e57b raacdb8e  
    8181       
    8282        if (scr_type == SCR_UNKNOWN) {
    83                 log(LF_ARCH, LVL_ERROR, "Unknown screen device.");
     83                printf("Unknown screen device.\n");
    8484                return;
    8585        }
     
    117117        case SCR_ATYFB:
    118118                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    119                         log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
     119                        printf("Too few screen registers.\n");
    120120                        return;
    121121                }
     
    124124               
    125125                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    126                         log(LF_ARCH, LVL_ERROR,
    127                             "Failed to absolutize fb register.");
     126                        printf("Failed to absolutize fb register.\n");
    128127                        return;
    129128                }
     
    131130                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    132131                    &fb_addr)) {
    133                         log(LF_ARCH, LVL_ERROR,
    134                             "Failed to determine screen address.");
     132                        printf("Failed to determine screen address.\n");
    135133                        return;
    136134                }
     
    154152                        break;
    155153                default:
    156                         log(LF_ARCH, LVL_ERROR,
    157                             "Unsupported bits per pixel.");
     154                        printf("Unsupported bits per pixel.\n");
    158155                        return;
    159156                }
     
    162159        case SCR_XVR:
    163160                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    164                         log(LF_ARCH, LVL_ERROR,
    165                             "Too few screen registers.");
     161                        printf("Too few screen registers.\n");
    166162                        return;
    167163                }
     
    170166               
    171167                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    172                         log(LF_ARCH, LVL_ERROR,
    173                             "Failed to absolutize fb register.");
     168                        printf("Failed to absolutize fb register.\n");
    174169                        return;
    175170                }
     
    177172                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    178173                    &fb_addr)) {
    179                         log(LF_ARCH, LVL_ERROR,
    180                             "Failed to determine screen address.");
     174                        printf("Failed to determine screen address.\n");
    181175                        return;
    182176                }
     
    202196                        break;
    203197                default:
    204                         log(LF_ARCH, LVL_ERROR,
    205                             "Unsupported bits per pixel.");
     198                        printf("Unsupported bits per pixel.\n");
    206199                        return;
    207200                }
     
    214207                upa_reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP];
    215208                if (!ofw_upa_apply_ranges(node->parent, upa_reg, &fb_addr)) {
    216                         log(LF_ARCH, LVL_ERROR,
    217                             "Failed to determine screen address.");
     209                        printf("Failed to determine screen address.\n");
    218210                        return;
    219211                }
     
    227219                        break;
    228220                default:
    229                         log(LF_ARCH, LVL_WARN, "Not implemented.");
     221                        printf("Not implemented.\n");
    230222                        return;
    231223                }
     
    233225                sbus_reg = &((ofw_sbus_reg_t *) prop->value)[0];
    234226                if (!ofw_sbus_apply_ranges(node->parent, sbus_reg, &fb_addr)) {
    235                         log(LF_ARCH, LVL_ERROR,
    236                             "Failed to determine screen address.");
     227                        printf("Failed to determine screen address.\n");
    237228                        return;
    238229                }
     
    242233        case SCR_QEMU_VGA:
    243234                if (prop->size / sizeof(ofw_pci_reg_t) < 2) {
    244                         log(LF_ARCH, LVL_ERROR, "Too few screen registers.");
     235                        printf("Too few screen registers.\n");
    245236                        return;
    246237                }
     
    249240
    250241                if (!ofw_pci_reg_absolutize(node, pci_reg, &pci_abs_reg)) {
    251                         log(LF_ARCH, LVL_ERROR,
    252                             "Failed to absolutize fb register.");
     242                        printf("Failed to absolutize fb register.\n");
    253243                        return;
    254244                }
     
    256246                if (!ofw_pci_apply_ranges(node->parent, &pci_abs_reg,
    257247                    &fb_addr)) {
    258                         log(LF_ARCH, LVL_ERROR,
    259                             "Failed to determine screen address.");
     248                        printf("Failed to determine screen address.\n");
    260249                        return;
    261250                }
     
    279268                        break;
    280269                default:
    281                         log(LF_ARCH, LVL_ERROR, "Unsupported bits per pixel.");
     270                        printf("Unsupported bits per pixel.\n");
    282271                        return;
    283272                }
  • kernel/arch/sparc64/src/mm/sun4v/tlb.c

    rfd07e57b raacdb8e  
    4646#include <arch.h>
    4747#include <print.h>
    48 #include <log.h>
    4948#include <typedefs.h>
    5049#include <config.h>
     
    336335void tlb_print(void)
    337336{
    338         log(LF_ARCH, LVL_WARN, "Operation not possible on Niagara.");
     337        printf("Operation not possible on Niagara.\n");
    339338}
    340339
  • kernel/arch/sparc64/src/smp/sun4u/smp.c

    rfd07e57b raacdb8e  
    4343#include <typedefs.h>
    4444#include <synch/waitq.h>
    45 #include <log.h>
     45#include <print.h>
    4646#include <arch/cpu_node.h>
    4747
     
    108108        if (waitq_sleep_timeout(&ap_completion_wq, 1000000, SYNCH_FLAGS_NONE) ==
    109109            ESYNCH_TIMEOUT)
    110                 log(LF_ARCH, LVL_NOTE, "%s: waiting for processor (mid = %" PRIu32
    111                     ") timed out", __func__, mid);
     110                printf("%s: waiting for processor (mid = %" PRIu32
     111                    ") timed out\n", __func__, mid);
    112112}
    113113
  • kernel/arch/sparc64/src/sun4v/md.c

    rfd07e57b raacdb8e  
    3636#include <panic.h>
    3737#include <func.h>
    38 #include <log.h>
     38#include <print.h>
    3939#include <str.h>
    4040#include <arch/sun4v/md.h>
     
    310310        retval = retval;
    311311        if (retval != HV_EOK) {
    312                 log(LF_ARCH, LVL_ERROR, "Could not retrieve machine "
    313                     "description, error=%" PRIu64 ".", retval);
     312                printf("Could not retrieve machine description, "
     313                    "error=%" PRIu64 ".\n", retval);
    314314        }
    315315}
  • kernel/arch/sparc64/src/trap/sun4u/interrupt.c

    rfd07e57b raacdb8e  
    4242#include <arch/asm.h>
    4343#include <arch/barrier.h>
    44 #include <log.h>
     44#include <print.h>
    4545#include <arch.h>
    4646#include <mm/tlb.h>
     
    9696                 */
    9797#ifdef CONFIG_DEBUG
    98                 log(LF_ARCH, LVL_DEBUG,
    99                     "cpu%u: spurious interrupt (intrcv=%#" PRIx64 ", data0=%#"
    100                     PRIx64 ")", CPU->id, intrcv, data0);
     98                printf("cpu%u: spurious interrupt (intrcv=%#" PRIx64
     99                    ", data0=%#" PRIx64 ")\n", CPU->id, intrcv, data0);
    101100#else
    102101                (void) intrcv;
  • kernel/arch/sparc64/src/trap/sun4v/interrupt.c

    rfd07e57b raacdb8e  
    4242#include <arch/asm.h>
    4343#include <arch/barrier.h>
    44 #include <log.h>
     44#include <print.h>
    4545#include <arch.h>
    4646#include <mm/tlb.h>
     
    111111                        ((void (*)(void)) data1)();
    112112                } else {
    113                         log(LF_ARCH, LVL_DEBUG, "Spurious interrupt on %" PRIu64
    114                             ", data = %" PRIx64 ".", CPU->arch.id, data1);
     113                        printf("Spurious interrupt on %" PRIu64 ", data = %" PRIx64 ".\n",
     114                            CPU->arch.id, data1);
    115115                }
    116116        }
  • kernel/doc/doxygroups.h

    rfd07e57b raacdb8e  
    167167 */
    168168 
    169 /** @defgroup generickio KIO
    170  * @brief Kernel character input/output facility
     169/** @defgroup genericklog KLog
     170 * @brief Kernel logging facility
    171171 * @ingroup genericconsole
    172172 */
  • kernel/genarch/src/acpi/acpi.c

    rfd07e57b raacdb8e  
    4141#include <mm/page.h>
    4242#include <mm/km.h>
    43 #include <log.h>
     43#include <print.h>
    4444
    4545#define RSDP_SIGNATURE      "RSD PTR "
     
    211211       
    212212        if ((acpi_rsdt) && (!acpi_sdt_check((uint8_t *) acpi_rsdt))) {
    213                 log(LF_ARCH, LVL_ERROR, "RSDT: bad checksum");
     213                printf("RSDT: bad checksum\n");
    214214                return;
    215215        }
    216216       
    217217        if ((acpi_xsdt) && (!acpi_sdt_check((uint8_t *) acpi_xsdt))) {
    218                 log(LF_ARCH, LVL_ERROR, "XSDT: bad checksum");
     218                printf("XSDT: bad checksum\n");
    219219                return;
    220220        }
  • kernel/genarch/src/acpi/madt.c

    rfd07e57b raacdb8e  
    4343#include <debug.h>
    4444#include <config.h>
    45 #include <log.h>
     45#include <print.h>
    4646#include <mm/slab.h>
    4747#include <memstr.h>
     
    236236                case MADT_L_SAPIC:
    237237                case MADT_PLATFORM_INTR_SRC:
    238                         log(LF_ARCH, LVL_WARN,
    239                             "MADT: Skipping %s entry (type=%" PRIu8 ")",
     238                        printf("MADT: Skipping %s entry (type=%" PRIu8 ")\n",
    240239                            entry[hdr->type], hdr->type);
    241240                        break;
     
    243242                        if ((hdr->type >= MADT_RESERVED_SKIP_BEGIN)
    244243                            && (hdr->type <= MADT_RESERVED_SKIP_END))
    245                                 log(LF_ARCH, LVL_NOTE,
    246                                     "MADT: Skipping reserved entry (type=%" PRIu8 ")",
     244                                printf("MADT: Skipping reserved entry (type=%" PRIu8 ")\n",
    247245                                    hdr->type);
    248246                               
    249247                        if (hdr->type >= MADT_RESERVED_OEM_BEGIN)
    250                                 log(LF_ARCH, LVL_NOTE,
    251                                     "MADT: Skipping OEM entry (type=%" PRIu8 ")",
     248                                printf("MADT: Skipping OEM entry (type=%" PRIu8 ")\n",
    252249                                    hdr->type);
    253250                       
  • kernel/genarch/src/drivers/via-cuda/cuda.c

    rfd07e57b raacdb8e  
    118118}
    119119
    120 #include <log.h>
     120#include <print.h>
    121121void cuda_wire(cuda_instance_t *instance, indev_t *kbrdin)
    122122{
     
    197197
    198198        if ((b & TREQ) != 0) {
    199                 log(LF_OTHER, LVL_ERROR, "cuda_irq_listen: no TREQ?!");
     199                printf("cuda_irq_listen: no TREQ?!\n");
    200200                return;
    201201        }
  • kernel/generic/include/console/console.h

    rfd07e57b raacdb8e  
    3939#include <print.h>
    4040#include <console/chardev.h>
    41 #include <synch/spinlock.h>
    4241
    4342#define PAGING(counter, increment, before, after) \
     
    6362extern void console_init(void);
    6463
    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);
     64extern void klog_init(void);
     65extern void klog_update(void *);
    7066
    7167extern wchar_t getc(indev_t *indev);
    7268extern size_t gets(indev_t *indev, char *buf, size_t buflen);
    73 extern sysarg_t sys_kio(int cmd, const void *buf, size_t size);
     69extern sysarg_t sys_klog(int cmd, const void *buf, size_t size);
    7470
    7571extern void grab_console(void);
  • kernel/generic/include/debug.h

    rfd07e57b raacdb8e  
    107107#define LOG(format, ...) \
    108108        do { \
    109                 log(LF_OTHER, LVL_DEBUG, \
    110                     "%s() from %s at %s:%u: " format,__func__, \
     109                printf("%s() from %s at %s:%u: " format "\n", __func__, \
    111110                    symtab_fmt_name_lookup(CALLER), __FILE__, __LINE__, \
    112111                    ##__VA_ARGS__); \
  • kernel/generic/include/synch/spinlock.h

    rfd07e57b raacdb8e  
    137137#ifdef CONFIG_DEBUG_SPINLOCK
    138138
    139 #include <log.h>
     139#include <print.h>
    140140
    141141#define DEADLOCK_THRESHOLD  100000000
     
    146146        if ((pname)++ > (value)) { \
    147147                (pname) = 0; \
    148                 log(LF_OTHER, LVL_WARN, \
    149                     "Deadlock probe %s: exceeded threshold %u\n" \
     148                printf("Deadlock probe %s: exceeded threshold %u\n" \
    150149                    "cpu%u: function=%s, line=%u\n", \
    151150                    #pname, (value), CPU->id, __func__, __LINE__); \
  • kernel/generic/src/console/cmd.c

    rfd07e57b raacdb8e  
    4545#include <console/kconsole.h>
    4646#include <print.h>
    47 #include <log.h>
    4847#include <panic.h>
    4948#include <typedefs.h>
     
    640639        for (i = 0; basic_commands[i]; i++) {
    641640                if (!cmd_register(basic_commands[i])) {
    642                         log(LF_OTHER, LVL_ERROR,
    643                             "Cannot register command %s",
     641                        printf("Cannot register command %s\n",
    644642                            basic_commands[i]->name);
    645643                }
     
    667665        unsigned int _len = (unsigned int) len;
    668666        if ((_len != len) || (((int) _len) < 0)) {
    669                 log(LF_OTHER, LVL_ERROR, "Command length overflow");
     667                printf("Command length overflow\n");
    670668                return 1;
    671669        }
  • kernel/generic/src/console/console.c

    rfd07e57b raacdb8e  
    5252#include <errno.h>
    5353#include <str.h>
    54 #include <abi/kio.h>
    55 
    56 #define KIO_PAGES    8
    57 #define KIO_LENGTH   (KIO_PAGES * PAGE_SIZE / sizeof(wchar_t))
     54#include <abi/klog.h>
     55
     56#define KLOG_PAGES    8
     57#define KLOG_LENGTH   (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))
    5858
    5959/** Kernel log cyclic buffer */
    60 wchar_t kio[KIO_LENGTH] __attribute__((aligned(PAGE_SIZE)));
     60wchar_t klog[KLOG_LENGTH] __attribute__((aligned(PAGE_SIZE)));
    6161
    6262/** Kernel log initialized */
    63 static atomic_t kio_inited = {false};
     63static atomic_t klog_inited = {false};
    6464
    6565/** First kernel log characters */
    66 static size_t kio_start = 0;
     66static size_t klog_start = 0;
    6767
    6868/** Number of valid kernel log characters */
    69 static size_t kio_len = 0;
     69static size_t klog_len = 0;
    7070
    7171/** Number of stored (not printed) kernel log characters */
    72 static size_t kio_stored = 0;
     72static size_t klog_stored = 0;
    7373
    7474/** Number of stored kernel log characters for uspace */
    75 static size_t kio_uspace = 0;
     75static size_t klog_uspace = 0;
    7676
    7777/** Kernel log spinlock */
    78 SPINLOCK_INITIALIZE_NAME(kio_lock, "kio_lock");
    79 
    80 /** Physical memory area used for kio buffer */
    81 static parea_t kio_parea;
     78SPINLOCK_STATIC_INITIALIZE_NAME(klog_lock, "klog_lock");
     79
     80/** Physical memory area used for klog buffer */
     81static parea_t klog_parea;
    8282
    8383static indev_t stdin_sink;
     
    146146 *
    147147 */
    148 void kio_init(void)
    149 {
    150         void *faddr = (void *) KA2PA(kio);
     148void klog_init(void)
     149{
     150        void *faddr = (void *) KA2PA(klog);
    151151       
    152152        ASSERT((uintptr_t) faddr % FRAME_SIZE == 0);
    153153       
    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);
     154        klog_parea.pbase = (uintptr_t) faddr;
     155        klog_parea.frames = SIZE2FRAMES(sizeof(klog));
     156        klog_parea.unpriv = false;
     157        klog_parea.mapped = false;
     158        ddi_parea_register(&klog_parea);
     159       
     160        sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
     161        sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
     162       
     163        event_set_unmask_callback(EVENT_KLOG, klog_update);
     164        atomic_set(&klog_inited, true);
    165165}
    166166
     
    247247}
    248248
    249 void kio_update(void *event)
    250 {
    251         if (!atomic_get(&kio_inited))
     249void klog_update(void *event)
     250{
     251        if (!atomic_get(&klog_inited))
    252252                return;
    253253       
    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)
     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);
     263}
     264
     265void putchar(const wchar_t ch)
    269266{
    270267        bool ordy = ((stdout) && (stdout->op->write));
    271268       
    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 
     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;
     294       
     295        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) {
    282307                /*
    283                  * We need to give up the spinlock for
    284                  * the physical operation of writing out
    285                  * the character.
     308                 * Output the character. In this case
     309                 * it should be no longer buffered.
    286310                 */
    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++;
    313 }
    314 
    315 void putchar(const wchar_t ch)
    316 {
    317         bool ordy = ((stdout) && (stdout->op->write));
    318        
    319         spinlock_lock(&kio_lock);
    320         kio_push_char(ch);
    321         spinlock_unlock(&kio_lock);
    322        
    323         /* Output stored characters */
    324         kio_flush();
    325        
    326         if (!ordy) {
     311                stdout->op->write(stdout, ch);
     312        } else {
    327313                /*
    328314                 * No standard output routine defined yet.
     
    340326        /* Force notification on newline */
    341327        if (ch == '\n')
    342                 kio_update(NULL);
     328                klog_update(NULL);
    343329}
    344330
     
    348334 *
    349335 */
    350 sysarg_t sys_kio(int cmd, const void *buf, size_t size)
     336sysarg_t sys_klog(int cmd, const void *buf, size_t size)
    351337{
    352338        char *data;
     
    354340
    355341        switch (cmd) {
    356         case KIO_UPDATE:
    357                 kio_update(NULL);
     342        case KLOG_UPDATE:
     343                klog_update(NULL);
    358344                return EOK;
    359         case KIO_WRITE:
    360         case KIO_COMMAND:
     345        case KLOG_WRITE:
     346        case KLOG_COMMAND:
    361347                break;
    362348        default:
     
    380366               
    381367                switch (cmd) {
    382                 case KIO_WRITE:
     368                case KLOG_WRITE:
    383369                        printf("%s", data);
    384370                        break;
    385                 case KIO_COMMAND:
     371                case KLOG_COMMAND:
    386372                        if (!stdin)
    387373                                break;
  • kernel/generic/src/lib/func.c

    rfd07e57b raacdb8e  
    3737
    3838#include <func.h>
    39 #include <log.h>
     39#include <print.h>
    4040#include <cpu.h>
    4141#include <arch/asm.h>
     
    7272       
    7373        if (CPU)
    74                 log(LF_OTHER, LVL_NOTE, "cpu%u: halted", CPU->id);
     74                printf("cpu%u: halted\n", CPU->id);
    7575        else
    76                 log(LF_OTHER, LVL_NOTE, "cpu: halted");
     76                printf("cpu: halted\n");
    7777       
    7878        cpu_halt();
  • kernel/generic/src/lib/rd.c

    rfd07e57b raacdb8e  
    3838 */
    3939
    40 #include <log.h>
     40#include <print.h>
    4141#include <lib/rd.h>
    4242#include <mm/frame.h>
     
    6868        sysinfo_set_item_val("rd.address.physical", NULL, (sysarg_t) base);
    6969       
    70         log(LF_OTHER, LVL_NOTE, "RAM disk at %p (size %zu bytes)", (void *) base,
    71             size);
     70        printf("RAM disk at %p (size %zu bytes)\n", (void *) base, size);
    7271}
    7372
  • kernel/generic/src/main/kinit.c

    rfd07e57b raacdb8e  
    5959#include <mm/km.h>
    6060#include <print.h>
    61 #include <log.h>
    6261#include <memstr.h>
    6362#include <console/console.h>
     
    141140                                thread_ready(thread);
    142141                        } else
    143                                 log(LF_OTHER, LVL_ERROR,
    144                                     "Unable to create kcpulb thread for cpu%u", i);
     142                                printf("Unable to create kcpulb thread for cpu%u\n", i);
    145143                }
    146144        }
     
    158156                thread_ready(thread);
    159157        else
    160                 log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
     158                printf("Unable to create kload thread\n");
    161159       
    162160#ifdef CONFIG_KCONSOLE
     
    170168                        thread_ready(thread);
    171169                else
    172                         log(LF_OTHER, LVL_ERROR,
    173                             "Unable to create kconsole thread");
     170                        printf("Unable to create kconsole thread\n");
    174171        }
    175172#endif /* CONFIG_KCONSOLE */
     
    213210        for (i = 0; i < init.cnt; i++) {
    214211                if (init.tasks[i].paddr % FRAME_SIZE) {
    215                         log(LF_OTHER, LVL_ERROR,
    216                             "init[%zu]: Address is not frame aligned", i);
     212                        printf("init[%zu]: Address is not frame aligned\n", i);
    217213                        programs[i].task = NULL;
    218214                        continue;
     
    277273                        init_rd((void *) init.tasks[i].paddr, init.tasks[i].size);
    278274                } else
    279                         log(LF_OTHER, LVL_ERROR,
    280                             "init[%zu]: Init binary load failed "
    281                             "(error %d, loader status %u)", i, rc,
     275                        printf("init[%zu]: Init binary load failed "
     276                            "(error %d, loader status %u)\n", i, rc,
    282277                            programs[i].loader_status);
    283278        }
  • kernel/generic/src/main/main.c

    rfd07e57b raacdb8e  
    6262#include <console/kconsole.h>
    6363#include <console/console.h>
    64 #include <log.h>
    6564#include <cpu.h>
    6665#include <align.h>
     
    282281        ipc_init();
    283282        event_init();
    284         kio_init();
    285         log_init();
     283        klog_init();
    286284        stats_init();
    287285       
  • kernel/generic/src/main/shutdown.c

    rfd07e57b raacdb8e  
    3939#include <func.h>
    4040#include <print.h>
    41 #include <log.h>
    4241
    4342void reboot(void)
     
    4645       
    4746#ifdef CONFIG_DEBUG
    48         log(LF_OTHER, LVL_DEBUG, "Rebooting the system");
     47        printf("Rebooting the system\n");
    4948#endif
    5049       
  • kernel/generic/src/mm/frame.c

    rfd07e57b raacdb8e  
    5454#include <arch.h>
    5555#include <print.h>
    56 #include <log.h>
    5756#include <align.h>
    5857#include <mm/slab.h>
     
    122121{
    123122        if (zones.count + 1 == ZONES_MAX) {
    124                 log(LF_OTHER, LVL_ERROR, "Maximum zone count %u exceeded!",
    125                     ZONES_MAX);
     123                printf("Maximum zone count %u exceeded!\n", ZONES_MAX);
    126124                return (size_t) -1;
    127125        }
     
    143141                            (!iswithin(zones.info[i].base, zones.info[i].count,
    144142                            base, count))) {
    145                                 log(LF_OTHER, LVL_WARN,
    146                                     "Zone (%p, %p) overlaps "
    147                                     "with previous zone (%p %p)!",
     143                                printf("Zone (%p, %p) overlaps "
     144                                    "with previous zone (%p %p)!\n",
    148145                                    (void *) PFN2ADDR(base), (void *) PFN2ADDR(count),
    149146                                    (void *) PFN2ADDR(zones.info[i].base),
     
    916913               
    917914#ifdef CONFIG_DEBUG
    918                 log(LF_OTHER, LVL_DEBUG,
    919                     "Thread %" PRIu64 " waiting for %zu frames "
    920                     "%zu available.", THREAD->tid, count, avail);
     915                printf("Thread %" PRIu64 " waiting for %zu frames "
     916                    "(%zu available).\n", THREAD->tid, count, avail);
    921917#endif
    922918               
     
    942938               
    943939#ifdef CONFIG_DEBUG
    944                 log(LF_OTHER, LVL_DEBUG, "Thread %" PRIu64 " woken up.",
    945                     THREAD->tid);
     940                printf("Thread %" PRIu64 " woken up.\n", THREAD->tid);
    946941#endif
    947942               
  • kernel/generic/src/proc/program.c

    rfd07e57b raacdb8e  
    4949#include <lib/elf_load.h>
    5050#include <errno.h>
    51 #include <log.h>
     51#include <print.h>
    5252#include <syscall/copy.h>
    5353#include <proc/program.h>
     
    155155               
    156156                program_loader = image_addr;
    157                 log(LF_OTHER, LVL_NOTE, "Program loader at %p", (void *) image_addr);
     157                printf("Program loader at %p\n", (void *) image_addr);
    158158               
    159159                return EOK;
     
    181181        if (!loader) {
    182182                as_destroy(as);
    183                 log(LF_OTHER, LVL_ERROR,
    184                     "Cannot spawn loader as none was registered");
     183                printf("Cannot spawn loader as none was registered\n");
    185184                return ENOENT;
    186185        }
     
    190189        if (prg->loader_status != EE_OK) {
    191190                as_destroy(as);
    192                 log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)",
     191                printf("Cannot spawn loader (%s)\n",
    193192                    elf_error(prg->loader_status));
    194193                return ENOENT;
  • kernel/generic/src/proc/scheduler.c

    rfd07e57b raacdb8e  
    6161#include <cpu.h>
    6262#include <print.h>
    63 #include <log.h>
    6463#include <debug.h>
    6564#include <stacktrace.h>
     
    518517       
    519518#ifdef SCHEDULER_VERBOSE
    520         log(LF_OTHER, LVL_DEBUG,
    521             "cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64
    522             ", nrdy=%" PRIua ")", CPU->id, THREAD->tid, THREAD->priority,
     519        printf("cpu%u: tid %" PRIu64 " (priority=%d, ticks=%" PRIu64
     520            ", nrdy=%" PRIua ")\n", CPU->id, THREAD->tid, THREAD->priority,
    523521            THREAD->ticks, atomic_get(&CPU->nrdy));
    524522#endif
     
    665663                               
    666664#ifdef KCPULB_VERBOSE
    667                                 log(LF_OTHER, LVL_DEBUG,
    668                                     "kcpulb%u: TID %" PRIu64 " -> cpu%u, "
    669                                     "nrdy=%ld, avg=%ld", CPU->id, t->tid,
     665                                printf("kcpulb%u: TID %" PRIu64 " -> cpu%u, "
     666                                    "nrdy=%ld, avg=%ld\n", CPU->id, t->tid,
    670667                                    CPU->id, atomic_get(&CPU->nrdy),
    671668                                    atomic_get(&nrdy) / config.cpu_active);
  • kernel/generic/src/syscall/syscall.c

    rfd07e57b raacdb8e  
    5656#include <console/console.h>
    5757#include <udebug/udebug.h>
    58 #include <log.h>
    5958
    6059/** Dispatch system call */
     
    8786                rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
    8887        } else {
    89                 log(LF_OTHER, LVL_ERROR,
    90                     "Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
     88                printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
    9189                task_kill_self(true);
    9290        }
     
    122120syshandler_t syscall_table[SYSCALL_END] = {
    123121        /* System management syscalls. */
    124         (syshandler_t) sys_kio,
     122        (syshandler_t) sys_klog,
    125123        (syshandler_t) sys_tls_set,
    126124       
     
    192190       
    193191        /* Kernel console syscalls. */
    194         (syshandler_t) sys_debug_activate_console,
    195        
    196         (syshandler_t) sys_klog,
     192        (syshandler_t) sys_debug_activate_console
    197193};
    198194
  • uspace/Makefile

    rfd07e57b raacdb8e  
    5050        app/kill \
    5151        app/killall \
    52         app/kio \
     52        app/klog \
    5353        app/loc \
    5454        app/logset \
     
    9292        srv/locsrv \
    9393        srv/logger \
    94         srv/klog \
    9594        srv/devman \
    9695        srv/loader \
  • uspace/app/init/init.c

    rfd07e57b raacdb8e  
    336336                srv_start("/srv/tmpfs");
    337337       
    338         srv_start("/srv/klog");
    339338        srv_start("/srv/locfs");
    340339        srv_start("/srv/taskmon");
  • uspace/app/trace/syscalls.c

    rfd07e57b raacdb8e  
    3838
    3939const sc_desc_t syscall_desc[] = {
    40     [SYS_KIO] ={ "kio",                                 3,      V_INT_ERRNO },
     40    [SYS_KLOG] ={ "klog",                               3,      V_INT_ERRNO },
    4141    [SYS_TLS_SET] = { "tls_set",                        1,      V_ERRNO },
    4242
  • uspace/lib/c/Makefile

    rfd07e57b raacdb8e  
    107107        generic/io/log.c \
    108108        generic/io/logctl.c \
    109         generic/io/kio.c \
    110109        generic/io/klog.c \
    111110        generic/io/snprintf.c \
  • uspace/lib/c/generic/assert.c

    rfd07e57b raacdb8e  
    3333#include <assert.h>
    3434#include <stdio.h>
    35 #include <io/kio.h>
     35#include <io/klog.h>
    3636#include <stdlib.h>
    3737#include <atomic.h>
     
    4444{
    4545        /*
    46          * Send the message safely to kio. Nested asserts should not occur.
     46         * Send the message safely to klog. Nested asserts should not occur.
    4747         */
    48         kio_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
     48        klog_printf("Assertion failed (%s) in file \"%s\", line %u.\n",
    4949            cond, file, line);
    5050       
  • uspace/lib/c/generic/io/io.c

    rfd07e57b raacdb8e  
    4242#include <malloc.h>
    4343#include <async.h>
    44 #include <io/kio.h>
     44#include <io/klog.h>
    4545#include <vfs/vfs.h>
    4646#include <vfs/vfs_sess.h>
     
    5757        .error = true,
    5858        .eof = true,
    59         .kio = false,
     59        .klog = false,
    6060        .sess = NULL,
    6161        .btype = _IONBF,
     
    6767};
    6868
    69 static FILE stdout_kio = {
     69static FILE stdout_klog = {
    7070        .fd = -1,
    7171        .error = false,
    7272        .eof = false,
    73         .kio = true,
     73        .klog = true,
    7474        .sess = NULL,
    7575        .btype = _IOLBF,
     
    8181};
    8282
    83 static FILE stderr_kio = {
     83static FILE stderr_klog = {
    8484        .fd = -1,
    8585        .error = false,
    8686        .eof = false,
    87         .kio = true,
     87        .klog = true,
    8888        .sess = NULL,
    8989        .btype = _IONBF,
     
    113113                stdout = fdopen(1, "w");
    114114        } else {
    115                 stdout = &stdout_kio;
     115                stdout = &stdout_klog;
    116116                list_append(&stdout->link, &files);
    117117        }
     
    120120                stderr = fdopen(2, "w");
    121121        } else {
    122                 stderr = &stderr_kio;
     122                stderr = &stderr_klog;
    123123                list_append(&stderr->link, &files);
    124124        }
     
    267267        stream->error = false;
    268268        stream->eof = false;
    269         stream->kio = false;
     269        stream->klog = false;
    270270        stream->sess = NULL;
    271271        stream->need_sync = false;
     
    289289        stream->error = false;
    290290        stream->eof = false;
    291         stream->kio = false;
     291        stream->klog = false;
    292292        stream->sess = NULL;
    293293        stream->need_sync = false;
     
    314314       
    315315        if ((stream != &stdin_null)
    316             && (stream != &stdout_kio)
    317             && (stream != &stderr_kio))
     316            && (stream != &stdout_klog)
     317            && (stream != &stderr_klog))
    318318                free(stream);
    319319       
     
    382382                ssize_t wr;
    383383               
    384                 if (stream->kio)
    385                         wr = kio_write(buf + done, left);
     384                if (stream->klog)
     385                        wr = klog_write(buf + done, left);
    386386                else
    387387                        wr = write(stream->fd, buf + done, left);
     
    705705        _fflushbuf(stream);
    706706       
    707         if (stream->kio) {
    708                 kio_update();
     707        if (stream->klog) {
     708                klog_update();
    709709                return EOK;
    710710        }
     
    740740int fileno(FILE *stream)
    741741{
    742         if (stream->kio) {
     742        if (stream->klog) {
    743743                errno = EBADF;
    744744                return -1;
  • uspace/lib/c/generic/io/klog.c

    rfd07e57b raacdb8e  
    11/*
    2  * Copyright (c) 2013 Martin Sucha
     2 * Copyright (c) 2006 Josef Cejka
     3 * Copyright (c) 2006 Jakub Vana
    34 * All rights reserved.
    45 *
     
    4041#include <abi/klog.h>
    4142#include <io/klog.h>
    42 #include <abi/log.h>
     43#include <io/printf_core.h>
    4344
    44 size_t klog_write(log_level_t lvl, const void *buf, size_t size)
     45size_t klog_write(const void *buf, size_t size)
    4546{
    46         ssize_t ret = (ssize_t) __SYSCALL4(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf,
    47             size, lvl);
     47        ssize_t ret = (ssize_t) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) buf, size);
    4848       
    4949        if (ret >= 0)
     
    5353}
    5454
    55 int klog_read(void *data, size_t size)
     55void klog_update(void)
    5656{
    57         return (int) __SYSCALL4(SYS_KLOG, KLOG_READ, (uintptr_t) data, size, 0);
     57        (void) __SYSCALL3(SYS_KLOG, KLOG_UPDATE, (uintptr_t) NULL, 0);
     58}
     59
     60void 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 */
     72int 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
     84static 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
     90static 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 */
     117int 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);
    58126}
    59127
  • uspace/lib/c/generic/private/stdio.h

    rfd07e57b raacdb8e  
    5353        int eof;
    5454       
    55         /** KIO indicator */
    56         int kio;
     55        /** Klog indicator */
     56        int klog;
    5757       
    5858        /** Session to the file provider */
  • uspace/lib/c/include/io/klog.h

    rfd07e57b raacdb8e  
    11/*
    2  * Copyright (c) 2013 Martin Sucha
     2 * Copyright (c) 2006 Jakub Vana
    33 * All rights reserved.
    44 *
     
    3939#include <stdarg.h>
    4040#include <io/verify.h>
    41 #include <stdio.h>
    42 #include <stdlib.h>
    43 #include <str.h>
    44 #include <abi/log.h>
    4541
    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 })
     42extern size_t klog_write(const void *, size_t);
     43extern void klog_update(void);
     44extern void klog_command(const void *, size_t);
     45extern int klog_printf(const char *, ...)
     46    PRINTF_ATTRIBUTE(1, 2);
     47extern int klog_vprintf(const char *, va_list);
    6348
    6449#endif
  • uspace/lib/c/include/io/log.h

    rfd07e57b raacdb8e  
    3939#include <io/verify.h>
    4040
    41 #include <abi/log.h>
     41/** Log message level. */
     42typedef 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;
    4259
    4360/** Log itself (logging target). */
  • uspace/lib/c/include/stdio.h

    rfd07e57b raacdb8e  
    4040#include <str.h>
    4141#include <io/verify.h>
    42 #include <abi/kio.h>
     42#include <abi/klog.h>
    4343
    4444#define EOF  (-1)
     
    5252                int _n = snprintf(_buf, sizeof(_buf), fmt, ##__VA_ARGS__); \
    5353                if (_n > 0) \
    54                         (void) __SYSCALL3(SYS_KIO, KIO_WRITE, (sysarg_t) _buf, str_size(_buf)); \
     54                        (void) __SYSCALL3(SYS_KLOG, KLOG_WRITE, (sysarg_t) _buf, str_size(_buf)); \
    5555        }
    5656
  • uspace/srv/logger/writer.c

    rfd07e57b raacdb8e  
    4040#include <io/log.h>
    4141#include <io/logctl.h>
    42 #include <io/klog.h>
    4342#include <ns.h>
    4443#include <async.h>
     
    8079        }
    8180
    82         KLOG_PRINTF(level, "[%s] %s: %s\n",
     81        printf("[%s] %s: %s\n",
    8382            log->full_name, log_level_str(level),
    8483            (const char *) message);
Note: See TracChangeset for help on using the changeset viewer.