summaryrefslogtreecommitdiffstats
path: root/sys/compat/freebsd32/freebsd32_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/freebsd32/freebsd32_misc.c')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 6d28715..fc2932b 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -437,6 +437,21 @@ freebsd32_mmap_partial(struct thread *td, vm_offset_t start, vm_offset_t end,
#endif
int
+freebsd32_mprotect(struct thread *td, struct freebsd32_mprotect_args *uap)
+{
+ struct mprotect_args ap;
+
+ ap.addr = PTRIN(uap->addr);
+ ap.len = uap->len;
+ ap.prot = uap->prot;
+#if defined(__amd64__) || defined(__ia64__)
+ if (i386_read_exec && (ap.prot & PROT_READ) != 0)
+ ap.prot |= PROT_EXEC;
+#endif
+ return (sys_mprotect(td, &ap));
+}
+
+int
freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
{
struct mmap_args ap;
@@ -520,6 +535,11 @@ freebsd32_mmap(struct thread *td, struct freebsd32_mmap_args *uap)
}
#endif
+#if defined(__amd64__) || defined(__ia64__)
+ if (i386_read_exec && (prot & PROT_READ))
+ prot |= PROT_EXEC;
+#endif
+
ap.addr = (void *) addr;
ap.len = len;
ap.prot = prot;
@@ -2811,7 +2831,7 @@ freebsd32_posix_fallocate(struct thread *td,
struct posix_fallocate_args ap;
ap.fd = uap->fd;
- ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32));
- ap.len = (uap->lenlo | ((off_t)uap->lenhi << 32));
+ ap.offset = PAIR32TO64(off_t, uap->offset);
+ ap.len = PAIR32TO64(off_t, uap->len);
return (sys_posix_fallocate(td, &ap));
}
OpenPOWER on IntegriCloud