From 6976b9a7c20dce349dccfb0eec658af5fa9af3c5 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 2 Mar 2009 10:50:59 +0000 Subject: minios: add ioremap/iounmap Add ioremap and iounmap functions to minios. Also move some unmapping code from and clean up mem_test. Signed-off-by: Rolf Neugebauer Acked-by: Samuel Thibault --- extras/mini-os/lib/sys.c | 42 +++++------------------------------------- 1 file changed, 5 insertions(+), 37 deletions(-) (limited to 'extras/mini-os/lib') diff --git a/extras/mini-os/lib/sys.c b/extras/mini-os/lib/sys.c index a07692b883..7c5f05cd41 100644 --- a/extras/mini-os/lib/sys.c +++ b/extras/mini-os/lib/sys.c @@ -1206,47 +1206,15 @@ void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset } else ASSERT(0); } -#define UNMAP_BATCH ((STACK_SIZE / 2) / sizeof(multicall_entry_t)) int munmap(void *start, size_t length) { int total = length / PAGE_SIZE; - ASSERT(!((unsigned long)start & ~PAGE_MASK)); - while (total) { - int n = UNMAP_BATCH; - if (n > total) - n = total; - { - int i; - multicall_entry_t call[n]; - unsigned char (*data)[PAGE_SIZE] = start; - int ret; - - for (i = 0; i < n; i++) { - int arg = 0; - call[i].op = __HYPERVISOR_update_va_mapping; - call[i].args[arg++] = (unsigned long) &data[i]; - call[i].args[arg++] = 0; -#ifdef __i386__ - call[i].args[arg++] = 0; -#endif - call[i].args[arg++] = UVMF_INVLPG; - } - - ret = HYPERVISOR_multicall(call, n); - if (ret) { - errno = -ret; - return -1; - } + int ret; - for (i = 0; i < n; i++) { - if (call[i].result) { - errno = call[i].result; - return -1; - } - } - } - start = (char *)start + n * PAGE_SIZE; - total -= n; + ret = unmap_frames((unsigned long)start, (unsigned long)total); + if (ret) { + errno = ret; + return -1; } return 0; } -- cgit v1.2.3