diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-04-16 00:45:25 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-04-16 00:45:25 +0200 |
commit | 46070c3122227f5fc04c9b7a29d0652600fa7074 (patch) | |
tree | 82d1d3e022e7fe96baa7834f8a7718c818f39353 /sys/src/9/port/portdat.h | |
parent | 88d7d8428a6cb10b421d5ff900617dad3c290fd1 (diff) |
kernel: add segio() function for reading/writing segments
devproc's procctlmemio() did not handle physical segment
types correctly, as it assumed it can just kmap() the page
in question and write to it. physical segments however
need to be mapped uncached but kmap() will always map
cached as it assumes normal memory. on some machines with
aliasing memory with different cache attributes
leads to undefined behaviour!
we borrow the code from devsegment and provide a generic
segio() function to read and write user segments which
handles all the cases without using kmap by just spawning
a kproc that attaches the segment that needs to be read
from or written to. fault() will setup the right mmu
attributes for us. it will also properly flush pages for
segments that maintain instruction cache when written.
however, tlb's have to be flushed separately.
segio() is used for devsegment and devproc now, which
also allows for simplification of fixfault() as there is no
special error handling case anymore as fixfault() is now
called from faulting process *only*.
reads from /proc/$pid/mem can now span multiple pages.
Diffstat (limited to 'sys/src/9/port/portdat.h')
-rw-r--r-- | sys/src/9/port/portdat.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/src/9/port/portdat.h b/sys/src/9/port/portdat.h index 495baac93..f2d0a1223 100644 --- a/sys/src/9/port/portdat.h +++ b/sys/src/9/port/portdat.h @@ -39,6 +39,7 @@ typedef struct RWlock RWlock; typedef struct Sargs Sargs; typedef struct Schedq Schedq; typedef struct Segment Segment; +typedef struct Segio Segio; typedef struct Sema Sema; typedef struct Timer Timer; typedef struct Timers Timers; @@ -392,6 +393,22 @@ struct Segment ulong mark; /* portcountrefs */ }; +struct Segio +{ + QLock; + Rendez cmdwait; + Rendez replywait; + + Proc *p; /* segmentio kproc */ + Segment *s; + + char *data; + char *addr; + int dlen; + int cmd; + char err[64]; +}; + enum { RENDLOG = 5, |