diff options
author | Bo Thorsen <bo@suse.co.uk> | 2002-04-26 07:05:56 +0000 |
---|---|---|
committer | Bo Thorsen <bo@gcc.gnu.org> | 2002-04-26 09:05:56 +0200 |
commit | d8ae8cd480b11169cbb725e296cc0a1d0302c73a (patch) | |
tree | 9407a4a1613bddaf25c5582a911fe46f122a9620 /gcc | |
parent | f8b954fcdc0446691171bd20e6cb218799d4d1a9 (diff) | |
download | gcc-d8ae8cd480b11169cbb725e296cc0a1d0302c73a.zip gcc-d8ae8cd480b11169cbb725e296cc0a1d0302c73a.tar.gz gcc-d8ae8cd480b11169cbb725e296cc0a1d0302c73a.tar.bz2 |
linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Define for x86-64.
2002-04-26 Bo Thorsen <bo@suse.co.uk>
* config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Define for
x86-64.
From-SVN: r52781
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/config/i386/linux64.h | 65 |
2 files changed, 70 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93dd23b..185b49a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2002-04-26 Bo Thorsen <bo@suse.co.uk> + + * config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Define for + x86-64. + 2002-04-26 Neil Booth <neil@daikokuya.demon.co.uk> * cppexp.c (CPP_UMINUS, CPP_UPLUS): New. diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h index 7d5ae8d..e457a7d 100644 --- a/gcc/config/i386/linux64.h +++ b/gcc/config/i386/linux64.h @@ -64,3 +64,68 @@ Boston, MA 02111-1307, USA. */ #define ENDFILE_SPEC "\ %{m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s} \ %{!m32:%{!shared:crtend.o%s} %{shared:crtendS.o%s} /usr/lib64/crtn.o%s}" + +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + +#ifdef IN_LIBGCC2 +#include <signal.h> +#include <sys/ucontext.h> +#endif + +#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ + do { \ + unsigned char *pc_ = (CONTEXT)->ra; \ + struct sigcontext *sc_; \ + long new_cfa_; \ + \ + /* movq __NR_rt_sigreturn, %rax ; syscall */ \ + if (*(unsigned char *)(pc_+0) == 0x48 \ + && *(unsigned long *)(pc_+1) == 0x050f0000000fc0c7) \ + { \ + struct ucontext *uc_ = (CONTEXT)->cfa; \ + sc_ = (struct sigcontext *) &uc_->uc_mcontext; \ + } \ + else \ + break; \ + \ + new_cfa_ = sc_->rsp; \ + (FS)->cfa_how = CFA_REG_OFFSET; \ + /* Register 7 is rsp */ \ + (FS)->cfa_reg = 7; \ + (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ + \ + /* The SVR4 register numbering macros aren't usable in libgcc. */ \ + (FS)->regs.reg[0].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[0].loc.offset = (long)&sc_->rax - new_cfa_; \ + (FS)->regs.reg[1].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[1].loc.offset = (long)&sc_->rbx - new_cfa_; \ + (FS)->regs.reg[2].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[2].loc.offset = (long)&sc_->rcx - new_cfa_; \ + (FS)->regs.reg[3].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[3].loc.offset = (long)&sc_->rdx - new_cfa_; \ + (FS)->regs.reg[4].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[4].loc.offset = (long)&sc_->rbp - new_cfa_; \ + (FS)->regs.reg[5].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[5].loc.offset = (long)&sc_->rsi - new_cfa_; \ + (FS)->regs.reg[6].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[6].loc.offset = (long)&sc_->rdi - new_cfa_; \ + (FS)->regs.reg[8].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[8].loc.offset = (long)&sc_->r8 - new_cfa_; \ + (FS)->regs.reg[9].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[9].loc.offset = (long)&sc_->r9 - new_cfa_; \ + (FS)->regs.reg[10].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[10].loc.offset = (long)&sc_->r10 - new_cfa_; \ + (FS)->regs.reg[11].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[11].loc.offset = (long)&sc_->r11 - new_cfa_; \ + (FS)->regs.reg[12].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[12].loc.offset = (long)&sc_->r12 - new_cfa_; \ + (FS)->regs.reg[13].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[13].loc.offset = (long)&sc_->r13 - new_cfa_; \ + (FS)->regs.reg[14].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[14].loc.offset = (long)&sc_->r14 - new_cfa_; \ + (FS)->regs.reg[15].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[15].loc.offset = (long)&sc_->r15 - new_cfa_; \ + (FS)->retaddr_column = 16; \ + goto SUCCESS; \ + } while (0) |