public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-179] [Ada] vx21.07: stack-checking on ppc
@ 2022-05-09  9:30 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-09  9:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:82bd388bf08329b4e271ef83adca22b3816ff14f

commit r13-179-g82bd388bf08329b4e271ef83adca22b3816ff14f
Author: Doug Rupp <rupp@adacore.com>
Date:   Mon Dec 20 14:25:30 2021 -0800

    [Ada] vx21.07: stack-checking on ppc
    
    On VxWorks >= 7.2 and 653, signal processing code is expected to clear
    the TCB exception count field when returning control back to user code.
    This change arranges to do so.  It is believed that this is only an
    issue in Kernel mode, and not RTP because there is no exception count
    field in RTP mode and no failures have been observed.
    
    gcc/ada/
    
            * init.c [vxworks] (CLEAR_EXCEPTION_COUNT): New macro.
            (__gnat_clear_exception_count): Remove.
            (__gnat_map_signal): Call CLEAR_EXCEPTION_COUNT().

Diff:
---
 gcc/ada/init.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 6b6ed5fb058..9eedffc4a37 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1758,8 +1758,26 @@ extern size_t vxIntStackOverflowSize;
 #define INT_OVERFLOW_SIZE vxIntStackOverflowSize
 #endif
 
-#ifdef VTHREADS
-#include "private/vThreadsP.h"
+/* VxWorks 653 vThreads expects the field excCnt to be zeroed when a signal is.
+   handled.  The VxWorks version of longjmp does this; GCC's builtin_longjmp
+   doesn't.  A similar issue is present VxWorks 7.2 and affects ZCX as well
+   as builtin_longjmp.  This field only exists in Kernel mode, not RTP.  */
+#if defined(VTHREADS) || (!defined(__RTP__) && (_WRS_VXWORKS_MAJOR >= 7))
+# ifdef VTHREADS
+#  include "private/vThreadsP.h"
+#  define EXCCNT vThreads.excCnt
+# else
+#  include "private/taskLibP.h"
+#  define EXCCNT excCnt
+# endif
+# define CLEAR_EXCEPTION_COUNT()			 \
+  do							 \
+    {							 \
+      WIND_TCB *currentTask = (WIND_TCB *) taskIdSelf(); \
+      currentTask->EXCCNT = 0;				 \
+    } while (0)
+#else
+# define CLEAR_EXCEPTION_COUNT()
 #endif
 
 #ifndef __RTP__
@@ -1835,19 +1853,6 @@ __gnat_reset_guard_page (int sig)
   return FALSE;
 }
 
-/* VxWorks 653 vThreads expects the field excCnt to be zeroed when a signal is.
-   handled. The VxWorks version of longjmp does this; GCC's builtin_longjmp
-   doesn't.  */
-void
-__gnat_clear_exception_count (void)
-{
-#ifdef VTHREADS
-  WIND_TCB *currentTask = (WIND_TCB *) taskIdSelf();
-
-  currentTask->vThreads.excCnt = 0;
-#endif
-}
-
 /* Handle different SIGnal to exception mappings in different VxWorks
    versions.  */
 void
@@ -1959,7 +1964,8 @@ __gnat_map_signal (int sig,
           break;
         }
     }
-  __gnat_clear_exception_count ();
+
+  CLEAR_EXCEPTION_COUNT ();
   Raise_From_Signal_Handler (exception, msg);
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-09  9:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09  9:30 [gcc r13-179] [Ada] vx21.07: stack-checking on ppc Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).