Changeset 7e752b2 in mainline for kernel/generic


Ignore:
Timestamp:
2010-11-26T01:33:20Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf61d3a
Parents:
202f57b
Message:
  • correct printf() formatting strings and corresponding arguments
  • minor cstyle changes and other small fixes
Location:
kernel/generic
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/spinlock.h

    r202f57b r7e752b2  
    146146        if ((pname)++ > (value)) { \
    147147                (pname) = 0; \
    148                 printf("Deadlock probe %s: exceeded threshold %u\n", \
     148                printf("Deadlock probe %s: exceeded threshold %u\n" \
    149149                    "cpu%u: function=%s, line=%u\n", \
    150150                    #pname, (value), CPU->id, __func__, __LINE__); \
  • kernel/generic/src/cpu/cpu.c

    r202f57b r7e752b2  
    107107void cpu_list(void)
    108108{
    109         size_t i;
     109        unsigned int i;
    110110       
    111111        for (i = 0; i < config.cpu_count; i++) {
  • kernel/generic/src/debug/debug.c

    r202f57b r7e752b2  
    5252        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
    5353            &call_site_off) == EOK)
    54                 printf("%s+%" PRIp "->%s\n", call_site_sym, call_site_off,
    55                     fn_sym);
     54                printf("%s()+%p->%s()\n", call_site_sym,
     55                    (void *) call_site_off, fn_sym);
    5656        else
    57                 printf("->%s\n", fn_sym);
     57                printf("->%s()\n", fn_sym);
    5858}
    5959
     
    6767        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
    6868            &call_site_off) == EOK)
    69                 printf("%s+%" PRIp "<-%s\n", call_site_sym, call_site_off,
    70                     fn_sym);
     69                printf("%s()+%p<-%s()\n", call_site_sym,
     70                    (void *) call_site_off, fn_sym);
    7171        else
    72                 printf("<-%s\n", fn_sym);
     72                printf("<-%s()\n", fn_sym);
    7373}
    7474
  • kernel/generic/src/debug/panic.c

    r202f57b r7e752b2  
    4242#include <interrupt.h>
    4343
     44#define BANNER_LEFT   "######>"
     45#define BANNER_RIGHT  "<######"
     46
    4447void panic_common(panic_category_t cat, istate_t *istate, int access,
    4548    uintptr_t address, const char *fmt, ...)
    4649{
    4750        va_list args;
    48 
     51       
    4952        silent = false;
    50 
    51         printf("\nKERNEL PANIC ");
     53       
     54        printf("\n%s Kernel panic ", BANNER_LEFT);
    5255        if (CPU)
    53                 printf("ON cpu%d ", CPU->id);
    54         printf("DUE TO ");
    55 
     56                printf("on cpu%u ", CPU->id);
     57        printf("due to ");
     58       
    5659        va_start(args, fmt);
    5760        if (cat == PANIC_ASSERT) {
    58                 printf("A FAILED ASSERTION:\n");
     61                printf("a failed assertion: %s\n", BANNER_RIGHT);
    5962                vprintf(fmt, args);
    6063                printf("\n");
    6164        } else if (cat == PANIC_BADTRAP) {
    62                 printf("BAD TRAP %ld.\n", address);
     65                printf("bad trap %" PRIun ". %s\n", address,
     66                    BANNER_RIGHT);
    6367                if (fmt) {
    6468                        vprintf(fmt, args);
     
    6670                }
    6771        } else if (cat == PANIC_MEMTRAP) {
    68                 printf("A BAD MEMORY ACCESS WHILE ");
     72                printf("a bad memory access while ");
    6973                if (access == PF_ACCESS_READ)
    70                         printf("LOADING FROM");
     74                        printf("loading from");
    7175                else if (access == PF_ACCESS_WRITE)
    72                         printf("STORING TO");
     76                        printf("storing to");
    7377                else if (access == PF_ACCESS_EXEC)
    74                         printf("BRANCHING TO");
     78                        printf("branching to");
    7579                else
    76                         printf("REFERENCING");
    77                 printf(" ADDRESS %p.\n", address);
     80                        printf("referencing");
     81                printf(" address %p. %s\n", (void *) address,
     82                    BANNER_RIGHT);
    7883                if (fmt) {
    7984                        vprintf(fmt, args);
     
    8186                }
    8287        } else {
    83                 printf("THE FOLLOWING REASON:\n");
     88                printf("the following reason: %s\n",
     89                    BANNER_RIGHT);
    8490                vprintf(fmt, args);
    8591                printf("\n");
    8692        }
    8793        va_end(args);
    88 
     94       
    8995        printf("\n");
    90 
     96       
    9197        if (istate) {
    9298                istate_decode(istate);
    9399                printf("\n");
    94100        }
    95 
     101       
    96102        stack_trace();
    97103        halt();
  • kernel/generic/src/debug/stacktrace.c

    r202f57b r7e752b2  
    4141#define STACK_FRAMES_MAX        20
    4242
    43 void
    44 stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
     43void stack_trace_ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)
    4544{
    4645        int cnt = 0;
     
    5453                if (ops->symbol_resolve &&
    5554                    ops->symbol_resolve(ctx->pc, &symbol, &offset)) {
    56                         if (offset)
    57                                 printf("%p: %s+%" PRIp "()\n",
    58                                     ctx->fp, symbol, offset);
     55                        if (offset)
     56                                printf("%p: %s()+%p\n", (void *) ctx->fp,
     57                                    symbol, (void *) offset);
    5958                        else
    60                                 printf("%p: %s()\n",
    61                                     ctx->fp, symbol);
    62                 } else {
    63                         printf("%p: %p()\n", ctx->fp, ctx->pc);
    64                 }
     59                                printf("%p: %s()\n", (void *) ctx->fp, symbol);
     60                } else
     61                        printf("%p: %p()\n", (void *) ctx->fp, (void *) ctx->pc);
     62               
    6563                if (!ops->return_address_get(ctx, &pc))
    6664                        break;
     65               
    6766                if (!ops->frame_pointer_prev(ctx, &fp))
    6867                        break;
     68               
    6969                ctx->fp = fp;
    7070                ctx->pc = pc;
  • kernel/generic/src/debug/symtab.c

    r202f57b r7e752b2  
    192192                uintptr_t addr = uint64_t_le2host(symbol_table[pos].address_le);
    193193                char *realname = symbol_table[pos].symbol_name;
    194                 printf("%p: %s\n", addr, realname);
     194                printf("%p: %s\n", (void *) addr, realname);
    195195                pos++;
    196196        }
  • kernel/generic/src/interrupt/interrupt.c

    r202f57b r7e752b2  
    176176        printf("Task %s (%" PRIu64 ") killed due to an exception at "
    177177            "program counter %p.\n", TASK->name, TASK->taskid,
    178             istate_get_pc(istate));
     178            (void *) istate_get_pc(istate));
    179179       
    180180        stack_trace_istate(istate);
  • kernel/generic/src/ipc/ipc.c

    r202f57b r7e752b2  
    702702        for (i = 0; i < IPC_MAX_PHONES; i++) {
    703703                if (SYNCH_FAILED(mutex_trylock(&task->phones[i].lock))) {
    704                         printf("%d: mutex busy\n", i);
     704                        printf("%zu: mutex busy\n", i);
    705705                        continue;
    706706                }
    707707               
    708708                if (task->phones[i].state != IPC_PHONE_FREE) {
    709                         printf("%" PRIs ": ", i);
     709                        printf("%zu: ", i);
    710710                       
    711711                        switch (task->phones[i].state) {
  • kernel/generic/src/main/kinit.c

    r202f57b r7e752b2  
    129129                 * For each CPU, create its load balancing thread.
    130130                 */
    131                 size_t i;
     131                unsigned int i;
    132132               
    133133                for (i = 0; i < config.cpu_count; i++) {
     
    139139                                thread_ready(thread);
    140140                        } else
    141                                 printf("Unable to create kcpulb thread for cpu" PRIs "\n", i);
     141                                printf("Unable to create kcpulb thread for cpu%u\n", i);
    142142                }
    143143        }
     
    179179        for (i = 0; i < init.cnt; i++) {
    180180                if (init.tasks[i].addr % FRAME_SIZE) {
    181                         printf("init[%" PRIs "].addr is not frame aligned\n", i);
     181                        printf("init[%zu].addr is not frame aligned\n", i);
    182182                        programs[i].task = NULL;
    183183                        continue;
     
    219219                       
    220220                        if (rd != RE_OK)
    221                                 printf("Init binary %" PRIs " not used (error %d)\n", i, rd);
     221                                printf("Init binary %zu not used (error %d)\n", i, rd);
    222222                }
    223223        }
  • kernel/generic/src/main/main.c

    r202f57b r7e752b2  
    183183        version_print();
    184184       
    185         LOG("\nconfig.base=%p config.kernel_size=%" PRIs
    186             "\nconfig.stack_base=%p config.stack_size=%" PRIs,
     185        LOG("\nconfig.base=%p config.kernel_size=%zu"
     186            "\nconfig.stack_base=%p config.stack_size=%zu",
    187187            config.base, config.kernel_size, config.stack_base,
    188188            config.stack_size);
     
    225225        slab_enable_cpucache();
    226226       
    227         printf("Detected %" PRIs " CPU(s), %" PRIu64" MiB free memory\n",
     227        printf("Detected %u CPU(s), %" PRIu64 " MiB free memory\n",
    228228            config.cpu_count, SIZE2MB(zones_total_size()));
    229229       
     
    241241                size_t i;
    242242                for (i = 0; i < init.cnt; i++)
    243                         LOG("init[%" PRIs "].addr=%p, init[%" PRIs
    244                             "].size=%" PRIs, i, init.tasks[i].addr, i,
    245                             init.tasks[i].size);
     243                        LOG("init[%zu].addr=%p, init[%zu].size=%zu",
     244                            i, init.tasks[i].addr, i, init.tasks[i].size);
    246245        } else
    247246                printf("No init binaries found.\n");
  • kernel/generic/src/mm/as.c

    r202f57b r7e752b2  
    18111811        }
    18121812       
    1813         panic("Inconsistency detected while adding %" PRIs " pages of used "
    1814             "space at %p.", count, page);
     1813        panic("Inconsistency detected while adding %zu pages of used "
     1814            "space at %p.", count, (void *) page);
    18151815}
    18161816
     
    19911991       
    19921992error:
    1993         panic("Inconsistency detected while removing %" PRIs " pages of used "
    1994             "space from %p.", count, page);
     1993        panic("Inconsistency detected while removing %zu pages of used "
     1994            "space from %p.", count, (void *) page);
    19951995}
    19961996
     
    21052105                       
    21062106                        mutex_lock(&area->lock);
    2107                         printf("as_area: %p, base=%p, pages=%" PRIs
    2108                             " (%p - %p)\n", area, area->base, area->pages,
    2109                             area->base, area->base + FRAMES2SIZE(area->pages));
     2107                        printf("as_area: %p, base=%p, pages=%zu"
     2108                            " (%p - %p)\n", area, (void *) area->base,
     2109                            area->pages, (void *) area->base,
     2110                            (void *) (area->base + FRAMES2SIZE(area->pages)));
    21102111                        mutex_unlock(&area->lock);
    21112112                }
  • kernel/generic/src/mm/frame.c

    r202f57b r7e752b2  
    145145                            (!iswithin(zones.info[i].base, zones.info[i].count,
    146146                            base, count))) {
    147                                 printf("Zone (%p, %p) overlaps with previous zone (%p, %p)!\n",
    148                                     PFN2ADDR(base), PFN2ADDR(count),
    149                                     PFN2ADDR(zones.info[i].base),
    150                                     PFN2ADDR(zones.info[i].count));
     147                                printf("Zone (%p, %p) overlaps "
     148                                    "with previous zone (%p %p)!\n",
     149                                    (void *) PFN2ADDR(base), (void *) PFN2ADDR(count),
     150                                    (void *) PFN2ADDR(zones.info[i].base),
     151                                    (void *) PFN2ADDR(zones.info[i].count));
    151152                        }
    152153                       
     
    10491050               
    10501051#ifdef CONFIG_DEBUG
    1051                 printf("Thread %" PRIu64 " waiting for %" PRIs " frames, "
    1052                     "%" PRIs " available.\n", THREAD->tid, size, avail);
     1052                printf("Thread %" PRIu64 " waiting for %zu frames, "
     1053                    "%zu available.\n", THREAD->tid, size, avail);
    10531054#endif
    10541055               
     
    12971298                bool available = zone_flags_available(flags);
    12981299               
    1299                 printf("%-4" PRIs, i);
     1300                printf("%-4zu", i);
    13001301               
    13011302#ifdef __32_BITS__
    1302                 printf("  %10p", base);
     1303                printf("  %p", (void *) base);
    13031304#endif
    13041305               
    13051306#ifdef __64_BITS__
    1306                 printf(" %18p", base);
     1307                printf(" %p", (void *) base);
    13071308#endif
    13081309               
    1309                 printf(" %12" PRIs " %c%c%c      ", count,
     1310                printf(" %12zu %c%c%c      ", count,
    13101311                    available ? 'A' : ' ',
    13111312                    (flags & ZONE_RESERVED) ? 'R' : ' ',
     
    13131314               
    13141315                if (available)
    1315                         printf("%14" PRIs " %14" PRIs,
     1316                        printf("%14zu %14zu",
    13161317                            free_count, busy_count);
    13171318               
     
    13541355        bool available = zone_flags_available(flags);
    13551356       
    1356         printf("Zone number:       %" PRIs "\n", znum);
    1357         printf("Zone base address: %p\n", base);
    1358         printf("Zone size:         %" PRIs " frames (%" PRIs " KiB)\n", count,
     1357        printf("Zone number:       %zu\n", znum);
     1358        printf("Zone base address: %p\n", (void *) base);
     1359        printf("Zone size:         %zu frames (%zu KiB)\n", count,
    13591360            SIZE2KB(FRAMES2SIZE(count)));
    13601361        printf("Zone flags:        %c%c%c\n",
     
    13641365       
    13651366        if (available) {
    1366                 printf("Allocated space:   %" PRIs " frames (%" PRIs " KiB)\n",
     1367                printf("Allocated space:   %zu frames (%zu KiB)\n",
    13671368                    busy_count, SIZE2KB(FRAMES2SIZE(busy_count)));
    1368                 printf("Available space:   %" PRIs " frames (%" PRIs " KiB)\n",
     1369                printf("Available space:   %zu frames (%zu KiB)\n",
    13691370                    free_count, SIZE2KB(FRAMES2SIZE(free_count)));
    13701371        }
  • kernel/generic/src/mm/slab.c

    r202f57b r7e752b2  
    890890                irq_spinlock_unlock(&slab_cache_lock, true);
    891891               
    892                 printf("%-18s %8" PRIs " %8u %8" PRIs " %8ld %8ld %8ld %-5s\n",
     892                printf("%-18s %8zu %8u %8zu %8ld %8ld %8ld %-5s\n",
    893893                    name, size, (1 << order), objects, allocated_slabs,
    894894                    cached_objs, allocated_objs,
  • kernel/generic/src/proc/program.c

    r202f57b r7e752b2  
    145145               
    146146                program_loader = image_addr;
    147                 LOG("Registered program loader at 0x%" PRIp,
    148                     image_addr);
     147                LOG("Registered program loader at %p",
     148                    (void *) image_addr);
    149149               
    150150                return EOK;
  • kernel/generic/src/proc/scheduler.c

    r202f57b r7e752b2  
    727727                irq_spinlock_lock(&cpus[cpu].lock, true);
    728728               
    729                 printf("cpu%u: address=%p, nrdy=%ld, needs_relink=%" PRIs "\n",
     729                printf("cpu%u: address=%p, nrdy=%" PRIua ", needs_relink=%zu\n",
    730730                    cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy),
    731731                    cpus[cpu].needs_relink);
  • kernel/generic/src/proc/task.c

    r202f57b r7e752b2  
    478478#ifdef __32_BITS__
    479479        if (*additional)
    480                 printf("%-8" PRIu64 " %9lu %7lu", task->taskid,
     480                printf("%-8" PRIu64 " %9" PRIua " %7" PRIua, task->taskid,
    481481                    atomic_get(&task->refcount), atomic_get(&task->active_calls));
    482482        else
     
    489489#ifdef __64_BITS__
    490490        if (*additional)
    491                 printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c %9lu %7lu",
     491                printf("%-8" PRIu64 " %9" PRIu64 "%c %9" PRIu64 "%c "
     492                    "%9" PRIua " %7" PRIua,
    492493                    task->taskid, ucycles, usuffix, kcycles, ksuffix,
    493494                    atomic_get(&task->refcount), atomic_get(&task->active_calls));
     
    501502                for (i = 0; i < IPC_MAX_PHONES; i++) {
    502503                        if (task->phones[i].callee)
    503                                 printf(" %" PRIs ":%p", i, task->phones[i].callee);
     504                                printf(" %zu:%p", i, task->phones[i].callee);
    504505                }
    505506                printf("\n");
  • kernel/generic/src/synch/spinlock.c

    r202f57b r7e752b2  
    102102               
    103103                if (i++ > DEADLOCK_THRESHOLD) {
    104                         printf("cpu%u: looping on spinlock %" PRIp ":%s, "
    105                             "caller=%" PRIp "(%s)\n", CPU->id, lock, lock->name,
    106                             CALLER, symtab_fmt_name_lookup(CALLER));
     104                        printf("cpu%u: looping on spinlock %p:%s, "
     105                            "caller=%p (%s)\n", CPU->id, lock, lock->name,
     106                            (void *) CALLER, symtab_fmt_name_lookup(CALLER));
    107107                       
    108108                        i = 0;
  • kernel/generic/src/sysinfo/sysinfo.c

    r202f57b r7e752b2  
    494494                        break;
    495495                case SYSINFO_VAL_DATA:
    496                         printf("+ %s (%" PRIs" bytes)\n", cur->name,
     496                        printf("+ %s (%zu bytes)\n", cur->name,
    497497                            cur->val.data.size);
    498498                        break;
     
    505505                        /* N.B.: No data was actually returned (only a dry run) */
    506506                        (void) cur->val.fn_data(cur, &size, true);
    507                         printf("+ %s (%" PRIs" bytes) [generated]\n", cur->name,
     507                        printf("+ %s (%zu bytes) [generated]\n", cur->name,
    508508                            size);
    509509                        break;
Note: See TracChangeset for help on using the changeset viewer.