summaryrefslogtreecommitdiff
path: root/gcc/ada/sigtramp-vxworks.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-18 09:57:49 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-04-18 09:57:49 +0000
commit9c1b4b969c6753065fb4b9f0765d219e0c8e0eef (patch)
tree6020598037499e70045bcc3796b5a74b15769ff3 /gcc/ada/sigtramp-vxworks.c
parent257893f37ae52c80b58097fc3e3a54d1cae397a0 (diff)
downloadgcc-9c1b4b969c6753065fb4b9f0765d219e0c8e0eef.tar.gz
2016-04-18 Ed Schonberg <schonberg@adacore.com>
* sem_disp.adb (Check_Dispatching_Call): Major rewriting to handle some complex cases of tag indeterminate calls that are actuals in other dispatching calls that are themselves tag indeterminate. (Check_Dispatching_Context): Add parameter to support recursive check for an enclosing construct that may provide a tag for a tag-indeterminate call. 2016-04-18 Hristian Kirtchev <kirtchev@adacore.com> * sem_prag.adb (Analyze_Depends_In_Decl_Part): Add global variables Task_Input_Seen and Task_Output_Seen. (Analyze_Global_Item): Detect an illegal use of the current instance of a single protected/task type in a global annotation. (Analyze_Input_Output): Inputs and output related to the current instance of a task unit are now tracked. (Check_Usage): Require the presence of the current instance of a task unit only when one input/output is available. (Current_Task_Instance_Seen): New routine. (Is_CCT_Instance): New parameter profile. Update the comment on usage. The routine now properly recognizes several cases related to single protected/task types. 2016-04-18 Hristian Kirtchev <kirtchev@adacore.com> * freeze.adb (Freeze_Entity): Use New_Freeze_Node to create a brand new freeze node. This handles a case where an ignored Ghost context is freezing something which is not ignored Ghost and whose freeze node should not be removed from the tree. (New_Freeze_Node): New routine. 2016-04-18 Jerome Lambourg <lambourg@adacore.com> * sigtramp.h (__gnat_set_is_vxsim) New function to tell sigtramp-vxworks to handle vxsim signal contexts. * sigtramp-vxworks.c (__gnat_sigtramp) Take into account the differences in the sigcontext structure between the expected regular x86 or x86_64 ones and the ones received in case of exexution on the vxworks simulator. * init.c: also compute is_vxsim in case of x86_64-vx7 target. Provide this information to sigtramp-vxworks.c. Remove the old mechanism for vxsim. * init-vxsim.c, sigtramp-vxworks-vxsim.c: remove, now obsolete. 2016-04-18 Eric Botcazou <ebotcazou@adacore.com> * exp_ch3.adb (Inline_Init_Proc): New function returning whether the initialization procedure of a type should be inlined. Return again True for controlled type themselves. (Build_Array_Init_Proc): Call it to set Set_Is_Inlined on Init_Proc. (Build_Record_Init_Proc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sigtramp-vxworks.c')
-rw-r--r--gcc/ada/sigtramp-vxworks.c76
1 files changed, 61 insertions, 15 deletions
diff --git a/gcc/ada/sigtramp-vxworks.c b/gcc/ada/sigtramp-vxworks.c
index 360b9211453..e9dd9aa1ce8 100644
--- a/gcc/ada/sigtramp-vxworks.c
+++ b/gcc/ada/sigtramp-vxworks.c
@@ -89,12 +89,13 @@ typedef struct ucontext
and not "static" to prevent compiler complaints about a symbol used but
never defined. */
-/* sigtramp stub providing CFI info for common registers. */
+#define TRAMP_COMMON __gnat_sigtramp_common
-extern void __gnat_sigtramp_common
-(int signo, void *siginfo, void *sigcontext,
- __sigtramphandler_t * handler, void * sc_pregs);
+/* sigtramp stub providing CFI info for common registers. */
+extern void
+TRAMP_COMMON (int signo, void *siginfo, void *sigcontext,
+ __sigtramphandler_t * handler, REG_SET * sc_pregs);
/* -------------------------------------
-- Common interface implementation --
@@ -102,6 +103,14 @@ extern void __gnat_sigtramp_common
We enforce optimization to minimize the overhead of the extra layer. */
+#if defined(__vxworks) && (defined (__i386__) || defined (__x86_64__)) && !defined (VTHREADS)
+static int __gnat_is_vxsim = 0;
+
+void __gnat_set_is_vxsim(int val) {
+ __gnat_is_vxsim = val;
+}
+#endif
+
void __gnat_sigtramp (int signo, void *si, void *sc,
__sigtramphandler_t * handler)
__attribute__((optimize(2)));
@@ -109,17 +118,58 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
void __gnat_sigtramp (int signo, void *si, void *sc,
__sigtramphandler_t * handler)
{
-#ifdef __RTP__
+ REG_SET *pregs;
+
+ /* VXSIM uses a different signal context structure than the regular x86
+ targets:
+ * on x86-vx6: two 32-bit values are added at the end of the REG_SET, plus
+ an explicit padding of 0xc8 characters (200 characters). The sigcontext
+ containing a complete REG_SET just before the field 'sc_pregs', this
+ adds a 208 bytes offset to get the value of 'sc_pregs'.
+ * on x86-vx7: the same offset is used on vx7: 3 32-bit values are present
+ at the enf of the reg set, but the padding is then of 0xc4 characters.
+ * on x86_64-vx7: two 64-bit values are added at the beginning of the
+ REG_SET. This adds a 16 bytes offset to get the value of 'sc_pregs',
+ and another 16 bytes offset within the pregs structure to retrieve the
+ registers list.
+ */
+
+ /* Retrieve the registers to restore : */
+#ifndef __RTP__
+#ifdef __HANDLE_VXSIM_SC
+#if defined(__i386__)
+ /* move sctx 208 bytes further, so that the vxsim's sc_pregs field coincide
+ with the expected x86 one */
+ struct sigcontext * sctx =
+ (struct sigcontext *) (sc + (__gnat_is_vxsim ? 208 : 0));
+#elif defined(__x86_64__)
+ /* move sctx 16 bytes further, so that the vxsim's sc_pregs field coincide
+ with the expected x86_64 one */
+ struct sigcontext * sctx =
+ (struct sigcontext *) (sc + (__gnat_is_vxsim ? 16 : 0));
+#endif /* __i386__ || __x86_64__ */
+#else /* __HANDLE_VXSIM_SC__ */
+ struct sigcontext * sctx = (struct sigcontext *) sc;
+#endif
+
+ pregs = sctx->sc_pregs;
+
+#else /* !defined(__RTP__) */
+
mcontext_t *mcontext = &((ucontext_t *) sc)->uc_mcontext;
+ /* No specific offset in this case for vxsim */
+ pregs = &(mcontext->regs);
- /* Pass MCONTEXT in the fifth position so that the assembly code can find
- it at the same stack location or in the same register as SC_PREGS. */
- __gnat_sigtramp_common (signo, si, mcontext, handler, mcontext);
-#else
- struct sigcontext * sctx = (struct sigcontext *) sc;
+#endif /* !defined(__RTP__) */
- __gnat_sigtramp_common (signo, si, sctx, handler, sctx->sc_pregs);
+#if defined (__HANDLE_VXSIM_SC) && defined (__x86_64__)
+ /* Ignore the first two values, that are not registers in case of
+ vxsim */
+ pregs = (REG_SET *) ((void *)pregs + (__gnat_is_vxsim ? 16 : 0));
#endif
+
+ /* And now call the real signal trampoline with the list of registers */
+ __gnat_sigtramp_common (signo, si, sc, handler, pregs);
}
/* Include the target specific bits. */
@@ -127,12 +177,8 @@ void __gnat_sigtramp (int signo, void *si, void *sc,
/* sigtramp stub for common registers. */
-#define TRAMP_COMMON __gnat_sigtramp_common
-
asm (SIGTRAMP_START(TRAMP_COMMON));
asm (CFI_DEF_CFA);
asm (CFI_COMMON_REGS);
asm (SIGTRAMP_BODY);
asm (SIGTRAMP_END(TRAMP_COMMON));
-
-