summaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-05 10:29:59 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2012-12-05 10:29:59 +0000
commitd32ceaf380038456c115fc3de41bd851780f74ff (patch)
tree27d42a6a40c0b1df7a6ef429c67194c986a05316 /gcc/ada/init.c
parent2c786073443f4bc8f339eec69f300ff184e24d38 (diff)
downloadgcc-d32ceaf380038456c115fc3de41bd851780f74ff.tar.gz
2012-12-05 Ed Schonberg <schonberg@adacore.com>
* s-rident.ads, restrict.ads: Remove discrepancies between the documentation on implementation-defined restrictions, and the internal data structure used for warnings and errors on implementation-defined restriction violations. 2012-12-05 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Chain_PPC): Pre- and postcondition aspects are legal on a subprogram body that acts as a spec. 2012-12-05 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Find_Selected_Component): If the selector name is an overloadable entity but the name is not overloaded, generate reference to it rather than delaying this until resolution. 2012-12-05 Robert Dewar <dewar@adacore.com> * checks.ads, checks.adb (Activate_Overflow_Check): No effect for MOD/REM/unary + * exp_ch4.adb (Expand_N_Op_Mod): Remove call to set Do_Overflow_Check. 2012-12-05 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Find_Non_Universal_Interpretation): Use the types of the right operand if the left operand is null. 2012-12-05 Sergey Rybin <rybin@adacore.com frybin> * gnat_ugn.texi, vms_data.ads: document gnatpp -nn option. 2012-12-05 Jose Ruiz <ruiz@adacore.com> * init.c (__gnat_install_handler): For the LEON VxWorks kernel run-time library we need to install a trap handler directly in the trap table (no support by the OS) for the software trap 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194196 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index e7283a20146..8a28bf68ab5 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1759,6 +1759,25 @@ __gnat_error_handler (int sig, void *si, struct sigcontext *sc)
#endif
}
+#if defined(__leon__) && defined(_WRS_KERNEL)
+/* For LEON VxWorks we need to install a trap handler for stack overflow */
+
+extern void excEnt (void);
+/* VxWorks exception handler entry */
+
+struct trap_entry {
+ unsigned long inst_first;
+ unsigned long inst_second;
+ unsigned long inst_third;
+ unsigned long inst_fourth;
+};
+/* Four instructions representing entries in the trap table */
+
+struct trap_entry *trap_0_entry;
+/* We will set the location of the entry for software trap 0 in the trap
+ table. */
+#endif
+
void
__gnat_install_handler (void)
{
@@ -1779,6 +1798,40 @@ __gnat_install_handler (void)
sigaction (SIGSEGV, &act, NULL);
sigaction (SIGBUS, &act, NULL);
+#if defined(__leon__) && defined(_WRS_KERNEL)
+ /* Specific to the LEON VxWorks kernel run-time library */
+
+ /* For stack checking the compiler triggers a software trap 0 (ta 0) in
+ case of overflow (we use the stack limit mechanism). We need to install
+ the trap handler here for this software trap (the OS does not handle
+ it) as if it were a data_access_exception (trap 9). We do the same as
+ if we put in the trap table a VXSPARC_BAD_TRAP(9). Software trap 0 is
+ located at vector 0x80, and each entry takes 4 words. */
+
+ trap_0_entry = (struct trap_entry *)(intVecBaseGet () + 0x80 * 4);
+
+ /* mov 0x9, %l7 */
+
+ trap_0_entry->inst_first = 0xae102000 + 9;
+
+ /* sethi %hi(excEnt), %l6 */
+
+ /* The 22 most significant bits of excEnt are obtained shifting 10 times
+ to the right. */
+
+ trap_0_entry->inst_second = 0x2d000000 + ((unsigned long)excEnt >> 10);
+
+ /* jmp %l6+%lo(excEnt) */
+
+ /* The 10 least significant bits of excEnt are obtained by masking */
+
+ trap_0_entry->inst_third = 0x81c5a000 + ((unsigned long)excEnt & 0x3ff);
+
+ /* rd %psr, %l0 */
+
+ trap_0_entry->inst_fourth = 0xa1480000;
+#endif
+
__gnat_handler_installed = 1;
}