1 /* Fault handler information. Linux/i386 and Linux/x86_64 version when it
3 Copyright (C) 2002, 2009 Bruno Haible <bruno@clisp.org>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2, or (at your option)
10 This program 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
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19 #include "fault-posix-ucontext.h"
21 #if defined __x86_64__
22 /* 64 bit registers */
24 /* See glibc/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
25 and the definition of GET_STACK in
26 glibc/sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h.
27 Note that the 'mcontext_t' defined in
28 glibc/sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
29 and the 'struct sigcontext' defined in
30 glibc/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
31 (see also <asm/sigcontext.h>)
32 are effectively the same. */
34 # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_RSP]
37 /* 32 bit registers */
39 /* See glibc/sysdeps/unix/sysv/linux/i386/sys/ucontext.h
40 and the definition of GET_STACK in
41 glibc/sysdeps/unix/sysv/linux/i386/sigcontextinfo.h.
42 Note that the 'mcontext_t' defined in
43 glibc/sysdeps/unix/sysv/linux/i386/sys/ucontext.h
44 and the 'struct sigcontext_ia32' defined in <asm/sigcontext32.h>
45 are effectively the same. */
47 # define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_ESP]
48 /* same value as ((ucontext_t *) ucp)->uc_mcontext.gregs[REG_UESP] */