summaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-05 09:27:49 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-05 09:27:49 +0000
commitde19cf1d1b867a61f655506f4d6413a2c3dff189 (patch)
tree81bb965c6ca4189ce06b8011f1ff175bd802e906 /gcc/ada/init.c
parent9c0520cbdfb21501b6f6091813e71a1e25ea8e85 (diff)
downloadgcc-de19cf1d1b867a61f655506f4d6413a2c3dff189.tar.gz
2008-08-05 Jose Ruiz <ruiz@adacore.com>
* init.c (__gnat_install_handler for linux): If we are building the Xenomai run time then we need to do two additional things: avoid memory swapping and transform the Linux environment task into a native Xenomai task. * gcc-interface/Makefile.in (LIBGNAT_TARGET_PAIRS for xenomai run time): Use interface to Xenomai native skin and avoid linux-specific way of setting CPU affinity. (EH_MECHANISM for the xenomai run time): Use sjlj exception mechanism. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138684 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 47fc71e6fff..d2c22ea49d3 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -746,11 +746,35 @@ __gnat_error_handler (int sig,
char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
#endif
+#ifdef __XENO__
+#include <sys/mman.h>
+#include <native/task.h>
+
+RT_TASK main_task;
+#endif
+
void
__gnat_install_handler (void)
{
struct sigaction act;
+#ifdef __XENO__
+ int prio;
+
+ if (__gl_main_priority == -1)
+ prio = 49;
+ else
+ prio = __gl_main_priority;
+
+ /* Avoid memory swapping for this program */
+
+ mlockall (MCL_CURRENT|MCL_FUTURE);
+
+ /* Turn the current Linux task into a native Xenomai task */
+
+ rt_task_shadow(&main_task, "environment_task", prio, T_FPU);
+#endif
+
/* Set up signal handler to map synchronous signals to appropriate
exceptions. Make sure that the handler isn't interrupted by another
signal that might cause a scheduling event! Also setup an alternate