ref: 647a1da10867b87f90e7f917d7c33ba69ed2a705
parent: 81e6b7e9c958bd5da3c93e204fff59e6868bd0fc
author: cinap_lenrek <[email protected]>
date: Sun Apr 12 12:05:05 EDT 2015
segment: fix print buffer overflow, map fixed segments uncached, add to zynq kernel
--- a/sys/src/9/port/devsegment.c
+++ b/sys/src/9/port/devsegment.c
@@ -319,7 +319,7 @@
segmentread(Chan *c, void *a, long n, vlong voff)
{
Globalseg *g;
- char buf[32];
+ char buf[128];
if(c->qid.type == QTDIR)
return devdirread(c, a, n, (Dirtab *)0, 0L, segmentgen);
@@ -329,11 +329,11 @@
g = c->aux;
if(g->s == nil)
error("segment not yet allocated");
- if(g->s->type&SG_TYPE == SG_FIXED)
- sprint(buf, "va %#p %#p fixed %#p\n", g->s->base, g->s->top-g->s->base,
+ if((g->s->type&SG_TYPE) == SG_FIXED)
+ snprint(buf, sizeof(buf), "va %#p %#p fixed %#p\n", g->s->base, g->s->top-g->s->base,
g->s->map[0]->pages[0]->pa);
else
- sprint(buf, "va %#p %#p\n", g->s->base, g->s->top-g->s->base);
+ snprint(buf, sizeof(buf), "va %#p %#p\n", g->s->base, g->s->top-g->s->base);
return readstr(voff, a, n, buf);
case Qdata:
g = c->aux;
--- a/sys/src/9/port/fault.c
+++ b/sys/src/9/port/fault.c
@@ -267,7 +267,6 @@
copypage(old, *pg);
putpage(old);
}
- case SG_FIXED: /* Never paged out */
mmuphys = PPN((*pg)->pa) | PTEWRITE | PTEVALID;
(*pg)->modref = PG_MOD|PG_REF;
break;
@@ -280,6 +279,7 @@
new->ref = 1;
*pg = new;
}
+ case SG_FIXED: /* Never paged out */
if (checkaddr && addr == addr2check)
(*checkaddr)(addr, s, *pg);
mmuphys = PPN((*pg)->pa) |PTEWRITE|PTEUNCACHED|PTEVALID;
--- a/sys/src/9/zynq/zynq
+++ b/sys/src/9/zynq/zynq
@@ -21,6 +21,7 @@
draw screen
mouse
usb
+ segment
link
etherzynq