summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/vga
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-05-19 14:02:02 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-05-19 14:02:02 +0200
commit8f8c2d67796e8da8a3f8d3e86849b07182a96697 (patch)
treef7c9abf339a3084acd54ea03c05f4fe5358dc975 /sys/src/cmd/aux/vga
parentca123ae36601fe3015c7ed745910358c562e031a (diff)
aux/vga: dont use /proc/$pid/mem to access vga bios
using /proc/$pid/mem to access vga bios is not portable and crashes sgi machines when aux/vga is run. instead, try /dev/realmodemem first (provided by realemu), then #v/vgabios.
Diffstat (limited to 'sys/src/cmd/aux/vga')
-rw-r--r--sys/src/cmd/aux/vga/io.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/sys/src/cmd/aux/vga/io.c b/sys/src/cmd/aux/vga/io.c
index e2a4a460e..9ccf51860 100644
--- a/sys/src/cmd/aux/vga/io.c
+++ b/sys/src/cmd/aux/vga/io.c
@@ -12,7 +12,6 @@ static int iowfd = -1;
static int iolfd = -1;
static int biosfd = -1;
static int msrfd = -1;
-static ulong biosoffset = 0;
enum {
Nctlchar = 256,
@@ -243,20 +242,13 @@ setpalette(int p, int r, int g, int b)
static long
doreadbios(char* buf, long len, long offset)
{
- char file[64];
-
- if(biosfd == -1){
- biosfd = open("#v/vgabios", OREAD);
- biosoffset = 0;
- }
- if(biosfd == -1){
- snprint(file, sizeof file, "#p/%d/mem", getpid());
- biosfd = devopen(file, OREAD);
- biosoffset = 0x80000000;
- }
- if(biosfd == -1)
+ if(biosfd < 0)
+ biosfd = open("/dev/realmodemem", OREAD);
+ if(biosfd < 0)
+ biosfd = devopen("#v/vgabios", OREAD);
+ if(biosfd < 0)
return -1;
- seek(biosfd, biosoffset+offset, 0);
+ seek(biosfd, offset, 0);
return read(biosfd, buf, len);
}