diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-10-14 14:42:04 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-10-14 14:42:04 +0200 |
commit | 124092ee8afddc68ec7905bd951cc647f7de84e6 (patch) | |
tree | 63af518b9244da060ec1650330653be5fc5a02cc /gcc/ada/init.c | |
parent | b447a7578e82b2d2bbe284fa3044f0070a2d8c12 (diff) | |
download | gcc-124092ee8afddc68ec7905bd951cc647f7de84e6.zip gcc-124092ee8afddc68ec7905bd951cc647f7de84e6.tar.gz gcc-124092ee8afddc68ec7905bd951cc647f7de84e6.tar.bz2 |
[multiple changes]
2013-10-14 Hristian Kirtchev <kirtchev@adacore.com>
* einfo.adb: Flag263 is now known as Has_Null_Refinement.
(Has_Null_Refinement): New routine.
(Set_Has_Null_Refinement): New routine.
(Write_Entity_Flags): Output the status of flag
Has_Null_Refinement.
* einfo.ads: Add new flag Has_Null_Refinement along with
comment on usage and update all nodes subject to the flag.
(Has_Null_Refinement): New routine along with pragma Inline.
(Set_Has_Null_Refinement): New rouitine along with pragma Inline.
* sem_prag.adb (Analyze_Constituent): Mark a state as having
a null refinement when the sole constituent is "null".
(Analyze_Global_List): Handle null input/output items.
(Analyze_Refined_Global_In_Decl_Part): Add local variable
Has_Null_State. Add logic to handle combinations of states
with null refinements and null global lists and/or items.
(Check_In_Out_States, Check_Input_States, Check_Output_States):
Use attribute Has_Null_Refinement to detect states with
constituents.
(Check_Refined_Global_List): Handle null input/output items.
(Process_Global_Item): Handle states with null refinements.
(Process_Global_List): Handle null input/output items.
2013-10-14 Robert Dewar <dewar@adacore.com>
* freeze.adb (Freeze_Entity): Reset Is_True_Constant for
aliased object
* gnat_ugn.texi: Update doc on aliased variables and constants.
2013-10-14 Ed Schonberg <schonberg@adacore.com>
* exp_pakd.adb (Expand_Packed_Element_Reference): If the
reference is an actual in a call, the prefix has not been fully
expanded, to account for the additional expansion for parameter
passing. the prefix itself is a packed reference as well,
recurse to complete the transformation of the prefix.
2013-10-14 Eric Botcazou <ebotcazou@adacore.com>
* exp_dbug.adb (Debug_Renaming_Declaration): Do not
materialize the entity when the renamed object contains an
N_Explicit_Dereference.
* sem_ch8.adb (Analyze_Object_Renaming):
If the renaming comes from source and the renamed object is a
dereference, mark the prefix as needing debug information.
2013-10-14 Doug Rupp <rupp@adacore.com>
* system-vxworks-arm.ads (Stack_Check_Probes, Stack_Check_Limits):
Enable Stack Probes, Disable Stack Limit Checking.
* init.c [VxWorks] (__gnat_inum_to_ivec): Caste return value.
(__gnat_map_signal): Fix signature.
(__gnat_error_handler): Make
static, fix signature, remove prototype, fix prototype warning.
[ARMEL and VxWorks6] (__gnat_map_signal): Check and re-arm guard
page for storage_error.
* exp_pakd.adb: Minor reformatting.
From-SVN: r203526
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r-- | gcc/ada/init.c | 64 |
1 files changed, 56 insertions, 8 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c index c8de26b..d7653c7 100644 --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -1665,8 +1665,6 @@ __gnat_install_handler () #include "private/vThreadsP.h" #endif -void __gnat_error_handler (int, void *, struct sigcontext *); - #ifndef __RTP__ /* Directly vectored Interrupt routines are not supported when using RTPs. */ @@ -1677,7 +1675,7 @@ extern int __gnat_inum_to_ivec (int); int __gnat_inum_to_ivec (int num) { - return INUM_TO_IVEC (num); + return (int) INUM_TO_IVEC (num); } #endif @@ -1711,8 +1709,8 @@ __gnat_clear_exception_count (void) /* Handle different SIGnal to exception mappings in different VxWorks versions. */ static void -__gnat_map_signal (int sig, void *si ATTRIBUTE_UNUSED, - struct sigcontext *sc ATTRIBUTE_UNUSED) +__gnat_map_signal (int sig, siginfo_t *si ATTRIBUTE_UNUSED, + void *sc ATTRIBUTE_UNUSED) { struct Exception_Data *exception; const char *msg; @@ -1799,6 +1797,56 @@ __gnat_map_signal (int sig, void *si ATTRIBUTE_UNUSED, msg = "unhandled signal"; } + /* On ARM VxWorks 6.x, the guard page is left in a RWX state by the kernel + after being violated, so subsequent violations aren't detected. Even if + this defect is fixed, it seems dubious to rely on the signal value alone, + so we retrieve the address of the guard page from the TCB and compare it + with the page that is violated (pREG 12 in the context) and re-arm that + page if there's a match. Additionally we're are assured this is a + genuine stack overflow condition and and set the message and exception + to that effect. */ +#if defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) + + /* We re-arm the guard page by re-setting it's attributes, however the + protection bits are just the low order seven (0x3f). + 0x00040 is the Valid Mask + 0x00f00 are Cache attributes + 0xff000 are Special attributes + We don't meddle with the 0xfff40 attributes. */ + +#define PAGE_SIZE 4096 +#define MMU_ATTR_PROT_MSK 0x0000003f /* Protection Mask. */ +#define GUARD_PAGE_PROT 0x8101 /* Found by experiment. */ + + if (sig == SIGSEGV || sig == SIGBUS || sig == SIGILL) + { + TASK_ID tid = taskIdSelf (); + WIND_TCB *pTcb = taskTcb (tid); + unsigned long Violated_Page + = ((struct sigcontext *) sc)->sc_pregs->r[12] & ~(PAGE_SIZE - 1); + + if ((unsigned long) (pTcb->pStackEnd - PAGE_SIZE) == Violated_Page) + { + vmStateSet (NULL, Violated_Page, + PAGE_SIZE, MMU_ATTR_PROT_MSK, GUARD_PAGE_PROT); + exception = &storage_error; + + switch (sig) + { + case SIGSEGV: + msg = "SIGSEGV: stack overflow"; + break; + case SIGBUS: + msg = "SIGBUS: stack overflow"; + break; + case SIGILL: + msg = "SIGILL: stack overflow"; + break; + } + } + } +#endif /* defined (ARMEL) && (_WRS_VXWORKS_MAJOR == 6) */ + __gnat_clear_exception_count (); Raise_From_Signal_Handler (exception, msg); } @@ -1806,8 +1854,8 @@ __gnat_map_signal (int sig, void *si ATTRIBUTE_UNUSED, /* Tasking and Non-tasking signal handler. Map SIGnal to Ada exception propagation after the required low level adjustments. */ -void -__gnat_error_handler (int sig, void *si, struct sigcontext *sc) +static void +__gnat_error_handler (int sig, siginfo_t *si, void *sc) { sigset_t mask; @@ -1865,7 +1913,7 @@ __gnat_install_handler (void) exceptions. Make sure that the handler isn't interrupted by another signal that might cause a scheduling event! */ - act.sa_handler = __gnat_error_handler; + act.sa_sigaction = __gnat_error_handler; act.sa_flags = SA_SIGINFO | SA_ONSTACK; sigemptyset (&act.sa_mask); |