aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/lib
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-03-02 10:50:59 +0000
committerKeir Fraser <keir.fraser@citrix.com>2009-03-02 10:50:59 +0000
commit6976b9a7c20dce349dccfb0eec658af5fa9af3c5 (patch)
treedbb16b8d0a9c693f4e6744bf95a75c3ad87df46c /extras/mini-os/lib
parent8e3feb5145bbde1f01d001ce9574f67de87173f7 (diff)
downloadxen-6976b9a7c20dce349dccfb0eec658af5fa9af3c5.tar.gz
xen-6976b9a7c20dce349dccfb0eec658af5fa9af3c5.tar.bz2
xen-6976b9a7c20dce349dccfb0eec658af5fa9af3c5.zip
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 <rolf.neugebauer@netronome.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'extras/mini-os/lib')
-rw-r--r--extras/mini-os/lib/sys.c42
1 files changed, 5 insertions, 37 deletions
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;
}