vesa/realmode cleanup

This commit is contained in:
cinap_lenrek 2011-11-05 06:54:48 +01:00
parent 563437cb6d
commit f5018135c0
3 changed files with 6 additions and 14 deletions

View file

@ -1,5 +1,4 @@
#include "mem.h"
#include "/sys/src/boot/pc/x16.h"
#undef DELAY
#define PADDR(a) ((a) & ~KZERO)

View file

@ -60,7 +60,6 @@
#define CONFADDR (KZERO+0x1200) /* info passed from boot loader */
#define TMPADDR (KZERO+0x2000) /* used for temporary mappings */
#define APBOOTSTRAP (KZERO+0x3000) /* AP bootstrap code */
#define RMBUF (KZERO+0x9000) /* buffer for user space - known to vga */
#define IDTADDR (KZERO+0x10800) /* idt */
#define REBOOTADDR (0x11000) /* reboot code - physical address */
#define CPU0PDB (KZERO+0x12000) /* bootstrap processor PDB */

View file

@ -20,6 +20,8 @@ enum {
Cdisable = 0,
Cenable,
Cblank,
RealModeBuf = 0x9000,
};
static void *hardscreen;
@ -37,26 +39,19 @@ static int vesactl;
static uchar*
vbesetup(Ureg *u, int ax)
{
ulong pa;
pa = PADDR(RMBUF);
memset(modebuf, 0, sizeof modebuf);
memset(u, 0, sizeof *u);
u->ax = ax;
u->es = (pa>>4)&0xF000;
u->di = pa&0xFFFF;
u->es = (RealModeBuf>>4)&0xF000;
u->di = RealModeBuf&0xFFFF;
return modebuf;
}
static void
vbecall(Ureg *u)
{
ulong pa;
pa = PADDR(RMBUF);
if(devtab[cmem->type]->write(cmem, modebuf, sizeof(modebuf), pa) != sizeof(modebuf))
if(devtab[cmem->type]->write(cmem, modebuf, sizeof(modebuf), RealModeBuf) != sizeof(modebuf))
error("write modebuf");
u->trap = 0x10;
if(devtab[creg->type]->write(creg, u, sizeof(*u), 0) != sizeof(*u))
error("write ureg");
@ -64,8 +59,7 @@ vbecall(Ureg *u)
error("read ureg");
if((u->ax&0xFFFF) != 0x004F)
error("vesa bios error");
if(devtab[cmem->type]->read(cmem, modebuf, sizeof(modebuf), pa) != sizeof(modebuf))
if(devtab[cmem->type]->read(cmem, modebuf, sizeof(modebuf), RealModeBuf) != sizeof(modebuf))
error("read modebuf");
}