summaryrefslogtreecommitdiff
path: root/gcc/config/s390/tpf.h
diff options
context:
space:
mode:
authorP.J. Darcy <darcypj@us.ibm.com>2004-09-22 13:57:40 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2004-09-22 13:57:40 +0000
commit4798630cb0aa99b3497a16b3e1a5ee0e12a1760b (patch)
tree5ea4cb91c0ccfc079c8ba527aecfba6dfff616d2 /gcc/config/s390/tpf.h
parent6a97296a060b9e053ae598076ffa14c41a5b6f39 (diff)
downloadgcc-4798630cb0aa99b3497a16b3e1a5ee0e12a1760b.tar.gz
s390-protos.h (s390_emit_tpf_eh_return): Add prototype.
2004-09-22 P.J. Darcy <darcypj@us.ibm.com> * config/s390/s390-protos.h (s390_emit_tpf_eh_return): Add prototype. * config/s390/s390.c (s390_emit_tpf_eh_return): New function. * config/s390/s390.h (TARGET_TPF): New macro. * config/s390/s390.md ("eh_return"): New expander. * config/s390/t-tpf (LIB2ADDEH): Use unwind-dw2-fde.c rather than unwind-dw2-fde-glibc.c. Add config/s390/tpf-eh.c. (LIB2ADDEHDEP): Remove unwind-dw2-fde.c. * config/s390/tpf.h (TARGET_TPF): Define to 1. (STACK_POINTER_OFFSET): Increase to 448. (TARGET_DEFAULT): Set -mtpf-trace on as default. (TPF_LOC_DIFF_OFFSET): New macro. (ASM_PREFERRED_EH_DATA_FORMAT): Redefine to always use absolute encoding. (__isPATrange): Add prototype. (MD_FALLBACK_FRAME_STATE_FOR): Define. * config/s390/tpf-eh.c: New file. From-SVN: r87857
Diffstat (limited to 'gcc/config/s390/tpf.h')
-rw-r--r--gcc/config/s390/tpf.h85
1 files changed, 82 insertions, 3 deletions
diff --git a/gcc/config/s390/tpf.h b/gcc/config/s390/tpf.h
index ce984e64003..587d373d6b7 100644
--- a/gcc/config/s390/tpf.h
+++ b/gcc/config/s390/tpf.h
@@ -1,5 +1,5 @@
/* Definitions for target OS TPF for GNU compiler, for IBM S/390 hardware
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Contributed by P.J. Darcy (darcypj@us.ibm.com),
Hartmut Penner (hpenner@de.ibm.com), and
Ulrich Weigand (uweigand@de.ibm.com).
@@ -25,6 +25,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define _TPF_H
/* TPF wants the following macros defined/undefined as follows. */
+#undef TARGET_TPF
+#define TARGET_TPF 1
#undef ASM_APP_ON
#define ASM_APP_ON "#APP\n"
#undef ASM_APP_OFF
@@ -50,11 +52,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* TPF OS specific stack-pointer offset. */
#undef STACK_POINTER_OFFSET
-#define STACK_POINTER_OFFSET 280
+#define STACK_POINTER_OFFSET 448
+/* TPF stack placeholder offset. */
+#undef TPF_LOC_DIFF_OFFSET
+#define TPF_LOC_DIFF_OFFSET 168
/* When building for TPF, set a generic default target that is 64 bits. */
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT 0x33
+#define TARGET_DEFAULT 0xb3
+
+/* Exception handling. */
+
+/* Select a format to encode pointers in exception handling data. */
+#undef ASM_PREFERRED_EH_DATA_FORMAT
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) DW_EH_PE_absptr
/* TPF OS specific compiler settings. */
#undef TARGET_OS_CPP_BUILTINS
@@ -108,5 +119,73 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld64.so}}}"
+extern unsigned int __isPATrange (void *);
+
+/* Exceptions macro defined for TPF so that functions without
+ dwarf frame information can be used with exceptions. */
+#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \
+ do \
+ { \
+ unsigned long int regs_; \
+ unsigned long int new_cfa_; \
+ int i_; \
+ \
+ if ((CONTEXT)->cfa == NULL) \
+ goto SUCCESS; \
+ \
+ /* Are we going through special linkage code? */ \
+ if (__isPATrange((CONTEXT)->ra)) \
+ { \
+ /* No stack frame. */ \
+ (FS)->cfa_how = CFA_REG_OFFSET; \
+ (FS)->cfa_reg = 15; \
+ (FS)->cfa_offset = STACK_POINTER_OFFSET; \
+ \
+ /* All registers remain unchanged ... */ \
+ for (i_ = 0; i_ < 32; i_++) \
+ { \
+ (FS)->regs.reg[i_].how = REG_SAVED_REG; \
+ (FS)->regs.reg[i_].loc.reg = i_; \
+ } \
+ \
+ /* ... except for %r14, which is stored at CFA-112 \
+ and used as return address. */ \
+ (FS)->regs.reg[14].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[14].loc.offset = \
+ TPF_LOC_DIFF_OFFSET - STACK_POINTER_OFFSET; \
+ (FS)->retaddr_column = 14; \
+ \
+ goto SUCCESS; \
+ \
+ } \
+ \
+ regs_ = *((unsigned long int *) \
+ (((unsigned long int) (CONTEXT)->cfa) - STACK_POINTER_OFFSET)); \
+ new_cfa_ = regs_ + STACK_POINTER_OFFSET; \
+ (FS)->cfa_how = CFA_REG_OFFSET; \
+ (FS)->cfa_reg = 15; \
+ (FS)->cfa_offset = new_cfa_ - \
+ (unsigned long int) (CONTEXT)->cfa + STACK_POINTER_OFFSET; \
+ \
+ for (i_ = 0; i_ < 16; i_++) \
+ { \
+ (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[i_].loc.offset = \
+ (regs_+(i_*8)) - new_cfa_; \
+ } \
+ \
+ for (i_ = 0; i_ < 4; i_++) \
+ { \
+ (FS)->regs.reg[16+i_].how = REG_SAVED_OFFSET; \
+ (FS)->regs.reg[16+i_].loc.offset = \
+ (regs_+(16*8)+(i_*8)) - new_cfa_; \
+ } \
+ \
+ (FS)->retaddr_column = 14; \
+ \
+ goto SUCCESS; \
+ \
+ } while (0)
+
#endif /* ! _TPF_H */