diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2020-04-14 20:30:48 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2020-04-14 20:30:48 +0000 |
commit | 562894f0dc310f658284863ff329906e7737a0a0 (patch) | |
tree | 8a830d5373ca9ce37e8d766441703236d0240ae9 /sys/compat/freebsd32 | |
parent | c23ca622a27cac1c9391d81c50342d091c1d3b63 (diff) |
Centralize compatability translation macros.
Copy the CP, PTRIN, etc macros from freebsd32.h into a sys/abi_compat.h
and replace existing definitation with includes where required. This
eliminates duplicate code and allows Linux and FreeBSD compatability
headers to be included in the same files.
Input from: cem, jhb
Obtained from: CheriBSD
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D24275
Notes
Notes:
svn path=/head/; revision=359937
Diffstat (limited to 'sys/compat/freebsd32')
-rw-r--r-- | sys/compat/freebsd32/freebsd32.h | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 1ce207626063..a3774c99a0cb 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -31,19 +31,11 @@ #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_ #define _COMPAT_FREEBSD32_FREEBSD32_H_ +#include <sys/abi_compat.h> #include <sys/procfs.h> #include <sys/socket.h> #include <sys/user.h> -#define PTRIN(v) (void *)(uintptr_t) (v) -#define PTROUT(v) (u_int32_t)(uintptr_t) (v) - -#define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0) -#define PTRIN_CP(src,dst,fld) \ - do { (dst).fld = PTRIN((src).fld); } while (0) -#define PTROUT_CP(src,dst,fld) \ - do { (dst).fld = PTROUT((src).fld); } while (0) - /* * i386 is the only arch with a 32-bit time_t */ @@ -57,37 +49,21 @@ struct timeval32 { time32_t tv_sec; int32_t tv_usec; }; -#define TV_CP(src,dst,fld) do { \ - CP((src).fld,(dst).fld,tv_sec); \ - CP((src).fld,(dst).fld,tv_usec); \ -} while (0) struct timespec32 { time32_t tv_sec; int32_t tv_nsec; }; -#define TS_CP(src,dst,fld) do { \ - CP((src).fld,(dst).fld,tv_sec); \ - CP((src).fld,(dst).fld,tv_nsec); \ -} while (0) struct itimerspec32 { struct timespec32 it_interval; struct timespec32 it_value; }; -#define ITS_CP(src, dst) do { \ - TS_CP((src), (dst), it_interval); \ - TS_CP((src), (dst), it_value); \ -} while (0) struct bintime32 { time32_t sec; uint32_t frac[2]; }; -#define BT_CP(src, dst, fld) do { \ - CP((src).fld, (dst).fld, sec); \ - *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac; \ -} while (0) struct rusage32 { struct timeval32 ru_utime; |