diff options
author | msmith <msmith@FreeBSD.org> | 1998-09-17 23:52:16 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-09-17 23:52:16 +0000 |
commit | f0b5ddae6f18f4e9b5ad66d339e2f6b10f5003fa (patch) | |
tree | 7fadd070d2d84c282103a99a4ea34ee576dfe81c /sys/boot/i386/libi386/comconsole.c | |
parent | 00163848c15519499c016ae12ed2a2a3aaf24a83 (diff) | |
download | FreeBSD-src-f0b5ddae6f18f4e9b5ad66d339e2f6b10f5003fa.zip FreeBSD-src-f0b5ddae6f18f4e9b5ad66d339e2f6b10f5003fa.tar.gz |
Initial integration of the i386 bootloader and BTX.
- Discard large amounts of BIOS-related code in favour of the more compact
BTX vm86 interface.
- Build the loader module as ELF, although the resulting object is a.out,
make gensetdefs 32/64-bit sensitive and use a single copy of it.
- Throw away installboot, as it's no longer required.
- Use direct bcopy operations in the i386_copy module, as BTX
maps the first 16M of memory. Check operations against the
detected size of actual memory.
Diffstat (limited to 'sys/boot/i386/libi386/comconsole.c')
-rw-r--r-- | sys/boot/i386/libi386/comconsole.c | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/sys/boot/i386/libi386/comconsole.c b/sys/boot/i386/libi386/comconsole.c index a75f92d..1d98585 100644 --- a/sys/boot/i386/libi386/comconsole.c +++ b/sys/boot/i386/libi386/comconsole.c @@ -24,22 +24,19 @@ * * From Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp * - * $Id$ + * $Id: comconsole.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include <stand.h> - -#include "bootstrap.h" - -/* in comconsole.S */ -extern void cominit(int s); -extern void computc(int c); -extern int comgetc(void); -extern int comiskey(void); +#include <bootstrap.h> +#include <btxv86.h> +#include "libi386.h" static void comc_probe(struct console *cp); static int comc_init(int arg); -static int comc_in(void); +static void comc_putchar(int c); +static int comc_getchar(void); +static int comc_ischar(void); struct console comconsole = { "comconsole", @@ -47,11 +44,13 @@ struct console comconsole = { 0, comc_probe, comc_init, - computc, - comc_in, - comiskey + comc_putchar, + comc_getchar, + comc_ischar }; +#define BIOS_COMPORT 0 + static void comc_probe(struct console *cp) { @@ -62,17 +61,43 @@ comc_probe(struct console *cp) static int comc_init(int arg) { - /* XXX arg is unit number, should we use variables instead? */ - cominit(arg); - return(0); + v86.ctl = V86_FLAGS; + v86.addr = 0x14; + v86.eax = 0xe3; /* 9600N81 */ + v86.edx = BIOS_COMPORT; /* XXX take as arg, or use env var? */ + v86int(); + return(v86.efl & 1); +} + +static void +comc_putchar(int c) +{ + v86.ctl = 0; + v86.addr = 0x14; + v86.eax = 0x100 | c; + v86int(); } static int -comc_in(void) +comc_getchar(void) { - if (comiskey()) { - return(comgetc()); + if (comc_ischar()) { + v86.ctl = 0; + v86.addr = 0x14; + v86.eax = 0x300; + v86int(); + return(v86.eax); } else { return(-1); } } + +static int +comc_ischar(void) +{ + v86.ctl = 0; + v86.addr = 0x14; + v86.eax = 0x200; + v86int(); + return(v86.eax & 0x1); +} |