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]

SPARC and header files



Hi,

On SPARC, the following code:

#define _GNU_SOURCE
#include <sys/ptrace.h>
#include <signal.h>

does not compile. signal includes bits/sigcontext.h, which includes
on SPARC asm/ptrace.h -> conflict with sys/ptrace.h

But if I create a special SPARC bits/sigcontext.h, I get problems
with linuxthreads :( asm/ptrace.h will be included over asm/elf.h,
sys/procfs.h.
What also means, the following doesn't work on SPARC, too:

#include <sys/ptrace.h>
#include <sys/procfs.h>

I have added my current patch, maybe somebody else can fix the problem
with sys/procfs.h

  Thorsten
-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/       kukuk@suse.de
SuSE GmbH            Schanzaeckerstr. 10            90443 Nuernberg
Linux is like a Vorlon.  It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.
2000-03-16  Thorsten Kukuk  <kukuk@suse.de>

	* sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h: New.

--- sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h
+++ sysdeps/unix/sysv/linux/sparc/bits/sigcontext.h	2000/03/16 14:03:45
@@ -0,0 +1,126 @@
+/* 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>
+
+#define SUNOS_MAXWIN   31
+
+/* A register window */
+struct reg_window {
+  unsigned long locals[8];
+  unsigned long ins[8];
+};
+
+#if __WORDSIZE == 64
+
+/* This is what SunOS doesn't, so we have to write this alone. */
+struct sigcontext {
+  int sigc_onstack;      /* state to restore */
+  int sigc_mask;         /* sigmask to restore */
+  unsigned long sigc_sp;   /* stack pointer */
+  unsigned long sigc_pc;   /* program counter */
+  unsigned long sigc_npc;  /* next program counter */
+  unsigned long sigc_psr;  /* for condition codes etc */
+  unsigned long sigc_g1;   /* User uses these two registers */
+  unsigned long sigc_o0;   /* within the trampoline code. */
+
+  /* Now comes information regarding the users window set
+     at the time of the signal. */
+  int sigc_oswins;       /* outstanding windows */
+
+  /* stack ptrs for each regwin buf */
+  char *sigc_spbuf[SUNOS_MAXWIN];
+
+  /* Windows to restore after signal */
+  struct reg_window sigc_wbuf[SUNOS_MAXWIN];
+};
+
+struct pt_regs {
+        unsigned long u_regs[16]; /* globals and ins */
+        unsigned long tstate;
+        unsigned long tpc;
+        unsigned long tnpc;
+        unsigned int y;
+        unsigned int fprs;
+};
+
+typedef struct {
+        struct     pt_regs si_regs;
+        long       si_mask;
+} __siginfo_t;
+
+typedef struct {
+        unsigned   int si_float_regs [64];
+        unsigned   long si_fsr;
+        unsigned   long si_gsr;
+        unsigned   long si_fprs;
+} __siginfo_fpu_t;
+
+#else
+
+/* This is what SunOS does, so shall I. */
+struct sigcontext {
+  int sigc_onstack;      /* state to restore */
+  int sigc_mask;         /* sigmask to restore */
+  int sigc_sp;           /* stack pointer */
+  int sigc_pc;           /* program counter */
+  int sigc_npc;          /* next program counter */
+  int sigc_psr;          /* for condition codes etc */
+  int sigc_g1;           /* User uses these two registers */
+  int sigc_o0;           /* within the trampoline code. */
+
+  /* Now comes information regarding the users window set
+     at the time of the signal. */
+  int sigc_oswins;       /* outstanding windows */
+
+  /* stack ptrs for each regwin buf */
+  char *sigc_spbuf[SUNOS_MAXWIN];
+
+  /* Windows to restore after signal */
+  struct reg_window sigc_wbuf[SUNOS_MAXWIN];
+};
+
+struct pt_regs {
+        unsigned long psr;
+        unsigned long pc;
+        unsigned long npc;
+        unsigned long y;
+        unsigned long u_regs[16]; /* globals and ins */
+};
+
+typedef struct {
+  struct pt_regs  si_regs;
+  int             si_mask;
+} __siginfo_t;
+
+typedef struct {
+  unsigned   long si_float_regs [32];
+  unsigned   long si_fsr;
+  unsigned   long si_fpqdepth;
+  struct {
+    unsigned long *insn_addr;
+    unsigned long insn;
+  } si_fpqueue [16];
+} __siginfo_fpu_t;
+
+#endif
+

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