Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys In preparation for COMPAT_NETBSD32 on SH-5:
details: https://anonhg.NetBSD.org/src/rev/87146716a7f0
branches: trunk
changeset: 538616:87146716a7f0
user: scw <scw%NetBSD.org@localhost>
date: Wed Oct 23 13:16:38 2002 +0000
description:
In preparation for COMPAT_NETBSD32 on SH-5:
- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().
Tested on Sparc64 by Matt Green.
diffstat:
sys/arch/sparc64/include/netbsd32_machdep.h | 10 +-
sys/arch/x86_64/include/netbsd32_machdep.h | 7 +-
sys/compat/netbsd32/netbsd32.h | 151 ++++++++++++++-------------
sys/compat/netbsd32/netbsd32_compat_09.c | 11 +-
sys/compat/netbsd32/netbsd32_compat_10.c | 22 ++-
sys/compat/netbsd32/netbsd32_compat_12.c | 12 +-
sys/compat/netbsd32/netbsd32_compat_13.c | 12 +-
sys/compat/netbsd32/netbsd32_compat_14.c | 22 ++--
sys/compat/netbsd32/netbsd32_compat_43.c | 71 +++++++-----
sys/compat/netbsd32/netbsd32_exec.h | 6 +-
sys/compat/netbsd32/netbsd32_fs.c | 63 +++++++----
sys/compat/netbsd32/netbsd32_ioctl.c | 28 ++--
sys/compat/netbsd32/netbsd32_ioctl.h | 8 +-
sys/compat/netbsd32/netbsd32_ipc.c | 17 +-
sys/compat/netbsd32/netbsd32_netbsd.c | 16 +-
sys/compat/netbsd32/netbsd32_select.c | 14 +-
sys/compat/netbsd32/netbsd32_signal.c | 73 +++++++++++--
sys/compat/netbsd32/netbsd32_socket.c | 41 +++---
sys/compat/netbsd32/netbsd32_sysctl.c | 22 ++-
sys/compat/netbsd32/netbsd32_time.c | 54 +++++----
sys/compat/netbsd32/netbsd32_wait.c | 17 +-
sys/compat/netbsd32/syscalls.master | 6 +-
22 files changed, 403 insertions(+), 280 deletions(-)
diffs (truncated from 2023 to 300 lines):
diff -r 09768bdcbc9a -r 87146716a7f0 sys/arch/sparc64/include/netbsd32_machdep.h
--- a/sys/arch/sparc64/include/netbsd32_machdep.h Wed Oct 23 13:01:16 2002 +0000
+++ b/sys/arch/sparc64/include/netbsd32_machdep.h Wed Oct 23 13:16:38 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.h,v 1.9 2002/07/04 23:32:07 thorpej Exp $ */
+/* $NetBSD: netbsd32_machdep.h,v 1.10 2002/10/23 13:16:38 scw Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -33,6 +33,14 @@
#include <sys/types.h>
#include <sys/proc.h>
+
+typedef u_int32_t netbsd32_pointer_t;
+
+/*
+ * Convert a pointer in the 32-bit world to a valid 64-bit pointer.
+ */
+#define NETBSD32PTR64(p32) ((void *)(u_long)(u_int)(p32))
+
#include <compat/netbsd32/netbsd32.h>
/* from <arch/sparc/include/signal.h> */
diff -r 09768bdcbc9a -r 87146716a7f0 sys/arch/x86_64/include/netbsd32_machdep.h
--- a/sys/arch/x86_64/include/netbsd32_machdep.h Wed Oct 23 13:01:16 2002 +0000
+++ b/sys/arch/x86_64/include/netbsd32_machdep.h Wed Oct 23 13:16:38 2002 +0000
@@ -1,9 +1,12 @@
-/* $NetBSD: netbsd32_machdep.h,v 1.4 2002/07/07 23:27:00 fvdl Exp $ */
+/* $NetBSD: netbsd32_machdep.h,v 1.5 2002/10/23 13:16:39 scw Exp $ */
#ifndef _MACHINE_NETBSD32_H_
#define _MACHINE_NETBSD32_H_
-typedef u_int32_t netbsd32_sigcontextp_t;
+typedef u_int32_t netbsd32_pointer_t;
+#define NETBSD32PTR64(p32) ((void *)(u_long)(u_int)(p32))
+
+typedef netbsd32_pointer_t netbsd32_sigcontextp_t;
struct netbsd32_sigcontext13 {
int sc_gs;
diff -r 09768bdcbc9a -r 87146716a7f0 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h Wed Oct 23 13:01:16 2002 +0000
+++ b/sys/compat/netbsd32/netbsd32.h Wed Oct 23 13:16:38 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.21 2001/12/08 00:35:27 thorpej Exp $ */
+/* $NetBSD: netbsd32.h,v 1.22 2002/10/23 13:16:40 scw Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -46,7 +46,7 @@
#include <sys/shm.h>
/*
- * first, define all the types we need.
+ * first, define the basic types we need.
*/
typedef int32_t netbsd32_long;
@@ -61,30 +61,58 @@
typedef int32_t netbsd32_intptr_t;
typedef u_int32_t netbsd32_uintptr_t;
-/* all pointers are u_int32_t */
+/*
+ * machine depedant section; must define:
+ * netbsd32_pointer_t
+ * - 32-bit pointer type, normally u_int32_t but can be int32_t
+ * for platforms which rely on sign-extension of pointers
+ * such as SH-5.
+ * NETBSD32PTR64(p32)
+ * - Translate a 32-bit pointer into something valid in a
+ * 64-bit context.
+ * struct netbsd32_sigcontext
+ * - 32bit compatibility sigcontext structure for this arch.
+ * netbsd32_sigcontextp_t
+ * - type of pointer to above, normally u_int32_t
+ * void netbsd32_setregs(struct proc *p, struct exec_package *pack,
+ * u_long stack);
+ * int netbsd32_sigreturn(struct proc *p, void *v,
+ * register_t *retval);
+ * void netbsd32_sendsig(sig_t catcher, int sig, int mask, u_long code);
+ * char netbsd32_esigcode[], netbsd32_sigcode[]
+ * - the above are abvious
+ *
+ * pull in the netbsd32 machine dependant header, that may help with the
+ * above, or it may be provided via the MD layer itself.
+ */
+#include <machine/netbsd32_machdep.h>
-typedef u_int32_t netbsd32_voidp;
-typedef u_int32_t netbsd32_u_shortp;
-typedef u_int32_t netbsd32_charp;
-typedef u_int32_t netbsd32_u_charp;
-typedef u_int32_t netbsd32_charpp;
-typedef u_int32_t netbsd32_size_tp;
-typedef u_int32_t netbsd32_intp;
-typedef u_int32_t netbsd32_longp;
-typedef u_int32_t netbsd32_caddrp;
-typedef u_int32_t netbsd32_caddr;
-typedef u_int32_t netbsd32_gid_tp;
-typedef u_int32_t netbsd32_fsid_tp_t;
+/*
+ * all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
+ */
+
+typedef netbsd32_pointer_t netbsd32_voidp;
+typedef netbsd32_pointer_t netbsd32_u_shortp;
+typedef netbsd32_pointer_t netbsd32_charp;
+typedef netbsd32_pointer_t netbsd32_u_charp;
+typedef netbsd32_pointer_t netbsd32_charpp;
+typedef netbsd32_pointer_t netbsd32_size_tp;
+typedef netbsd32_pointer_t netbsd32_intp;
+typedef netbsd32_pointer_t netbsd32_longp;
+typedef netbsd32_pointer_t netbsd32_caddrp;
+typedef netbsd32_pointer_t netbsd32_caddr;
+typedef netbsd32_pointer_t netbsd32_gid_tp;
+typedef netbsd32_pointer_t netbsd32_fsid_tp_t;
/*
* now, the compatibility structures and their fake pointer types.
*/
/* from <sys/types.h> */
-typedef u_int32_t netbsd32_fd_setp_t;
+typedef netbsd32_pointer_t netbsd32_fd_setp_t;
/* from <sys/uio.h> */
-typedef u_int32_t netbsd32_iovecp_t;
+typedef netbsd32_pointer_t netbsd32_iovecp_t;
struct netbsd32_iovec {
netbsd32_voidp iov_base; /* Base address. */
netbsd32_size_t iov_len; /* Length. */
@@ -94,36 +122,36 @@
typedef int32_t netbsd32_timer_t;
typedef int32_t netbsd32_time_t;
-typedef u_int32_t netbsd32_timespecp_t;
+typedef netbsd32_pointer_t netbsd32_timespecp_t;
struct netbsd32_timespec {
netbsd32_time_t tv_sec; /* seconds */
netbsd32_long tv_nsec; /* and nanoseconds */
};
-typedef u_int32_t netbsd32_timevalp_t;
+typedef netbsd32_pointer_t netbsd32_timevalp_t;
struct netbsd32_timeval {
netbsd32_long tv_sec; /* seconds */
netbsd32_long tv_usec; /* and microseconds */
};
-typedef u_int32_t netbsd32_timezonep_t;
+typedef netbsd32_pointer_t netbsd32_timezonep_t;
struct netbsd32_timezone {
int tz_minuteswest; /* minutes west of Greenwich */
int tz_dsttime; /* type of dst correction */
};
-typedef u_int32_t netbsd32_itimervalp_t;
+typedef netbsd32_pointer_t netbsd32_itimervalp_t;
struct netbsd32_itimerval {
struct netbsd32_timeval it_interval; /* timer interval */
struct netbsd32_timeval it_value; /* current value */
};
/* from <sys/mount.h> */
-typedef u_int32_t netbsd32_fidp_t;
+typedef netbsd32_pointer_t netbsd32_fidp_t;
-typedef u_int32_t netbsd32_fhandlep_t;
+typedef netbsd32_pointer_t netbsd32_fhandlep_t;
-typedef u_int32_t netbsd32_statfsp_t;
+typedef netbsd32_pointer_t netbsd32_statfsp_t;
struct netbsd32_statfs {
short f_type; /* type of file system */
u_short f_flags; /* copy of mount flags */
@@ -143,10 +171,10 @@
};
/* from <sys/poll.h> */
-typedef u_int32_t netbsd32_pollfdp_t;
+typedef netbsd32_pointer_t netbsd32_pollfdp_t;
/* from <sys/resource.h> */
-typedef u_int32_t netbsd32_rusagep_t;
+typedef netbsd32_pointer_t netbsd32_rusagep_t;
struct netbsd32_rusage {
struct netbsd32_timeval ru_utime;/* user time used */
struct netbsd32_timeval ru_stime;/* system time used */
@@ -166,9 +194,9 @@
netbsd32_long ru_nivcsw; /* involuntary " */
};
-typedef u_int32_t netbsd32_orlimitp_t;
+typedef netbsd32_pointer_t netbsd32_orlimitp_t;
-typedef u_int32_t netbsd32_rlimitp_t;
+typedef netbsd32_pointer_t netbsd32_rlimitp_t;
struct netbsd32_loadavg {
fixpt_t ldavg[3];
@@ -176,7 +204,7 @@
};
/* from <sys/ipc.h> */
-typedef u_int32_t netbsd32_ipc_permp_t;
+typedef netbsd32_pointer_t netbsd32_ipc_permp_t;
struct netbsd32_ipc_perm {
ushort cuid; /* creator user id */
ushort cgid; /* creator group id */
@@ -197,7 +225,7 @@
};
/* from <sys/msg.h> */
-typedef u_int32_t netbsd32_msgp_t;
+typedef netbsd32_pointer_t netbsd32_msgp_t;
struct netbsd32_msg {
netbsd32_msgp_t msg_next; /* next msg in the chain */
netbsd32_long msg_type; /* type of this message */
@@ -248,7 +276,7 @@
};
/* from <sys/sem.h> */
-typedef u_int32_t netbsd32_semp_t;
+typedef netbsd32_pointer_t netbsd32_semp_t;
typedef u_int32_t netbsd32_semid_dsp_t;
struct netbsd32_semid_ds {
@@ -284,7 +312,7 @@
netbsd32_u_shortp array; /* array for GETALL & SETALL */
};
-typedef u_int32_t netbsd32_sembufp_t;
+typedef netbsd32_pointer_t netbsd32_sembufp_t;
struct netbsd32_sembuf {
unsigned short sem_num; /* semaphore # */
short sem_op; /* semaphore operation */
@@ -318,35 +346,35 @@
};
/* from <sys/signal.h> */
-typedef u_int32_t netbsd32_sigsetp_t;
-typedef u_int32_t netbsd32_sigactionp_t;
+typedef netbsd32_pointer_t netbsd32_sigsetp_t;
+typedef netbsd32_pointer_t netbsd32_sigactionp_t;
struct netbsd32_sigaction {
netbsd32_voidp sa_handler; /* signal handler */
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
};
-typedef u_int32_t netbsd32_sigaltstack13p_t;
+typedef netbsd32_pointer_t netbsd32_sigaltstack13p_t;
struct netbsd32_sigaltstack13 {
netbsd32_charp ss_sp; /* signal stack base */
int ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
};
-typedef u_int32_t netbsd32_sigaltstackp_t;
+typedef netbsd32_pointer_t netbsd32_sigaltstackp_t;
struct netbsd32_sigaltstack {
netbsd32_voidp ss_sp; /* signal stack base */
netbsd32_size_t ss_size; /* signal stack length */
int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */
};
-typedef u_int32_t netbsd32_sigstackp_t;
+typedef netbsd32_pointer_t netbsd32_sigstackp_t;
struct netbsd32_sigstack {
netbsd32_voidp ss_sp; /* signal stack pointer */
int ss_onstack; /* current status */
};
-typedef u_int32_t netbsd32_sigvecp_t;
+typedef netbsd32_pointer_t netbsd32_sigvecp_t;
struct netbsd32_sigvec {
netbsd32_voidp sv_handler; /* signal handler */
int sv_mask; /* signal mask to apply */
@@ -354,10 +382,10 @@
};
/* from <sys/socket.h> */
-typedef u_int32_t netbsd32_sockaddrp_t;
-typedef u_int32_t netbsd32_osockaddrp_t;
+typedef netbsd32_pointer_t netbsd32_sockaddrp_t;
+typedef netbsd32_pointer_t netbsd32_osockaddrp_t;
-typedef u_int32_t netbsd32_msghdrp_t;
+typedef netbsd32_pointer_t netbsd32_msghdrp_t;
struct netbsd32_msghdr {
netbsd32_caddr_t msg_name; /* optional address */
u_int msg_namelen; /* size of address */
@@ -368,7 +396,7 @@
int msg_flags; /* flags on received message */
};
-typedef u_int32_t netbsd32_omsghdrp_t;
Home |
Main Index |
Thread Index |
Old Index