From 8f8c2d67796e8da8a3f8d3e86849b07182a96697 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 19 May 2015 14:02:02 +0200 Subject: [PATCH] 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. --- sys/src/cmd/aux/vga/io.c | 20 ++++++-------------- 1 file 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); }