]> sourceware.org Git - glibc.git/commitdiff
* sysdeps/unix/sysv/linux/arm/profil-counter.h: Use the i386 version.
authorDaniel Jacobowitz <dan@codesourcery.com>
Fri, 21 Dec 2007 16:57:47 +0000 (16:57 +0000)
committerDaniel Jacobowitz <dan@codesourcery.com>
Fri, 21 Dec 2007 16:57:47 +0000 (16:57 +0000)
* sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump): Update
to use ucontext.
(REGISTER_DUMP): Likewise.
* sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT,
SIGCONTEXT_EXTRA_ARGS, GET_PC, GET_FRAME, GET_STACK): Likewise.
(sigaction, __sigaction): Define.
* sysdeps/unix/sysv/linux/arm/bits/armsigctx.h: Delete.

ChangeLog.arm
sysdeps/unix/sysv/linux/arm/bits/armsigctx.h [deleted file]
sysdeps/unix/sysv/linux/arm/profil-counter.h
sysdeps/unix/sysv/linux/arm/register-dump.h
sysdeps/unix/sysv/linux/arm/sigcontextinfo.h

index 140a789340405b7626d0810495eb5ae4add10d81..f23b2b92d91bdb6a6b4c062d37fcca3c40fc24bf 100644 (file)
@@ -1,3 +1,14 @@
+2007-12-21  Daniel Jacobowitz  <dan@codesourcery.com>
+
+       * sysdeps/unix/sysv/linux/arm/profil-counter.h: Use the i386 version.
+       * sysdeps/unix/sysv/linux/arm/register-dump.h (register_dump): Update
+       to use ucontext.
+       (REGISTER_DUMP): Likewise.
+       * sysdeps/unix/sysv/linux/arm/sigcontextinfo.h (SIGCONTEXT,
+       SIGCONTEXT_EXTRA_ARGS, GET_PC, GET_FRAME, GET_STACK): Likewise.
+       (sigaction, __sigaction): Define.
+       * sysdeps/unix/sysv/linux/arm/bits/armsigctx.h: Delete.
+
 2007-10-22  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * sysdeps/unix/sysv/linux/arm/bits/fcntl.h (F_DUPFD_CLOEXEC): Define.
diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h
deleted file mode 100644 (file)
index 4530cdb..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Definition of `struct sigcontext' for Linux/ARM
-   Copyright (C) 1996, 1997, 1998, 1999, 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-/* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
-   Fortunately 2.0 puts a magic number in the first word and this is not
-   a legal value for `trap_no', so we can tell them apart.  */
-
-/* Early 2.2 and 2.3 kernels do not have the `fault_address' member in
-   the sigcontext structure.  Unfortunately there is no reliable way
-   to test for its presence and this word will contain garbage for too-old
-   kernels.  Versions 2.2.14 and 2.3.35 (plus later versions) are known to
-   include this element.  */
-
-#ifndef __ARMSIGCTX_H
-#define __ARMSIGCTX_H  1
-
-#include <asm/ptrace.h>
-
-union k_sigcontext
-  {
-    struct
-      {
-       unsigned long int trap_no;
-       unsigned long int error_code;
-       unsigned long int oldmask;
-       unsigned long int arm_r0;
-       unsigned long int arm_r1;
-       unsigned long int arm_r2;
-       unsigned long int arm_r3;
-       unsigned long int arm_r4;
-       unsigned long int arm_r5;
-       unsigned long int arm_r6;
-       unsigned long int arm_r7;
-       unsigned long int arm_r8;
-       unsigned long int arm_r9;
-       unsigned long int arm_r10;
-       unsigned long int arm_fp;
-       unsigned long int arm_ip;
-       unsigned long int arm_sp;
-       unsigned long int arm_lr;
-       unsigned long int arm_pc;
-       unsigned long int arm_cpsr;
-       unsigned long fault_address;
-      } v21;
-    struct
-      {
-       unsigned long int magic;
-       struct pt_regs reg;
-       unsigned long int trap_no;
-       unsigned long int error_code;
-       unsigned long int oldmask;
-      } v20;
-};
-
-#define SIGCONTEXT_2_0_MAGIC   0x4B534154
-
-#endif /* bits/armsigctx.h */
index 7639883f10ebc982dc626d4f06959452bb524e33..8a6a0bcf3d5981b9a91c30f581ccd2529269b2c1 100644 (file)
@@ -1,37 +1,2 @@
-/* Low-level statistical profiling support function.  Linux/ARM version.
-   Copyright (C) 1996, 1997, 1998, 2002 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 Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 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
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
-
-#include <signal.h>
-#include <bits/armsigctx.h>
-
-void
-profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc)
-{
-  void *pc;
-  if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC)
-    pc = (void *) sc.v20.reg.ARM_pc;
-  else
-    pc = (void *) sc.v21.arm_pc;
-  profil_count (pc);
-
-  /* This is a hack to prevent the compiler from implementing the
-     above function call as a sibcall.  The sibcall would overwrite
-     the signal context.  */
-  asm volatile ("");
-}
+/* We can use the ix86 version.  */
+#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>
index 2baccb2cb757644f98dc5b333068bd114be5d6ff..73ec5fecfefbe8f8043450c751b1ad121ecb9ebd 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <sys/uio.h>
 #include <stdio-common/_itoa.h>
-#include <bits/armsigctx.h>
+#include <sys/ucontext.h>
 
 /* We will print the register dump in this format:
 
@@ -45,7 +45,7 @@ hexvalue (unsigned long int value, char *buf, size_t len)
 }
 
 static void
-register_dump (int fd, union k_sigcontext *ctx)
+register_dump (int fd, const struct ucontext *ctx)
 {
   char regs[21][8];
   struct iovec iov[97];
@@ -61,53 +61,27 @@ register_dump (int fd, union k_sigcontext *ctx)
   ++nr
 
   /* Generate strings of register contents.  */
-  if (ctx->v20.magic == SIGCONTEXT_2_0_MAGIC)
-    {
-      hexvalue (ctx->v20.reg.ARM_r0, regs[0], 8);
-      hexvalue (ctx->v20.reg.ARM_r1, regs[1], 8);
-      hexvalue (ctx->v20.reg.ARM_r2, regs[2], 8);
-      hexvalue (ctx->v20.reg.ARM_r3, regs[3], 8);
-      hexvalue (ctx->v20.reg.ARM_r4, regs[4], 8);
-      hexvalue (ctx->v20.reg.ARM_r5, regs[5], 8);
-      hexvalue (ctx->v20.reg.ARM_r6, regs[6], 8);
-      hexvalue (ctx->v20.reg.ARM_r7, regs[7], 8);
-      hexvalue (ctx->v20.reg.ARM_r8, regs[8], 8);
-      hexvalue (ctx->v20.reg.ARM_r9, regs[9], 8);
-      hexvalue (ctx->v20.reg.ARM_r10, regs[10], 8);
-      hexvalue (ctx->v20.reg.ARM_fp, regs[11], 8);
-      hexvalue (ctx->v20.reg.ARM_ip, regs[12], 8);
-      hexvalue (ctx->v20.reg.ARM_sp, regs[13], 8);
-      hexvalue (ctx->v20.reg.ARM_lr, regs[14], 8);
-      hexvalue (ctx->v20.reg.ARM_pc, regs[15], 8);
-      hexvalue (ctx->v20.reg.ARM_cpsr, regs[16], 8);
-      hexvalue (ctx->v20.trap_no, regs[17], 8);
-      hexvalue (ctx->v20.error_code, regs[18], 8);
-      hexvalue (ctx->v20.oldmask, regs[19], 8);
-    }
-  else
-    {
-      hexvalue (ctx->v21.arm_r0, regs[0], 8);
-      hexvalue (ctx->v21.arm_r1, regs[1], 8);
-      hexvalue (ctx->v21.arm_r2, regs[2], 8);
-      hexvalue (ctx->v21.arm_r3, regs[3], 8);
-      hexvalue (ctx->v21.arm_r4, regs[4], 8);
-      hexvalue (ctx->v21.arm_r5, regs[5], 8);
-      hexvalue (ctx->v21.arm_r6, regs[6], 8);
-      hexvalue (ctx->v21.arm_r7, regs[7], 8);
-      hexvalue (ctx->v21.arm_r8, regs[8], 8);
-      hexvalue (ctx->v21.arm_r9, regs[9], 8);
-      hexvalue (ctx->v21.arm_r10, regs[10], 8);
-      hexvalue (ctx->v21.arm_fp, regs[11], 8);
-      hexvalue (ctx->v21.arm_ip, regs[12], 8);
-      hexvalue (ctx->v21.arm_sp, regs[13], 8);
-      hexvalue (ctx->v21.arm_lr, regs[14], 8);
-      hexvalue (ctx->v21.arm_pc, regs[15], 8);
-      hexvalue (ctx->v21.arm_cpsr, regs[16], 8);
-      hexvalue (ctx->v21.trap_no, regs[17], 8);
-      hexvalue (ctx->v21.error_code, regs[18], 8);
-      hexvalue (ctx->v21.oldmask, regs[19], 8);
-      hexvalue (ctx->v21.fault_address, regs[20], 8);
-    }
+  hexvalue (ctx->uc_mcontext.arm_r0, regs[0], 8);
+  hexvalue (ctx->uc_mcontext.arm_r1, regs[1], 8);
+  hexvalue (ctx->uc_mcontext.arm_r2, regs[2], 8);
+  hexvalue (ctx->uc_mcontext.arm_r3, regs[3], 8);
+  hexvalue (ctx->uc_mcontext.arm_r4, regs[4], 8);
+  hexvalue (ctx->uc_mcontext.arm_r5, regs[5], 8);
+  hexvalue (ctx->uc_mcontext.arm_r6, regs[6], 8);
+  hexvalue (ctx->uc_mcontext.arm_r7, regs[7], 8);
+  hexvalue (ctx->uc_mcontext.arm_r8, regs[8], 8);
+  hexvalue (ctx->uc_mcontext.arm_r9, regs[9], 8);
+  hexvalue (ctx->uc_mcontext.arm_r10, regs[10], 8);
+  hexvalue (ctx->uc_mcontext.arm_fp, regs[11], 8);
+  hexvalue (ctx->uc_mcontext.arm_ip, regs[12], 8);
+  hexvalue (ctx->uc_mcontext.arm_sp, regs[13], 8);
+  hexvalue (ctx->uc_mcontext.arm_lr, regs[14], 8);
+  hexvalue (ctx->uc_mcontext.arm_pc, regs[15], 8);
+  hexvalue (ctx->uc_mcontext.arm_cpsr, regs[16], 8);
+  hexvalue (ctx->uc_mcontext.trap_no, regs[17], 8);
+  hexvalue (ctx->uc_mcontext.error_code, regs[18], 8);
+  hexvalue (ctx->uc_mcontext.oldmask, regs[19], 8);
+  hexvalue (ctx->uc_mcontext.fault_address, regs[20], 8);
 
   /* Generate the output.  */
   ADD_STRING ("Register dump:\n\n R0: ");
@@ -150,11 +124,8 @@ register_dump (int fd, union k_sigcontext *ctx)
   ADD_MEM (regs[18], 8);
   ADD_STRING ("   OldMask: ");
   ADD_MEM (regs[19], 8);
-  if (ctx->v20.magic != SIGCONTEXT_2_0_MAGIC)
-    {
-      ADD_STRING ("\n Addr: ");
-      ADD_MEM (regs[20], 8);
-    }
+  ADD_STRING ("\n Addr: ");
+  ADD_MEM (regs[20], 8);
 
   ADD_STRING ("\n");
 
@@ -163,4 +134,4 @@ register_dump (int fd, union k_sigcontext *ctx)
 }
 
 
-#define REGISTER_DUMP register_dump (fd, &ctx)
+#define REGISTER_DUMP register_dump (fd, ctx)
index 30c2e3a6ce030fc7f07fa9f7ae79cc695060cb4c..72136fdfa0d8d3e5dc33b312d38a921a399cffd3 100644 (file)
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <bits/armsigctx.h>
+#include <sys/ucontext.h>
 #include "kernel-features.h"
 
-#define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
-#define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
+#define SIGCONTEXT siginfo_t *_si, struct ucontext *
+#define SIGCONTEXT_EXTRA_ARGS _si,
 
 /* The sigcontext structure changed between 2.0 and 2.1 kernels.  On any
    modern system we should be able to assume that the "new" format will be
    in use.  */
-#if __LINUX_KERNEL_VERSION > 131328
 
-#define GET_PC(ctx)    ((void *) ctx.v21.arm_pc)
-#define GET_FRAME(ctx) ADVANCE_STACK_FRAME ((void *) ctx.v21.arm_fp)
-#define GET_STACK(ctx) ((void *) ctx.v21.arm_sp)
-
-#else
-
-#define GET_PC(ctx)    ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-                        ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
-#define GET_FRAME(ctx) \
-       ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-                        ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
-#define GET_STACK(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
-                        ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
-
-#endif
+#define GET_PC(ctx)    ((void *) (ctx)->uc_mcontext.arm_pc)
+#define GET_FRAME(ctx) ADVANCE_STACK_FRAME ((void *) ctx->uc_mcontext.arm_fp)
+#define GET_STACK(ctx) ((void *) (ctx)->uc_mcontext.arm_sp)
 
 #define ADVANCE_STACK_FRAME(frm)       \
                        ((struct layout *)frm - 1)
 
 #define CALL_SIGHANDLER(handler, signo, ctx) \
   (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
+
+/* There is no reliable way to get the sigcontext unless we use a
+   three-argument signal handler.  */
+#define __sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (__sigaction) (sig, act, oact); \
+})
+
+#define sigaction(sig, act, oact) ({ \
+  (act)->sa_flags |= SA_SIGINFO; \
+  (sigaction) (sig, act, oact); \
+})
This page took 0.060775 seconds and 5 git commands to generate.