summaryrefslogtreecommitdiff
path: root/sys/src/9/port/devsegment.c
AgeCommit message (Collapse)Author
2016-05-05kernel: fix cb->f[0] nil dereferences due to short control requestcinap_lenrek
2016-03-30devsegment: cleanupscinap_lenrek
- return distinct error message when attempting to create Globalseg with physseg name - copy directory name to up->genbuf so it stays valid after we unlock(&glogalseglock) - cleanup wstat() handling, allow changing uid - make sure global segment size is below SEGMAXSIZE - move isoverlap() check from globalsegattach() into segattach() - remove Proc* argument from globalsegattach(), segattach() and isoverlap() - make Physseg.attr and segattach attr parameter an int for consistency
2016-03-27zynq: introduce SG_FAULT to prevent access to AXI segment while PL is not readycinap_lenrek
access to the axi segment hangs the machine when the fpga is not programmed yet. to prevent access, we introduce a new SG_FAULT flag, that when set on the Segment.type or Physseg.attr, causes the fault handler to immidiately return with an error (as if the segment would not be mapped). during programming, we temporarily set the SG_FAULT flag on the axi physseg, flush all processes tlb's that have the segment mapped and when programming is done, we clear the flag again.
2015-06-09devsegment: fix parsecmd() memory leakcinap_lenrek
2015-04-16kernel: add segio() function for reading/writing segmentscinap_lenrek
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.
2015-04-13segment: don't store pointers in a longcinap_lenrek
2015-04-13segment: fix read/write g->dlen race, avoid copying kernel memory, qlockcinap_lenrek
code like "return g->dlen;" is wrong as we do not hold the qlock of the global segment. another process could come in and override g->dlen making us return the wrong byte count. avoid copying when we already got a kernel address (kernel memory is the same on processes) which is the case with bread()/bwrite(). this is the same optimization that devsd does. also avoid allocating/freeing and copying while holding the qlock. when we copy to/from user memory, we might fault preventing others from accessing the segment while fault handling is in progress.
2015-04-12segment: speed up fixedseg() doing single pass over freelistcinap_lenrek
walking the freelist for every page is too slow. as we are freeing a range, we can do a single pass unlinking all pages in our range and at the end, check if all pages where freed, if not put the pages that we did free back and retry, otherwise we'r done.
2015-04-12segment: fix print buffer overflow, map fixed segments uncached, add to zynq ↵cinap_lenrek
kernel
2015-04-12kernel: fixed segment support (for fpga experiments)cinap_lenrek
fixed segments are continuous in physical memory but allocated in user pages. unlike shared segments, they are not allocated on demand but the pages are allocated on creation time (devsegment). fixed segments are never swapped out, segfreed or resized and can only be destroyed as a whole. the physical base address can be discovered by userspace reading the ctl file in devsegment.
2014-12-08devsegment: fix segmentcreate function signaturemischief
2013-11-22kernel: kproc error and exitcinap_lenrek
catch the error() that can be thrown by sleep() and tsleep() in kprocs. add missing pexit() calls. always set the freemem argument to pexit() from kproc otherwise the process gets added to the broken list.
2012-10-01devproc buffer overflow, strncpycinap_lenrek
in devproc status read handler the p->status, p->text and p->user could overflow the local statbuf buffer as they where copied into it with code like: memmove(statbuf+someoff, p->text, strlen(p->text)). now using readstr() which will truncate if the string is too long. make strncpy() usage consistent, make sure results are always null terminated.
2011-03-30Import sources from 2011-03-30 iso image - libTaru Karttunen
2011-03-30Import sources from 2011-03-30 iso imageTaru Karttunen