2014-07-29 Doug Rupp <rupp@adacore.com>
* sigtramp-armvxw.c: Enhance to handle RTP trampolining.
* init.c: Remove guard on sigtramp for ARM VxWorks RTP.
2014-07-29 Vincent Celier <celier@adacore.com>
* switch-c.adb (Scan_Front_End_Switches): Do not fail when two
runtime directorie specified with two switches --RTS= designate
the same directory, even when there are no literarily the same.
2014-07-29 Robert Dewar <dewar@adacore.com>
* gnat_ugn.texi: Minor documentation clarification.
* switch-c.adb: Minor reformatting.
From-SVN: r213187
+2014-07-29 Doug Rupp <rupp@adacore.com>
+
+ * sigtramp-armvxw.c: Enhance to handle RTP trampolining.
+ * init.c: Remove guard on sigtramp for ARM VxWorks RTP.
+
+2014-07-29 Vincent Celier <celier@adacore.com>
+
+ * switch-c.adb (Scan_Front_End_Switches): Do not fail when two
+ runtime directorie specified with two switches --RTS= designate
+ the same directory, even when there are no literarily the same.
+
+2014-07-29 Robert Dewar <dewar@adacore.com>
+
+ * gnat_ugn.texi: Minor documentation clarification.
+ * switch-c.adb: Minor reformatting.
+
2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address):
2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address):
The @var{xxx} ^string specified with the switch^option^ may be either
@itemize @bullet
@item ``@option{^in^INVALID^}'' requesting an invalid value where possible
The @var{xxx} ^string specified with the switch^option^ may be either
@itemize @bullet
@item ``@option{^in^INVALID^}'' requesting an invalid value where possible
-@item ``@option{^lo^LOW^}'' for the lowest possible value
-@item ``@option{^hi^HIGH^}'' for the highest possible value
+@item ``@option{^lo^LOW^}'' for the lowest possible value (all 0 bits)
+@item ``@option{^hi^HIGH^}'' for the highest possible value (all 1 bits)
@item ``@option{@var{xx}}'' for a value consisting of repeated bytes with the
value @code{16#@var{xx}#} (i.e., @var{xx} is a string of two hexadecimal digits).
@end itemize
@item ``@option{@var{xx}}'' for a value consisting of repeated bytes with the
value @code{16#@var{xx}#} (i.e., @var{xx} is a string of two hexadecimal digits).
@end itemize
#include <signal.h>
#include <taskLib.h>
#include <signal.h>
#include <taskLib.h>
+#ifdef __RTP__
+#include <base/b_ucontext_t.h>
+#else
#include <intLib.h>
#include <iv.h>
#endif
#include <intLib.h>
#include <iv.h>
#endif
sigdelset (&mask, sig);
sigprocmask (SIG_SETMASK, &mask, NULL);
sigdelset (&mask, sig);
sigprocmask (SIG_SETMASK, &mask, NULL);
-#if (defined (__ARMEL__) || defined (__PPC__)) && defined(_WRS_KERNEL)
+#if defined (__ARMEL__) || (defined (__PPC__) && defined (_WRS_KERNEL))
/* On PowerPC, kernel mode, we process signals through a Call Frame Info
trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX
/* On PowerPC, kernel mode, we process signals through a Call Frame Info
trampoline, voiding the need for myriads of fallback_frame_state
variants in the ZCX runtime. We have no simple way to distinguish ZCX
#include <vxWorks.h>
#include <arch/../regs.h>
#include <vxWorks.h>
#include <arch/../regs.h>
+#else
+#include <signal.h>
+#include <base/b_ucontext_t.h>
+#endif
/* ----------------------
-- General comments --
/* ----------------------
-- General comments --
Stubs are generated from toplevel asms and .cfi directives, much simpler
to use and check for correctness than manual encodings of CFI byte
sequences. The general idea is to establish CFA as sigcontext->sc_pregs
Stubs are generated from toplevel asms and .cfi directives, much simpler
to use and check for correctness than manual encodings of CFI byte
sequences. The general idea is to establish CFA as sigcontext->sc_pregs
- and state where to find the registers as offsets from there.
+ (for DKM) and mcontext (for RTP) and state where to find the registers as
+ offsets from there.
As of today, we support a stub providing CFI info for common
registers (GPRs, LR, ...). We might need variants with support for floating
point or altivec registers as well at some point.
As of today, we support a stub providing CFI info for common
registers (GPRs, LR, ...). We might need variants with support for floating
point or altivec registers as well at some point.
- Checking which variant should apply and getting at sc_pregs is simpler
- to express in C (we can't use offsetof in toplevel asms and hardcoding
- constants is not workable with the flurry of VxWorks variants), so this
- is the choice for our toplevel interface.
+ Checking which variant should apply and getting at sc_pregs / mcontext
+ is simpler to express in C (we can't use offsetof in toplevel asms and
+ hardcoding constants is not workable with the flurry of VxWorks variants),
+ so this is the choice for our toplevel interface.
Note that the registers we "restore" here are those to which we have
direct access through the system sigcontext structure, which includes
only a partial set of the non-volatiles ABI-wise. */
Note that the registers we "restore" here are those to which we have
direct access through the system sigcontext structure, which includes
only a partial set of the non-volatiles ABI-wise. */
-/* -----------------------------------------
- -- Protypes for our internal asm stubs --
- -----------------------------------------
+/* -------------------------------------------
+ -- Prototypes for our internal asm stubs --
+ -------------------------------------------
- SC_PREGS is always expected to be SIGCONTEXT->sc_pregs. Eventhough our
- symbols will remain local, the prototype claims "extern" and not
- "static" to prevent compiler complaints about a symbol used but never
- defined. */
+ Eventhough our symbols will remain local, the prototype claims "extern"
+ and not "static" to prevent compiler complaints about a symbol used but
+ never defined. */
/* sigtramp stub providing CFI info for common registers. */
/* sigtramp stub providing CFI info for common registers. */
void __gnat_sigtramp (int signo, void *si, void *sc,
__sigtramphandler_t * handler)
{
void __gnat_sigtramp (int signo, void *si, void *sc,
__sigtramphandler_t * handler)
{
+#ifdef __RTP__
+ mcontext_t *mcontext = &((ucontext_t *) sc)->uc_mcontext;
+
+ /* Pass MCONTEXT in the fifth position so that the assembly code can find
+ it at the same stack location or in the same register as SC_PREGS. */
+ __gnat_sigtramp_common (signo, si, mcontext, handler, mcontext);
+#else
struct sigcontext * sctx = (struct sigcontext *) sc;
__gnat_sigtramp_common (signo, si, sctx, handler, sctx->sc_pregs);
struct sigcontext * sctx = (struct sigcontext *) sc;
__gnat_sigtramp_common (signo, si, sctx, handler, sctx->sc_pregs);
TCR("# registers we're going to modify") \
TCR("mov ip, sp") \
TCR("stmfd sp!, {r"S(CFA_REG)", fp, ip, lr, pc}") \
TCR("# registers we're going to modify") \
TCR("mov ip, sp") \
TCR("stmfd sp!, {r"S(CFA_REG)", fp, ip, lr, pc}") \
-TCR("# Setup CFA_REG = sc_pregs, that we'll retrieve as our CFA value") \
+TCR("# Setup CFA_REG = context, which we'll retrieve as our CFA value") \
TCR("ldr r"S(CFA_REG)", [ip]") \
TCR("") \
TCR("# Call the real handler. The signo, siginfo and sigcontext") \
TCR("ldr r"S(CFA_REG)", [ip]") \
TCR("") \
TCR("# Call the real handler. The signo, siginfo and sigcontext") \
with Ada.Unchecked_Deallocation;
with System.WCh_Con; use System.WCh_Con;
with Ada.Unchecked_Deallocation;
with System.WCh_Con; use System.WCh_Con;
or else Switch_Chars (Ptr + 3) /= '='
then
Osint.Fail ("missing path for --RTS");
or else Switch_Chars (Ptr + 3) /= '='
then
Osint.Fail ("missing path for --RTS");
- -- Check that this is the first time --RTS is specified or if
- -- it is not the first time, the same path has been specified.
+ declare
+ Runtime_Dir : String_Access;
- if RTS_Specified = null then
- RTS_Specified := new String'(Switch_Chars (Ptr + 4 .. Max));
+ begin
+ if System.OS_Lib.Is_Absolute_Path
+ (Switch_Chars (Ptr + 4 .. Max))
+ then
+ Runtime_Dir :=
+ new String'
+ (System.OS_Lib.Normalize_Pathname
+ (Switch_Chars (Ptr + 4 .. Max)));
- elsif
- RTS_Specified.all /= Switch_Chars (Ptr + 4 .. Max)
- then
- Osint.Fail ("--RTS cannot be specified multiple times");
- end if;
+ else
+ Runtime_Dir :=
+ new String'(Switch_Chars (Ptr + 4 .. Max));
+ end if;
+ -- Check that this is the first time --RTS is specified
+ -- or if it is not the first time, the same path has been
+ -- specified.
- Opt.No_Stdinc := True;
- Opt.RTS_Switch := True;
+ if RTS_Specified = null then
+ RTS_Specified := Runtime_Dir;
- RTS_Src_Path_Name :=
- Get_RTS_Search_Dir
- (Switch_Chars (Ptr + 4 .. Max), Include);
+ elsif RTS_Specified.all /= Runtime_Dir.all then
+ Osint.Fail ("--RTS cannot be specified multiple times");
+ end if;
- RTS_Lib_Path_Name :=
- Get_RTS_Search_Dir
- (Switch_Chars (Ptr + 4 .. Max), Objects);
- if RTS_Src_Path_Name /= null
- and then RTS_Lib_Path_Name /= null
- then
- -- Store the -fRTS switch (Note: Store_Compilation_Switch
- -- changes -fRTS back into --RTS for the actual output).
+ Opt.No_Stdinc := True;
+ Opt.RTS_Switch := True;
- Store_Compilation_Switch (Switch_Chars);
+ RTS_Src_Path_Name :=
+ Get_RTS_Search_Dir (Runtime_Dir.all, Include);
- elsif RTS_Src_Path_Name = null
- and then RTS_Lib_Path_Name = null
- then
- Osint.Fail ("RTS path not valid: missing " &
- "adainclude and adalib directories");
+ RTS_Lib_Path_Name :=
+ Get_RTS_Search_Dir (Runtime_Dir.all, Objects);
- elsif RTS_Src_Path_Name = null then
- Osint.Fail ("RTS path not valid: missing " &
- "adainclude directory");
+ if RTS_Src_Path_Name /= null
+ and then RTS_Lib_Path_Name /= null
+ then
+ -- Store the -fRTS switch (Note: Store_Compilation_Switch
+ -- changes -fRTS back into --RTS for the actual output).
- elsif RTS_Lib_Path_Name = null then
- Osint.Fail ("RTS path not valid: missing " &
- "adalib directory");
- end if;
+ Store_Compilation_Switch (Switch_Chars);
+
+ elsif RTS_Src_Path_Name = null
+ and then RTS_Lib_Path_Name = null
+ then
+ Osint.Fail ("RTS path not valid: missing "
+ & "adainclude and adalib directories");
+
+ elsif RTS_Src_Path_Name = null then
+ Osint.Fail ("RTS path not valid: missing "
+ & "adainclude directory");
+
+ elsif RTS_Lib_Path_Name = null then
+ Osint.Fail ("RTS path not valid: missing "
+ & "adalib directory");
+ end if;
+ end;
end if;
-- There are no other switches not starting with -gnat
end if;
-- There are no other switches not starting with -gnat
if C = 'b'
and then (Ptr /= First_Ptr + 1
if C = 'b'
and then (Ptr /= First_Ptr + 1
- or else not First_Switch)
+ or else not First_Switch)
then
Osint.Fail
("-gnatd.b must be first if combined "
then
Osint.Fail
("-gnatd.b must be first if combined "