Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3064 → Rev 3065

/trunk/kernel/generic/src/console/klog.c
File deleted
/trunk/kernel/generic/src/console/console.c
43,22 → 43,23
#include <print.h>
#include <atomic.h>
 
#define BUFLEN 2048
static char debug_buffer[BUFLEN];
static size_t offset = 0;
/** Initialize stdout to something that does not print, but does not fail
*
* Save data in some buffer so that it could be retrieved in the debugger
*/
static void null_putchar(chardev_t *d, const char ch)
{
if (offset >= BUFLEN)
offset = 0;
debug_buffer[offset++] = ch;
}
#define KLOG_SIZE 4096
 
/**< Kernel log cyclic buffer */
static char klog[KLOG_SIZE];
 
/**< First kernel log characters */
static index_t klog_start = 0;
/**< Number of valid kernel log characters */
static size_t klog_len = 0;
/**< Number of stored (not printed) kernel log characters */
static size_t klog_stored = 0;
 
static chardev_operations_t null_stdout_ops = {
.write = null_putchar
.suspend = NULL,
.resume = NULL,
.write = NULL,
.read = NULL
};
 
chardev_t null_stdout = {
90,7 → 91,7
return chardev->op->read(chardev);
/* no other way of interacting with user, halt */
if (CPU)
printf("cpu%d: ", CPU->id);
printf("cpu%u: ", CPU->id);
else
printf("cpu: ");
printf("halted - no kconsole\n");
161,8 → 162,28
 
void putchar(char c)
{
if ((klog_stored > 0) && (stdout->op->write)) {
/* Print charaters stored in kernel log */
index_t i;
for (i = klog_len - klog_stored; i < klog_len; i++)
stdout->op->write(stdout, klog[(klog_start + i) % KLOG_SIZE]);
klog_stored = 0;
}
/* Store character in the cyclic kernel log */
klog[(klog_start + klog_len) % KLOG_SIZE] = c;
if (klog_len < KLOG_SIZE)
klog_len++;
else
klog_start = (klog_start + 1) % KLOG_SIZE;
if (stdout->op->write)
stdout->op->write(stdout, c);
else {
/* The character is just in the kernel log */
if (klog_stored < klog_len)
klog_stored++;
}
}
 
/** @}
/trunk/kernel/generic/src/console/cmd.c
563,7 → 563,7
/* This doesn't have to be very accurate */
unative_t sec = uptime->seconds1;
printf("Up %u days, %u hours, %u minutes, %u seconds\n",
printf("Up %" PRIun " days, %" PRIun " hours, %" PRIun " minutes, %" PRIun " seconds\n",
sec / 86400, (sec % 86400) / 3600, (sec % 3600) / 60, sec % 60);
return 1;
632,7 → 632,7
printf("Duplicate symbol, be more specific.\n");
} else {
symbol = get_symtab_entry(symaddr);
printf("Calling %s() (%.*p)\n", symbol, sizeof(uintptr_t) * 2, symaddr);
printf("Calling %s() (%p)\n", symbol, symaddr);
#ifdef ia64
fptr.f = symaddr;
fptr.gp = ((unative_t *)cmd_call2)[1];
640,7 → 640,7
#else
f = (unative_t (*)(void)) symaddr;
#endif
printf("Result: %#zx\n", f());
printf("Result: %#" PRIxn "\n", f());
}
return 1;
686,7 → 686,7
struct {
unative_t f;
unative_t gp;
}fptr;
} fptr;
#endif
 
symaddr = get_symbol_addr((char *) argv->buffer);
698,7 → 698,7
} else {
symbol = get_symtab_entry(symaddr);
 
printf("Calling f(%#zx): %.*p: %s\n", arg1, sizeof(uintptr_t) * 2, symaddr, symbol);
printf("Calling f(%#" PRIxn "): %p: %s\n", arg1, symaddr, symbol);
#ifdef ia64
fptr.f = symaddr;
fptr.gp = ((unative_t *)cmd_call2)[1];
706,7 → 706,7
#else
f = (unative_t (*)(unative_t,...)) symaddr;
#endif
printf("Result: %#zx\n", f(arg1));
printf("Result: %#" PRIxn "\n", f(arg1));
}
return 1;
735,8 → 735,8
printf("Duplicate symbol, be more specific.\n");
} else {
symbol = get_symtab_entry(symaddr);
printf("Calling f(0x%zx,0x%zx): %.*p: %s\n",
arg1, arg2, sizeof(uintptr_t) * 2, symaddr, symbol);
printf("Calling f(%#" PRIxn ", %#" PRIxn "): %p: %s\n",
arg1, arg2, symaddr, symbol);
#ifdef ia64
fptr.f = symaddr;
fptr.gp = ((unative_t *)cmd_call2)[1];
744,7 → 744,7
#else
f = (unative_t (*)(unative_t,unative_t,...)) symaddr;
#endif
printf("Result: %#zx\n", f(arg1, arg2));
printf("Result: %#" PRIxn "\n", f(arg1, arg2));
}
return 1;
774,8 → 774,8
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",
arg1, arg2, arg3, sizeof(uintptr_t) * 2, symaddr, symbol);
printf("Calling f(%#" PRIxn ",%#" PRIxn ", %#" PRIxn "): %p: %s\n",
arg1, arg2, arg3, symaddr, symbol);
#ifdef ia64
fptr.f = symaddr;
fptr.gp = ((unative_t *)cmd_call2)[1];
783,7 → 783,7
#else
f = (unative_t (*)(unative_t,unative_t,unative_t,...)) symaddr;
#endif
printf("Result: %#zx\n", f(arg1, arg2, arg3));
printf("Result: %#" PRIxn "\n", f(arg1, arg2, arg3));
}
return 1;
856,7 → 856,7
} else {
if (pointer)
addr = (uint32_t *)(*(unative_t *)addr);
printf("Writing 0x%x -> %.*p\n", arg1, sizeof(uintptr_t) * 2, addr);
printf("Writing %#" PRIx64 " -> %p\n", arg1, addr);
*addr = arg1;
}
1025,7 → 1025,7
char suffix;
order(dt, &cycles, &suffix);
printf("Time: %llu%c cycles\n", cycles, suffix);
printf("Time: %" PRIu64 "%c cycles\n", cycles, suffix);
if (ret == NULL) {
printf("Test passed\n");
1053,7 → 1053,7
}
for (i = 0; i < cnt; i++) {
printf("%s (%d/%d) ... ", test->name, i + 1, cnt);
printf("%s (%u/%u) ... ", test->name, i + 1, cnt);
/* Update and read thread accounting
for benchmarking */
1081,7 → 1081,7
data[i] = dt;
order(dt, &cycles, &suffix);
printf("OK (%llu%c cycles)\n", cycles, suffix);
printf("OK (%" PRIu64 "%c cycles)\n", cycles, suffix);
}
if (ret) {
1094,7 → 1094,7
}
order(sum / (uint64_t) cnt, &cycles, &suffix);
printf("Average\t\t%llu%c\n", cycles, suffix);
printf("Average\t\t%" PRIu64 "%c\n", cycles, suffix);
}
free(data);
/trunk/kernel/generic/src/console/chardev.c
42,7 → 42,7
* @param chardev Character device.
* @param op Implementation of character device operations.
*/
void chardev_initialize(char *name,chardev_t *chardev,
void chardev_initialize(char *name, chardev_t *chardev,
chardev_operations_t *op)
{
chardev->name = name;