Commit 37efd88e by Jose Ruiz Committed by Arnaud Charlet

init.c (__gnat_install_handler for linux): If we are building the Xenomai run…

init.c (__gnat_install_handler for linux): If we are building the Xenomai run time then we need to do two additional things...

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.

From-SVN: r138684
parent 0df218a9
...@@ -850,13 +850,24 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),) ...@@ -850,13 +850,24 @@ ifeq ($(strip $(filter-out %86 linux%,$(arch) $(osys))),)
LIBGNAT_TARGET_PAIRS += \ LIBGNAT_TARGET_PAIRS += \
g-soccon.ads<g-soccon-linux-x86.ads \ g-soccon.ads<g-soccon-linux-x86.ads \
s-linux.ads<s-linux.ads \ s-linux.ads<s-linux.ads \
s-osinte.adb<s-osinte-posix.adb \ s-osinte.adb<s-osinte-posix.adb
s-osinte.ads<s-osinte-linux.ads \
s-tasinf.ads<s-tasinf-linux.ads \ ifeq ($(strip $(filter-out xenomai,$(THREAD_KIND))),)
s-tasinf.adb<s-tasinf-linux.adb \ LIBGNAT_TARGET_PAIRS += \
s-taprop.adb<s-taprop-linux.adb s-osinte.ads<s-osinte-linux-xenomai.ads \
s-taprop.adb<s-taprop-linux-xenomai.adb
EH_MECHANISM=
else
LIBGNAT_TARGET_PAIRS += \
s-osinte.ads<s-osinte-linux.ads \
s-taprop.adb<s-taprop-linux.adb \
s-tasinf.ads<s-tasinf-linux.ads \
s-tasinf.adb<s-tasinf-linux.adb
EH_MECHANISM=-gcc
endif
EH_MECHANISM=-gcc
THREADSLIB = -lpthread THREADSLIB = -lpthread
EXTRA_GNATRTL_TASKING_OBJS=s-linux.o EXTRA_GNATRTL_TASKING_OBJS=s-linux.o
endif endif
......
...@@ -746,11 +746,35 @@ __gnat_error_handler (int sig, ...@@ -746,11 +746,35 @@ __gnat_error_handler (int sig,
char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */ char __gnat_alternate_stack[16 * 1024]; /* 2 * SIGSTKSZ */
#endif #endif
#ifdef __XENO__
#include <sys/mman.h>
#include <native/task.h>
RT_TASK main_task;
#endif
void void
__gnat_install_handler (void) __gnat_install_handler (void)
{ {
struct sigaction act; 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 /* Set up signal handler to map synchronous signals to appropriate
exceptions. Make sure that the handler isn't interrupted by another exceptions. Make sure that the handler isn't interrupted by another
signal that might cause a scheduling event! Also setup an alternate signal that might cause a scheduling event! Also setup an alternate
......
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