Commit 3ff688aa by P.J. Darcy Committed by Ulrich Weigand

t-tpf (LIB2ADDEH): Remove tpf-eh.c.

2004-10-02  P.J. Darcy  <darcypj@us.ibm.com>

	* config/s390/t-tpf (LIB2ADDEH): Remove tpf-eh.c.
	* config/s390/tpf-eh.c: Remove file.
	* config/s390/tpf-unwind.h: New file.
	* config/s390/tpf.h (MD_FALLBACK_FRAME_STATE_FOR): Remove.
	(MD_UNWIND_SUPPORT): Define.

From-SVN: r88417
parent 62bea9ef
2004-10-02 P.J. Darcy <darcypj@us.ibm.com>
* config/s390/t-tpf (LIB2ADDEH): Remove tpf-eh.c.
* config/s390/tpf-eh.c: Remove file.
* config/s390/tpf-unwind.h: New file.
* config/s390/tpf.h (MD_FALLBACK_FRAME_STATE_FOR): Remove.
(MD_UNWIND_SUPPORT): Define.
2004-10-02 Joseph S. Myers <jsm@polyomino.org.uk> 2004-10-02 Joseph S. Myers <jsm@polyomino.org.uk>
* c-typeck.c (warn_for_assignment): Don't permit argnum == 0. * c-typeck.c (warn_for_assignment): Don't permit argnum == 0.
......
...@@ -7,8 +7,7 @@ TARGET_LIBGCC2_CFLAGS = -fPIC ...@@ -7,8 +7,7 @@ TARGET_LIBGCC2_CFLAGS = -fPIC
# the symbol versions that glibc used. # the symbol versions that glibc used.
SHLIB_MAPFILES += $(srcdir)/config/s390/libgcc-glibc.ver SHLIB_MAPFILES += $(srcdir)/config/s390/libgcc-glibc.ver
# Use unwind-dw2-fde and extra tpf-eh support routines. # Use unwind-dw2-fde.
LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
$(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c \ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
$(srcdir)/config/s390/tpf-eh.c
LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h
/* Exception handling routines for TPF. /* DWARF2 EH unwinding support for TPF OS.
Copyright (C) 2004 Free Software Foundation, Inc. Copyright (C) 2004 Free Software Foundation, Inc.
Contributed by P.J. Darcy (darcypj@us.ibm.com). Contributed by P.J. Darcy (darcypj@us.ibm.com).
This file is part of GCC. This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it GCC is free software; you can redistribute it and/or modify it under
under the terms of the GNU General Public License as published by the terms of the GNU General Public License as published by the Free
the Free Software Foundation; either version 2, or (at your option) Software Foundation; either version 2, or (at your option) any later
any later version. version.
In addition to the permissions in the GNU General Public License, the In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs, compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combined the file, and distribution when not linked into a combined
executable.) executable.)
GCC is distributed in the hope that it will be useful, but WITHOUT GCC is distributed in the hope that it will be useful, but WITHOUT ANY
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY WARRANTY; without even the implied warranty of MERCHANTABILITY or
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
License for more details. for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */ 02111-1307, USA. */
#define __USE_GNU 1 #define __USE_GNU 1
#define _GNU_SOURCE #define _GNU_SOURCE
...@@ -34,26 +34,17 @@ ...@@ -34,26 +34,17 @@
#undef __USE_GNU #undef __USE_GNU
#undef _GNU_SOURCE #undef _GNU_SOURCE
#define CURRENT_STACK_PTR() \
({ register unsigned long int *stack_ptr asm ("%r15"); stack_ptr; })
#define PREVIOUS_STACK_PTR() \
((unsigned long int *)(*(CURRENT_STACK_PTR())))
#define RA_OFFSET_FROM_START_OF_STACK_FRAME 112
#define CURRENT_STACK_PTR_OFFSET 120
#define TPFRA_OFFSET_FROM_START_OF_STACK_FRAME 168
#define MIN_PATRANGE 0x10000
#define MAX_PATRANGE 0x800000
#define INVALID_RETURN 0
/* Function Name: __isPATrange /* Function Name: __isPATrange
Parameters passed into it: address to check Parameters passed into it: address to check
Return Value: A 1 if address is in pat code "range", 0 if not Return Value: A 1 if address is in pat code "range", 0 if not
Description: This function simply checks to see if the address Description: This function simply checks to see if the address
passed to it is in the CP pat code range. */ passed to it is in the CP pat code range. */
unsigned int __isPATrange(void *addr) #define MIN_PATRANGE 0x10000
#define MAX_PATRANGE 0x800000
static inline unsigned int
__isPATrange (void *addr)
{ {
if (addr > (void *)MIN_PATRANGE && addr < (void *)MAX_PATRANGE) if (addr > (void *)MIN_PATRANGE && addr < (void *)MAX_PATRANGE)
return 1; return 1;
...@@ -61,17 +52,99 @@ unsigned int __isPATrange(void *addr) ...@@ -61,17 +52,99 @@ unsigned int __isPATrange(void *addr)
return 0; return 0;
} }
/* TPF stack placeholder offset. */
#define TPF_LOC_DIFF_OFFSET 168
/* Exceptions macro defined for TPF so that functions without
dwarf frame information can be used with exceptions. */
#define MD_FALLBACK_FRAME_STATE_FOR s390_fallback_frame_state
static _Unwind_Reason_Code
s390_fallback_frame_state (struct _Unwind_Context *context,
_Unwind_FrameState *fs)
{
unsigned long int regs;
unsigned long int new_cfa;
int i;
if (context->cfa == NULL)
return _URC_END_OF_STACK;
/* 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;
return _URC_NO_REASON;
}
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;
return _URC_NO_REASON;
}
/* Function Name: __tpf_eh_return /* Function Name: __tpf_eh_return
Parameters passed into it: Destination address to jump to. Parameters passed into it: Destination address to jump to.
Return Value: Converted Destination address if a Pat Stub exists. Return Value: Converted Destination address if a Pat Stub exists.
Description: This function swaps the unwinding return address Description: This function swaps the uwinding return address
with the cp stub code. The original target return address is with the cp stub code. The original target return address is
then stored into the tpf return address field. The cp stub then stored into the tpf return address field. The cp stub
code is searched for by climbing back up the stack and code is searched for by climbing back up the stack and
comparing the tpf stored return address object address to comparing the tpf stored return address object address to
that of the targets object address. */ that of the targets object address. */
void *__tpf_eh_return (void *target) #define CURRENT_STACK_PTR() \
({ register unsigned long int *stack_ptr asm ("%r15"); stack_ptr; })
#define PREVIOUS_STACK_PTR() \
((unsigned long int *)(*(CURRENT_STACK_PTR())))
#define RA_OFFSET_FROM_START_OF_STACK_FRAME 112
#define CURRENT_STACK_PTR_OFFSET 120
#define TPFRA_OFFSET_FROM_START_OF_STACK_FRAME 168
#define INVALID_RETURN 0
void * __tpf_eh_return (void *target);
void *
__tpf_eh_return (void *target)
{ {
Dl_info targetcodeInfo, currentcodeInfo; Dl_info targetcodeInfo, currentcodeInfo;
int retval; int retval;
...@@ -158,7 +231,7 @@ void *__tpf_eh_return (void *target) ...@@ -158,7 +231,7 @@ void *__tpf_eh_return (void *target)
the exception handling unwinder so that it can the exception handling unwinder so that it can
actually do the "leap" shift out the low order actually do the "leap" shift out the low order
bit designated to determine if we are in 64BIT mode. bit designated to determine if we are in 64BIT mode.
This is necessary for CTOA stubs. This is nececcary for CTOA stubs.
Otherwise we leap one byte past where we want to Otherwise we leap one byte past where we want to
go to in the TPF pat stub linkage code. */ go to in the TPF pat stub linkage code. */
shifter = *((unsigned long int *) shifter = *((unsigned long int *)
...@@ -181,3 +254,4 @@ void *__tpf_eh_return (void *target) ...@@ -181,3 +254,4 @@ void *__tpf_eh_return (void *target)
return target; return target;
} }
...@@ -53,9 +53,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -53,9 +53,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* TPF OS specific stack-pointer offset. */ /* TPF OS specific stack-pointer offset. */
#undef STACK_POINTER_OFFSET #undef STACK_POINTER_OFFSET
#define STACK_POINTER_OFFSET 448 #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. */ /* When building for TPF, set a generic default target that is 64 bits. */
#undef TARGET_DEFAULT #undef TARGET_DEFAULT
...@@ -119,73 +116,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -119,73 +116,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
%{rdynamic:-export-dynamic} \ %{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker /lib/ld64.so}}}" %{!dynamic-linker:-dynamic-linker /lib/ld64.so}}}"
extern unsigned int __isPATrange (void *); #define MD_UNWIND_SUPPORT "config/s390/tpf-unwind.h"
/* 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 */ #endif /* ! _TPF_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment