From 565cf738ef5dfcf23a91da6d59f6cb174c1c8495 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 26 Aug 2001 04:10:57 +0000 Subject: be and le varients of syscallarg; from netbsd --- sys/kern/makesyscalls.sh | 18 ++++++++++++++++-- sys/sys/systm.h | 10 ++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/sys/kern/makesyscalls.sh b/sys/kern/makesyscalls.sh index 53934584a6a..6aac60c0270 100644 --- a/sys/kern/makesyscalls.sh +++ b/sys/kern/makesyscalls.sh @@ -1,5 +1,5 @@ #! /bin/sh - -# $OpenBSD: makesyscalls.sh,v 1.7 2001/01/29 07:20:24 jasoni Exp $ +# $OpenBSD: makesyscalls.sh,v 1.8 2001/08/26 04:10:56 deraadt Exp $ # $NetBSD: makesyscalls.sh,v 1.26 1998/01/09 06:17:51 thorpej Exp $ # # Copyright (c) 1994,1996 Christopher G. Demetriou @@ -175,8 +175,22 @@ NR == 1 { printf " * created from%s\n */\n\n", $0 > sysnumhdr printf " * created from%s\n */\n\n", $0 > sysarghdr - printf "#define\tsyscallarg(x)\tunion { x datum; register_t pad; }\n" \ + printf "#ifdef\tsyscallarg\n" > sysarghdr + printf "#undef\tsyscallarg\n" > sysarghdr + printf "#endif\n\n" > sysarghdr + printf "#define\tsyscallarg(x)\t\t\t\t\t\t\t\\\n" > sysarghdr + printf "\tunion {\t\t\t\t\t\t\t\t\\\n" > sysarghdr + printf "\t\tregister_t pad;\t\t\t\t\t\t\\\n" > sysarghdr + printf "\t\tstruct { x datum; } le;\t\t\t\t\t\\\n" > sysarghdr + printf "\t\tstruct {\t\t\t\t\t\t\\\n" > sysarghdr + printf "\t\t\tint8_t pad[ (sizeof (register_t) < sizeof (x))\t\\\n" \ > sysarghdr + printf "\t\t\t\t? 0\t\t\t\t\t\\\n" > sysarghdr + printf "\t\t\t\t: sizeof (register_t) - sizeof (x)];\t\\\n" \ + > sysarghdr + printf "\t\t\tx datum;\t\t\t\t\t\\\n" > sysarghdr + printf "\t\t} be;\t\t\t\t\t\t\t\\\n" > sysarghdr + printf "\t}\n" > sysarghdr next } NF == 0 || $1 ~ /^;/ { diff --git a/sys/sys/systm.h b/sys/sys/systm.h index f2821e0df68..6e53938b79b 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.42 2001/08/23 08:18:59 miod Exp $ */ +/* $OpenBSD: systm.h,v 1.43 2001/08/26 04:10:56 deraadt Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -108,7 +108,13 @@ extern struct sysent { /* system call table */ short sy_argsize; /* total size of arguments */ sy_call_t *sy_call; /* implementing function */ } sysent[]; -#define SCARG(p,k) ((p)->k.datum) /* get arg from args pointer */ +#if BYTE_ORDER == BIG_ENDIAN +#define SCARG(p, k) ((p)->k.be.datum) /* get arg from args pointer */ +#elif BYTE_ORDER == LITTLE_ENDIAN +#define SCARG(p, k) ((p)->k.le.datum) /* get arg from args pointer */ +#else +#error "what byte order is this machine?" +#endif #if defined(_KERNEL) && defined(SYSCALL_DEBUG) void scdebug_call __P((struct proc *p, register_t code, register_t retval[])); -- cgit v1.2.3