/kernel/trunk/genarch/src/i8042/i8042.c |
---|
32,6 → 32,7 |
#include <cpu.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <print.h> |
#include <synch/spinlock.h> |
#include <typedefs.h> |
#include <console/chardev.h> |
/kernel/trunk/genarch/src/acpi/matd.c |
---|
176,15 → 176,15 |
case MADT_IO_SAPIC: |
case MADT_L_SAPIC: |
case MADT_PLATFORM_INTR_SRC: |
printf("MADT: skipping %s entry (type=%zd)\n", entry[h->type], h->type); |
printf("MADT: skipping %s entry (type=%d)\n", entry[h->type], h->type); |
break; |
default: |
if (h->type >= MADT_RESERVED_SKIP_BEGIN && h->type <= MADT_RESERVED_SKIP_END) { |
printf("MADT: skipping reserved entry (type=%zd)\n", h->type); |
printf("MADT: skipping reserved entry (type=%d)\n", h->type); |
} |
if (h->type >= MADT_RESERVED_OEM_BEGIN) { |
printf("MADT: skipping OEM entry (type=%zd)\n", h->type); |
printf("MADT: skipping OEM entry (type=%d)\n", h->type); |
} |
break; |
} |
228,7 → 228,7 |
void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32 index) |
{ |
ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int)); |
printf("MADT: ignoring %s entry: bus=%zd, source=%zd, global_int=%zd, flags=%#hX\n", |
printf("MADT: ignoring %s entry: bus=%d, source=%d, global_int=%d, flags=%W\n", |
entry[override->header.type], override->bus, override->source, |
override->global_int, override->flags); |
} |
/kernel/trunk/genarch/src/acpi/acpi.c |
---|
96,7 → 96,7 |
if (!acpi_sdt_check((__u8 *) h)) |
goto next; |
*signature_map[j].sdt_ptr = h; |
printf("%#zX: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); |
printf("%P: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); |
} |
} |
next: |
117,7 → 117,7 |
if (!acpi_sdt_check((__u8 *) h)) |
goto next; |
*signature_map[j].sdt_ptr = h; |
printf("%#zX: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); |
printf("%P: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description); |
} |
} |
next: |
151,7 → 151,7 |
return; |
rsdp_found: |
printf("%#zX: ACPI Root System Description Pointer\n", acpi_rsdp); |
printf("%P: ACPI Root System Description Pointer\n", acpi_rsdp); |
acpi_rsdt = (struct acpi_rsdt *) (__native) acpi_rsdp->rsdt_address; |
if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((__address) acpi_rsdp->xsdt_address); |
/kernel/trunk/genarch/src/softint/division.c |
---|
65,10 → 65,10 |
} |
static unsigned long long divandmod64(unsigned long long a, unsigned long long b, unsigned long long *remainder) |
static unsigned long divandmod64(unsigned long a, unsigned long b, unsigned long *remainder) |
{ |
unsigned long long result; |
int steps = sizeof(unsigned long long) * 8; |
unsigned long result; |
int steps = sizeof(unsigned long) * 8; |
*remainder = 0; |
result = 0; |
111,12 → 111,12 |
} |
/* 64bit integer division */ |
long long __divdi3(long long a, long long b) |
long __divdi3(long a, long b) |
{ |
unsigned long long rem; |
long long result; |
unsigned long rem; |
long result; |
result = (long long)divandmod64(ABSVAL(a), ABSVAL(b), &rem); |
result = (long)divandmod64(ABSVAL(a), ABSVAL(b), &rem); |
if ( SGN(a) == SGN(b)) return result; |
return -result; |
130,9 → 130,9 |
} |
/* 64bit unsigned integer division */ |
unsigned long long __udivdi3(unsigned long long a, unsigned long long b) |
unsigned long __udivdi3(unsigned long a, unsigned long b) |
{ |
unsigned long long rem; |
unsigned long rem; |
return divandmod64(a, b, &rem); |
} |
151,17 → 151,17 |
} |
/* 64bit remainder of the signed division */ |
long long __moddi3(long long a,long long b) |
long __moddi3(long a, long b) |
{ |
unsigned long long rem; |
unsigned long rem; |
divandmod64(a, b, &rem); |
/* if divident is negative, remainder must be too */ |
if (!(SGN(a))) { |
return -((long long)rem); |
return -((long)rem); |
} |
return (long long)rem; |
return (long)rem; |
} |
/* 32bit remainder of the unsigned division */ |
173,14 → 173,14 |
} |
/* 64bit remainder of the unsigned division */ |
unsigned long long __umoddi3(unsigned long long a, unsigned long long b) |
unsigned long __umoddi3(unsigned long a, unsigned long b) |
{ |
unsigned long long rem; |
unsigned long rem; |
divandmod64(a, b, &rem); |
return rem; |
} |
unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c) |
unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsigned long *c) |
{ |
return divandmod64(a, b, c); |
} |
/kernel/trunk/genarch/include/softint/division.h |
---|
34,27 → 34,27 |
int __divsi3(int a, int b); |
/* 64bit integer division */ |
long long __divdi3(long long a, long long b); |
long __divdi3(long a, long b); |
/* 32bit unsigned integer division */ |
unsigned int __udivsi3(unsigned int a, unsigned int b); |
/* 64bit unsigned integer division */ |
unsigned long long __udivdi3(unsigned long long a, unsigned long long b); |
unsigned long __udivdi3(unsigned long a, unsigned long b); |
/* 32bit remainder of the signed division */ |
int __modsi3(int a, int b); |
/* 64bit remainder of the signed division */ |
long long __moddi3(long long a, long long b); |
long __moddi3(long a, long b); |
/* 32bit remainder of the unsigned division */ |
unsigned int __umodsi3(unsigned int a, unsigned int b); |
/* 64bit remainder of the unsigned division */ |
unsigned long long __umoddi3(unsigned long long a, unsigned long long b); |
unsigned long __umoddi3(unsigned long a, unsigned long b); |
unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c); |
unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsigned long *c); |
#endif |
/kernel/trunk/generic/include/print.h |
---|
37,11 → 37,9 |
#define INT32 4 |
#define INT64 8 |
extern int printf(const char *fmt, ...); |
extern void printf(const char *fmt, ...); |
/* We need this address in spinlock to avoid deadlock in deadlock detection */ |
extern spinlock_t printflock; |
#define EOF (-1) |
#endif |
/kernel/trunk/generic/src/proc/scheduler.c |
---|
449,7 → 449,7 |
THREAD->state = Running; |
#ifdef SCHEDULER_VERBOSE |
printf("cpu%d: tid %d (priority=%d,ticks=%lld,nrdy=%ld)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy)); |
printf("cpu%d: tid %d (priority=%d,ticks=%d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->priority, THREAD->ticks, atomic_get(&CPU->nrdy)); |
#endif |
/* |
569,7 → 569,7 |
*/ |
spinlock_lock(&t->lock); |
#ifdef KCPULB_VERBOSE |
printf("kcpulb%d: TID %d -> cpu%d, nrdy=%ld, avg=%nd\n", CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy), atomic_get(&nrdy) / config.cpu_active); |
printf("kcpulb%d: TID %d -> cpu%d, nrdy=%d, avg=%d\n", CPU->id, t->tid, CPU->id, atomic_get(&CPU->nrdy), atomic_get(&nrdy) / config.cpu_active); |
#endif |
t->flags |= X_STOLEN; |
t->state = Entering; |
633,7 → 633,7 |
continue; |
spinlock_lock(&cpus[cpu].lock); |
printf("cpu%d: address=%P, nrdy=%ld, needs_relink=%ld\n", |
printf("cpu%d: address=%P, nrdy=%d, needs_relink=%d\n", |
cpus[cpu].id, &cpus[cpu], atomic_get(&cpus[cpu].nrdy), cpus[cpu].needs_relink); |
for (i=0; i<RQ_COUNT; i++) { |
/kernel/trunk/generic/src/proc/task.c |
---|
212,11 → 212,11 |
t = (task_t *) node->value[i]; |
spinlock_lock(&t->lock); |
printf("%s: address=%#zX, taskid=%#llX, as=%#zX, ActiveCalls: %zd", |
printf("%s: address=%P, taskid=%Q, as=%P, ActiveCalls: %d", |
t->name, t, t->taskid, t->as, atomic_get(&t->active_calls)); |
for (j=0; j < IPC_MAX_PHONES; j++) { |
if (t->phones[j].callee) |
printf(" Ph(%zd): %#zX ", j, t->phones[j].callee); |
printf(" Ph(%d): %P ", j, t->phones[j].callee); |
} |
printf("\n"); |
spinlock_unlock(&t->lock); |
/kernel/trunk/generic/src/proc/thread.c |
---|
418,10 → 418,10 |
thread_t *t; |
t = (thread_t *) node->value[i]; |
printf("%s: address=%#zX, tid=%zd, state=%s, task=%#zX, code=%#zX, stack=%#zX, cpu=", |
printf("%s: address=%P, tid=%d, state=%s, task=%P, code=%P, stack=%P, cpu=", |
t->name, t, t->tid, thread_states[t->state], t->task, t->thread_code, t->kstack); |
if (t->cpu) |
printf("cpu%zd ", t->cpu->id); |
printf("cpu%d ", t->cpu->id); |
else |
printf("none"); |
printf("\n"); |
/kernel/trunk/generic/src/mm/slab.c |
---|
792,7 → 792,7 |
printf("SLAB name\tOsize\tPages\tObj/pg\tSlabs\tCached\tAllocobjs\tCtl\n"); |
for (cur = slab_cache_list.next;cur!=&slab_cache_list; cur=cur->next) { |
cache = list_get_instance(cur, slab_cache_t, link); |
printf("%s\t%zd\t%zd\t%zd\t%zd\t%zd\t%zd\t\t%s\n", cache->name, cache->size, |
printf("%s\t%d\t%d\t%d\t%d\t%d\t%d\t\t%s\n", cache->name, cache->size, |
(1 << cache->order), cache->objects, |
atomic_get(&cache->allocated_slabs), |
atomic_get(&cache->cached_objs), |
/kernel/trunk/generic/src/mm/frame.c |
---|
280,7 → 280,7 |
frame = list_get_instance(block, frame_t, buddy_link); |
zone = (zone_t *) b->data; |
index = frame_index(zone, frame); |
printf("%zd", index); |
printf("%d", index); |
} |
/** Buddy system find_buddy implementation |
1028,7 → 1028,7 |
for (i = 0; i < zones.count; i++) { |
zone = zones.info[i]; |
spinlock_lock(&zone->lock); |
printf("%d: %#X \t%zd\t\t%zd\n",i,PFN2ADDR(zone->base), |
printf("%d: %L\t%d\t\t%d\n",i,PFN2ADDR(zone->base), |
zone->free_count, zone->busy_count); |
spinlock_unlock(&zone->lock); |
} |
1061,10 → 1061,10 |
spinlock_lock(&zone->lock); |
printf("Memory zone information\n"); |
printf("Zone base address: %#zX\n", PFN2ADDR(zone->base)); |
printf("Zone size: %zd frames (%zdK)\n", zone->count, ((zone->count) * FRAME_SIZE) >> 10); |
printf("Allocated space: %zd frames (%zdK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); |
printf("Available space: %zd (%zdK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); |
printf("Zone base address: %P\n", PFN2ADDR(zone->base)); |
printf("Zone size: %d frames (%dK)\n", zone->count, ((zone->count) * FRAME_SIZE) >> 10); |
printf("Allocated space: %d frames (%dK)\n", zone->busy_count, (zone->busy_count * FRAME_SIZE) >> 10); |
printf("Available space: %d (%dK)\n", zone->free_count, (zone->free_count * FRAME_SIZE) >> 10); |
buddy_system_structure_print(zone->buddy_system, FRAME_SIZE); |
spinlock_unlock(&zone->lock); |
/kernel/trunk/generic/src/mm/buddy.c |
---|
291,7 → 291,7 |
cnt++; |
} |
printf("#%zd\t%zd\t%zdK\t\t%zdK\t\t%zd\t", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); |
printf("#%d\t%d\t%dK\t\t%dK\t\t%d\t", i, cnt, (cnt * (1 << i) * elem_size) >> 10, ((1 << i) * elem_size) >> 10, 1 << i); |
if (!list_empty(&b->order[i])) { |
for (cur = b->order[i].next; cur != &b->order[i]; cur = cur->next) { |
b->op->print_id(b, cur); |
304,6 → 304,6 |
elem_count += (1 << i) * cnt; |
} |
printf("-----\t------\t--------\t----------\t---------------\n"); |
printf("Buddy system contains %zd free elements (%zd blocks)\n" , elem_count, block_count); |
printf("Buddy system contains %d free elements (%d blocks)\n" , elem_count, block_count); |
} |
/kernel/trunk/generic/src/adt/btree.c |
---|
945,7 → 945,7 |
printf("("); |
for (i = 0; i < node->keys; i++) { |
printf("%lld%s", node->key[i], i < node->keys - 1 ? "," : ""); |
printf("%d%s", node->key[i], i < node->keys - 1 ? "," : ""); |
if (node->depth && node->subtree[i]) { |
list_append(&node->subtree[i]->bfs_link, &head); |
} |
967,7 → 967,7 |
printf("("); |
for (i = 0; i < node->keys; i++) |
printf("%lld%s", node->key[i], i < node->keys - 1 ? "," : ""); |
printf("%d%s", node->key[i], i < node->keys - 1 ? "," : ""); |
printf(")"); |
} |
printf("\n"); |
/kernel/trunk/generic/src/main/kinit.c |
---|
153,7 → 153,7 |
if (!ipc_phone_0) |
ipc_phone_0 = &utask->answerbox; |
} else |
printf("Init task %zd not started.\n", i); |
printf("Init task %d not started.\n", i); |
} |
#ifdef CONFIG_TEST |
/kernel/trunk/generic/src/main/main.c |
---|
176,7 → 176,7 |
arch_post_mm_init(); |
version_print(); |
printf("%#zX: hardcoded_ktext_size=%zdK, hardcoded_kdata_size=%zdK\n", |
printf("%P: hardcoded_ktext_size=%dK, hardcoded_kdata_size=%dK\n", |
config.base, hardcoded_ktext_size/1024, hardcoded_kdata_size/1024); |
arch_pre_smp_init(); |
184,8 → 184,8 |
slab_enable_cpucache(); /* Slab must be initialized AFTER we know the number of processors */ |
printf("config.memory_size=%zdM\n", config.memory_size/(1024*1024)); |
printf("config.cpu_count=%zd\n", config.cpu_count); |
printf("config.memory_size=%dM\n", config.memory_size/(1024*1024)); |
printf("config.cpu_count=%d\n", config.cpu_count); |
cpu_init(); |
calibrate_delay_loop(); |
196,7 → 196,7 |
futex_init(); |
for (i = 0; i < init.cnt; i++) |
printf("init[%zd].addr=%P, init[%zd].size=%zd\n", i, init.tasks[i].addr, i, init.tasks[i].size); |
printf("init[%d].addr=%P, init[%d].size=%d\n", i, init.tasks[i].addr, i, init.tasks[i].size); |
ipc_init(); |
/kernel/trunk/generic/src/main/uinit.c |
---|
31,6 → 31,7 |
#include <proc/thread.h> |
#include <userspace.h> |
#include <mm/slab.h> |
#include <print.h> |
/** Thread used to bring up userspace thread. |
* |
/kernel/trunk/generic/src/console/cmd.c |
---|
458,9 → 458,9 |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(): %p: %s\n", symaddr, symbol); |
printf("Calling f(): 0x%p: %s\n", symaddr, symbol); |
f = (__native (*)(void)) symaddr; |
printf("Result: %p\n", f()); |
printf("Result: 0x%p\n", f()); |
} |
return 1; |
482,9 → 482,9 |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%zX): %p: %s\n", arg1, symaddr, symbol); |
printf("Calling f(0x%x): 0x%p: %s\n", arg1, symaddr, symbol); |
f = (__native (*)(__native,...)) symaddr; |
printf("Result: %p\n", f(arg1)); |
printf("Result: 0x%p\n", f(arg1)); |
} |
return 1; |
507,10 → 507,10 |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%zx,0x%zx): %p: %s\n", |
printf("Calling f(0x%x,0x%x): 0x%p: %s\n", |
arg1, arg2, symaddr, symbol); |
f = (__native (*)(__native,__native,...)) symaddr; |
printf("Result: %p\n", f(arg1, arg2)); |
printf("Result: 0x%p\n", f(arg1, arg2)); |
} |
return 1; |
534,10 → 534,10 |
printf("Duplicate symbol, be more specific.\n"); |
} else { |
symbol = get_symtab_entry(symaddr); |
printf("Calling f(0x%zx,0x%zx, 0x%zx): %p: %s\n", |
printf("Calling f(0x%x,0x%x, 0x%x): 0x%p: %s\n", |
arg1, arg2, arg3, symaddr, symbol); |
f = (__native (*)(__native,__native,__native,...)) symaddr; |
printf("Result: %p\n", f(arg1, arg2, arg3)); |
printf("Result: 0x%p\n", f(arg1, arg2, arg3)); |
} |
return 1; |
598,7 → 598,7 |
} else { |
if (pointer) |
addr = (__u32 *)(*(__native *)addr); |
printf("Writing 0x%x -> %p\n", arg1, addr); |
printf("Writing 0x%x -> 0x%p\n", arg1, addr); |
*addr = arg1; |
} |
/kernel/trunk/generic/src/time/clock.c |
---|
35,6 → 35,7 |
#include <func.h> |
#include <proc/scheduler.h> |
#include <cpu.h> |
#include <print.h> |
#include <arch.h> |
#include <adt/list.h> |
#include <atomic.h> |
/kernel/trunk/generic/src/time/timeout.c |
---|
34,8 → 34,10 |
#include <synch/spinlock.h> |
#include <func.h> |
#include <cpu.h> |
#include <print.h> |
#include <arch/asm.h> |
#include <arch.h> |
#include <print.h> |
/** Initialize timeouts |
/kernel/trunk/generic/src/lib/elf.c |
---|
33,6 → 33,7 |
#include <mm/as.h> |
#include <mm/frame.h> |
#include <mm/slab.h> |
#include <print.h> |
#include <align.h> |
#include <memstr.h> |
#include <macros.h> |
/kernel/trunk/generic/src/debug/print.c |
---|
1,6 → 1,5 |
/* |
* Copyright (C) 2001-2004 Jakub Jermar |
* Copyright (C) 2006 Josef Cejka |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
35,168 → 34,55 |
#include <arch.h> |
static char digits[] = "0123456789abcdef"; /**< Hexadecimal characters */ |
SPINLOCK_INITIALIZE(printflock); /**< printf spinlock */ |
#define __PRINTF_FLAG_PREFIX 0x00000001 /* show prefixes 0x or 0*/ |
#define __PRINTF_FLAG_SIGNED 0x00000002 /* signed / unsigned number */ |
#define __PRINTF_FLAG_ZEROPADDED 0x00000004 /* print leading zeroes */ |
#define __PRINTF_FLAG_LEFTALIGNED 0x00000010 /* align to left */ |
#define __PRINTF_FLAG_SHOWPLUS 0x00000020 /* always show + sign */ |
#define __PRINTF_FLAG_SPACESIGN 0x00000040 /* print space instead of plus */ |
#define __PRINTF_FLAG_BIGCHARS 0x00000080 /* show big characters */ |
#define __PRINTF_FLAG_NEGATIVE 0x00000100 /* number has - sign */ |
#define PRINT_NUMBER_BUFFER_SIZE (64+5) /* Buffer big enought for 64 bit number |
* printed in base 2, sign, prefix and |
* 0 to terminate string.. (last one is only for better testing |
* end of buffer by zero-filling subroutine) |
*/ |
typedef enum { |
PrintfQualifierByte = 0, |
PrintfQualifierShort, |
PrintfQualifierInt, |
PrintfQualifierLong, |
PrintfQualifierLongLong, |
PrintfQualifierNative, |
PrintfQualifierPointer |
} qualifier_t; |
static char digits_small[] = "0123456789abcdef"; /* Small hexadecimal characters */ |
static char digits_big[] = "0123456789ABCDEF"; /* Big hexadecimal characters */ |
static inline int isdigit(int c) |
/** Print NULL terminated string |
* |
* Print characters from str using putchar() until |
* \\0 character is reached. |
* |
* @param str Characters to print. |
* |
*/ |
static void print_str(const char *str) |
{ |
return ((c >= '0' )&&( c <= '9')); |
} |
int i = 0; |
char c; |
char errstr[] = "(NULL)"; |
static __native strlen(const char *str) |
{ |
__native counter = 0; |
while (str[counter] != 0) { |
counter++; |
} |
return counter; |
} |
/** Print one string without adding \n at end |
* Dont use this function directly - printflock is not locked here |
* */ |
static int putstr(const char *str) |
{ |
int count; |
if (str == NULL) { |
str = "(NULL)"; |
} |
while ((c = errstr[i++])) |
putchar(c); |
return; |
} |
for (count = 0; str[count] != 0; count++) { |
putchar(str[count]); |
} |
return count; |
while ((c = str[i++])) |
putchar(c); |
} |
/** Print count characters from buffer to output |
/** Print hexadecimal digits |
* |
* Print fixed count of hexadecimal digits from |
* the number num. The digits are printed in |
* natural left-to-right order starting with |
* the width-th digit. |
* |
* @param num Number containing digits. |
* @param width Count of digits to print. |
* |
*/ |
static int putnchars(const char *buffer, __native count) |
static void print_fixed_hex(const __u64 num, const int width) |
{ |
int i; |
if (buffer == NULL) { |
buffer = "(NULL)"; |
count = 6; |
} |
for (i = 0; i < count; i++) { |
putchar(buffer[i]); |
} |
return count; |
for (i = width*8 - 4; i >= 0; i -= 4) |
putchar(digits[(num>>i) & 0xf]); |
} |
/** Print one formatted character |
* @param c character to print |
* @param width |
* @param flags |
* @return number of printed characters or EOF |
*/ |
static int print_char(char c, int width, __u64 flags) |
{ |
int counter = 0; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (--width > 0) { /* one space is consumed by character itself hence predecrement */ |
/* FIXME: painful slow */ |
putchar(' '); |
++counter; |
} |
} |
putchar(c); |
++counter; |
while (--width > 0) { /* one space is consumed by character itself hence predecrement */ |
putchar(' '); |
++counter; |
} |
return counter; |
} |
/** Print one string |
* @param s string |
* @param width |
* @param precision |
* @param flags |
* @return number of printed characters or EOF |
*/ |
static int print_string(char *s, int width, int precision, __u64 flags) |
{ |
int counter = 0; |
__native size; |
if (s == NULL) { |
return putstr("(NULL)"); |
} |
size = strlen(s); |
/* print leading spaces */ |
if (precision == 0) |
precision = size; |
width -= precision; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (width-- > 0) { |
putchar(' '); |
counter++; |
} |
} |
while (precision > size) { |
precision--; |
putchar(' '); |
++counter; |
} |
if (putnchars(s, precision) == EOF) { |
return EOF; |
} |
counter += precision; |
while (width-- > 0) { |
putchar(' '); |
++counter; |
} |
return ++counter; |
} |
/** Print number in given base |
* |
* Print significant digits of a number in given |
203,146 → 89,22 |
* base. |
* |
* @param num Number to print. |
* @param width |
* @param precision |
* @param base Base to print the number in (should |
* be in range 2 .. 16). |
* @param flags output modifiers |
* @return number of written characters or EOF |
* |
*/ |
static int print_number(__u64 num, int width, int precision, int base , __u64 flags) |
static void print_number(const __native num, const unsigned int base) |
{ |
char *digits = digits_small; |
char d[PRINT_NUMBER_BUFFER_SIZE]; /* this is good enough even for base == 2, prefix and sign */ |
char *ptr = &d[PRINT_NUMBER_BUFFER_SIZE - 1]; |
int size = 0; |
int written = 0; |
char sgn; |
int val = num; |
char d[sizeof(__native)*8+1]; /* this is good enough even for base == 2 */ |
int i = sizeof(__native)*8-1; |
if (flags & __PRINTF_FLAG_BIGCHARS) |
digits = digits_big; |
do { |
d[i--] = digits[val % base]; |
} while (val /= base); |
*ptr-- = 0; /* Put zero at end of string */ |
if (num == 0) { |
*ptr-- = '0'; |
size++; |
} else { |
do { |
*ptr-- = digits[num % base]; |
size++; |
} while (num /= base); |
} |
/* Collect sum of all prefixes/signs/... to calculate padding and leading zeroes */ |
if (flags & __PRINTF_FLAG_PREFIX) { |
switch(base) { |
case 2: /* Binary formating is not standard, but usefull */ |
size += 2; |
break; |
case 8: |
size++; |
break; |
case 16: |
size += 2; |
break; |
} |
} |
sgn = 0; |
if (flags & __PRINTF_FLAG_SIGNED) { |
if (flags & __PRINTF_FLAG_NEGATIVE) { |
sgn = '-'; |
size++; |
} else if (flags & __PRINTF_FLAG_SHOWPLUS) { |
sgn = '+'; |
size++; |
} else if (flags & __PRINTF_FLAG_SPACESIGN) { |
sgn = ' '; |
size++; |
} |
} |
if (flags & __PRINTF_FLAG_LEFTALIGNED) { |
flags &= ~__PRINTF_FLAG_ZEROPADDED; |
} |
/* if number is leftaligned or precision is specified then zeropadding is ignored */ |
if (flags & __PRINTF_FLAG_ZEROPADDED) { |
if ((precision == 0) && (width > size)) { |
precision = width - size; |
} |
} |
/* print leading spaces */ |
if (size > precision) /* We must print whole number not only a part */ |
precision = size; |
width -= precision; |
if (!(flags & __PRINTF_FLAG_LEFTALIGNED)) { |
while (width-- > 0) { |
putchar(' '); |
written++; |
} |
} |
/* print sign */ |
if (sgn) { |
putchar(sgn); |
written++; |
} |
/* print prefix */ |
if (flags & __PRINTF_FLAG_PREFIX) { |
switch(base) { |
case 2: /* Binary formating is not standard, but usefull */ |
putchar('0'); |
if (flags & __PRINTF_FLAG_BIGCHARS) { |
putchar('B'); |
} else { |
putchar('b'); |
} |
written += 2; |
break; |
case 8: |
putchar('o'); |
written++; |
break; |
case 16: |
putchar('0'); |
if (flags & __PRINTF_FLAG_BIGCHARS) { |
putchar('X'); |
} else { |
putchar('x'); |
} |
written += 2; |
break; |
} |
} |
/* print leading zeroes */ |
precision -= size; |
while (precision-- > 0) { |
putchar('0'); |
written++; |
} |
/* print number itself */ |
written += putstr(++ptr); |
/* print ending spaces */ |
while (width-- > 0) { |
putchar(' '); |
written++; |
} |
return written; |
d[sizeof(__native)*8] = 0; |
print_str(&d[i + 1]); |
} |
402,269 → 164,103 |
* |
* @param fmt Formatting NULL terminated string. |
*/ |
int printf(const char *fmt, ...) |
void printf(const char *fmt, ...) |
{ |
int irqpri; |
int i = 0, j = 0; /* i is index of currently processed char from fmt, j is index to the first not printed nonformating character */ |
int end; |
int counter; /* counter of printed characters */ |
int retval; /* used to store return values from called functions */ |
int irqpri, i = 0; |
va_list ap; |
char c; |
qualifier_t qualifier; /* type of argument */ |
int base; /* base in which will be parameter (numbers only) printed */ |
__u64 number; /* argument value */ |
__native size; /* byte size of integer parameter */ |
int width, precision; |
__u64 flags; |
char c; |
counter = 0; |
va_start(ap, fmt); |
irqpri = interrupts_disable(); |
spinlock_lock(&printflock); |
while ((c = fmt[i])) { |
/* control character */ |
if (c == '%' ) { |
/* print common characters if any processed */ |
if (i > j) { |
if ((retval = putnchars(&fmt[j], (__native)(i - j))) == EOF) { /* error */ |
counter = -counter; |
goto out; |
} |
counter += retval; |
} |
j = i; |
/* parse modifiers */ |
flags = 0; |
end = 0; |
do { |
++i; |
switch (c = fmt[i]) { |
case '#': flags |= __PRINTF_FLAG_PREFIX; break; |
case '-': flags |= __PRINTF_FLAG_LEFTALIGNED; break; |
case '+': flags |= __PRINTF_FLAG_SHOWPLUS; break; |
case ' ': flags |= __PRINTF_FLAG_SPACESIGN; break; |
case '0': flags |= __PRINTF_FLAG_ZEROPADDED; break; |
default: end = 1; |
}; |
} while (end == 0); |
/* width & '*' operator */ |
width = 0; |
if (isdigit(fmt[i])) { |
while (isdigit(fmt[i])) { |
width *= 10; |
width += fmt[i++] - '0'; |
} |
} else if (fmt[i] == '*') { |
/* get width value from argument list*/ |
i++; |
width = (int)va_arg(ap, int); |
if (width < 0) { |
/* negative width means to set '-' flag */ |
width *= -1; |
flags |= __PRINTF_FLAG_LEFTALIGNED; |
} |
} |
/* precision and '*' operator */ |
precision = 0; |
if (fmt[i] == '.') { |
++i; |
if (isdigit(fmt[i])) { |
while (isdigit(fmt[i])) { |
precision *= 10; |
precision += fmt[i++] - '0'; |
} |
} else if (fmt[i] == '*') { |
/* get precision value from argument list*/ |
i++; |
precision = (int)va_arg(ap, int); |
if (precision < 0) { |
/* negative precision means to ignore it */ |
precision = 0; |
} |
} |
} |
while ((c = fmt[i++])) { |
switch (c) { |
switch (fmt[i++]) { |
/** TODO: unimplemented qualifiers: |
* t ptrdiff_t - ISO C 99 |
*/ |
case 'h': /* char or short */ |
qualifier = PrintfQualifierShort; |
if (fmt[i] == 'h') { |
i++; |
qualifier = PrintfQualifierByte; |
} |
break; |
case 'l': /* long or long long*/ |
qualifier = PrintfQualifierLong; |
if (fmt[i] == 'l') { |
i++; |
qualifier = PrintfQualifierLongLong; |
} |
break; |
case 'z': /* __native */ |
qualifier = PrintfQualifierNative; |
break; |
default: |
qualifier = PrintfQualifierInt; /* default type */ |
--i; |
} |
base = 10; |
/* control character */ |
case '%': |
switch (c = fmt[i++]) { |
switch (c = fmt[i]) { |
/* percentile itself */ |
case '%': |
break; |
/* |
* String and character conversions. |
*/ |
case 's': |
if ((retval = print_string(va_arg(ap, char*), width, precision, flags)) == EOF) { |
counter = -counter; |
goto out; |
}; |
counter += retval; |
j = i + 1; |
goto next_char; |
case 'c': |
c = va_arg(ap, unsigned int); |
if ((retval = print_char(c, width, flags )) == EOF) { |
counter = -counter; |
goto out; |
}; |
counter += retval; |
j = i + 1; |
goto next_char; |
/* |
* String and character conversions. |
*/ |
case 's': |
print_str(va_arg(ap, char_ptr)); |
goto loop; |
/* |
* Integer values |
*/ |
case 'P': /* pointer */ |
flags |= __PRINTF_FLAG_BIGCHARS; |
case 'p': |
flags |= __PRINTF_FLAG_PREFIX; |
base = 16; |
qualifier = PrintfQualifierPointer; |
break; |
case 'b': |
base = 2; |
break; |
case 'o': |
base = 8; |
break; |
case 'd': |
case 'i': |
flags |= __PRINTF_FLAG_SIGNED; |
case 'u': |
break; |
case 'X': |
flags |= __PRINTF_FLAG_BIGCHARS; |
case 'x': |
base = 16; |
break; |
/* percentile itself */ |
case '%': |
j = i; |
goto next_char; |
/* |
* Bad formatting. |
*/ |
default: |
/* Unknown format |
* now, the j is index of '%' so we will |
* print whole bad format sequence |
*/ |
goto next_char; |
} |
/* Print integers */ |
/* print number */ |
switch (qualifier) { |
case PrintfQualifierByte: |
size = sizeof(unsigned char); |
number = (__u64)va_arg(ap, unsigned int); |
break; |
case PrintfQualifierShort: |
size = sizeof(unsigned short); |
number = (__u64)va_arg(ap, unsigned int); |
break; |
case PrintfQualifierInt: |
size = sizeof(unsigned int); |
number = (__u64)va_arg(ap, unsigned int); |
break; |
case PrintfQualifierLong: |
size = sizeof(unsigned long); |
number = (__u64)va_arg(ap, unsigned long); |
break; |
case PrintfQualifierLongLong: |
size = sizeof(unsigned long long); |
number = (__u64)va_arg(ap, unsigned long long); |
break; |
case PrintfQualifierPointer: |
size = sizeof(void *); |
number = (__u64)(unsigned long)va_arg(ap, void *); |
break; |
case PrintfQualifierNative: |
size = sizeof(__native); |
number = (__u64)va_arg(ap, __native); |
break; |
default: /* Unknown qualifier */ |
counter = -counter; |
goto out; |
} |
if (flags & __PRINTF_FLAG_SIGNED) { |
if (number & (0x1 << (size*8 - 1))) { |
flags |= __PRINTF_FLAG_NEGATIVE; |
if (size == sizeof(__u64)) { |
number = -((__s64)number); |
} else { |
number = ~number; |
number &= (~((0xFFFFFFFFFFFFFFFFll) << (size * 8))); |
number++; |
} |
} |
} |
case 'c': |
c = (char) va_arg(ap, int); |
break; |
if ((retval = print_number(number, width, precision, base, flags)) == EOF ) { |
counter = -counter; |
/* |
* Hexadecimal conversions with fixed width. |
*/ |
case 'P': |
print_str("0x"); |
case 'p': |
print_fixed_hex(va_arg(ap, __native), sizeof(__native)); |
goto loop; |
case 'Q': |
print_str("0x"); |
case 'q': |
print_fixed_hex(va_arg(ap, __u64), INT64); |
goto loop; |
case 'L': |
print_str("0x"); |
case 'l': |
print_fixed_hex(va_arg(ap, __native), INT32); |
goto loop; |
case 'W': |
print_str("0x"); |
case 'w': |
print_fixed_hex(va_arg(ap, __native), INT16); |
goto loop; |
case 'B': |
print_str("0x"); |
case 'b': |
print_fixed_hex(va_arg(ap, __native), INT8); |
goto loop; |
/* |
* Decimal and hexadecimal conversions. |
*/ |
case 'd': |
print_number(va_arg(ap, __native), 10); |
goto loop; |
case 'X': |
print_str("0x"); |
case 'x': |
print_number(va_arg(ap, __native), 16); |
goto loop; |
/* |
* Bad formatting. |
*/ |
default: |
goto out; |
}; |
} |
counter += retval; |
j = i + 1; |
} |
next_char: |
++i; |
} |
default: putchar(c); |
} |
if (i > j) { |
if ((retval = putnchars(&fmt[j], (__native)(i - j))) == EOF) { /* error */ |
counter = -counter; |
goto out; |
} |
counter += retval; |
loop: |
; |
} |
out: |
spinlock_unlock(&printflock); |
interrupts_restore(irqpri); |
va_end(ap); |
return counter; |
} |
/kernel/trunk/generic/src/debug/symtab.c |
---|
132,7 → 132,7 |
while (symtab_search_one(name, &i)) { |
addr = __u64_le2host(symbol_table[i].address_le); |
realname = symbol_table[i].symbol_name; |
printf("%p: %s\n", addr, realname); |
printf("0x%p: %s\n", addr, realname); |
i++; |
} |
} |
/kernel/trunk/generic/src/interrupt/interrupt.c |
---|
96,7 → 96,7 |
symbol = get_symtab_entry((__native)exc_table[i].f); |
if (!symbol) |
symbol = "not found"; |
printf("%d %s %p(%s)\n", i + IVT_FIRST, exc_table[i].name, |
printf("%d %s 0x%p(%s)\n", i + IVT_FIRST, exc_table[i].name, |
exc_table[i].f,symbol); |
if (!((i+1) % 20)) { |
printf("Press any key to continue."); |
/kernel/trunk/arch/sparc64/src/mm/tlb.c |
---|
201,7 → 201,7 |
d.value = itlb_data_access_read(i); |
t.value = itlb_tag_read_read(i); |
printf("%d: vpn=%#llX, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#X, diag=%#X, pfn=%#X, soft=%#X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", |
printf("%d: vpn=%Q, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%X, diag=%X, pfn=%X, soft=%X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", |
i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); |
} |
210,7 → 210,7 |
d.value = dtlb_data_access_read(i); |
t.value = dtlb_tag_read_read(i); |
printf("%d: vpn=%#llX, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%#X, diag=%#X, pfn=%#X, soft=%#X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", |
printf("%d: vpn=%Q, context=%d, v=%d, size=%d, nfo=%d, ie=%d, soft2=%X, diag=%X, pfn=%X, soft=%X, l=%d, cp=%d, cv=%d, e=%d, p=%d, w=%d, g=%d\n", |
i, t.vpn, t.context, d.v, d.size, d.nfo, d.ie, d.soft2, d.diag, d.pfn, d.soft, d.l, d.cp, d.cv, d.e, d.p, d.w, d.g); |
} |
/kernel/trunk/arch/ia64/src/interrupt.c |
---|
132,13 → 132,13 |
putchar('\n'); |
printf("Interrupted context dump:\n"); |
printf("ar.bsp=%P\tar.bspstore=%P\n", istate->ar_bsp, istate->ar_bspstore); |
printf("ar.rnat=%#llX\tar.rsc=%$llX\n", istate->ar_rnat, istate->ar_rsc); |
printf("ar.ifs=%#llX\tar.pfs=%#llX\n", istate->ar_ifs, istate->ar_pfs); |
printf("cr.isr=%#llX\tcr.ipsr=%#llX\t\n", istate->cr_isr.value, istate->cr_ipsr); |
printf("ar.rnat=%Q\tar.rsc=%Q\n", istate->ar_rnat, istate->ar_rsc); |
printf("ar.ifs=%Q\tar.pfs=%Q\n", istate->ar_ifs, istate->ar_pfs); |
printf("cr.isr=%Q\tcr.ipsr=%Q\t\n", istate->cr_isr.value, istate->cr_ipsr); |
printf("cr.iip=%#llX, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?"); |
printf("cr.iipa=%#llX\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?"); |
printf("cr.ifa=%#llX\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?"); |
printf("cr.iip=%Q, #%d\t(%s)\n", istate->cr_iip, istate->cr_isr.ei ,iip ? iip : "?"); |
printf("cr.iipa=%Q\t(%s)\n", istate->cr_iipa, iipa ? iipa : "?"); |
printf("cr.ifa=%Q\t(%s)\n", istate->cr_ifa, ifa ? ifa : "?"); |
} |
void general_exception(__u64 vector, istate_t *istate) |
182,7 → 182,7 |
scheduler_fpu_lazy_request(); |
#else |
dump_interrupted_context(istate); |
panic("Interruption: %#hX (%s)\n", (__u16) vector, vector_to_string(vector)); |
panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector)); |
#endif |
} |
217,7 → 217,7 |
void universal_handler(__u64 vector, istate_t *istate) |
{ |
dump_interrupted_context(istate); |
panic("Interruption: %#hX (%s)\n", (__u16) vector, vector_to_string(vector)); |
panic("Interruption: %W (%s)\n", (__u16) vector, vector_to_string(vector)); |
} |
void external_interrupt(__u64 vector, istate_t *istate) |
/kernel/trunk/arch/ppc32/Makefile.inc |
---|
55,11 → 55,6 |
CONFIG_PAGE_PT = y |
DEFS += -DCONFIG_PAGE_PT |
## Compile with support for software integer division. |
# |
CONFIG_SOFTINT = y |
ARCH_SOURCES = \ |
arch/$(ARCH)/src/console.c \ |
arch/$(ARCH)/src/context.S \ |
/kernel/trunk/arch/ppc32/src/mm/memory_init.c |
---|
43,5 → 43,5 |
count_t i; |
for (i = 0; i < bootinfo.memmap.count; i++) |
printf("base: %#X size: %#X\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); |
printf("base: %L size: %L\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); |
} |
/kernel/trunk/arch/amd64/src/interrupt.c |
---|
51,17 → 51,17 |
symbol = ""; |
printf("-----EXCEPTION(%d) OCCURED----- ( %s )\n",n, __FUNCTION__); |
printf("%%rip: %#llX (%s)\n",istate->rip, symbol); |
printf("ERROR_WORD=%#llX\n", istate->error_word); |
printf("%%rcs=%#llX, flags=%#llX, %%cr0=%#llX\n", istate->cs, istate->rflags,read_cr0()); |
printf("%%rax=%#llX, %%rcx=%#llX, %%rdx=%#llX\n",istate->rax,istate->rcx,istate->rdx); |
printf("%%rsi=%#llX, %%rdi=%#llX, %%r8 =%#llX\n",istate->rsi,istate->rdi,istate->r8); |
printf("%%r9 =%#llX, %%r10 =%#llX, %%r11=%#llX\n",istate->r9,istate->r10,istate->r11); |
printf("%%rip: %Q (%s)\n",istate->rip, symbol); |
printf("ERROR_WORD=%Q\n", istate->error_word); |
printf("%%rcs=%Q, flags=%Q, %%cr0=%Q\n", istate->cs, istate->rflags,read_cr0()); |
printf("%%rax=%Q, %%rcx=%Q, %%rdx=%Q\n",istate->rax,istate->rcx,istate->rdx); |
printf("%%rsi=%Q, %%rdi=%Q, %%r8 =%Q\n",istate->rsi,istate->rdi,istate->r8); |
printf("%%r9 =%Q, %%r10 =%Q, %%r11=%Q\n",istate->r9,istate->r10,istate->r11); |
#ifdef CONFIG_DEBUG_ALLREGS |
printf("%%r12=%#llX, %%r13=%#llX, %%r14=%#llX\n",istate->r12,istate->r13,istate->r14); |
printf("%%r15=%#llX, %%rbx=%#llX, %%rbp=%#llX\n",istate->r15,istate->rbx,&istate->rbp); |
printf("%%r12=%Q, %%r13=%Q, %%r14=%Q\n",istate->r12,istate->r13,istate->r14); |
printf("%%r15=%Q, %%rbx=%Q, %%rbp=%Q\n",istate->r15,istate->rbx,&istate->rbp); |
#endif |
printf("%%rsp=%#llX\n",&istate->stack[0]); |
printf("%%rsp=%Q\n",&istate->stack[0]); |
} |
/* |
/kernel/trunk/arch/amd64/src/debugger.c |
---|
105,7 → 105,7 |
for (i=0; i < BKPOINTS_MAX; i++) |
if (breakpoints[i].address) { |
symbol = get_symtab_entry(breakpoints[i].address); |
printf("%d. %p in %s\n",i, |
printf("%d. 0x%p in %s\n",i, |
breakpoints[i].address, symbol); |
printf(" Count(%d) ", breakpoints[i].counter); |
printf("\n"); |
/kernel/trunk/arch/amd64/src/mm/memory_init.c |
---|
45,7 → 45,7 |
__u8 i; |
for (i=0;i<e820counter;i++) { |
printf("E820 base: %#llX size: %#llX type: ", e820table[i].base_address, e820table[i].size); |
printf("E820 base: %Q size: %Q type: ", e820table[i].base_address, e820table[i].size); |
switch (e820table[i].type) { |
case MEMMAP_MEMORY_AVAILABLE: |
printf("available memory\n"); |
/kernel/trunk/arch/ppc64/src/mm/memory_init.c |
---|
43,5 → 43,5 |
count_t i; |
for (i = 0; i < bootinfo.memmap.count; i++) |
printf("base: %P size: %#X\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); |
printf("base: %L size: %L\n", bootinfo.memmap.zones[i].start, bootinfo.memmap.zones[i].size); |
} |
/kernel/trunk/arch/mips32/Makefile.inc |
---|
106,12 → 106,7 |
CFLAGS += -mhard-float -mips3 |
endif |
## Compile with support for software integer division. |
# |
CONFIG_SOFTINT = y |
ARCH_SOURCES = \ |
arch/$(ARCH)/src/start.S \ |
arch/$(ARCH)/src/context.S \ |
/kernel/trunk/arch/mips32/src/exception.c |
---|
73,7 → 73,7 |
if (s) |
rasymbol = s; |
printf("PC: %#X(%s) RA: %#X(%s), SP(%P)\n",istate->epc,pcsymbol, |
printf("PC: %X(%s) RA: %X(%s), SP(%P)\n",istate->epc,pcsymbol, |
istate->ra,rasymbol, istate->sp); |
} |
/kernel/trunk/arch/mips32/src/mm/tlb.c |
---|
409,8 → 409,8 |
lo0.value = cp0_entry_lo0_read(); |
lo1.value = cp0_entry_lo1_read(); |
printf("%d: asid=%d, vpn2=%d, mask=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=%hhd, pfn[0]=%d\n" |
"\t\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=%hhd, pfn[1]=%d\n", |
printf("%d: asid=%d, vpn2=%d, mask=%d\tg[0]=%d, v[0]=%d, d[0]=%d, c[0]=%B, pfn[0]=%d\n" |
"\t\t\t\tg[1]=%d, v[1]=%d, d[1]=%d, c[1]=%B, pfn[1]=%d\n", |
i, hi.asid, hi.vpn2, mask.mask, lo0.g, lo0.v, lo0.d, lo0.c, lo0.pfn, |
lo1.g, lo1.v, lo1.d, lo1.c, lo1.pfn); |
} |
/kernel/trunk/arch/mips32/src/debugger.c |
---|
242,7 → 242,7 |
for (i=0; i < BKPOINTS_MAX; i++) |
if (breakpoints[i].address) { |
symbol = get_symtab_entry(breakpoints[i].address); |
printf("%d. %p in %s\n",i, |
printf("%d. 0x%p in %s\n",i, |
breakpoints[i].address, symbol); |
printf(" Count(%d) ", breakpoints[i].counter); |
if (breakpoints[i].flags & BKPOINT_INPROG) |
328,7 → 328,7 |
printf("Warning: breakpoint recursion\n"); |
if (!(cur->flags & BKPOINT_FUNCCALL)) |
printf("***Breakpoint %d: %p in %s.\n", i, |
printf("***Breakpoint %d: 0x%p in %s.\n", i, |
fireaddr, get_symtab_entry(istate->epc)); |
/* Return first instruction back */ |
341,7 → 341,7 |
} |
cur->flags |= BKPOINT_INPROG; |
} else { |
printf("***Breakpoint %p in %s.\n", fireaddr, |
printf("***Breakpoint 0x%p in %s.\n", fireaddr, |
get_symtab_entry(fireaddr)); |
/* Move on to next instruction */ |
istate->epc += 4; |
/kernel/trunk/arch/ia32/Makefile.inc |
---|
102,11 → 102,6 |
DEFS += -DCONFIG_SIMICS_FIX |
endif |
## Compile with support for software integer division. |
# |
CONFIG_SOFTINT = y |
ARCH_SOURCES = \ |
arch/$(ARCH)/src/context.s \ |
arch/$(ARCH)/src/debug/panic.s \ |
/kernel/trunk/arch/ia32/src/interrupt.c |
---|
61,15 → 61,15 |
else |
printf("----------------EXCEPTION OCCURED----------------\n"); |
printf("%%eip: %#X (%s)\n",istate->eip,symbol); |
printf("ERROR_WORD=%#X\n", istate->error_word); |
printf("%%cs=%#X,flags=%#X\n", istate->cs, istate->eflags); |
printf("%%eax=%#X, %%ecx=%#X, %%edx=%#X, %%esp=%#X\n", istate->eax,istate->ecx,istate->edx,&istate->stack[0]); |
printf("%%eip: %X (%s)\n",istate->eip,symbol); |
printf("ERROR_WORD=%X\n", istate->error_word); |
printf("%%cs=%X,flags=%X\n", istate->cs, istate->eflags); |
printf("%%eax=%X, %%ecx=%X, %%edx=%X, %%esp=%X\n", istate->eax,istate->ecx,istate->edx,&istate->stack[0]); |
#ifdef CONFIG_DEBUG_ALLREGS |
printf("%%esi=%#X, %%edi=%#X, %%ebp=%#X, %%ebx=%#X\n", istate->esi,istate->edi,istate->ebp,istate->ebx); |
printf("%%esi=%X, %%edi=%X, %%ebp=%X, %%ebx=%X\n", istate->esi,istate->edi,istate->ebp,istate->ebx); |
#endif |
printf("stack: %#X, %#X, %#X, %#X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); |
printf(" %#X, %#X, %#X, %#X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); |
printf("stack: %X, %X, %X, %X\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); |
printf(" %X, %X, %X, %X\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); |
} |
void null_interrupt(int n, istate_t *istate) |
100,7 → 100,7 |
"stmxcsr %0;\n" |
:"=m"(mxcsr) |
); |
printf("MXCSR: %#zX\n",(__native)(mxcsr)); |
printf("MXCSR: %X\n",(__native)(mxcsr)); |
panic("SIMD FP exception(19)\n"); |
} |
120,7 → 120,7 |
page = read_cr2(); |
if (!as_page_fault(page)) { |
PRINT_INFO_ERRCODE(istate); |
printf("page fault address: %#X\n", page); |
printf("page fault address: %X\n", page); |
panic("page fault\n"); |
} |
} |
/kernel/trunk/arch/ia32/src/smp/apic.c |
---|
412,13 → 412,13 |
printf("LVT on cpu%d, LAPIC ID: %d\n", CPU->id, l_apic_id()); |
tm.value = l_apic[LVT_Tm]; |
printf("LVT Tm: vector=%hhd, %s, %s, %s\n", tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], tm_mode_str[tm.mode]); |
printf("LVT Tm: vector=%B, %s, %s, %s\n", tm.vector, delivs_str[tm.delivs], mask_str[tm.masked], tm_mode_str[tm.mode]); |
lint.value = l_apic[LVT_LINT0]; |
printf("LVT LINT0: vector=%hhd, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); |
printf("LVT LINT0: vector=%B, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); |
lint.value = l_apic[LVT_LINT1]; |
printf("LVT LINT1: vector=%hhd, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); |
printf("LVT LINT1: vector=%B, %s, %s, %s, irr=%d, %s, %s\n", tm.vector, delmod_str[lint.delmod], delivs_str[lint.delivs], intpol_str[lint.intpol], lint.irr, trigmod_str[lint.trigger_mode], mask_str[lint.masked]); |
error.value = l_apic[LVT_Err]; |
printf("LVT Err: vector=%hhd, %s, %s\n", error.vector, delivs_str[error.delivs], mask_str[error.masked]); |
printf("LVT Err: vector=%B, %s, %s\n", error.vector, delivs_str[error.delivs], mask_str[error.masked]); |
#endif |
} |
/kernel/trunk/arch/ia32/src/mm/frame.c |
---|
91,7 → 91,7 |
name = e820names[e820table[i].type]; |
else |
name = "invalid"; |
printf("%P %#llXB %s\n", |
printf("%P %QB %s\n", |
(__native) e820table[i].base_address, |
(__u64) e820table[i].size, |
name); |
/kernel/trunk/arch/ia32/src/mm/memory_init.c |
---|
45,7 → 45,7 |
__u8 i; |
for (i=0;i<e820counter;i++) { |
printf("E820 base: %#llX size: %lld type: ", e820table[i].base_address, e820table[i].size); |
printf("E820 base: %Q size: %Q type: ", e820table[i].base_address, e820table[i].size); |
switch (e820table[i].type) { |
case MEMMAP_MEMORY_AVAILABLE: |
printf("available memory\n"); |
/kernel/trunk/test/synch/rwlock4/test.c |
---|
132,7 → 132,7 |
thread_t *thrd; |
context_save(&ctx); |
printf("sp=%#X, readers_in=%d\n", ctx.sp, rwlock.readers_in); |
printf("sp=%X, readers_in=%d\n", ctx.sp, rwlock.readers_in); |
k = random(7) + 1; |
printf("Creating %d readers\n", k); |
/kernel/trunk/test/synch/rwlock5/test.c |
---|
91,7 → 91,7 |
readers = i*READERS; |
writers = (4-i)*WRITERS; |
printf("Creating %ld readers and %ld writers...", readers, writers); |
printf("Creating %d readers and %d writers...", readers, writers); |
for (j=0; j<(READERS+WRITERS)/2; j++) { |
for (k=0; k<i; k++) { |
116,7 → 116,7 |
waitq_wakeup(&can_start, WAKEUP_ALL); |
while (items_read.count != readers || items_written.count != writers) { |
printf("%zd readers remaining, %zd writers remaining, readers_in=%zd\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in); |
printf("%d readers remaining, %d writers remaining, readers_in=%d\n", readers - items_read.count, writers - items_written.count, rwlock.readers_in); |
thread_usleep(100000); |
} |
} |
/kernel/trunk/test/mm/falloc2/test.c |
---|
77,7 → 77,7 |
for (i = 0; i < allocated; i++) { |
for (k = 0; k <= ((FRAME_SIZE << order) - 1); k++) { |
if (((__u8 *) frames[i])[k] != val) { |
printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset %#zX\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); |
printf("Thread #%d (cpu%d): Unexpected data (%d) in block %P offset %X\n", THREAD->tid, CPU->id, ((char *) frames[i])[k], frames[i], k); |
failed(); |
} |
} |
/kernel/trunk/test/mm/falloc1/test.c |
---|
59,7 → 59,7 |
frames[allocated] = PA2KA(PFN2ADDR(frame_alloc_rc(order, FRAME_ATOMIC | FRAME_KA, &status))); |
if (ALIGN_UP(frames[allocated], FRAME_SIZE << order) != frames[allocated]) { |
panic("Test failed. Block at address %P (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
panic("Test failed. Block at address %X (size %dK) is not aligned\n", frames[allocated], (FRAME_SIZE << order) >> 10); |
} |
if (status == 0) { |
/kernel/trunk/test/mm/mapping1/test.c |
---|
50,9 → 50,9 |
frame0 = PA2KA(PFN2ADDR(frame_alloc(ONE_FRAME, FRAME_KA))); |
frame1 = PA2KA(PFN2ADDR(frame_alloc(ONE_FRAME, FRAME_KA))); |
printf("Writing %#X to physical address %P.\n", VALUE0, KA2PA(frame0)); |
printf("Writing %L to physical address %P.\n", VALUE0, KA2PA(frame0)); |
*((__u32 *) frame0) = VALUE0; |
printf("Writing %#X to physical address %P.\n", VALUE1, KA2PA(frame1)); |
printf("Writing %L to physical address %P.\n", VALUE1, KA2PA(frame1)); |
*((__u32 *) frame1) = VALUE1; |
printf("Mapping virtual address %P to physical address %P.\n", PAGE0, KA2PA(frame0)); |
60,22 → 60,22 |
printf("Mapping virtual address %P to physical address %P.\n", PAGE1, KA2PA(frame1)); |
page_mapping_insert(AS_KERNEL, PAGE1, KA2PA(frame1), PAGE_PRESENT | PAGE_WRITE); |
printf("Value at virtual address %P is %#X.\n", PAGE0, v0 = *((__u32 *) PAGE0)); |
printf("Value at virtual address %P is %#X.\n", PAGE1, v1 = *((__u32 *) PAGE1)); |
printf("Value at virtual address %P is %L.\n", PAGE0, v0 = *((__u32 *) PAGE0)); |
printf("Value at virtual address %P is %L.\n", PAGE1, v1 = *((__u32 *) PAGE1)); |
ASSERT(v0 == VALUE0); |
ASSERT(v1 == VALUE1); |
printf("Writing %#X to virtual address %P.\n", 0, PAGE0); |
printf("Writing %X to virtual address %P.\n", 0, PAGE0); |
*((__u32 *) PAGE0) = 0; |
printf("Writing %#X to virtual address %P.\n", 0, PAGE1); |
printf("Writing %X to virtual address %P.\n", 0, PAGE1); |
*((__u32 *) PAGE1) = 0; |
v0 = *((__u32 *) PAGE0); |
v1 = *((__u32 *) PAGE1); |
printf("Value at virtual address %P is %#X.\n", PAGE0, *((__u32 *) PAGE0)); |
printf("Value at virtual address %P is %#X.\n", PAGE1, *((__u32 *) PAGE1)); |
printf("Value at virtual address %P is %X.\n", PAGE0, *((__u32 *) PAGE0)); |
printf("Value at virtual address %P is %X.\n", PAGE1, *((__u32 *) PAGE1)); |
ASSERT(v0 == 0); |
ASSERT(v1 == 0); |
/kernel/trunk/test/fpu/fpu1/test.c |
---|
93,10 → 93,10 |
} |
if((int)(100000000*e)!=E_10e8) |
panic("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); |
panic("tid%d: e*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); |
} |
printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); |
printf("tid%d: e*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*e),(__native) E_10e8); |
atomic_inc(&threads_ok); |
} |
131,15 → 131,15 |
#ifdef __ia64_ARCH_H__ |
if((int)(1000000*pi)!=PI_10e8) |
panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (1000000*pi),(__native) (PI_10e8/100)); |
panic("tid%d: pi*10e8=%d should be %d\n", THREAD->tid, (__native) (1000000*pi),(__native) (PI_10e8/100)); |
#else |
if((int)(100000000*pi)!=PI_10e8) |
panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); |
panic("tid%d: pi*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); |
#endif |
} |
printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); |
printf("tid%d: pi*10e8=%d should be %d\n", THREAD->tid, (__native) (100000000*pi),(__native) PI_10e8); |
atomic_inc(&threads_ok); |
} |
/kernel/trunk/test/print/print1/test.c |
---|
30,21 → 30,13 |
void test(void) |
{ |
__native nat = 0x12345678u; |
printf(" Printf test \n"); |
printf(" text 10.8s %*.*s \n", 5, 3, "text"); |
printf(" very long text 10.8s %10.8s \n", "very long text"); |
printf(" text 8.10s %8.10s \n", "text"); |
printf(" very long text 8.10s %8.10s \n", "very long text"); |
printf(" char: c '%c', 3.2c '%3.2c', -3.2c '%-3.2c', 2.3c '%2.3c', -2.3c '%-2.3c' \n",'a', 'b', 'c', 'd', 'e' ); |
printf(" int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",1, 1, 1, 1, 1 ); |
printf(" -int: d '%d', 3.2d '%3.2d', -3.2d '%-3.2d', 2.3d '%2.3d', -2.3d '%-2.3d' \n",-1, -1, -1, -1, -1 ); |
printf(" 0xint: x '%#x', 5.3x '%#5.3x', -5.3x '%#-5.3x', 3.5x '%#3.5x', -3.5x '%#-3.5x' \n",17, 17, 17, 17, 17 ); |
printf("'%#llx' 64bit, '%#x' 32bit, '%#hhx' 8bit, '%#hx' 16bit, __native '%#zX'. '%#llX' 64bit and '%s' string.\n", 0x1234567887654321ll, 0x12345678, 0x12, 0x1234, nat, 0x1234567887654321ull, "Lovely string" ); |
printf(" Q %Q %q \n",0x1111111111111111ull, 0x2222222222222222ull); |
printf(" Q,l %Q %l \n", 0x3333333333333333ull, 0x01234567); |
printf(" l,Q %l %Q \n", 0x01234567, 0x4444444444444444ull); |
printf(" L %L %l \n",0x01234567 ,0x01234567); |
printf(" W %W %w \n",0x0123 ,0x0123); |
printf(" B %B %b \n",0x01 ,0x01); |
printf(" Print to NULL '%s'\n",NULL); |
return; |
} |