1 |
2 |
drasko |
/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
2 |
|
|
This file is part of the GNU C Library.
|
3 |
|
|
Contributed by Philip Blundell <philb@gnu.org>, 1999.
|
4 |
|
|
|
5 |
|
|
The GNU C Library is free software; you can redistribute it and/or
|
6 |
|
|
modify it under the terms of the GNU Lesser General Public
|
7 |
|
|
License as published by the Free Software Foundation; either
|
8 |
|
|
version 2.1 of the License, or (at your option) any later version.
|
9 |
|
|
|
10 |
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
11 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 |
|
|
Lesser General Public License for more details.
|
14 |
|
|
|
15 |
|
|
You should have received a copy of the GNU Lesser General Public
|
16 |
|
|
License along with the GNU C Library; if not, write to the Free
|
17 |
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
18 |
|
|
02111-1307 USA. */
|
19 |
|
|
|
20 |
|
|
#include <bits/armsigctx.h>
|
21 |
|
|
#include <linux/version.h>
|
22 |
|
|
|
23 |
|
|
#define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
|
24 |
|
|
#define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
|
25 |
|
|
|
26 |
|
|
/* The sigcontext structure changed between 2.0 and 2.1 kernels. On any
|
27 |
|
|
modern system we should be able to assume that the "new" format will be
|
28 |
|
|
in use. */
|
29 |
|
|
#if LINUX_VERSION_CODE > 131328
|
30 |
|
|
|
31 |
|
|
#define GET_PC(ctx) ((void *) ctx.v21.arm_pc)
|
32 |
|
|
#define GET_FRAME(ctx) ADVANCE_STACK_FRAME ((void *) ctx.v21.arm_fp)
|
33 |
|
|
#define GET_STACK(ctx) ((void *) ctx.v21.arm_sp)
|
34 |
|
|
|
35 |
|
|
#else
|
36 |
|
|
|
37 |
|
|
#define GET_PC(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
|
38 |
|
|
ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
|
39 |
|
|
#define GET_FRAME(ctx) \
|
40 |
|
|
ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
|
41 |
|
|
ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
|
42 |
|
|
#define GET_STACK(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
|
43 |
|
|
ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
|
44 |
|
|
|
45 |
|
|
#endif
|
46 |
|
|
|
47 |
|
|
#define ADVANCE_STACK_FRAME(frm) \
|
48 |
|
|
((struct layout *)frm - 1)
|
49 |
|
|
|
50 |
|
|
#define CALL_SIGHANDLER(handler, signo, ctx) \
|
51 |
|
|
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
|