summaryrefslogtreecommitdiff
path: root/gcc/config/sh/linux.h
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 00:17:19 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-08 00:17:19 +0000
commitaebd6cb6ec855cc4f9a07a694847b4a19fe5759a (patch)
treef6927bd90fe84c682dd04619d255d6355aac36d5 /gcc/config/sh/linux.h
parent97307e4d7dc6478c0d70de1816c9009a100f5542 (diff)
downloadgcc-aebd6cb6ec855cc4f9a07a694847b4a19fe5759a.tar.gz
* doc/tm.texi (MD_UNWIND_SUPPORT): Document.
(MD_FALLBACK_FRAME_STATE_FOR): Update. * unwind-dw2.c (MD_UNWIND_SUPPORT): #include if defined. (uw_frame_state_for): Adjust MD_FALLBACK_FRAME_STATE_FOR invocation. (MD_FROB_UPDATE_CONTEXT): Remove default. (uw_update_context_1): Instead #ifdef invocation. * config/ia64/unwind-ia64.c (MD_UNWIND_SUPPORT): #include if defined. (uw_frame_state_for): Adjust MD_FALLBACK_FRAME_STATE_FOR invocation. * config/alpha/gnu.h (MD_FALLBACK_FRAME_STATE_FOR): Don't undef. (MD_UNWIND_SUPPORT): Undefine this instead. * config/i386/gnu.h: Likewise. * config/alpha/linux-unwind.h: New file, macro converted to function, extracted from.. * config/alpha/linux.h (MD_FALLBACK_FRAME_STATE_FOR): ..this. (MD_UNWIND_SUPPORT): Define. * config/alpha/vms-unwind.h, config/alpha/vms.h: Likewise. * config/i386/linux-unwind.h, config/i386/linux.h, config/i386/linux64.h: Likewise. * config/ia64/linux-unwind.h, config/ia64/linux.h: Likewise. MD_HANDLE_UNWABI too. * config/mips/linux-unwind.h, config/mips/linux.h: Likewise. * config/pa/linux-unwind.h, config/pa/pa32-linux.h: Likewise. * config/rs6000/darwin-unwind.h, config/rs6000/darwin.h: Likewise. * config/s390/linux-unwind.h, config/s390/linux.h: Likewise. * config/sparc/linux-unwind.h, config/sparc/linux.h, config/sparc/linux64.h: Likewise. * config/sh/linux-unwind.h, config/sh/linux.h: Likewise, but merge SH_FALLBACK_FRAME_FLOAT_STATE into sh_fallback_frame_state. * config/rs6000/linux-unwind.h, config/rs6000/linux.h, config/rs6000/linux64.h: Likewise. Split out get_sigcontext function. Use ARG_POINTER_REGNUM for 32-bit temp reg too. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87167 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sh/linux.h')
-rw-r--r--gcc/config/sh/linux.h154
1 files changed, 1 insertions, 153 deletions
diff --git a/gcc/config/sh/linux.h b/gcc/config/sh/linux.h
index b01b52d28db..1142b126946 100644
--- a/gcc/config/sh/linux.h
+++ b/gcc/config/sh/linux.h
@@ -147,159 +147,7 @@ do { \
fprintf (STREAM, "2:\tlds.l\t@r15+,pr\n"); \
} while (0)
-/* 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>
-#include "insn-constants.h"
-
-# if defined (__SH5__)
-#define SH_DWARF_FRAME_GP0 0
-#define SH_DWARF_FRAME_FP0 (__SH5__ == 32 ? 245 : 77)
-#define SH_DWARF_FRAME_XD0 289
-#define SH_DWARF_FRAME_BT0 68
-#define SH_DWARF_FRAME_PR 241
-#define SH_DWARF_FRAME_PR_MEDIA 18
-#define SH_DWARF_FRAME_GBR 238
-#define SH_DWARF_FRAME_MACH 239
-#define SH_DWARF_FRAME_MACL 240
-#define SH_DWARF_FRAME_PC 64
-#define SH_DWARF_FRAME_SR 65
-#define SH_DWARF_FRAME_FPUL 244
-#define SH_DWARF_FRAME_FPSCR 243
-#else
-#define SH_DWARF_FRAME_GP0 0
-#define SH_DWARF_FRAME_FP0 25
-#define SH_DWARF_FRAME_XD0 87
-#define SH_DWARF_FRAME_PR 17
-#define SH_DWARF_FRAME_GBR 19
-#define SH_DWARF_FRAME_MACH 20
-#define SH_DWARF_FRAME_MACL 21
-#define SH_DWARF_FRAME_PC 16
-#define SH_DWARF_FRAME_SR 22
-#define SH_DWARF_FRAME_FPUL 23
-#define SH_DWARF_FRAME_FPSCR 24
-#endif /* defined (__SH5__) */
-
-#if defined (__SH5__)
-/* MD_FALLBACK_FRAME_STATE_FOR is not yet defined for SHMEDIA. */
-#else /* defined (__SH5__) */
-
-#if defined (__SH3E__) || defined (__SH4__)
-#define SH_FALLBACK_FRAME_FLOAT_STATE(SC, FS, CFA) \
- do { \
- int i_, r_; \
- \
- r_ = SH_DWARF_FRAME_FP0; \
- for (i_ = 0; i_ < 16; i_++) \
- { \
- (FS)->regs.reg[r_+i_].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[r_+i_].loc.offset \
- = (long)&((SC)->sc_fpregs[i_]) - (CFA); \
- } \
- \
- r_ = SH_DWARF_FRAME_XD0 ; \
- for (i_ = 0; i_ < 8; i_++) \
- { \
- (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[i_].loc.offset \
- = (long)&((SC)->sc_xfpregs[2*i_]) - (CFA); \
- } \
- \
- (FS)->regs.reg[SH_DWARF_FRAME_FPUL].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_FPUL].loc.offset \
- = (long)&((SC)->sc_fpul) - (CFA); \
- (FS)->regs.reg[SH_DWARF_FRAME_FPSCR].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_FPSCR].loc.offset \
- = (long)&((SC)->sc_fpscr) - (CFA); \
- } while (0)
-
-#else
-#define SH_FALLBACK_FRAME_FLOAT_STATE(SC, FS, CFA)
-#endif
-
-#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
- do { \
- unsigned char *pc_ = (CONTEXT)->ra; \
- struct sigcontext *sc_; \
- long new_cfa_; \
- int i_; \
- \
- /* mov.w 1f,r3; trapa #0x10; 1: .short 0x77 (sigreturn) */ \
- /* mov.w 1f,r3; trapa #0x10; 1: .short 0xad (rt_sigreturn) */ \
- /* Newer kernel uses pad instructions to avoid an SH-4 core bug. */\
- /* mov.w 1f,r3; trapa #0x10; or r0,r0; or r0,r0; or r0,r0; or r0,r0;\
- or r0,r0; 1: .short 0x77 (sigreturn) */ \
- /* mov.w 1f,r3; trapa #0x10; or r0,r0; or r0,r0; or r0,r0; or r0,r0;\
- or r0,r0; 1: .short 0xad (rt_sigreturn) */ \
- if (((*(unsigned short *) (pc_+0) == 0x9300) \
- && (*(unsigned short *) (pc_+2) == 0xc310) \
- && (*(unsigned short *) (pc_+4) == 0x0077)) \
- || (((*(unsigned short *) (pc_+0) == 0x9305) \
- && (*(unsigned short *) (pc_+2) == 0xc310) \
- && (*(unsigned short *) (pc_+14) == 0x0077)))) \
- sc_ = (CONTEXT)->cfa; \
- else if (((*(unsigned short *) (pc_+0) == 0x9300) \
- && (*(unsigned short *) (pc_+2) == 0xc310) \
- && (*(unsigned short *) (pc_+4) == 0x00ad)) \
- || (((*(unsigned short *) (pc_+0) == 0x9305) \
- && (*(unsigned short *) (pc_+2) == 0xc310) \
- && (*(unsigned short *) (pc_+14) == 0x00ad)))) \
- { \
- struct rt_sigframe { \
- struct siginfo info; \
- struct ucontext uc; \
- } *rt_ = (CONTEXT)->cfa; \
- sc_ = (struct sigcontext *) &rt_->uc.uc_mcontext; \
- } \
- else \
- break; \
- \
- new_cfa_ = sc_->sc_regs[15]; \
- (FS)->cfa_how = CFA_REG_OFFSET; \
- (FS)->cfa_reg = 15; \
- (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \
- \
- for (i_ = 0; i_ < 15; i_++) \
- { \
- (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[i_].loc.offset \
- = (long)&(sc_->sc_regs[i_]) - new_cfa_; \
- } \
- \
- (FS)->regs.reg[SH_DWARF_FRAME_PR].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_PR].loc.offset \
- = (long)&(sc_->sc_pr) - new_cfa_; \
- (FS)->regs.reg[SH_DWARF_FRAME_SR].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_SR].loc.offset \
- = (long)&(sc_->sc_sr) - new_cfa_; \
- (FS)->regs.reg[SH_DWARF_FRAME_GBR].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_GBR].loc.offset \
- = (long)&(sc_->sc_gbr) - new_cfa_; \
- (FS)->regs.reg[SH_DWARF_FRAME_MACH].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_MACH].loc.offset \
- = (long)&(sc_->sc_mach) - new_cfa_; \
- (FS)->regs.reg[SH_DWARF_FRAME_MACL].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_MACL].loc.offset \
- = (long)&(sc_->sc_macl) - new_cfa_; \
- \
- SH_FALLBACK_FRAME_FLOAT_STATE(sc_, (FS), new_cfa_); \
- \
- /* The unwinder expects the PC to point to the following insn, \
- whereas the kernel returns the address of the actual \
- faulting insn. */ \
- sc_->sc_pc += 2; \
- (FS)->regs.reg[SH_DWARF_FRAME_PC].how = REG_SAVED_OFFSET; \
- (FS)->regs.reg[SH_DWARF_FRAME_PC].loc.offset \
- = (long)&(sc_->sc_pc) - new_cfa_; \
- (FS)->retaddr_column = SH_DWARF_FRAME_PC; \
- goto SUCCESS; \
- } while (0)
-
-#endif /* defined (__SH5__) */
-#endif /* IN_LIBGCC2 */
+#define MD_UNWIND_SUPPORT "config/sh/linux-unwind.h"
/* For SH3 and SH4, we use a slot of the unwind frame which correspond
to a fake register number 16 as a placeholder for the return address