Module Name:    src
Committed By:   martin
Date:           Tue Nov 19 13:36:25 UTC 2019

Modified Files:
        src/sys/compat/netbsd32 [netbsd-9]: netbsd32.h
        src/sys/compat/sys [netbsd-9]: siginfo.h

Log Message:
Pull up following revision(s) (requested by rin in ticket #457):

        sys/compat/sys/siginfo.h: revision 1.9
        sys/compat/netbsd32/netbsd32.h: revision 1.131

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.

Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.4.1 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/compat/sys/siginfo.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.123 src/sys/compat/netbsd32/netbsd32.h:1.123.4.1
--- src/sys/compat/netbsd32/netbsd32.h:1.123	Wed Feb 20 06:04:28 2019
+++ src/sys/compat/netbsd32/netbsd32.h	Tue Nov 19 13:36:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.123 2019/02/20 06:04:28 mrg Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.123.4.1 2019/11/19 13:36:25 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -162,6 +162,10 @@ typedef int64_t netbsd32_int64 NETBSD32_
 typedef uint64_t netbsd32_uint64 NETBSD32_INT64_ALIGN;
 #undef NETBSD32_INT64_ALIGN
 
+/* Type used in siginfo, avoids circular dependencies between headers. */
+CTASSERT(sizeof(netbsd32_uint64) == sizeof(netbsd32_siginfo_uint64));
+CTASSERT(__alignof__(netbsd32_uint64) == __alignof__(netbsd32_siginfo_uint64));
+
 /*
  * all pointers are netbsd32_pointer_t (defined in <machine/netbsd32_machdep.h>)
  */

Index: src/sys/compat/sys/siginfo.h
diff -u src/sys/compat/sys/siginfo.h:1.7.2.1 src/sys/compat/sys/siginfo.h:1.7.2.2
--- src/sys/compat/sys/siginfo.h:1.7.2.1	Tue Oct 15 18:32:13 2019
+++ src/sys/compat/sys/siginfo.h	Tue Nov 19 13:36:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.7.2.1 2019/10/15 18:32:13 martin Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.7.2.2 2019/11/19 13:36:25 martin Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,6 +34,15 @@
 
 #ifdef _KERNEL
 
+/* Avoids circular dependency with machine/netbsd32_machdep.h */
+#if defined(__x86_64__) || (defined(__arm__) && defined(__ARM_EABI__))
+#define NETBSD32_SIGINFO_UINT64_ALIGN __attribute__((__aligned__(4)))
+#else
+#define NETBSD32_SIGINFO_UINT64_ALIGN __attribute__((__aligned__(8)))
+#endif
+typedef uint64_t netbsd32_siginfo_uint64 NETBSD32_SIGINFO_UINT64_ALIGN;
+#undef NETBSD32_SIGINFO_UINT64_ALIGN
+
 typedef union sigval32 {
 	int sival_int;
 	uint32_t sival_ptr;
@@ -73,7 +82,7 @@ struct __ksiginfo32 {
 			int	_sysnum;
 			int	_retval[2];
 			int	_error;
-			uint64_t _args[8]; /* SYS_MAXSYSARGS */
+			netbsd32_siginfo_uint64 _args[8]; /* SYS_MAXSYSARGS */
 		} _syscall;
 
 		struct {

Reply via email to