diff options
author | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-11-05 06:19:52 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@centraldogma> | 2011-11-05 06:19:52 +0100 |
commit | 563437cb6dca9aa9d50835ba0a4ac346af007332 (patch) | |
tree | 691a9acbd4d54f5dba3e99926c75ad08ad1c1f84 /sys/src/9/pc/devarch.c | |
parent | d8c69ebafde74366823f7743ff7b6cea708b40b7 (diff) |
remove realmode and e820 code from kernel
Diffstat (limited to 'sys/src/9/pc/devarch.c')
-rw-r--r-- | sys/src/9/pc/devarch.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/src/9/pc/devarch.c b/sys/src/9/pc/devarch.c index 46c98b19c..081607fe3 100644 --- a/sys/src/9/pc/devarch.c +++ b/sys/src/9/pc/devarch.c @@ -989,6 +989,39 @@ archctlwrite(Chan*, void *a, long n, vlong) return n; } +static long +rmemrw(int isr, void *a, long n, vlong off) +{ + if(off < 0 || n < 0) + error("bad offset/count"); + if(isr){ + if(off >= MB) + return 0; + if(off+n >= MB) + n = MB - off; + memmove(a, KADDR((ulong)off), n); + }else{ + /* allow vga framebuf's access */ + if(off >= MB || off+n > MB || + (off < 0xA0000 || off+n > 0xB0000+0x10000)) + error("bad offset/count in write"); + memmove(KADDR((ulong)off), a, n); + } + return n; +} + +static long +rmemread(Chan*, void *a, long n, vlong off) +{ + return rmemrw(1, a, n, off); +} + +static long +rmemwrite(Chan*, void *a, long n, vlong off) +{ + return rmemrw(0, a, n, off); +} + void archinit(void) { @@ -1037,6 +1070,7 @@ archinit(void) addarchfile("cputype", 0444, cputyperead, nil); addarchfile("archctl", 0664, archctlread, archctlwrite); + addarchfile("realmodemem", 0660, rmemread, rmemwrite); } /* |