diff options
Diffstat (limited to 'sys/src/9/cycv/mmu.c')
| -rw-r--r-- | sys/src/9/cycv/mmu.c | 23 |
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; +} |
