summaryrefslogtreecommitdiff
path: root/sys/src/9/port/fault.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-03-03 13:08:29 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-03-03 13:08:29 +0100
commiteaf91d0f8ef43344ea9b8b030ab1a446211b8d10 (patch)
tree5ad5923bd448d456034c4af9209fb984fef2720b /sys/src/9/port/fault.c
parent2259f3fb9aebb2973ee2d892bec944f177a41c64 (diff)
kernel: fix physical segment handling
ignore physical segments in mcountseg() and mfreeseg(). physical segments are not backed by user pages, and doing putpage() on physical segment pages in mfreeseg() is an error. do now allow physical segemnts to be resized. the segment size is only checked in segattach() to be within the physical segment! ignore physical segments in portcountpagerefs() as pagenumber() does not work on the malloced page structures of a physical segment. get rid of Physseg.pgalloc() and Physseg.pgfree() indirection as this was never used and if theres a need to do more efficient allocation, it should be done in a portable way.
Diffstat (limited to 'sys/src/9/port/fault.c')
-rw-r--r--sys/src/9/port/fault.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/sys/src/9/port/fault.c b/sys/src/9/port/fault.c
index d77894641..b6f5e3894 100644
--- a/sys/src/9/port/fault.c
+++ b/sys/src/9/port/fault.c
@@ -200,7 +200,6 @@ fixfault(Segment *s, uintptr addr, int read, int doputmmu)
Pte **p, *etp;
uintptr soff, mmuphys=0;
Page **pg, *old, *new;
- Page *(*fn)(Segment*, uintptr);
addr &= ~(BY2PG-1);
soff = addr-s->base;
@@ -274,19 +273,13 @@ fixfault(Segment *s, uintptr addr, int read, int doputmmu)
break;
case SG_PHYSICAL:
- if(*pg == nil) {
- fn = s->pseg->pgalloc;
- if(fn)
- *pg = (*fn)(s, addr);
- else {
- new = smalloc(sizeof(Page));
- new->va = addr;
- new->pa = s->pseg->pa+(addr-s->base);
- new->ref = 1;
- *pg = new;
- }
+ if(*pg == nil){
+ new = smalloc(sizeof(Page));
+ new->va = addr;
+ new->pa = s->pseg->pa+(addr-s->base);
+ new->ref = 1;
+ *pg = new;
}
-
if (checkaddr && addr == addr2check)
(*checkaddr)(addr, s, *pg);
mmuphys = PPN((*pg)->pa) |PTEWRITE|PTEUNCACHED|PTEVALID;