summaryrefslogtreecommitdiff
path: root/sys/src/9/cycv/mmu.c
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2020-01-10 18:49:33 +0000
committeraiju <devnull@localhost>2020-01-10 18:49:33 +0000
commitd64f76c96c5ecfedf6c2a3fcf4b5ce6fa53df714 (patch)
treec8060d5736b448ff49bd58e90f546c90a0102ca7 /sys/src/9/cycv/mmu.c
parent17ebe55031ae6945ad1f671b69267a672328e4b1 (diff)
add cycv ethernet driver
Diffstat (limited to 'sys/src/9/cycv/mmu.c')
-rw-r--r--sys/src/9/cycv/mmu.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/src/9/cycv/mmu.c b/sys/src/9/cycv/mmu.c
index d7fef9540..8a449e70b 100644
--- a/sys/src/9/cycv/mmu.c
+++ b/sys/src/9/cycv/mmu.c
@@ -374,3 +374,26 @@ tmpunmap(void *v)
coherence();
flushpg(v);
}
+
+void *
+ucalloc(ulong len)
+{
+ static Lock l;
+ static uchar *free = nil;
+ uchar *va;
+
+ if(len == 0)
+ panic("ucalloc: len == 0");
+ ilock(&l);
+ if(free == nil)
+ free = (uchar*)-BY2PG;
+ len = PGROUND(len);
+ free -= len;
+ if(free < (uchar*)OCRAM)
+ panic("ucalloc: out of uncached memory");
+ va = free;
+ iunlock(&l);
+
+ invaldse(va, va + len);
+ return (void *) va;
+}