summaryrefslogtreecommitdiff
path: root/sys/src/9/port/segment.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/segment.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/segment.c')
-rw-r--r--sys/src/9/port/segment.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c
index 5bafd0c36..c64a4efbf 100644
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -11,9 +11,9 @@ int imagereclaim(int);
* Attachable segment types
*/
static Physseg physseg[10] = {
- { SG_SHARED, "shared", 0, SEGMAXSIZE, 0, 0 },
- { SG_BSS, "memory", 0, SEGMAXSIZE, 0, 0 },
- { 0, 0, 0, 0, 0, 0 },
+ { SG_SHARED, "shared", 0, SEGMAXSIZE },
+ { SG_BSS, "memory", 0, SEGMAXSIZE },
+ { 0, 0, 0, 0 },
};
static Lock physseglock;
@@ -459,6 +459,9 @@ mcountseg(Segment *s)
int i, j;
Page *pg;
+ if((s->type&SG_TYPE) == SG_PHYSICAL)
+ return 0;
+
pages = 0;
for(i = 0; i < s->mapsize; i++){
if(s->map[i] == nil)
@@ -482,6 +485,9 @@ mfreeseg(Segment *s, uintptr start, int pages)
uintptr soff;
Page *pg;
+ if((s->type&SG_TYPE) == SG_PHYSICAL)
+ return;
+
/*
* We want to zero s->map[i]->page[j] and putpage(pg),
* but we have to make sure other processors flush the