diff options
Diffstat (limited to 'roms/openbios/arch/unix/unix.c')
-rw-r--r-- | roms/openbios/arch/unix/unix.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/roms/openbios/arch/unix/unix.c b/roms/openbios/arch/unix/unix.c index 65e67bc36..1f628eb78 100644 --- a/roms/openbios/arch/unix/unix.c +++ b/roms/openbios/arch/unix/unix.c @@ -32,6 +32,7 @@ #include "kernel/stack.h" #include "arch/unix/plugins.h" #include "libopenbios/bindings.h" +#include "libopenbios/console.h" #include "libopenbios/openbios.h" #include "openbios-version.h" @@ -179,7 +180,7 @@ static ucell read_dictionary(char *fil) * functions used by primitives */ -int availchar(void) +static int unix_availchar(void) { int tmp = getc(stdin); if (tmp != EOF) { @@ -189,6 +190,23 @@ int availchar(void) return 0; } +static int unix_putchar(int c) +{ + putc(c, stdout); + return c; +} + +static int unix_getchar(void) +{ + return getc(stdin); +} + +static struct _console_ops unix_console_ops = { + .putchar = unix_putchar, + .availchar = unix_availchar, + .getchar = unix_getchar +}; + u8 inb(u32 reg) { #ifdef CONFIG_PLUGINS @@ -498,6 +516,9 @@ int main(int argc, char *argv[]) return 1; } + /* Initialise console */ + init_console(unix_console_ops); + if ((dict = (unsigned char *) malloc(DICTIONARY_SIZE)) == NULL) { printk("panic: not enough memory.\n"); return 1; |