From a0713cb6beb00ca850e7c20f287d32f1e1a14a49 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 11 Sep 2017 12:12:05 +0200 Subject: [PATCH] libgnat: Rename ?-[a-z]*-* into ?-[a-z]*__* 2017-09-11 Jerome Lambourg * libgnat: Rename ?-[a-z]*-* into ?-[a-z]*__* * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Take this renaming into account. From-SVN: r251968 --- gcc/ada/ChangeLog | 10 + gcc/ada/gcc-interface/Make-lang.in | 4 +- gcc/ada/gcc-interface/Makefile.in | 276 +++++++++--------- ...coinho-shared.adb => a-coinho__shared.adb} | 0 ...coinho-shared.ads => a-coinho__shared.ads} | 0 ...a-dirval-mingw.adb => a-dirval__mingw.adb} | 0 ...ull.adb => a-elchha__vxworks-ppc-full.adb} | 0 ...a-excpol-abort.adb => a-excpol__abort.adb} | 0 ...numaux-darwin.adb => a-numaux__darwin.adb} | 0 ...numaux-darwin.ads => a-numaux__darwin.ads} | 0 ...ux-libc-x86.ads => a-numaux__libc-x86.ads} | 0 ...maux-vxworks.ads => a-numaux__vxworks.ads} | 0 .../{a-numaux-x86.adb => a-numaux__x86.adb} | 0 .../{a-numaux-x86.ads => a-numaux__x86.ads} | 0 ...strunb-shared.adb => a-strunb__shared.adb} | 0 ...strunb-shared.ads => a-strunb__shared.ads} | 0 ...stunau-shared.adb => a-stunau__shared.adb} | 0 ...stwiun-shared.adb => a-stwiun__shared.adb} | 0 ...stwiun-shared.ads => a-stwiun__shared.ads} | 0 ...stzunb-shared.adb => a-stzunb__shared.adb} | 0 ...stzunb-shared.ads => a-stzunb__shared.ads} | 0 ...suteio-shared.adb => a-suteio__shared.adb} | 0 ...swunau-shared.adb => a-swunau__shared.adb} | 0 ...swuwti-shared.adb => a-swuwti__shared.adb} | 0 ...szunau-shared.adb => a-szunau__shared.adb} | 0 ...szuzti-shared.adb => a-szuzti__shared.adb} | 0 .../{g-alleve-hard.adb => g-alleve__hard.adb} | 0 .../{g-alleve-hard.ads => g-alleve__hard.ads} | 0 ...-put-vxworks.adb => g-io__put-vxworks.adb} | 0 ...g-sercom-linux.adb => g-sercom__linux.adb} | 0 ...g-sercom-mingw.adb => g-sercom__mingw.adb} | 0 ...g-socket-dummy.adb => g-socket__dummy.adb} | 0 ...g-socket-dummy.ads => g-socket__dummy.ads} | 0 ...g-socthi-dummy.adb => g-socthi__dummy.adb} | 0 ...g-socthi-dummy.ads => g-socthi__dummy.ads} | 0 ...g-socthi-mingw.adb => g-socthi__mingw.adb} | 0 ...g-socthi-mingw.ads => g-socthi__mingw.ads} | 0 ...cthi-vxworks.adb => g-socthi__vxworks.adb} | 0 ...cthi-vxworks.ads => g-socthi__vxworks.ads} | 0 ...soliop-lynxos.ads => g-soliop__lynxos.ads} | 0 ...g-soliop-mingw.ads => g-soliop__mingw.ads} | 0 ...liop-solaris.ads => g-soliop__solaris.ads} | 0 ...g-sothco-dummy.adb => g-sothco__dummy.adb} | 0 ...g-sothco-dummy.ads => g-sothco__dummy.ads} | 0 ...sifd-sockets.adb => g-stsifd__sockets.adb} | 0 .../{i-vxwork-x86.ads => i-vxwork__x86.ads} | 0 ...ocou-builtin.adb => s-atocou__builtin.adb} | 0 .../{s-atocou-x86.adb => s-atocou__x86.adb} | 0 .../{s-excmac-arm.adb => s-excmac__arm.adb} | 0 .../{s-excmac-arm.ads => s-excmac__arm.ads} | 0 .../{s-excmac-gcc.adb => s-excmac__gcc.adb} | 0 .../{s-excmac-gcc.ads => s-excmac__gcc.ads} | 0 .../{s-flocon-none.adb => s-flocon__none.adb} | 0 ...s-gloloc-mingw.adb => s-gloloc__mingw.adb} | 0 ...s-memory-mingw.adb => s-memory__mingw.adb} | 0 .../{s-mmauni-long.ads => s-mmauni__long.ads} | 0 ...s-mmosin-mingw.adb => s-mmosin__mingw.adb} | 0 ...s-mmosin-mingw.ads => s-mmosin__mingw.ads} | 0 .../{s-mmosin-unix.adb => s-mmosin__unix.adb} | 0 .../{s-mmosin-unix.ads => s-mmosin__unix.ads} | 0 ...osprim-darwin.adb => s-osprim__darwin.adb} | 0 ...osprim-lynxos.ads => s-osprim__lynxos.ads} | 0 ...s-osprim-mingw.adb => s-osprim__mingw.adb} | 0 ...s-osprim-posix.adb => s-osprim__posix.adb} | 0 ...-posix2008.adb => s-osprim__posix2008.adb} | 0 ...prim-solaris.adb => s-osprim__solaris.adb} | 0 .../{s-osprim-unix.adb => s-osprim__unix.adb} | 0 ...prim-vxworks.adb => s-osprim__vxworks.adb} | 0 .../{s-osprim-x32.adb => s-osprim__x32.adb} | 0 gcc/ada/libgnat/s-osvers__vxworks-653.ads | 38 +++ ...s-parame-ae653.ads => s-parame__ae653.ads} | 0 .../{s-parame-hpux.ads => s-parame__hpux.ads} | 0 ...s-parame-rtems.adb => s-parame__rtems.adb} | 0 ...rame-vxworks.adb => s-parame__vxworks.adb} | 0 ...rame-vxworks.ads => s-parame__vxworks.ads} | 0 ...s-stchop-limit.ads => s-stchop__limit.ads} | 0 ...s-stchop-rtems.adb => s-stchop__rtems.adb} | 0 ...chop-vxworks.adb => s-stchop__vxworks.adb} | 0 .../{s-stratt-xdr.adb => s-stratt__xdr.adb} | 0 .../{s-traceb-hpux.adb => s-traceb__hpux.adb} | 0 ...traceb-mastop.adb => s-traceb__mastop.adb} | 0 ...s-trasym-dwarf.adb => s-trasym__dwarf.adb} | 0 ...s-tsmona-linux.adb => s-tsmona__linux.adb} | 0 ...s-tsmona-mingw.adb => s-tsmona__mingw.adb} | 0 gcc/ada/libgnat/s__thread-ae653.adb | 247 ++++++++++++++++ 85 files changed, 435 insertions(+), 140 deletions(-) rename gcc/ada/libgnat/{a-coinho-shared.adb => a-coinho__shared.adb} (100%) rename gcc/ada/libgnat/{a-coinho-shared.ads => a-coinho__shared.ads} (100%) rename gcc/ada/libgnat/{a-dirval-mingw.adb => a-dirval__mingw.adb} (100%) rename gcc/ada/libgnat/{a-elchha-vxworks-ppc-full.adb => a-elchha__vxworks-ppc-full.adb} (100%) rename gcc/ada/libgnat/{a-excpol-abort.adb => a-excpol__abort.adb} (100%) rename gcc/ada/libgnat/{a-numaux-darwin.adb => a-numaux__darwin.adb} (100%) rename gcc/ada/libgnat/{a-numaux-darwin.ads => a-numaux__darwin.ads} (100%) rename gcc/ada/libgnat/{a-numaux-libc-x86.ads => a-numaux__libc-x86.ads} (100%) rename gcc/ada/libgnat/{a-numaux-vxworks.ads => a-numaux__vxworks.ads} (100%) rename gcc/ada/libgnat/{a-numaux-x86.adb => a-numaux__x86.adb} (100%) rename gcc/ada/libgnat/{a-numaux-x86.ads => a-numaux__x86.ads} (100%) rename gcc/ada/libgnat/{a-strunb-shared.adb => a-strunb__shared.adb} (100%) rename gcc/ada/libgnat/{a-strunb-shared.ads => a-strunb__shared.ads} (100%) rename gcc/ada/libgnat/{a-stunau-shared.adb => a-stunau__shared.adb} (100%) rename gcc/ada/libgnat/{a-stwiun-shared.adb => a-stwiun__shared.adb} (100%) rename gcc/ada/libgnat/{a-stwiun-shared.ads => a-stwiun__shared.ads} (100%) rename gcc/ada/libgnat/{a-stzunb-shared.adb => a-stzunb__shared.adb} (100%) rename gcc/ada/libgnat/{a-stzunb-shared.ads => a-stzunb__shared.ads} (100%) rename gcc/ada/libgnat/{a-suteio-shared.adb => a-suteio__shared.adb} (100%) rename gcc/ada/libgnat/{a-swunau-shared.adb => a-swunau__shared.adb} (100%) rename gcc/ada/libgnat/{a-swuwti-shared.adb => a-swuwti__shared.adb} (100%) rename gcc/ada/libgnat/{a-szunau-shared.adb => a-szunau__shared.adb} (100%) rename gcc/ada/libgnat/{a-szuzti-shared.adb => a-szuzti__shared.adb} (100%) rename gcc/ada/libgnat/{g-alleve-hard.adb => g-alleve__hard.adb} (100%) rename gcc/ada/libgnat/{g-alleve-hard.ads => g-alleve__hard.ads} (100%) rename gcc/ada/libgnat/{g-io-put-vxworks.adb => g-io__put-vxworks.adb} (100%) rename gcc/ada/libgnat/{g-sercom-linux.adb => g-sercom__linux.adb} (100%) rename gcc/ada/libgnat/{g-sercom-mingw.adb => g-sercom__mingw.adb} (100%) rename gcc/ada/libgnat/{g-socket-dummy.adb => g-socket__dummy.adb} (100%) rename gcc/ada/libgnat/{g-socket-dummy.ads => g-socket__dummy.ads} (100%) rename gcc/ada/libgnat/{g-socthi-dummy.adb => g-socthi__dummy.adb} (100%) rename gcc/ada/libgnat/{g-socthi-dummy.ads => g-socthi__dummy.ads} (100%) rename gcc/ada/libgnat/{g-socthi-mingw.adb => g-socthi__mingw.adb} (100%) rename gcc/ada/libgnat/{g-socthi-mingw.ads => g-socthi__mingw.ads} (100%) rename gcc/ada/libgnat/{g-socthi-vxworks.adb => g-socthi__vxworks.adb} (100%) rename gcc/ada/libgnat/{g-socthi-vxworks.ads => g-socthi__vxworks.ads} (100%) rename gcc/ada/libgnat/{g-soliop-lynxos.ads => g-soliop__lynxos.ads} (100%) rename gcc/ada/libgnat/{g-soliop-mingw.ads => g-soliop__mingw.ads} (100%) rename gcc/ada/libgnat/{g-soliop-solaris.ads => g-soliop__solaris.ads} (100%) rename gcc/ada/libgnat/{g-sothco-dummy.adb => g-sothco__dummy.adb} (100%) rename gcc/ada/libgnat/{g-sothco-dummy.ads => g-sothco__dummy.ads} (100%) rename gcc/ada/libgnat/{g-stsifd-sockets.adb => g-stsifd__sockets.adb} (100%) rename gcc/ada/libgnat/{i-vxwork-x86.ads => i-vxwork__x86.ads} (100%) rename gcc/ada/libgnat/{s-atocou-builtin.adb => s-atocou__builtin.adb} (100%) rename gcc/ada/libgnat/{s-atocou-x86.adb => s-atocou__x86.adb} (100%) rename gcc/ada/libgnat/{s-excmac-arm.adb => s-excmac__arm.adb} (100%) rename gcc/ada/libgnat/{s-excmac-arm.ads => s-excmac__arm.ads} (100%) rename gcc/ada/libgnat/{s-excmac-gcc.adb => s-excmac__gcc.adb} (100%) rename gcc/ada/libgnat/{s-excmac-gcc.ads => s-excmac__gcc.ads} (100%) rename gcc/ada/libgnat/{s-flocon-none.adb => s-flocon__none.adb} (100%) rename gcc/ada/libgnat/{s-gloloc-mingw.adb => s-gloloc__mingw.adb} (100%) rename gcc/ada/libgnat/{s-memory-mingw.adb => s-memory__mingw.adb} (100%) rename gcc/ada/libgnat/{s-mmauni-long.ads => s-mmauni__long.ads} (100%) rename gcc/ada/libgnat/{s-mmosin-mingw.adb => s-mmosin__mingw.adb} (100%) rename gcc/ada/libgnat/{s-mmosin-mingw.ads => s-mmosin__mingw.ads} (100%) rename gcc/ada/libgnat/{s-mmosin-unix.adb => s-mmosin__unix.adb} (100%) rename gcc/ada/libgnat/{s-mmosin-unix.ads => s-mmosin__unix.ads} (100%) rename gcc/ada/libgnat/{s-osprim-darwin.adb => s-osprim__darwin.adb} (100%) rename gcc/ada/libgnat/{s-osprim-lynxos.ads => s-osprim__lynxos.ads} (100%) rename gcc/ada/libgnat/{s-osprim-mingw.adb => s-osprim__mingw.adb} (100%) rename gcc/ada/libgnat/{s-osprim-posix.adb => s-osprim__posix.adb} (100%) rename gcc/ada/libgnat/{s-osprim-posix2008.adb => s-osprim__posix2008.adb} (100%) rename gcc/ada/libgnat/{s-osprim-solaris.adb => s-osprim__solaris.adb} (100%) rename gcc/ada/libgnat/{s-osprim-unix.adb => s-osprim__unix.adb} (100%) rename gcc/ada/libgnat/{s-osprim-vxworks.adb => s-osprim__vxworks.adb} (100%) rename gcc/ada/libgnat/{s-osprim-x32.adb => s-osprim__x32.adb} (100%) create mode 100644 gcc/ada/libgnat/s-osvers__vxworks-653.ads rename gcc/ada/libgnat/{s-parame-ae653.ads => s-parame__ae653.ads} (100%) rename gcc/ada/libgnat/{s-parame-hpux.ads => s-parame__hpux.ads} (100%) rename gcc/ada/libgnat/{s-parame-rtems.adb => s-parame__rtems.adb} (100%) rename gcc/ada/libgnat/{s-parame-vxworks.adb => s-parame__vxworks.adb} (100%) rename gcc/ada/libgnat/{s-parame-vxworks.ads => s-parame__vxworks.ads} (100%) rename gcc/ada/libgnat/{s-stchop-limit.ads => s-stchop__limit.ads} (100%) rename gcc/ada/libgnat/{s-stchop-rtems.adb => s-stchop__rtems.adb} (100%) rename gcc/ada/libgnat/{s-stchop-vxworks.adb => s-stchop__vxworks.adb} (100%) rename gcc/ada/libgnat/{s-stratt-xdr.adb => s-stratt__xdr.adb} (100%) rename gcc/ada/libgnat/{s-traceb-hpux.adb => s-traceb__hpux.adb} (100%) rename gcc/ada/libgnat/{s-traceb-mastop.adb => s-traceb__mastop.adb} (100%) rename gcc/ada/libgnat/{s-trasym-dwarf.adb => s-trasym__dwarf.adb} (100%) rename gcc/ada/libgnat/{s-tsmona-linux.adb => s-tsmona__linux.adb} (100%) rename gcc/ada/libgnat/{s-tsmona-mingw.adb => s-tsmona__mingw.adb} (100%) create mode 100644 gcc/ada/libgnat/s__thread-ae653.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 93d9f6a5429..84608b3e5df 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,13 @@ +2017-09-11 Yannick Moy + + * lib-xref-spark_specific.adb: Minor rewrite. + +2017-09-11 Jerome Lambourg + + * libgnat: Rename ?-[a-z]*-* into ?-[a-z]*__* + * gcc-interface/Makefile.in, gcc-interface/Make-lang.in: Take this + renaming into account. + 2017-09-11 Jerome Lambourg * libgnarl: Rename ?-[a-z]*-* into ?-[a-z]*__* diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index b9d06b025ad..65826952d31 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -636,11 +636,11 @@ CFLAGS-ada/raise-gcc.o += -I$(srcdir)/../libgcc -DEH_MECHANISM_$(EH_MECHANISM) ada/libgnat/s-excmac.o: ada/libgnat/s-excmac.ads ada/libgnat/s-excmac.adb -ada/libgnat/s-excmac.ads: $(srcdir)/ada/libgnat/s-excmac-$(EH_MECHANISM).ads +ada/libgnat/s-excmac.ads: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).ads mkdir -p ada/libgnat $(CP) $< $@ -ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac-$(EH_MECHANISM).adb +ada/libgnat/s-excmac.adb: $(srcdir)/ada/libgnat/s-excmac__$(EH_MECHANISM).adb mkdir -p ada/libgnat $(CP) $< $@ diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index d30028dab55..c05395ad6d6 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -359,7 +359,7 @@ a-intnam.ads. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the VxWorks 653 Partition OS version of this file. If you add an OS +-- variant please be sure to update type OS_Version in all variants of this +-- file, which is part of the Level A certified run-time libraries. + +package System.OS_Versions is + pragma Pure (System.OS_Versions); + type OS_Version is + (LynxOS_178, VxWorks_Cert, VxWorks_Cert_RTP, VxWorks_653, VxWorks_MILS); + OS : constant OS_Version := VxWorks_653; +end System.OS_Versions; diff --git a/gcc/ada/libgnat/s-parame-ae653.ads b/gcc/ada/libgnat/s-parame__ae653.ads similarity index 100% rename from gcc/ada/libgnat/s-parame-ae653.ads rename to gcc/ada/libgnat/s-parame__ae653.ads diff --git a/gcc/ada/libgnat/s-parame-hpux.ads b/gcc/ada/libgnat/s-parame__hpux.ads similarity index 100% rename from gcc/ada/libgnat/s-parame-hpux.ads rename to gcc/ada/libgnat/s-parame__hpux.ads diff --git a/gcc/ada/libgnat/s-parame-rtems.adb b/gcc/ada/libgnat/s-parame__rtems.adb similarity index 100% rename from gcc/ada/libgnat/s-parame-rtems.adb rename to gcc/ada/libgnat/s-parame__rtems.adb diff --git a/gcc/ada/libgnat/s-parame-vxworks.adb b/gcc/ada/libgnat/s-parame__vxworks.adb similarity index 100% rename from gcc/ada/libgnat/s-parame-vxworks.adb rename to gcc/ada/libgnat/s-parame__vxworks.adb diff --git a/gcc/ada/libgnat/s-parame-vxworks.ads b/gcc/ada/libgnat/s-parame__vxworks.ads similarity index 100% rename from gcc/ada/libgnat/s-parame-vxworks.ads rename to gcc/ada/libgnat/s-parame__vxworks.ads diff --git a/gcc/ada/libgnat/s-stchop-limit.ads b/gcc/ada/libgnat/s-stchop__limit.ads similarity index 100% rename from gcc/ada/libgnat/s-stchop-limit.ads rename to gcc/ada/libgnat/s-stchop__limit.ads diff --git a/gcc/ada/libgnat/s-stchop-rtems.adb b/gcc/ada/libgnat/s-stchop__rtems.adb similarity index 100% rename from gcc/ada/libgnat/s-stchop-rtems.adb rename to gcc/ada/libgnat/s-stchop__rtems.adb diff --git a/gcc/ada/libgnat/s-stchop-vxworks.adb b/gcc/ada/libgnat/s-stchop__vxworks.adb similarity index 100% rename from gcc/ada/libgnat/s-stchop-vxworks.adb rename to gcc/ada/libgnat/s-stchop__vxworks.adb diff --git a/gcc/ada/libgnat/s-stratt-xdr.adb b/gcc/ada/libgnat/s-stratt__xdr.adb similarity index 100% rename from gcc/ada/libgnat/s-stratt-xdr.adb rename to gcc/ada/libgnat/s-stratt__xdr.adb diff --git a/gcc/ada/libgnat/s-traceb-hpux.adb b/gcc/ada/libgnat/s-traceb__hpux.adb similarity index 100% rename from gcc/ada/libgnat/s-traceb-hpux.adb rename to gcc/ada/libgnat/s-traceb__hpux.adb diff --git a/gcc/ada/libgnat/s-traceb-mastop.adb b/gcc/ada/libgnat/s-traceb__mastop.adb similarity index 100% rename from gcc/ada/libgnat/s-traceb-mastop.adb rename to gcc/ada/libgnat/s-traceb__mastop.adb diff --git a/gcc/ada/libgnat/s-trasym-dwarf.adb b/gcc/ada/libgnat/s-trasym__dwarf.adb similarity index 100% rename from gcc/ada/libgnat/s-trasym-dwarf.adb rename to gcc/ada/libgnat/s-trasym__dwarf.adb diff --git a/gcc/ada/libgnat/s-tsmona-linux.adb b/gcc/ada/libgnat/s-tsmona__linux.adb similarity index 100% rename from gcc/ada/libgnat/s-tsmona-linux.adb rename to gcc/ada/libgnat/s-tsmona__linux.adb diff --git a/gcc/ada/libgnat/s-tsmona-mingw.adb b/gcc/ada/libgnat/s-tsmona__mingw.adb similarity index 100% rename from gcc/ada/libgnat/s-tsmona-mingw.adb rename to gcc/ada/libgnat/s-tsmona__mingw.adb diff --git a/gcc/ada/libgnat/s__thread-ae653.adb b/gcc/ada/libgnat/s__thread-ae653.adb new file mode 100644 index 00000000000..ca871286fce --- /dev/null +++ b/gcc/ada/libgnat/s__thread-ae653.adb @@ -0,0 +1,247 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT COMPILER COMPONENTS -- +-- -- +-- S Y S T E M . T H R E A D S -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1992-2017, Free Software Foundation, Inc. -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception under Section 7 of GPL version 3, you are granted -- +-- additional permissions described in the GCC Runtime Library Exception, -- +-- version 3.1, as published by the Free Software Foundation. -- +-- -- +-- You should have received a copy of the GNU General Public License and -- +-- a copy of the GCC Runtime Library Exception along with this program; -- +-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- +-- . -- +-- -- +-- GNAT was originally developed by the GNAT team at New York University. -- +-- Extensive contributions were provided by Ada Core Technologies Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the VxWorks 653 version of this package + +pragma Restrictions (No_Tasking); +-- The VxWorks 653 version of this package is intended only for programs +-- which do not use Ada tasking. This restriction ensures that this +-- will be checked by the binder. + +with System.OS_Versions; use System.OS_Versions; +with System.Secondary_Stack; +pragma Elaborate_All (System.Secondary_Stack); + +package body System.Threads is + + use Interfaces.C; + + package SSS renames System.Secondary_Stack; + + package SSL renames System.Soft_Links; + + Current_ATSD : aliased System.Address := System.Null_Address; + pragma Export (C, Current_ATSD, "__gnat_current_atsd"); + + Main_ATSD : aliased ATSD; + -- TSD for environment task + + Stack_Limit : Address; + + pragma Import (C, Stack_Limit, "__gnat_stack_limit"); + + type Set_Stack_Limit_Proc_Acc is access procedure; + pragma Convention (C, Set_Stack_Limit_Proc_Acc); + + Set_Stack_Limit_Hook : Set_Stack_Limit_Proc_Acc; + pragma Import (C, Set_Stack_Limit_Hook, "__gnat_set_stack_limit_hook"); + -- Procedure to be called when a task is created to set stack limit if + -- limit checking is used. + + -------------------------- + -- VxWorks specific API -- + -------------------------- + + ERROR : constant STATUS := Interfaces.C.int (-1); + + function taskIdVerify (tid : t_id) return STATUS; + pragma Import (C, taskIdVerify, "taskIdVerify"); + + function taskIdSelf return t_id; + pragma Import (C, taskIdSelf, "taskIdSelf"); + + function taskVarAdd + (tid : t_id; pVar : System.Address) return int; + pragma Import (C, taskVarAdd, "taskVarAdd"); + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Init_RTS; + -- This procedure performs the initialization of the run-time lib. + -- It installs System.Threads versions of certain operations of the + -- run-time lib. + + procedure Install_Handler; + pragma Import (C, Install_Handler, "__gnat_install_handler"); + + function Get_Sec_Stack_Addr return Address; + + procedure Set_Sec_Stack_Addr (Addr : Address); + + ----------------------- + -- Thread_Body_Enter -- + ----------------------- + + procedure Thread_Body_Enter + (Sec_Stack_Address : System.Address; + Sec_Stack_Size : Natural; + Process_ATSD_Address : System.Address) + is + -- Current_ATSD must already be a taskVar of taskIdSelf. + -- No assertion because taskVarGet is not available on VxWorks/CERT, + -- which is used on VxWorks 653 3.x as a guest OS. + + TSD : constant ATSD_Access := From_Address (Process_ATSD_Address); + + begin + + TSD.Sec_Stack_Addr := Sec_Stack_Address; + SSS.SS_Init (TSD.Sec_Stack_Addr, Sec_Stack_Size); + Current_ATSD := Process_ATSD_Address; + + Install_Handler; + + -- Initialize stack limit if needed + + if Current_ATSD /= Main_ATSD'Address + and then Set_Stack_Limit_Hook /= null + then + Set_Stack_Limit_Hook.all; + end if; + end Thread_Body_Enter; + + ---------------------------------- + -- Thread_Body_Exceptional_Exit -- + ---------------------------------- + + procedure Thread_Body_Exceptional_Exit + (EO : Ada.Exceptions.Exception_Occurrence) + is + pragma Unreferenced (EO); + + begin + -- No action for this target + + null; + end Thread_Body_Exceptional_Exit; + + ----------------------- + -- Thread_Body_Leave -- + ----------------------- + + procedure Thread_Body_Leave is + begin + -- No action for this target + + null; + end Thread_Body_Leave; + + -------------- + -- Init_RTS -- + -------------- + + procedure Init_RTS is + -- Register environment task + Result : constant Interfaces.C.int := Register (taskIdSelf); + pragma Assert (Result /= ERROR); + + begin + Main_ATSD.Sec_Stack_Addr := SSL.Get_Sec_Stack_Addr_NT; + Current_ATSD := Main_ATSD'Address; + Install_Handler; + SSL.Get_Sec_Stack_Addr := Get_Sec_Stack_Addr'Access; + SSL.Set_Sec_Stack_Addr := Set_Sec_Stack_Addr'Access; + end Init_RTS; + + ------------------------ + -- Get_Sec_Stack_Addr -- + ------------------------ + + function Get_Sec_Stack_Addr return Address is + CTSD : constant ATSD_Access := From_Address (Current_ATSD); + begin + pragma Assert (CTSD /= null); + return CTSD.Sec_Stack_Addr; + end Get_Sec_Stack_Addr; + + -------------- + -- Register -- + -------------- + + function Register (T : Thread_Id) return STATUS is + Result : STATUS; + + begin + -- It cannot be assumed that the caller of this routine has a ATSD; + -- so neither this procedure nor the procedures that it calls should + -- raise or handle exceptions, or make use of a secondary stack. + + -- This routine is only necessary because taskVarAdd cannot be + -- executed once an VxWorks 653 partition has entered normal mode + -- (depending on configRecord.c, allocation could be disabled). + -- Otherwise, everything could have been done in Thread_Body_Enter. + + if taskIdVerify (T) = ERROR then + return ERROR; + end if; + + Result := taskVarAdd (T, Current_ATSD'Address); + pragma Assert (Result /= ERROR); + + -- The same issue applies to the task variable that contains the stack + -- limit when that overflow checking mechanism is used instead of + -- probing. If stack checking is enabled and limit checking is used, + -- allocate the limit for this task. The environment task has this + -- initialized by the binder-generated main when + -- System.Stack_Check_Limits = True. + + pragma Warnings (Off); + -- OS is a constant + if Result /= ERROR + and then OS /= VxWorks_653 + and then Set_Stack_Limit_Hook /= null + then + Result := taskVarAdd (T, Stack_Limit'Address); + pragma Assert (Result /= ERROR); + end if; + pragma Warnings (On); + + return Result; + end Register; + + ------------------------ + -- Set_Sec_Stack_Addr -- + ------------------------ + + procedure Set_Sec_Stack_Addr (Addr : Address) is + CTSD : constant ATSD_Access := From_Address (Current_ATSD); + begin + pragma Assert (CTSD /= null); + CTSD.Sec_Stack_Addr := Addr; + end Set_Sec_Stack_Addr; + +begin + -- Initialize run-time library + + Init_RTS; +end System.Threads; -- 2.30.2