This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: SPARC and header files


Hi!

Here is a patch which should reflect the current signal layout.
On SPARC 32bit userland there is a problem because we have 3 incompatible
signal contexts (old style, "new" style and real time).
struct sigcontext from kernel headers used to describe the old (SunOS) style
which glibc makes sure is never sent, so even if some application used it,
it would be better if it did not compile.
sys/procfs.h is not yet done, the structure are bogus as well but I have to
find the best way how to layout things both in glibc (so that things are
clean) and in gdb (so that it compiles/works both with glibc 2.2, glibc 2.0,
libc5 and older/more recent kernel headers).

2000-03-16  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h: New file.
	* sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h: Use struct
	sigcontext.
	* sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h: Likewise.

--- libc/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h.jj	Thu Mar 16 17:47:58 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h	Thu Mar 16 17:25:10 2000
@@ -0,0 +1,79 @@
+/* Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
+# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+
+/* It is quite hard to choose what to put here, because
+ * Linux/sparc32 had at least 3 totally incompatible
+ * signal stack layouts.
+ * This one is for the "new" style signals, which are
+ * now delivered unless SA_SIGINFO is requested.
+ */
+
+typedef struct sigcontext
+  {
+    struct
+      {
+	unsigned int	psr;
+	unsigned int	pc;
+	unsigned int	npc;
+	unsigned int	y;
+	unsigned int	u_regs[16]; /* globals and ins */
+      }			si_regs;
+    int			si_mask;
+  };
+
+#else /* sparc64 */
+
+typedef struct
+  {
+    unsigned int	si_float_regs [64];
+    unsigned long	si_fsr;
+    unsigned long	si_gsr;
+    unsigned long	si_fprs;
+  } __siginfo_fpu_t;
+
+struct sigcontext
+  {
+    char		sigc_info[128];
+    struct
+      {
+	unsigned long	u_regs[16]; /* globals and ins */
+	unsigned long	tstate;
+	unsigned long	tpc;
+	unsigned long	tnpc;
+	unsigned int	y;
+	unsigned int	fprs;
+      }			sigc_regs;
+    __siginfo_fpu_t *	sigc_fpu_save;
+    struct
+      {
+	void *		ss_sp;
+	int		ss_flags;
+	unsigned long	ss_size;
+      }			sigc_stack;
+    unsigned long	sigc_mask;
+};
+
+#endif /* sparc64 */
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h.jj	Wed Feb  3 10:30:19 1999
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/profil-counter.h	Thu Mar 16 17:49:41 2000
@@ -20,7 +20,7 @@
 #include <signal.h>
 
 void
-profil_counter (int signo, __siginfo_t *si)
+profil_counter (int signo, struct sigcontext *si)
 {
   profil_count ((void *) si->si_regs.pc);
 }
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h.jj	Mon Jan 17 07:58:55 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h	Thu Mar 16 17:50:17 2000
@@ -17,7 +17,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-#define SIGCONTEXT __siginfo_t *
+#define SIGCONTEXT struct sigcontext *
 #define SIGCONTEXT_EXTRA_ARGS
 #define GET_PC(__ctx)	((void *) ((__ctx)->si_regs.pc))
 #define ADVANCE_STACK_FRAME(__next) \


Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.99-pre2 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]