diff options
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/bits/armsigctx.h | 59 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/profil-counter.h | 42 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/register-dump.h | 69 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/socket.h | 2 |
4 files changed, 110 insertions, 62 deletions
diff --git a/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h new file mode 100644 index 0000000000..395e194293 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/bits/armsigctx.h @@ -0,0 +1,59 @@ +/* Definition of `struct sigcontext' for Linux/ARM + Copyright (C) 1996, 1997, 1998 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. */ + +/* 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. */ + +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; + } 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 diff --git a/sysdeps/unix/sysv/linux/arm/profil-counter.h b/sysdeps/unix/sysv/linux/arm/profil-counter.h index 0d5024fa47..55a11bd76b 100644 --- a/sysdeps/unix/sysv/linux/arm/profil-counter.h +++ b/sysdeps/unix/sysv/linux/arm/profil-counter.h @@ -19,51 +19,13 @@ #include <signal.h> #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; - } 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; -}; +#include <bits/armsigctx.h> void profil_counter (int signo, int _a2, int _a3, int _a4, union k_sigcontext sc) { - /* 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. */ - void *pc; - if (sc.v20.magic == 0x4B534154) + if (sc.v20.magic == SIGCONTEXT_2_0_MAGIC) pc = (void *) sc.v20.reg.ARM_pc; else pc = (void *) sc.v21.arm_pc; diff --git a/sysdeps/unix/sysv/linux/arm/register-dump.h b/sysdeps/unix/sysv/linux/arm/register-dump.h index 1b948ab5ff..015780c623 100644 --- a/sysdeps/unix/sysv/linux/arm/register-dump.h +++ b/sysdeps/unix/sysv/linux/arm/register-dump.h @@ -20,6 +20,7 @@ #include <sys/uio.h> #include <stdio-common/_itoa.h> +#include <bits/armsigctx.h> /* We will print the register dump in this format: @@ -43,7 +44,7 @@ hexvalue (unsigned long int value, char *buf, size_t len) } static void -register_dump (int fd, struct sigcontext *ctx) +register_dump (int fd, union k_sigcontext *ctx) { char regs[20][8]; struct iovec iov[97]; @@ -59,26 +60,52 @@ register_dump (int fd, struct sigcontext *ctx) ++nr /* Generate strings of register contents. */ - hexvalue (ctx->arm_r0, regs[0], 8); - hexvalue (ctx->arm_r1, regs[1], 8); - hexvalue (ctx->arm_r2, regs[2], 8); - hexvalue (ctx->arm_r3, regs[3], 8); - hexvalue (ctx->arm_r4, regs[4], 8); - hexvalue (ctx->arm_r5, regs[5], 8); - hexvalue (ctx->arm_r6, regs[6], 8); - hexvalue (ctx->arm_r7, regs[7], 8); - hexvalue (ctx->arm_r8, regs[8], 8); - hexvalue (ctx->arm_r9, regs[9], 8); - hexvalue (ctx->arm_r10, regs[10], 4); - hexvalue (ctx->arm_fp, regs[11], 4); - hexvalue (ctx->arm_ip, regs[12], 4); - hexvalue (ctx->arm_sp, regs[13], 4); - hexvalue (ctx->arm_lr, regs[14], 4); - hexvalue (ctx->arm_pc, regs[15], 4); - hexvalue (ctx->arm_cpsr, regs[16], 8); - hexvalue (ctx->trap_no, regs[17], 8); - hexvalue (ctx->error_code, regs[18], 8); - hexvalue (ctx->old_mask, regs[19], 8); + 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], 4); + hexvalue (ctx->v20.reg.ARM_fp, regs[11], 4); + hexvalue (ctx->v20.reg.ARM_ip, regs[12], 4); + hexvalue (ctx->v20.reg.ARM_sp, regs[13], 4); + hexvalue (ctx->v20.reg.ARM_lr, regs[14], 4); + hexvalue (ctx->v20.reg.ARM_pc, regs[15], 4); + 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], 4); + hexvalue (ctx->v21.arm_fp, regs[11], 4); + hexvalue (ctx->v21.arm_ip, regs[12], 4); + hexvalue (ctx->v21.arm_sp, regs[13], 4); + hexvalue (ctx->v21.arm_lr, regs[14], 4); + hexvalue (ctx->v21.arm_pc, regs[15], 4); + 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); + } /* Generate the output. */ ADD_STRING ("Register dump:\n\n R0: "); diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index eef389db44..47d70611f1 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -227,7 +227,7 @@ enum SCM_CREDENTIALS = 0x02, /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif - __SCM_CONNECT = 0x03, /* Data array is `struct scm_connect'. */ + __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */ }; /* User visible structure for SCM_CREDENTIALS message */ |