summaryrefslogtreecommitdiffstats
path: root/sys/compat/freebsd32
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2012-03-03 08:19:18 +0000
committerjmallett <jmallett@FreeBSD.org>2012-03-03 08:19:18 +0000
commit50c253779ff59b0d64f2cfbb7efedabe19a620d8 (patch)
tree84d0a513be42586ec703acf6b5a531bc9d48d09c /sys/compat/freebsd32
parent402a0f9de41a1a087445529e59d3183a11d266b9 (diff)
downloadFreeBSD-src-50c253779ff59b0d64f2cfbb7efedabe19a620d8.zip
FreeBSD-src-50c253779ff59b0d64f2cfbb7efedabe19a620d8.tar.gz
o) Add COMPAT_FREEBSD32 support for MIPS kernels using the n64 ABI with userlands
using the o32 ABI. This mostly follows nwhitehorn's lead in implementing COMPAT_FREEBSD32 on powerpc64. o) Add a new type to the freebsd32 compat layer, time32_t, which is time_t in the 32-bit ABI being used. Since the MIPS port is relatively-new, even the 32-bit ABIs use a 64-bit time_t. o) Because time{spec,val}32 has the same size and layout as time{spec,val} on MIPS with 32-bit compatibility, then, disable some code which assumes otherwise wrongly when built for MIPS. A more general macro to check in this case would seem like a good idea eventually. If someone adds support for using n32 userland with n64 kernels on MIPS, then they will have to add a variety of flags related to each piece of the ABI that can vary. That's probably the right time to generalize further. o) Add MIPS to the list of architectures which use PAD64_REQUIRED in the freebsd32 compat code. Probably this should be generalized at some point. Reviewed by: gonzo
Diffstat (limited to 'sys/compat/freebsd32')
-rw-r--r--sys/compat/freebsd32/freebsd32.h13
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c6
-rw-r--r--sys/compat/freebsd32/freebsd32_proto.h14
-rw-r--r--sys/compat/freebsd32/freebsd32_syscall.h2
-rw-r--r--sys/compat/freebsd32/freebsd32_syscalls.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_sysent.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_systrace_args.c6
-rw-r--r--sys/compat/freebsd32/syscalls.master2
8 files changed, 33 insertions, 18 deletions
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h
index 1d8f149..e263f0d 100644
--- a/sys/compat/freebsd32/freebsd32.h
+++ b/sys/compat/freebsd32/freebsd32.h
@@ -42,8 +42,17 @@
#define PTROUT_CP(src,dst,fld) \
do { (dst).fld = PTROUT((src).fld); } while (0)
+/*
+ * Being a newer port, 32-bit FreeBSD/MIPS uses 64-bit time_t.
+ */
+#ifdef __mips__
+typedef int64_t time32_t;
+#else
+typedef int32_t time32_t;
+#endif
+
struct timeval32 {
- int32_t tv_sec;
+ time32_t tv_sec;
int32_t tv_usec;
};
#define TV_CP(src,dst,fld) do { \
@@ -52,7 +61,7 @@ struct timeval32 {
} while (0)
struct timespec32 {
- int32_t tv_sec;
+ time32_t tv_sec;
int32_t tv_nsec;
};
#define TS_CP(src,dst,fld) do { \
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index aff280a..3938e99 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -104,16 +104,22 @@ __FBSDID("$FreeBSD$");
#include <compat/freebsd32/freebsd32_signal.h>
#include <compat/freebsd32/freebsd32_proto.h>
+#ifndef __mips__
CTASSERT(sizeof(struct timeval32) == 8);
CTASSERT(sizeof(struct timespec32) == 8);
CTASSERT(sizeof(struct itimerval32) == 16);
+#endif
CTASSERT(sizeof(struct statfs32) == 256);
+#ifndef __mips__
CTASSERT(sizeof(struct rusage32) == 72);
+#endif
CTASSERT(sizeof(struct sigaltstack32) == 12);
CTASSERT(sizeof(struct kevent32) == 20);
CTASSERT(sizeof(struct iovec32) == 8);
CTASSERT(sizeof(struct msghdr32) == 28);
+#ifndef __mips__
CTASSERT(sizeof(struct stat32) == 96);
+#endif
CTASSERT(sizeof(struct sigaction32) == 24);
static int freebsd32_kevent_copyout(void *arg, struct kevent *kevp, int count);
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index 1d6310b..48c6f2e 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -33,7 +33,7 @@ struct thread;
#define PADR_(t) 0
#endif
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
struct freebsd32_wait4_args {
@@ -589,7 +589,7 @@ struct freebsd32_posix_fadvise_args {
char len2_l_[PADL_(uint32_t)]; uint32_t len2; char len2_r_[PADR_(uint32_t)];
char advice_l_[PADL_(int)]; int advice; char advice_r_[PADR_(int)];
};
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *);
@@ -703,7 +703,7 @@ int freebsd32_posix_fadvise(struct thread *, struct freebsd32_posix_fadvise_args
#ifdef COMPAT_43
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
struct ofreebsd32_lseek_args {
@@ -789,7 +789,7 @@ int ofreebsd32_getdirentries(struct thread *, struct ofreebsd32_getdirentries_ar
#ifdef COMPAT_FREEBSD4
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
struct freebsd4_freebsd32_getfsstat_args {
@@ -846,7 +846,7 @@ int freebsd4_freebsd32_sigreturn(struct thread *, struct freebsd4_freebsd32_sigr
#ifdef COMPAT_FREEBSD6
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
struct freebsd6_freebsd32_pread_args {
@@ -912,7 +912,7 @@ int freebsd6_freebsd32_ftruncate(struct thread *, struct freebsd6_freebsd32_ftru
#ifdef COMPAT_FREEBSD7
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
struct freebsd7_freebsd32_semctl_args {
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index d21b583..ad3d986 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart
*/
#define FREEBSD32_SYS_syscall 0
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index c58a414..faba864 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,11 +3,11 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart
*/
const char *freebsd32_syscallnames[] = {
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
"syscall", /* 0 = syscall */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 4371d16..590ed41 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227691 2011-11-19 06:35:15Z ed
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 227776 2011-11-21 01:26:10Z lstewart
*/
#include "opt_compat.h"
@@ -44,7 +44,7 @@
/* The casts are bogus but will do for now. */
struct sysent freebsd32_sysent[] = {
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 0 = syscall */
diff --git a/sys/compat/freebsd32/freebsd32_systrace_args.c b/sys/compat/freebsd32/freebsd32_systrace_args.c
index 7f6bf68..13df961 100644
--- a/sys/compat/freebsd32/freebsd32_systrace_args.c
+++ b/sys/compat/freebsd32/freebsd32_systrace_args.c
@@ -11,7 +11,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
{
int64_t *iarg = (int64_t *) uarg;
switch (sysnum) {
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
/* nosys */
@@ -3077,7 +3077,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
{
const char *p = NULL;
switch (sysnum) {
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
/* nosys */
@@ -8192,7 +8192,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
{
const char *p = NULL;
switch (sysnum) {
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
/* nosys */
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index b80fd9c..11476ed 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -52,7 +52,7 @@
#include <compat/freebsd32/freebsd32.h>
#include <compat/freebsd32/freebsd32_proto.h>
-#if !defined(PAD64_REQUIRED) && defined(__powerpc__)
+#if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__))
#define PAD64_REQUIRED
#endif
OpenPOWER on IntegriCloud