/kernel/trunk/generic/src/console/console.c |
---|
34,6 → 34,8 |
#include <arch/types.h> |
#include <typedefs.h> |
#include <arch.h> |
#include <func.h> |
#include <print.h> |
/** Standard input character device. */ |
chardev_t *stdin = NULL; |
50,6 → 52,18 |
__u8 ch; |
ipl_t ipl; |
if (haltstate) { |
/* If we are here, we are hopefully on the processor, that |
* issued the 'halt' command, so proceed to read the character |
* directly from input |
*/ |
if (chardev->op->read) |
return chardev->op->read(chardev); |
/* no other way of interacting with user, halt */ |
printf("cpu: halted - no kconsole\n"); |
cpu_halt(); |
} |
waitq_sleep(&chardev->wq); |
ipl = interrupts_disable(); |
spinlock_lock(&chardev->lock); |
114,5 → 128,6 |
void putchar(char c) |
{ |
if (stdout->op->write) |
stdout->op->write(stdout, c); |
} |
/kernel/trunk/generic/src/console/kconsole.c |
---|
247,7 → 247,7 |
if (c == '\n') { |
putchar(c); |
break; |
} if (c == '\b') { |
} if (c == '\b') { /* Backspace */ |
if (position == 0) |
continue; |
for (i=position; i<curlen;i++) |
261,7 → 261,7 |
rdln_print_c('\b',curlen-position+1); |
continue; |
} |
if (c == '\t') { |
if (c == '\t') { /* Tabulator */ |
int found; |
/* Move to the end of the word */ |
309,7 → 309,7 |
rdln_print_c('\b', curlen-position); |
continue; |
} |
if (c == 0x1b) { |
if (c == 0x1b) { /* Special command */ |
mod = _getc(input); |
c = _getc(input); |
317,6 → 317,7 |
continue; |
if (c == 0x33 && _getc(input) == 0x7e) { |
/* Delete */ |
if (position == curlen) |
continue; |
for (i=position+1; i<curlen;i++) { |
331,7 → 332,7 |
rdln_print_c('\b',position); |
position = 0; |
} |
else if (c == 0x46) { |
else if (c == 0x46) { /* End */ |
for (i=position;i<curlen;i++) |
putchar(current[i]); |
position = curlen; |
355,7 → 356,7 |
rdln_print_c('\b',position); |
rdln_print_c(' ',curlen); |
rdln_print_c('\b',curlen); |
if (c == 0x41) |
if (c == 0x41) /* Up */ |
histposition--; |
else |
histposition++; |
/kernel/trunk/generic/src/lib/func.c |
---|
32,6 → 32,7 |
#include <arch/asm.h> |
#include <arch.h> |
#include <typedefs.h> |
#include <console/kconsole.h> |
__u32 haltstate = 0; /**< Halt flag */ |
45,6 → 46,11 |
{ |
haltstate = 1; |
interrupts_disable(); |
#ifdef CONFIG_DEBUG |
printf("\n"); |
kconsole(NULL); /* Run kconsole as a last resort to user */ |
#endif |
if (CPU) |
printf("cpu%d: halted\n", CPU->id); |
else |