diff options
author | bo <bo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-26 07:05:56 +0000 |
---|---|---|
committer | bo <bo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-26 07:05:56 +0000 |
commit | 0e73d519923f66d224b9481ece36246c36cb6a7a (patch) | |
tree | 9407a4a1613bddaf25c5582a911fe46f122a9620 /gcc/config/i386/linux64.h | |
parent | 87215b905fa696bfb36549cc49d36c815f022392 (diff) | |
download | gcc-0e73d519923f66d224b9481ece36246c36cb6a7a.tar.gz |
2002-04-26 Bo Thorsen <bo@suse.co.uk>
* config/i386/linux64.h (MD_FALLBACK_FRAME_STATE_FOR): Define for
x86-64.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52781 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/i386/linux64.h')
-rw-r--r-- | gcc/config/i386/linux64.h | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/gcc/config/i386/linux64.h b/gcc/config/i386/linux64.h index 7d5ae8d7539..e457a7dedc7 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) |