Changeset b2fa1204 in mainline for kernel/generic/src


Ignore:
Timestamp:
2014-01-05T21:12:26Z (12 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca05e9b
Parents:
bd6ff94
Message:

Cherrypick usage of kernel logger

Location:
kernel/generic/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    rbd6ff94 rb2fa1204  
    4545#include <console/kconsole.h>
    4646#include <print.h>
     47#include <log.h>
    4748#include <panic.h>
    4849#include <typedefs.h>
     
    639640        for (i = 0; basic_commands[i]; i++) {
    640641                if (!cmd_register(basic_commands[i])) {
    641                         printf("Cannot register command %s\n",
     642                        log(LF_OTHER, LVL_ERROR,
     643                            "Cannot register command %s",
    642644                            basic_commands[i]->name);
    643645                }
     
    665667        unsigned int _len = (unsigned int) len;
    666668        if ((_len != len) || (((int) _len) < 0)) {
    667                 printf("Command length overflow\n");
     669                log(LF_OTHER, LVL_ERROR, "Command length overflow");
    668670                return 1;
    669671        }
  • kernel/generic/src/lib/func.c

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

    rbd6ff94 rb2fa1204  
    3838 */
    3939
    40 #include <print.h>
     40#include <log.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         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);
    7172}
    7273
  • kernel/generic/src/main/kinit.c

    rbd6ff94 rb2fa1204  
    5959#include <mm/km.h>
    6060#include <print.h>
     61#include <log.h>
    6162#include <memstr.h>
    6263#include <console/console.h>
     
    140141                                thread_ready(thread);
    141142                        } 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);
    143145                }
    144146        }
     
    156158                thread_ready(thread);
    157159        else
    158                 printf("Unable to create kload thread\n");
     160                log(LF_OTHER, LVL_ERROR, "Unable to create kload thread");
    159161       
    160162#ifdef CONFIG_KCONSOLE
     
    168170                        thread_ready(thread);
    169171                else
    170                         printf("Unable to create kconsole thread\n");
     172                        log(LF_OTHER, LVL_ERROR,
     173                            "Unable to create kconsole thread");
    171174        }
    172175#endif /* CONFIG_KCONSOLE */
     
    210213        for (i = 0; i < init.cnt; i++) {
    211214                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);
    213217                        programs[i].task = NULL;
    214218                        continue;
     
    273277                        init_rd((void *) init.tasks[i].paddr, init.tasks[i].size);
    274278                } 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,
    277282                            programs[i].loader_status);
    278283        }
  • kernel/generic/src/main/shutdown.c

    rbd6ff94 rb2fa1204  
    3939#include <func.h>
    4040#include <print.h>
     41#include <log.h>
    4142
    4243void reboot(void)
     
    4546       
    4647#ifdef CONFIG_DEBUG
    47         printf("Rebooting the system\n");
     48        log(LF_OTHER, LVL_DEBUG, "Rebooting the system");
    4849#endif
    4950       
  • kernel/generic/src/mm/frame.c

    rbd6ff94 rb2fa1204  
    5454#include <arch.h>
    5555#include <print.h>
     56#include <log.h>
    5657#include <align.h>
    5758#include <mm/slab.h>
     
    121122{
    122123        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);
    124126                return (size_t) -1;
    125127        }
     
    141143                            (!iswithin(zones.info[i].base, zones.info[i].count,
    142144                            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)!",
    145148                                    (void *) PFN2ADDR(base), (void *) PFN2ADDR(count),
    146149                                    (void *) PFN2ADDR(zones.info[i].base),
     
    913916               
    914917#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);
    917921#endif
    918922               
     
    938942               
    939943#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);
    941946#endif
    942947               
  • kernel/generic/src/proc/program.c

    rbd6ff94 rb2fa1204  
    4949#include <lib/elf_load.h>
    5050#include <errno.h>
    51 #include <print.h>
     51#include <log.h>
    5252#include <syscall/copy.h>
    5353#include <proc/program.h>
     
    155155               
    156156                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);
    158158               
    159159                return EOK;
     
    181181        if (!loader) {
    182182                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");
    184185                return ENOENT;
    185186        }
     
    189190        if (prg->loader_status != EE_OK) {
    190191                as_destroy(as);
    191                 printf("Cannot spawn loader (%s)\n",
     192                log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)",
    192193                    elf_error(prg->loader_status));
    193194                return ENOENT;
  • kernel/generic/src/proc/scheduler.c

    rbd6ff94 rb2fa1204  
    6161#include <cpu.h>
    6262#include <print.h>
     63#include <log.h>
    6364#include <debug.h>
    6465#include <stacktrace.h>
     
    517518       
    518519#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,
    521523            THREAD->ticks, atomic_get(&CPU->nrdy));
    522524#endif
     
    663665                               
    664666#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,
    667670                                    CPU->id, atomic_get(&CPU->nrdy),
    668671                                    atomic_get(&nrdy) / config.cpu_active);
  • kernel/generic/src/syscall/syscall.c

    rbd6ff94 rb2fa1204  
    8787                rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
    8888        } else {
    89                 printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
     89                log(LF_OTHER, LVL_ERROR,
     90                    "Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
    9091                task_kill_self(true);
    9192        }
Note: See TracChangeset for help on using the changeset viewer.