aboutsummaryrefslogtreecommitdiff
path: root/linux-user
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-09 15:24:18 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2003-06-09 15:24:18 +0000
commit4a585ccb2f45446a127a9f7a5147b033ac02bd5f (patch)
tree3d11d2230e8a6b53a430c2e4352e3a2bdf44900d /linux-user
parentaa0aa4fa31054a9488fd49c29c6ab12e2e85be58 (diff)
avoid unaligned file offset in anonymous mapping
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@215 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user')
-rw-r--r--linux-user/mmap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 1c3eb35f21..0c2fe8dc1a 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -188,7 +188,7 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
host_start = start & host_page_mask;
if (!(flags & MAP_FIXED)) {
-#ifdef __alpha__
+#if defined(__alpha__) || defined(__sparc__)
/* tell the kenel to search at the same place as i386 */
if (host_start == 0)
host_start = 0x40000000;
@@ -282,8 +282,13 @@ long target_mmap(unsigned long start, unsigned long len, int prot,
/* map the middle (easier) */
if (host_start < host_end) {
+ unsigned long offset1;
+ if (flags & MAP_ANONYMOUS)
+ offset1 = 0;
+ else
+ offset1 = offset + host_start - start;
ret = (long)mmap((void *)host_start, host_end - host_start,
- prot, flags, fd, offset + host_start - start);
+ prot, flags, fd, offset1);
if (ret == -1)
return ret;
}