]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/arm/bits/sigcontextinfo.h
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / arm / bits / sigcontextinfo.h
1 /* 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, see
17    <http://www.gnu.org/licenses/>.  */
18
19 #include <bits/armsigctx.h>
20 #include <linux/version.h>
21
22 #define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
23 #define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
24
25 /* The sigcontext structure changed between 2.0 and 2.1 kernels.  On any
26    modern system we should be able to assume that the "new" format will be
27    in use.  */
28 #if LINUX_VERSION_CODE > 131328
29
30 #define GET_PC(ctx)     ((void *) ctx.v21.arm_pc)
31 #define GET_FRAME(ctx)  ADVANCE_STACK_FRAME ((void *) ctx.v21.arm_fp)
32 #define GET_STACK(ctx)  ((void *) ctx.v21.arm_sp)
33
34 #else
35
36 #define GET_PC(ctx)     ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
37                          ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
38 #define GET_FRAME(ctx)  \
39         ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
40                          ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
41 #define GET_STACK(ctx)  ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
42                          ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
43
44 #endif
45
46 #define ADVANCE_STACK_FRAME(frm)        \
47                         ((struct layout *)frm - 1)
48
49 #define CALL_SIGHANDLER(handler, signo, ctx) \
50   (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))