aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/boost/libs
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
commite6c9b17192c56494adba359d5e132c431b241191 (patch)
tree6f2449871a118a0e8919ce842b1174e06cb470ef /contrib/restricted/boost/libs
parent285021ab1aac39e84b269d9bacd4deee69cf63fc (diff)
downloadydb-e6c9b17192c56494adba359d5e132c431b241191.tar.gz
Ydb stable 22-4-2122.4.21
x-stable-origin-commit: e89099581237299a132feafb5b58af59ebd0468a
Diffstat (limited to 'contrib/restricted/boost/libs')
-rw-r--r--contrib/restricted/boost/libs/.yandex_meta/licenses.list.txt72
-rw-r--r--contrib/restricted/boost/libs/CMakeLists.darwin.txt11
-rw-r--r--contrib/restricted/boost/libs/CMakeLists.linux.txt13
-rw-r--r--contrib/restricted/boost/libs/CMakeLists.txt13
-rw-r--r--contrib/restricted/boost/libs/atomic/.yandex_meta/licenses.list.txt39
-rw-r--r--contrib/restricted/boost/libs/chrono/.yandex_meta/licenses.list.txt86
-rw-r--r--contrib/restricted/boost/libs/chrono/CMakeLists.txt2
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches.hpp24
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp66
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp65
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/last_lap.hpp42
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/no_memory.hpp36
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/dont_start.hpp32
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp133
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/base_formatter.hpp65
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp109
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/times_formatter.hpp117
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/laps_stopwatch.hpp442
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp31
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp34
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopclock.hpp176
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp37
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/process_default_formatter.hpp42
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopclock.hpp175
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp259
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp31
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/strict_stopclock.hpp143
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/system_default_formatter.hpp19
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp26
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/simple_stopwatch.hpp110
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch.hpp444
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch_scoped.hpp142
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/strict_stopwatch.hpp115
-rw-r--r--contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/suspendable_stopwatch.hpp334
-rw-r--r--contrib/restricted/boost/libs/container/.yandex_meta/licenses.list.txt65
-rw-r--r--contrib/restricted/boost/libs/context/.yandex_meta/licenses.list.txt91
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S113
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_macho_gas.S109
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_elf_gas.S86
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_macho_gas.S95
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.asm81
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.masm81
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_combined_sysv_macho_gas.S20
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_gas.asm117
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.asm116
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.masm116
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_elf_gas.S92
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_macho_gas.S74
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_mips32_o32_elf_gas.S118
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc32_ppc64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S206
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_macho_gas.S201
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_xcoff_gas.S203
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S220
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_macho_gas.S164
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_xcoff_gas.S84
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm209
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm205
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.masm205
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_elf_gas.S84
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_macho_gas.S88
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_elf_gas.S79
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_macho_gas.S71
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.asm77
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.masm77
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_combined_sysv_macho_gas.S20
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_gas.asm147
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.asm140
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.masm140
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_elf_gas.S112
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_macho_gas.S90
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_mips32_o32_elf_gas.S96
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc32_ppc64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_elf_gas.S142
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_macho_gas.S137
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_xcoff_gas.S138
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_elf_gas.S176
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_macho_gas.S126
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_xcoff_gas.S62
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_gas.asm174
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.asm163
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.masm163
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S112
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_macho_gas.S108
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_elf_gas.S91
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_macho_gas.S100
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.asm86
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.masm86
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_combined_sysv_macho_gas.S20
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_gas.asm125
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.asm124
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.masm124
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_elf_gas.S99
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_macho_gas.S81
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_i386_x86_64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_mips32_o32_elf_gas.S119
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_ppc64_sysv_macho_gas.S16
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_elf_gas.S206
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_macho_gas.S201
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_xcoff_gas.S203
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S240
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_macho_gas.S151
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_xcoff_gas.S83
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_gas.asm211
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm207
-rw-r--r--contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.masm207
-rw-r--r--contrib/restricted/boost/libs/context/src/continuation.cpp60
-rw-r--r--contrib/restricted/boost/libs/context/src/dummy.cpp0
-rw-r--r--contrib/restricted/boost/libs/context/src/execution_context.cpp69
-rw-r--r--contrib/restricted/boost/libs/context/src/fiber.cpp58
-rw-r--r--contrib/restricted/boost/libs/context/src/untested.cpp7
-rw-r--r--contrib/restricted/boost/libs/context/src/windows/stack_traits.cpp116
-rw-r--r--contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt36
-rw-r--r--contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp114
-rw-r--r--contrib/restricted/boost/libs/date_time/.yandex_meta/licenses.list.txt50
-rw-r--r--contrib/restricted/boost/libs/date_time/src/gregorian/gregorian_types.cpp62
-rw-r--r--contrib/restricted/boost/libs/date_time/src/posix_time/posix_time_types.cpp35
-rw-r--r--contrib/restricted/boost/libs/exception/.yandex_meta/licenses.list.txt33
-rw-r--r--contrib/restricted/boost/libs/filesystem/.yandex_meta/licenses.list.txt80
-rw-r--r--contrib/restricted/boost/libs/iostreams/.yandex_meta/licenses.list.txt67
-rw-r--r--contrib/restricted/boost/libs/iostreams/CMakeLists.txt2
-rw-r--r--contrib/restricted/boost/libs/iostreams/src/bzip2.cpp168
-rw-r--r--contrib/restricted/boost/libs/iostreams/src/lzma.cpp147
-rw-r--r--contrib/restricted/boost/libs/locale/.yandex_meta/licenses.list.txt38
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/all_generator.hpp45
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/api.hpp357
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/collate.cpp127
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/converter.cpp106
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/lcid.cpp127
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/numeric.cpp245
-rw-r--r--contrib/restricted/boost/libs/locale/src/win32/win_backend.cpp153
-rw-r--r--contrib/restricted/boost/libs/log/.yandex_meta/licenses.list.txt66
-rw-r--r--contrib/restricted/boost/libs/log/config/atomic-int32/atomic_int32.cpp17
-rw-r--r--contrib/restricted/boost/libs/log/config/native-syslog/native_syslog.cpp26
-rw-r--r--contrib/restricted/boost/libs/log/config/pthread-mutex-robust/pthread_mutex_robust.cpp37
-rw-r--r--contrib/restricted/boost/libs/log/config/visibility/visibility.cpp16
-rw-r--r--contrib/restricted/boost/libs/log/config/x86-ext/avx2.cpp16
-rw-r--r--contrib/restricted/boost/libs/log/config/x86-ext/ssse3.cpp15
-rw-r--r--contrib/restricted/boost/libs/log/config/xopen-source-600/xopen_source_600.cpp17
-rw-r--r--contrib/restricted/boost/libs/log/src/dump_avx2.cpp349
-rw-r--r--contrib/restricted/boost/libs/log/src/dump_ssse3.cpp311
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/auto_handle.hpp79
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/debug_output_backend.cpp78
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/event_log_backend.cpp635
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/event_log_registry.hpp491
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/ipc_reliable_message_queue.cpp818
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.cpp544
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.hpp652
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/light_rw_mutex.cpp201
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.cpp251
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.hpp102
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/object_name.cpp227
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/simple_event_log.h95
-rw-r--r--contrib/restricted/boost/libs/log/src/windows/utf_code_conversion.hpp42
-rw-r--r--contrib/restricted/boost/libs/program_options/.yandex_meta/licenses.list.txt55
-rw-r--r--contrib/restricted/boost/libs/program_options/CMakeLists.txt2
-rw-r--r--contrib/restricted/boost/libs/python/.yandex_meta/licenses.list.txt120
-rw-r--r--contrib/restricted/boost/libs/python/arcadia_test/mod/module.cpp11
-rw-r--r--contrib/restricted/boost/libs/python/arcadia_test/py2/test_hello.py5
-rw-r--r--contrib/restricted/boost/libs/python/arcadia_test/py3/test_hello.py5
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/dtype.cpp220
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/matrix.cpp63
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/ndarray.cpp301
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/numpy.cpp33
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/scalars.cpp36
-rw-r--r--contrib/restricted/boost/libs/python/src/numpy/ufunc.cpp65
-rw-r--r--contrib/restricted/boost/libs/random/.yandex_meta/licenses.list.txt43
-rw-r--r--contrib/restricted/boost/libs/regex/.yandex_meta/licenses.list.txt51
-rw-r--r--contrib/restricted/boost/libs/serialization/.yandex_meta/licenses.list.txt87
-rw-r--r--contrib/restricted/boost/libs/serialization/src/binary_wiarchive.cpp47
-rw-r--r--contrib/restricted/boost/libs/serialization/src/binary_woarchive.cpp44
-rw-r--r--contrib/restricted/boost/libs/system/.yandex_meta/licenses.list.txt36
-rw-r--r--contrib/restricted/boost/libs/system/CMakeLists.txt2
-rw-r--r--contrib/restricted/boost/libs/thread/.yandex_meta/licenses.list.txt116
-rw-r--r--contrib/restricted/boost/libs/thread/CMakeLists.txt2
-rw-r--r--contrib/restricted/boost/libs/thread/src/tss_null.cpp38
-rw-r--r--contrib/restricted/boost/libs/thread/src/win32/thread.cpp973
-rw-r--r--contrib/restricted/boost/libs/thread/src/win32/thread_primitives.cpp140
-rw-r--r--contrib/restricted/boost/libs/thread/src/win32/tss_dll.cpp85
-rw-r--r--contrib/restricted/boost/libs/thread/src/win32/tss_pe.cpp337
-rw-r--r--contrib/restricted/boost/libs/timer/.yandex_meta/licenses.list.txt42
183 files changed, 22479 insertions, 5 deletions
diff --git a/contrib/restricted/boost/libs/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..db29dd547c
--- /dev/null
+++ b/contrib/restricted/boost/libs/.yandex_meta/licenses.list.txt
@@ -0,0 +1,72 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2016 Raffi Enficiaud.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright Gennadiy Rozental 2005-2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright Gennadiy Rozental 2006-2010.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright Gennadiy Rozental 2011.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (c) Copyright Raffi Enficiaud 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/CMakeLists.darwin.txt b/contrib/restricted/boost/libs/CMakeLists.darwin.txt
new file mode 100644
index 0000000000..8aa92aa277
--- /dev/null
+++ b/contrib/restricted/boost/libs/CMakeLists.darwin.txt
@@ -0,0 +1,11 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(chrono)
+add_subdirectory(system)
+add_subdirectory(thread)
diff --git a/contrib/restricted/boost/libs/CMakeLists.linux.txt b/contrib/restricted/boost/libs/CMakeLists.linux.txt
new file mode 100644
index 0000000000..a6641eba8d
--- /dev/null
+++ b/contrib/restricted/boost/libs/CMakeLists.linux.txt
@@ -0,0 +1,13 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+add_subdirectory(chrono)
+add_subdirectory(iostreams)
+add_subdirectory(program_options)
+add_subdirectory(system)
+add_subdirectory(thread)
diff --git a/contrib/restricted/boost/libs/CMakeLists.txt b/contrib/restricted/boost/libs/CMakeLists.txt
new file mode 100644
index 0000000000..dbfe6fa2c4
--- /dev/null
+++ b/contrib/restricted/boost/libs/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+# This file was gererated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+if (APPLE)
+ include(CMakeLists.darwin.txt)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
+ include(CMakeLists.linux.txt)
+endif()
diff --git a/contrib/restricted/boost/libs/atomic/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/atomic/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..445e6b59c5
--- /dev/null
+++ b/contrib/restricted/boost/libs/atomic/.yandex_meta/licenses.list.txt
@@ -0,0 +1,39 @@
+====================BSL-1.0====================
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ * Copyright (c) 2011 Helge Bahmann
+ * Copyright (c) 2013-2014 Andrey Semashev
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2011 Helge Bahmann
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/chrono/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/chrono/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..261729da1d
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/.yandex_meta/licenses.list.txt
@@ -0,0 +1,86 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Howard Hinnant
+// Copyright 2011 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright 2009-2010 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright 2009-2011 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright 2010 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2003, 2006, 2008
+// Copyright 2009-2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2008
+// Copyright Vicente J. Botet Escriba 2009-2010
+
+
+====================COPYRIGHT====================
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost
+// Software License, Version 1.0.
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/chrono/CMakeLists.txt b/contrib/restricted/boost/libs/chrono/CMakeLists.txt
index fc7b1ee73c..dbfe6fa2c4 100644
--- a/contrib/restricted/boost/libs/chrono/CMakeLists.txt
+++ b/contrib/restricted/boost/libs/chrono/CMakeLists.txt
@@ -8,6 +8,6 @@
if (APPLE)
include(CMakeLists.darwin.txt)
-elseif (UNIX AND NOT APPLE)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
include(CMakeLists.linux.txt)
endif()
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches.hpp
new file mode 100644
index 0000000000..66fd02cb17
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches.hpp
@@ -0,0 +1,24 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2010.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STOPWATCHES_HPP
+#define BOOST_STOPWATCHES_HPP
+
+//-----------------------------------------------------------------------------
+#include <boost/chrono/stopwatches/simple_stopwatch.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/reporters/system_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/process_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/thread_default_formatter.hpp>
+//-----------------------------------------------------------------------------
+
+#endif // BOOST_STOPWATCHES_HPP
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
new file mode 100644
index 0000000000..740c40d28c
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
@@ -0,0 +1,66 @@
+// boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_ACCUMULATOR_SET_HPP
+#define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_ACCUMULATOR_SET_HPP
+
+#include <boost/chrono/stopwatches/collectors/last_lap.hpp>
+#include <boost/accumulators/framework/accumulator_set.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/sum.hpp>
+#include <boost/accumulators/statistics/min.hpp>
+#include <boost/accumulators/statistics/max.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/accumulators/framework/features.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<
+ typename Duration,
+ typename Features = accumulators::features<accumulators::tag::count,
+ accumulators::tag::sum, accumulators::tag::min,
+ accumulators::tag::max, accumulators::tag::mean>,
+ typename Weight = void>
+ struct laps_accumulator_set : last_lap<Duration>
+ {
+ typedef last_lap<Duration> base_type;
+ typedef Duration duration;
+ typedef typename duration::rep rep;
+ typedef accumulators::accumulator_set<rep, Features,
+ Weight> storage_type;
+ storage_type acc_;
+
+ void store(duration const& d)
+ {
+ this->base_type::store(d);
+ acc_(d.count());
+ }
+
+ void reset()
+ {
+ this->base_type::reset();
+ acc_ = storage_type();
+ }
+
+ storage_type const& accumulator_set() const { return acc_; }
+
+ duration elapsed() const { return duration(accumulators::sum(acc_)); }
+
+ };
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
new file mode 100644
index 0000000000..debb5fc102
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
@@ -0,0 +1,65 @@
+// boost/chrono/stopwatches/collectors/laps_sequence_container.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
+#define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAPS_CONTAINER_HPP
+
+#include <list>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<
+ typename Duration,
+ typename SequenceContainer = std::list<Duration>
+ >
+ struct laps_sequence_container
+ {
+ typedef Duration duration;
+ typedef typename duration::rep rep;
+ typedef SequenceContainer storage_type;
+ typedef typename SequenceContainer::iterator iterator;
+ typedef typename SequenceContainer::const_iterator const_iterator;
+ storage_type cont_;
+
+ void store(duration const& d)
+ {
+ cont_.push_front(d);
+ }
+
+ void reset()
+ {
+ cont_.clear();
+ }
+
+ storage_type const& container() const { return cont_; }
+
+ duration last() const {
+ if (cont_.empty())
+ return duration::zero();
+ else
+ return *cont_.begin();
+ }
+
+ duration elapsed() const {
+ duration elapsed_ = duration::zero();
+ for (const_iterator it = cont_.begin(); it !=cont_.end(); ++it) elapsed_ += *it;
+ return elapsed_;
+ }
+
+ };
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/last_lap.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/last_lap.hpp
new file mode 100644
index 0000000000..1a24392f4b
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/last_lap.hpp
@@ -0,0 +1,42 @@
+// boost/chrono/stopwatches/collectors/last_lap.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_LAST_LAP_HPP
+#define BOOST_CHRONO_STOPWATCHES_MEMORIES_LAST_LAP_HPP
+
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Duration>
+ struct last_lap
+ {
+ typedef Duration duration;
+ duration last_;
+ void store(duration const& d)
+ {
+ last_ = d;
+ }
+ void reset()
+ {
+ last_ = duration::zero();
+ }
+ duration last() const { return last_; }
+ duration elapsed() const { return duration::zero(); }
+
+ };
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/no_memory.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/no_memory.hpp
new file mode 100644
index 0000000000..7c68b6cb0f
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/collectors/no_memory.hpp
@@ -0,0 +1,36 @@
+// boost/chrono/stopwatches/collectors/no_memory.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_MEMORIES_NO_MEMORY_HPP
+#define BOOST_CHRONO_STOPWATCHES_MEMORIES_NO_MEMORY_HPP
+
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Duration>
+ struct no_memory
+ {
+ typedef Duration duration;
+
+ duration elapsed() const { return duration::zero(); }
+ duration last() const { return duration::zero(); }
+ void store(duration const& ) {}
+ void reset() {}
+
+ };
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/dont_start.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/dont_start.hpp
new file mode 100644
index 0000000000..e9c4df3667
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/dont_start.hpp
@@ -0,0 +1,32 @@
+// boost/chrono/stopwatches/dont.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_DONT_START__HPP
+#define BOOST_CHRONO_STOPWATCHES_DONT_START__HPP
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * Type used to don't start a basic_stopwatch at construction time.
+ */
+ struct dont_start_t
+ {
+ };
+
+ /**
+ * Instance used to don't start a basic_stopwatch at construction time.
+ */
+ static const dont_start_t dont_start =
+ { };
+
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp
new file mode 100644
index 0000000000..dc0cf18e74
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp
@@ -0,0 +1,133 @@
+// boost/chrono/stopwatches/formatters/ accumulator_set_formatter.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_FORMATTERS_ACCUMULATOR_SET_HPP
+#define BOOST_CHRONO_STOPWATCHES_FORMATTERS_ACCUMULATOR_SET_HPP
+
+#include <boost/chrono/stopwatches/formatters/base_formatter.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/current_function.hpp>
+#include <boost/accumulators/framework/accumulator_set.hpp>
+#include <boost/accumulators/statistics/count.hpp>
+#include <boost/accumulators/statistics/sum.hpp>
+#include <boost/accumulators/statistics/min.hpp>
+#include <boost/accumulators/statistics/max.hpp>
+#include <boost/accumulators/statistics/mean.hpp>
+#include <boost/accumulators/accumulators.hpp>
+#include <boost/format.hpp>
+#include <boost/format/group.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/assert.hpp>
+#include <string>
+#include <iostream>
+#include <cassert>
+#include <iomanip>
+
+#define BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT_DEFAULT "count=%1%, sum=%2%, min=%3%, max=%4%, mean=%5%\n"
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Ratio = milli, typename CharT = char,
+ typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_accumulator_set_formatter: public base_formatter<CharT, Traits> , public basic_format<
+ CharT, Traits>
+ {
+
+ public:
+ typedef base_formatter<CharT, Traits> base_type;
+ typedef basic_format<CharT, Traits> format_type;
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ basic_accumulator_set_formatter() :
+ base_type(),
+ format_type(BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT_DEFAULT)
+ {
+ }
+ basic_accumulator_set_formatter(ostream_type& os) :
+ base_type(os),
+ format_type(BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT_DEFAULT)
+ {
+ }
+ basic_accumulator_set_formatter(const char* fmt, ostream_type& os =
+ std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+ basic_accumulator_set_formatter(string_type const& fmt, ostream_type& os =
+ std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+
+ // static string_type format(const char* s)
+ // {
+ // string_type res(s);
+ // res += boost::chrono::detail::adaptive_string(" : ");
+ // res += BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT_DEFAULT;
+ // return res;
+ // }
+
+ template<class Stopwatch>
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec = BOOST_CHRONO_THROWS
+ )
+ {
+
+ typedef typename Stopwatch::laps_collector::storage_type
+ laps_collector_acc;
+ laps_collector_acc const& acc =
+ stopwatch_.get_laps_collector().accumulator_set();
+
+ typedef typename Stopwatch::duration duration_t;
+
+ duration_style_io_saver dsios(this->os_);
+ this->os_
+ << static_cast<format_type&> (*this)
+ % boost::accumulators::count(acc)
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), (boost::accumulators::count(acc)
+ == 0) ? boost::chrono::duration<double, Ratio>(duration_t::zero()) : boost::chrono::duration<
+ double, Ratio>(duration_t(boost::accumulators::sum(acc))))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), (boost::accumulators::count(acc)
+ == 0) ? boost::chrono::duration<double, Ratio>(duration_t::zero()) : boost::chrono::duration<
+ double, Ratio>(duration_t((boost::accumulators::min)(acc))))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), (boost::accumulators::count(acc)
+ == 0) ? boost::chrono::duration<double, Ratio>(duration_t::zero()) : boost::chrono::duration<
+ double, Ratio>(duration_t((boost::accumulators::max)(acc))))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), ((boost::accumulators::count(acc)
+ > 0) ? boost::chrono::duration<double, Ratio>(duration_t(boost::accumulators::sum(acc)
+ / boost::accumulators::count(acc))) : boost::chrono::duration<
+ double, Ratio>(duration_t::zero())));
+
+ }
+ };
+
+ typedef basic_accumulator_set_formatter<milli, char>
+ accumulator_set_formatter;
+ typedef basic_accumulator_set_formatter<milli, wchar_t>
+ waccumulator_set_formatter;
+
+ } // namespace chrono
+} // namespace boost
+
+#if 0
+#define BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT(F) \
+ boost::chrono::detail::adaptive_string(F " : " BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT_DEFAULT)
+#ifdef __GNUC__
+#define BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FUNCTION_FORMAT \
+ boost::chrono::elapsed_formatter::format(BOOST_CURRENT_FUNCTION)
+#else
+#define BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FUNCTION_FORMAT \
+ BOOST_CHRONO_STOPWATCHES_ACCUMULATOR_SET_FORMAT(BOOST_CURRENT_FUNCTION)
+#endif
+#endif
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/base_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/base_formatter.hpp
new file mode 100644
index 0000000000..855379ae1d
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/base_formatter.hpp
@@ -0,0 +1,65 @@
+// boost/chrono/stopwatches/formatters/base_formatter.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_FORMATTERS_BASE_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_FORMATTERS_BASE_FORMATTER_HPP
+
+#include <boost/chrono/io/duration_style.hpp>
+#include <boost/chrono/duration.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/cstdint.hpp>
+#include <iostream>
+#include <iomanip>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename CharT = char, typename Traits = std::char_traits<CharT> >
+ class base_formatter
+ {
+ base_formatter& operator=(base_formatter const& rhs) ;
+
+ public:
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ base_formatter() :
+ precision_(3), os_(std::cout), duration_style_(duration_style::symbol)
+ {
+ }
+ base_formatter(ostream_type& os) :
+ precision_(3), os_(os), duration_style_(duration_style::symbol)
+ {
+ }
+
+ void set_precision(std::size_t precision)
+ {
+ precision_ = precision;
+ if (precision_ > 9)
+ precision_ = 9; // sanity check
+ }
+ void set_os(ostream_type& os)
+ {
+ os_ = os;
+ }
+ void set_duration_style(duration_style style)
+ {
+ duration_style_ = style;
+ }
+
+ protected:
+ std::size_t precision_;
+ ostream_type & os_;
+ duration_style duration_style_;
+
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp
new file mode 100644
index 0000000000..7ec23c8e4e
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/elapsed_formatter.hpp
@@ -0,0 +1,109 @@
+// boost/chrono/stopwatches/formatters/elapsed_formatter.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_FORMATTERS_ELAPSED_HPP
+#define BOOST_CHRONO_STOPWATCHES_FORMATTERS_ELAPSED_HPP
+
+#include <boost/chrono/stopwatches/formatters/base_formatter.hpp>
+#include <boost/chrono/chrono_io.hpp>
+#include <boost/current_function.hpp>
+#include <boost/format.hpp>
+#include <boost/format/group.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/assert.hpp>
+#include <string>
+#include <iostream>
+#include <cassert>
+#include <iomanip>
+
+#define BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT "%1%\n"
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Ratio, typename CharT,
+ typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_elapsed_formatter: public base_formatter<CharT, Traits>, public basic_format<CharT, Traits>
+ {
+
+ public:
+ typedef base_formatter<CharT, Traits> base_type;
+ typedef basic_format<CharT, Traits> format_type;
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ basic_elapsed_formatter() :
+ base_type(),
+ format_type(BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT)
+ {
+ }
+ basic_elapsed_formatter(ostream_type& os) :
+ base_type(os),
+ format_type(BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT)
+ {
+ }
+ basic_elapsed_formatter(const char* fmt, ostream_type& os = std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+ basic_elapsed_formatter(string_type const& fmt, ostream_type& os =
+ std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+
+// static string_type format(const char* s)
+// {
+// string_type res(s);
+// res += boost::chrono::detail::adaptive_string(" : ");
+// res += BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT;
+// return res;
+// }
+
+ template<class Stopwatch>
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec= BOOST_CHRONO_THROWS
+ )
+ {
+ typedef typename Stopwatch::duration duration_t;
+ duration_t d = stopwatch_.elapsed();
+ //duration_t d = stopwatch_.elapsed(ec);
+
+ if (d < duration_t::zero())
+ return;
+
+ duration_style_io_saver dsios(this->os_);
+ this->os_ << static_cast<format_type&>(*this)
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), boost::chrono::duration<
+ double, Ratio>(d))
+ ;
+
+ }
+ };
+
+ typedef basic_elapsed_formatter<milli, char> elapsed_formatter;
+ typedef basic_elapsed_formatter<milli, wchar_t> welapsed_formatter;
+
+ } // namespace chrono
+} // namespace boost
+
+#if 0
+#define BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT(F) \
+ boost::chrono::detail::adaptive_string(F " : " BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT_DEFAULT)
+#ifdef __GNUC__
+#define BOOST_CHRONO_STOPWATCHES_ELAPSED_FUNCTION_FORMAT \
+ boost::chrono::elapsed_formatter::format(BOOST_CURRENT_FUNCTION)
+#else
+#define BOOST_CHRONO_STOPWATCHES_ELAPSED_FUNCTION_FORMAT \
+ BOOST_CHRONO_STOPWATCHES_ELAPSED_FORMAT(BOOST_CURRENT_FUNCTION)
+#endif
+#endif
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/times_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/times_formatter.hpp
new file mode 100644
index 0000000000..4db70d08f7
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/formatters/times_formatter.hpp
@@ -0,0 +1,117 @@
+// boost/chrono/stopwatches/formatters/times_formatter.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_FORMATTERS_TIMES_HPP
+#define BOOST_CHRONO_STOPWATCHES_FORMATTERS_TIMES_HPP
+
+#include <boost/chrono/stopwatches/formatters/base_formatter.hpp>
+//#include <boost/chrono/detail/system.hpp>
+#include <boost/current_function.hpp>
+//#include <boost/chrono/stopwatches/detail/adaptive_string.hpp>
+#include <boost/format.hpp>
+#include <boost/format/group.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/assert.hpp>
+#include <string>
+#include <iostream>
+#include <cassert>
+#include <iomanip>
+
+#define BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT_DEFAULT "real %1%, cpu %4% (%5%%%), user %2%, system %3%\n"
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Ratio = milli, typename CharT = char,
+ typename Traits = std::char_traits<CharT>,
+ class Alloc = std::allocator<CharT> >
+ class basic_times_formatter: public base_formatter<CharT, Traits>, public basic_format<CharT, Traits>
+ {
+
+ public:
+ typedef base_formatter<CharT, Traits> base_type;
+ typedef basic_format<CharT, Traits> format_type;
+ typedef std::basic_string<CharT, Traits, Alloc> string_type;
+ typedef CharT char_type;
+ typedef std::basic_ostream<CharT, Traits> ostream_type;
+
+ basic_times_formatter() :
+ base_type(),
+ format_type(BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT_DEFAULT)
+ {
+ }
+ basic_times_formatter(ostream_type& os) :
+ base_type(os),
+ format_type(BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT_DEFAULT)
+ {
+ }
+ basic_times_formatter(const char* fmt, ostream_type& os = std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+ basic_times_formatter(string_type const& fmt, ostream_type& os =
+ std::cout) :
+ base_type(os), format_type(fmt)
+ {
+ }
+
+// static string_type format(const char* s)
+// {
+// string_type res(s);
+// res += boost::chrono::detail::adaptive_string(" : ");
+// res += BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT_DEFAULT;
+// return res;
+// }
+
+ template<class Stopwatch>
+ void operator()(Stopwatch & stopwatch_
+ //, system::error_code & ec= BOOST_CHRONO_THROWS
+ )
+ {
+ typedef typename Stopwatch::duration::rep times_type;
+ //times_type times = stopwatch_.elapsed(ec).count();
+ times_type times = stopwatch_.elapsed().count();
+
+ if (times.real < 0)
+ return;
+ double p;
+ if (times.real > 0)
+ p=double(times.user+times.system)*100/times.real;
+ else
+ p=0;
+
+ duration_style_io_saver dsios(this->os_);
+ this->os_ << static_cast<format_type&>(*this)
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), boost::chrono::duration<double, Ratio>(nanoseconds(times.real)))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), boost::chrono::duration<double, Ratio>(nanoseconds(times.user)))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), boost::chrono::duration<double, Ratio>(nanoseconds(times.system)))
+ % io::group(std::fixed, std::setprecision(this->precision_), duration_fmt(this->duration_style_), boost::chrono::duration<double, Ratio>(nanoseconds(times.user+times.system)))
+ % io::group(std::fixed, std::setprecision(2), p)
+ ;
+ }
+ };
+
+ typedef basic_times_formatter<milli, char> times_formatter;
+ typedef basic_times_formatter<milli, wchar_t> wtimes_formatter;
+
+ } // namespace chrono
+} // namespace boost
+
+#if 0
+#define BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT(F) \
+ boost::chrono::detail::adaptive_string(F " : " BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT_DEFAULT)
+#ifdef __GNUC__
+#define BOOST_CHRONO_STOPWATCHES_TIMES_FUNCTION_FORMAT \
+ boost::chrono::times_formatter::format(BOOST_CURRENT_FUNCTION)
+#else
+#define BOOST_CHRONO_STOPWATCHES_TIMES_FUNCTION_FORMAT \
+ BOOST_CHRONO_STOPWATCHES_TIMES_FORMAT(BOOST_CURRENT_FUNCTION)
+#endif
+#endif
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/laps_stopwatch.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/laps_stopwatch.hpp
new file mode 100644
index 0000000000..981644193a
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/laps_stopwatch.hpp
@@ -0,0 +1,442 @@
+// boost/chrono/stopwatches/laps_stopwatch.hpp -----------------------------//
+
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_LAPS_STOPWATCH_HPP
+#define BOOST_CHRONO_STOPWATCHES_LAPS_STOPWATCH_HPP
+
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/collectors/no_memory.hpp> // default laps_collector
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/system_clocks.hpp> // default_clock
+#include <boost/system/error_code.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+
+ /**
+ * A laps_stopwatch is a model of @c Stopwatch taking as template parameters the @c Clock and the @c LapsCollector.
+ *
+ * The main difference respect to a @c simple_stopwatch is that the user can stop it.
+ * Each sequence of start-stop results in a new elapsed duration sample that is provided to the LapsCollector.
+ *
+ * It is up to the LapsCollector to make whatever wants with each sample.
+ * A LapCollector must define a store(duration const&) and a clear() functions.
+ *
+ * The library provides LapsCollectors that forget the sample, store the
+ * last one, cummulates the samples in an accumulator set or store them in a container.
+ * For simplicity the default LapCollector is the one that forget the samples.
+ *
+ * Even if it is preferable to use process or thread wide clocks,
+ * the default of the Clock parameter is high_resolution_clock,
+ * as it is the single one ensured on all platforms.
+ */
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration> >
+ class laps_stopwatch
+ {
+ public:
+ typedef LapsCollector laps_collector;
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+ /**
+ * Default constructor.
+ *
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running().
+ */
+ explicit laps_stopwatch()
+ :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Default constructor.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ */
+ explicit laps_stopwatch(
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start(ec);
+ }
+#endif
+ /**
+ * Not starting constructor.
+ *
+ * Effects: Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ */
+ explicit laps_stopwatch(
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ }
+
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit laps_stopwatch(
+ laps_collector const& acc
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit laps_stopwatch(
+ laps_collector const& acc,
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start(ec);
+ }
+#endif
+
+ /**
+ * Not starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ laps_stopwatch(
+ laps_collector const& acc,
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ }
+
+ /**
+ * Destructor.
+ *
+ * Effects: Do nothing.
+ */
+ ~laps_stopwatch()
+ {
+ }
+
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart()
+ {
+ time_point tmp = clock::now();
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: is_running().
+ */
+ void start()
+ {
+ start_ = clock::now();
+ running_ = true;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void start(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ start_ = tmp;
+ running_ = true;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Gives the elapsed time since start time to the LapCollector.
+ *
+ * Throws: Any exception that the LapCollector can throw when .
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop()
+ {
+ if (is_running())
+ {
+ laps_collector_.store(clock::now() - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Gives the elapsed time since start time to the LapCollector if no internal error occurs.
+ *
+ * Throws: Any exception that the LapCollector can Throw.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop(
+ system::error_code & ec
+ )
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ laps_collector_.store(tmp - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+#endif
+
+ /**
+ * States if the Stopwatch is running.
+ */
+ bool is_running() const {
+ return running_;
+ }
+
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Returns: the elapsed time since the last start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap() const
+ {
+ if (is_running())
+ {
+ return clock::now() - start_;
+ }
+ else
+ {
+ return duration::zero();
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap(
+ system::error_code & ec
+ ) const
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+
+ return tmp - start_;
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#endif
+
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed() const
+ {
+ return laps_collector_.elapsed()+elapsed_current_lap();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed(
+ system::error_code & ec
+ ) const
+ {
+ duration tmp = elapsed_current_lap(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+ return laps_collector_.elapsed() + tmp;
+ }
+#endif
+ /**
+ * Elapsed time for the last lap.
+ *
+ * Returns: the elapsed time of the last lap.
+ *
+ */
+
+ duration last() const
+ {
+ return laps_collector_.last();
+ }
+ /**
+ * Resets the stopwatch.
+ *
+ * Effects: Resets the LapCollector.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ *
+ */
+ void reset()
+ {
+
+ laps_collector_.reset();
+ running_ = false;
+ start_ = time_point(duration::zero());
+ }
+
+ /**
+ * LapsCollector getter.
+ *
+ * Returns: the LapCollector instance.
+ *
+ */
+ laps_collector const& get_laps_collector() BOOST_NOEXCEPT
+ {
+ return laps_collector_;
+ }
+
+ /**
+ * Useful typedef for scoped run
+ */
+ typedef stopwatch_runner<laps_stopwatch<Clock, LapsCollector> >
+ scoped_run;
+ /**
+ * Useful typedef for scoped stop
+ */
+ typedef stopwatch_stopper<laps_stopwatch<Clock, LapsCollector> >
+ scoped_stop;
+
+ private:
+ time_point start_;
+ bool running_;
+ laps_collector laps_collector_;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+#endif // header
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp
new file mode 100644
index 0000000000..d85039ab62
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/clock_default_formatter.hpp
@@ -0,0 +1,31 @@
+// boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_CLOCK_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_CLOCK_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, class Clock>
+ struct basic_clock_default_formatter
+ {
+ typedef basic_elapsed_formatter<milli, CharT> type;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp
new file mode 100644
index 0000000000..239833fcfc
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp
@@ -0,0 +1,34 @@
+// boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPWATCH_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPWATCH_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp>
+#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
+#include <boost/chrono/stopwatches/stopwatch.hpp>
+#include <boost/chrono/thread_clock.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template <typename CharT, typename Clock, typename Features, typename Weight>
+ struct basic_stopwatch_reporter_default_formatter<CharT, stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
+ {
+ typedef basic_accumulator_set_formatter<milli,CharT> type;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopclock.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopclock.hpp
new file mode 100644
index 0000000000..4debbc5518
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopclock.hpp
@@ -0,0 +1,176 @@
+// boost/chrono/stopwatches/reporters/stopclock.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+#error
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#endif
+
+#include <boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/stopwatch.hpp>
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/cstdint.hpp>
+#include <cassert>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, typename Clock, typename LapsCollector, class Formatter>
+ class basic_stopclock: public basic_stopwatch_reporter<CharT, stopwatch<Clock, LapsCollector>, Formatter>
+ {
+ public:
+ typedef basic_stopwatch_reporter<CharT, stopwatch<Clock, LapsCollector>, Formatter> base_type;
+ typedef Clock clock;
+ typedef stopwatch<Clock, LapsCollector> stopwatch;
+ typedef Formatter formatter_type;
+
+ basic_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit basic_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit basic_stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit basic_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit basic_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit basic_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ basic_stopclock(const basic_stopclock&); // = delete;
+ basic_stopclock& operator=(const basic_stopclock&); // = delete;
+ };
+
+
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration>,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char, stopwatch<Clock, LapsCollector> >::type>
+ class stopclock;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<char, stopclock<Stopwatch,
+ Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<typename Clock, typename LapsCollector, class Formatter>
+ class stopclock: public basic_stopclock<char, Clock, LapsCollector, Formatter>
+ {
+ typedef basic_stopclock<char, Clock, LapsCollector, Formatter> base_type;
+ public:
+ typedef Clock clock;
+ typedef typename base_type::stopwatch stopwatch;
+ typedef Formatter formatter_type;
+
+ stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ stopclock(const stopclock&); // = delete;
+ stopclock& operator=(const stopclock&); // = delete;
+ };
+
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp
new file mode 100644
index 0000000000..e157eb39d2
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp
@@ -0,0 +1,37 @@
+// boost/chrono/stopwatches/reporters/laps_stopwatch_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPWATCH_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPWATCH_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/accumulator_set_formatter.hpp>
+#include <boost/chrono/stopwatches/collectors/laps_accumulator_set.hpp>
+#include <boost/chrono/stopwatches/laps_stopwatch.hpp>
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+#include <boost/chrono/thread_clock.hpp>
+#endif
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template <typename CharT, typename Clock, typename Features, typename Weight>
+ struct basic_stopwatch_reporter_default_formatter<CharT, laps_stopwatch<Clock,laps_accumulator_set<typename Clock::duration,Features, Weight> > >
+ {
+ typedef basic_accumulator_set_formatter<milli,CharT> type;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/process_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/process_default_formatter.hpp
new file mode 100644
index 0000000000..4b3c1c58e9
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/process_default_formatter.hpp
@@ -0,0 +1,42 @@
+// boost/chrono/stopwatches/reporters/process_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_PROCESS_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_PROCESS_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/clock_default_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/times_formatter.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+
+namespace boost
+{
+ namespace chrono
+ {
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+
+ template <typename CharT>
+ struct basic_clock_default_formatter<CharT, process_cpu_clock>
+ {
+ typedef basic_times_formatter<milli, CharT> type;
+ };
+
+#endif
+ } // namespace chrono
+} // namespace boost
+
+
+#endif
+
+#endif
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopclock.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopclock.hpp
new file mode 100644
index 0000000000..937cabdd45
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopclock.hpp
@@ -0,0 +1,175 @@
+// boost/chrono/stopwatches/reporters/stopclock.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_LAPS_STOPCLOCK_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#endif
+
+#include <boost/chrono/stopwatches/reporters/laps_accumulator_set_stopwatch_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/stopwatch.hpp>
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/detail/system.hpp>
+#include <boost/cstdint.hpp>
+#include <cassert>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, typename Clock, typename LapsCollector, class Formatter>
+ class basic_stopclock: public basic_stopwatch_reporter<CharT, stopwatch<Clock, LapsCollector>, Formatter>
+ {
+ public:
+ typedef basic_stopwatch_reporter<CharT, stopwatch<Clock, LapsCollector>, Formatter> base_type;
+ typedef Clock clock;
+ typedef stopwatch<Clock, LapsCollector> stopwatch_type;
+ typedef Formatter formatter_type;
+
+ basic_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit basic_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit basic_stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit basic_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit basic_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit basic_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<basic_stopclock<CharT,Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ basic_stopclock(const basic_stopclock&); // = delete;
+ basic_stopclock& operator=(const basic_stopclock&); // = delete;
+ };
+
+
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration>,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char, stopwatch<Clock, LapsCollector> >::type>
+ class stopclock;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<char, stopclock<Stopwatch,
+ Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<typename Clock, typename LapsCollector, class Formatter>
+ class stopclock: public basic_stopclock<char, Clock, LapsCollector, Formatter>
+ {
+ typedef basic_stopclock<char, Clock, LapsCollector, Formatter> base_type;
+ public:
+ typedef Clock clock;
+ typedef typename base_type::stopwatch_type stopwatch_type;
+ typedef Formatter formatter_type;
+
+ stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit stopclock(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<stopclock<Clock, LapsCollector, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ stopclock(const stopclock&); // = delete;
+ stopclock& operator=(const stopclock&); // = delete;
+ };
+
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp
new file mode 100644
index 0000000000..8d379cd9cf
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp
@@ -0,0 +1,259 @@
+// boost/chrono/stopwatches/stopwatch_reporter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_STOPWATCH_REPORTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_STOPWATCH_REPORTER_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#endif
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/detail/system.hpp>
+#include <boost/cstdint.hpp>
+#include <cassert>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, class Stopwatch, class Formatter=basic_stopwatch_reporter_default_formatter<CharT, Stopwatch> >
+ class basic_stopwatch_reporter: public Stopwatch
+ {
+ public:
+ typedef Stopwatch base_type;
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch_type;
+ typedef Formatter formatter_type;
+
+ basic_stopwatch_reporter() BOOST_NOEXCEPT :
+ formatter_(), reported_(false)
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit basic_stopwatch_reporter(system::error_code & ec) :
+ base_type(ec), formatter_(), reported_(false)
+ {
+ }
+#endif
+
+ explicit basic_stopwatch_reporter(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag),
+ formatter_(), reported_(false)
+ {
+ }
+
+ explicit basic_stopwatch_reporter(const typename Formatter::char_type* fmt) :
+ formatter_(fmt), reported_(false)
+ {
+ }
+ explicit basic_stopwatch_reporter(typename Formatter::string_type const& fmt) :
+ formatter_(fmt), reported_(false)
+ {
+ }
+ explicit basic_stopwatch_reporter(formatter_type fmt) :
+ formatter_(fmt), reported_(false)
+ {
+ }
+
+ ~basic_stopwatch_reporter() BOOST_NOEXCEPT
+ {
+ if (!reported())
+ {
+ this->report();
+ }
+ }
+
+ inline void report() BOOST_NOEXCEPT
+ {
+ formatter_(*this);
+ reported_ = true;
+ }
+// inline void report(system::error_code & ec)
+// {
+// formatter_(*this, ec);
+// reported_ = true;
+// }
+
+ bool reported() const
+ {
+ return reported_;
+ }
+
+ formatter_type& format()
+ {
+ return formatter_;
+ }
+
+ protected:
+ formatter_type formatter_;
+ bool reported_;
+
+ basic_stopwatch_reporter(const basic_stopwatch_reporter&); // = delete;
+ basic_stopwatch_reporter& operator=(const basic_stopwatch_reporter&); // = delete;
+ };
+
+
+ template<class Stopwatch,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char, Stopwatch>::type>
+ class stopwatch_reporter;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<char, stopwatch_reporter<Stopwatch, Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<class Stopwatch, class Formatter>
+ class stopwatch_reporter: public basic_stopwatch_reporter<char, Stopwatch,
+ Formatter>
+ {
+ typedef basic_stopwatch_reporter<char, Stopwatch, Formatter> base_type;
+ public:
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch_type;
+ typedef Formatter formatter_type;
+
+ stopwatch_reporter()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit stopwatch_reporter(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit stopwatch_reporter(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit stopwatch_reporter(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit stopwatch_reporter(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit stopwatch_reporter(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<stopwatch_reporter<Stopwatch, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ stopwatch_reporter(const stopwatch_reporter&); // = delete;
+ stopwatch_reporter& operator=(const stopwatch_reporter&); // = delete;
+ };
+
+ template<class Stopwatch,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<wchar_t,
+ Stopwatch>::type>
+ class wstopwatch_reporter;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<wchar_t, wstopwatch_reporter<Stopwatch, Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<class Stopwatch, class Formatter>
+ class wstopwatch_reporter: public basic_stopwatch_reporter<wchar_t, Stopwatch, Formatter>
+ {
+ typedef basic_stopwatch_reporter<wchar_t, Stopwatch, Formatter> base_type;
+ public:
+ typedef typename Stopwatch::clock clock;
+ typedef Stopwatch stopwatch_type;
+ typedef Formatter formatter_type;
+
+ wstopwatch_reporter() :
+ base_type()
+ {
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit wstopwatch_reporter(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+ explicit wstopwatch_reporter(
+ const dont_start_t& tag
+ ) BOOST_NOEXCEPT :
+ base_type(tag)
+ {
+ }
+
+ explicit wstopwatch_reporter(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit wstopwatch_reporter(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit wstopwatch_reporter(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+ typedef stopwatch_runner<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_run;
+ typedef stopwatch_stopper<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_stop;
+ typedef stopwatch_suspender<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_suspend;
+ typedef stopwatch_resumer<wstopwatch_reporter<Stopwatch, Formatter> >
+ scoped_resume;
+
+ protected:
+
+ wstopwatch_reporter(const wstopwatch_reporter&); // = delete;
+ wstopwatch_reporter& operator=(const wstopwatch_reporter&); // = delete;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp
new file mode 100644
index 0000000000..bd81214eb2
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp
@@ -0,0 +1,31 @@
+// boost/chrono/stopwatches/stopwatch_reporter_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/stopwatches/reporters/clock_default_formatter.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template <class CharT, class Stopwatch>
+ struct basic_stopwatch_reporter_default_formatter
+ : basic_clock_default_formatter<CharT, typename Stopwatch::clock>
+ {
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/strict_stopclock.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/strict_stopclock.hpp
new file mode 100644
index 0000000000..2252c8049a
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/strict_stopclock.hpp
@@ -0,0 +1,143 @@
+// boost/chrono/stopwatches/reporters/strict_stopclock.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_STRICT_STOPCLOCK_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_STRICT_STOPCLOCK_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __GNUC__
+#pragma GCC system_header
+#elif defined __SUNPRO_CC
+#pragma disable_warn
+#elif defined _MSC_VER
+#pragma warning(push, 1)
+#endif
+#endif
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter.hpp>
+#include <boost/chrono/stopwatches/strict_stopwatch.hpp>
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/detail/system.hpp>
+#include <boost/cstdint.hpp>
+#include <cassert>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<class CharT, typename Clock, class Formatter>
+ class basic_strict_stopclock: public basic_stopwatch_reporter<CharT, strict_stopwatch<Clock>, Formatter>
+ {
+ public:
+ typedef basic_stopwatch_reporter<CharT, strict_stopwatch<Clock>, Formatter> base_type;
+ typedef Clock clock;
+ typedef strict_stopwatch<Clock> stopwatch;
+ typedef Formatter formatter_type;
+
+ basic_strict_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit basic_strict_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+
+ explicit basic_strict_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit basic_strict_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit basic_strict_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ protected:
+
+ basic_strict_stopclock(const basic_strict_stopclock&); // = delete;
+ basic_strict_stopclock& operator=(const basic_strict_stopclock&); // = delete;
+ };
+
+
+ template<typename Clock=high_resolution_clock,
+ class Formatter = typename basic_stopwatch_reporter_default_formatter<char, strict_stopwatch<Clock> >::type>
+ class strict_stopclock;
+
+ template<class Stopwatch, class Formatter>
+ struct basic_stopwatch_reporter_default_formatter<char, strict_stopclock<Stopwatch, Formatter> >
+ {
+ typedef Formatter type;
+ };
+
+ template<typename Clock, class Formatter>
+ class strict_stopclock: public basic_strict_stopclock<char, Clock, Formatter>
+ {
+ typedef basic_strict_stopclock<char, Clock, Formatter> base_type;
+ public:
+ typedef Clock clock;
+ typedef typename base_type::stopwatch stopwatch;
+ typedef Formatter formatter_type;
+
+ strict_stopclock()
+ {
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit strict_stopclock(system::error_code & ec) :
+ base_type(ec)
+ {
+ }
+#endif
+
+ explicit strict_stopclock(formatter_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ explicit strict_stopclock(const typename Formatter::char_type* fmt) :
+ base_type(fmt)
+ {
+ }
+ explicit strict_stopclock(typename Formatter::string_type const& fmt) :
+ base_type(fmt)
+ {
+ }
+
+ protected:
+
+ strict_stopclock(const strict_stopclock&); // = delete;
+ strict_stopclock& operator=(const strict_stopclock&); // = delete;
+ };
+
+
+
+ } // namespace chrono
+} // namespace boost
+
+
+#if !defined(BOOST_ENABLE_WARNINGS) && !defined(BOOST_CHRONO_ENABLE_WARNINGS)
+#if defined __SUNPRO_CC
+#pragma enable_warn
+#elif defined _MSC_VER
+#pragma warning(pop)
+#endif
+#endif
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/system_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/system_default_formatter.hpp
new file mode 100644
index 0000000000..ed2a384412
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/system_default_formatter.hpp
@@ -0,0 +1,19 @@
+// boost/chrono/stopwatches/reporters/system_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_SYSTEM_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_SYSTEM_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/clock_default_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
+#include <boost/chrono/system_clocks.hpp>
+
+
+
+#endif
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp
new file mode 100644
index 0000000000..40b0eb7d14
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/reporters/thread_default_formatter.hpp
@@ -0,0 +1,26 @@
+// boost/chrono/stopwatches/reporters/thread_default_formatter.hpp
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_REPORTERS_THREAD_DEFAULT_FORMATTER_HPP
+#define BOOST_CHRONO_STOPWATCHES_REPORTERS_THREAD_DEFAULT_FORMATTER_HPP
+
+#include <boost/chrono/config.hpp>
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+
+#include <boost/chrono/stopwatches/reporters/stopwatch_reporter_default_formatter.hpp>
+#include <boost/chrono/stopwatches/reporters/clock_default_formatter.hpp>
+#include <boost/chrono/stopwatches/formatters/elapsed_formatter.hpp>
+#include <boost/chrono/thread_clock.hpp>
+
+
+
+#endif
+
+#endif
+
+
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/simple_stopwatch.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/simple_stopwatch.hpp
new file mode 100644
index 0000000000..f36acbb714
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/simple_stopwatch.hpp
@@ -0,0 +1,110 @@
+// boost/chrono/stopwatches/simple_stopwatch.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_SIMPLE_STOPWATCH__HPP
+#define BOOST_CHRONO_STOPWATCHES_SIMPLE_STOPWATCH__HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/system/error_code.hpp>
+#include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * This class provides the simpler stopwatch which is just able to give the elapsed time since its construction.
+ */
+ template<typename Clock=high_resolution_clock>
+ class simple_stopwatch
+ {
+ public:
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+
+ simple_stopwatch() :
+ start_(clock::now())
+ {
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit simple_stopwatch(system::error_code & ec) :
+ start_(duration::zero())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ {
+ return;
+ }
+ }
+ start_ = tmp;
+ }
+#endif
+
+ ~simple_stopwatch() BOOST_NOEXCEPT
+ {
+ }
+
+ duration elapsed()
+ {
+ return clock::now() - start_;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ duration elapsed(system::error_code & ec) BOOST_NOEXCEPT
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return duration::zero();
+ }
+ return tmp - start_;
+ }
+#endif
+
+ private:
+ time_point start_;
+ simple_stopwatch(const simple_stopwatch&); // = delete;
+ simple_stopwatch& operator=(const simple_stopwatch&); // = delete;
+ };
+
+ typedef simple_stopwatch<system_clock> system_simple_stopwatch;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef simple_stopwatch<steady_clock> steady_simple_stopwatch;
+#endif
+ typedef simple_stopwatch<high_resolution_clock> high_resolution_simple_stopwatch;
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ typedef simple_stopwatch<process_real_cpu_clock> process_real_cpu_simple_stopwatch;
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ typedef simple_stopwatch<process_user_cpu_clock> process_user_cpu_simple_stopwatch;
+ typedef simple_stopwatch<process_system_cpu_clock> process_system_cpu_simple_stopwatch;
+ typedef simple_stopwatch<process_cpu_clock> process_cpu_simple_stopwatch;
+#endif
+#endif
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ typedef simple_stopwatch<thread_clock> thread_simple_stopwatch;
+#endif
+
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch.hpp
new file mode 100644
index 0000000000..afa00806bf
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch.hpp
@@ -0,0 +1,444 @@
+// boost/chrono/stopwatches/stopwatch.hpp -----------------------------//
+
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_STOPWATCH_HPP
+#define BOOST_CHRONO_STOPWATCHES_STOPWATCH_HPP
+
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/collectors/no_memory.hpp> // default laps_collector
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/system_clocks.hpp> // default_clock
+#include <boost/chrono/detail/system.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+
+ /**
+ * A stopwatch is a model of @c Stopwatch taking as parameters the @c Clock and the @c LapsCollector.
+ *
+ * The main difference respect to a @c simple_stopwatch is that the user can stop it.
+ * Each sequence of start-stop results in a new elapsed duration sample that is provided to the LapsCollector.
+ *
+ * It is up to the LapsCollector to do whatever it wants with each sample.
+ * A LapCollector must define a store(duration const&) and a clear() functions.
+ *
+ * The library provides LapsCollectors that forget the sample, store the
+ * last one, cummulates the samples in an accumulator set or store them in a container.
+ * For simplicity the default LapCollector is the one that forget the samples.
+ *
+ * Even if it is preferable to use process or thread wide clocks,
+ * the default of the Clock parameter is high_resolution_clock,
+ * as it is the single one ensured on all platforms.
+ */
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration> >
+ class stopwatch
+ {
+ public:
+ typedef LapsCollector laps_collector;
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+ /**
+ * Default constructor.
+ *
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running().
+ */
+ stopwatch()
+ :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Default constructor.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ */
+ explicit stopwatch(
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ start(ec);
+ }
+#endif
+ /**
+ * Not starting constructor.
+ *
+ * Effects: Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ */
+ explicit stopwatch(
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_()
+ {
+ }
+
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit stopwatch(
+ laps_collector const& acc
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Starting constructor from a LapsCollector instance.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Copies the LapsCollector. Starts the stopwatch.
+ * Post-conditions: is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ explicit stopwatch(
+ laps_collector const& acc,
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ start(ec);
+ }
+#endif
+
+ /**
+ * Not starting constructor from a LapsCollector instance.
+ *
+ * Effects: Copies the LapsCollector. Don't starts the stopwatch.
+ * Post-conditions: ! is_running() if no error occur.
+ *
+ * Remark: The LapsCollector is copied and owned by the stopwatch.
+ */
+ stopwatch(
+ laps_collector const& acc,
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ laps_collector_(acc)
+ {
+ }
+
+ /**
+ * Destructor.
+ *
+ * Effects: Do nothing.
+ */
+ ~stopwatch() BOOST_NOEXCEPT
+ {
+ }
+
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart()
+ {
+ time_point tmp = clock::now();
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Restart the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: As if stop(); start() were called, but ensuring that the start time is the same as the stop time.
+ *
+ * Post-conditions: is_running() if no error occur.
+ */
+ void restart(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ if (is_running())
+ {
+ laps_collector_.store(tmp - start_);
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: is_running().
+ */
+ void start()
+ {
+ start_ = clock::now();
+ running_ = true;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Memorize the current time.
+ *
+ * Post-conditions: @c is_running() if no error occur.
+ */
+ void start(
+ system::error_code & ec
+ )
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ start_ = tmp;
+ running_ = true;
+ }
+#endif
+
+ /**
+ * Start the stopwatch.
+ *
+ * Requires: is_running().
+ * Effects: Stores the elapsed time since start time into the LapCollector.
+ *
+ * Throws: Any exception that the LapCollector can throw.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop()
+ {
+ if (is_running())
+ {
+ laps_collector_.store(clock::now() - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Start the stopwatch.
+ *
+ * Requires: is_running().
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ * Effects: Stores the elapsed time since start time into the LapCollector if no internal error occurs.
+ *
+ * Throws: Any exception that the LapCollector can Throw.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ */
+ void stop(
+ system::error_code & ec
+ )
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ laps_collector_.store(tmp - start_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ }
+ }
+#endif
+
+ /**
+ * States if the Stopwatch is running.
+ */
+ bool is_running() const {
+ return running_;
+ }
+
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Returns: the elapsed time since the last start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap() const
+ {
+ if (is_running())
+ {
+ return clock::now() - start_;
+ }
+ else
+ {
+ return duration::zero();
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter for the current lap.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed_current_lap(
+ system::error_code & ec
+ ) const
+ {
+ if (is_running())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+
+ return tmp - start_;
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#endif
+
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed() const
+ {
+ return laps_collector_.elapsed()+elapsed_current_lap();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ /**
+ * Elapsed time getter.
+ *
+ * Effects: Assign the error code if any internal error occur while retrieving the current time.
+ *
+ * Returns: the elapsed time since the start if no internal error occur.
+ *
+ */
+ duration elapsed(
+ system::error_code & ec
+ ) const
+ {
+ duration tmp = elapsed_current_lap(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+ return laps_collector_.elapsed() + tmp;
+ }
+#endif
+ /**
+ * Elapsed time for the last lap.
+ *
+ * Returns: the elapsed time of the last lap.
+ *
+ */
+
+ duration last() const
+ {
+ return laps_collector_.last();
+ }
+ /**
+ * Resets the stopwatch.
+ *
+ * Effects: Resets the LapCollector.
+ *
+ * Post-conditions: !is_running() if no error occur.
+ *
+ */
+ void reset()
+ {
+
+ laps_collector_.reset();
+ running_ = false;
+ start_ = time_point(duration::zero());
+ }
+
+ /**
+ * LapsCollector getter.
+ *
+ * Returns: the LapCollector instance.
+ *
+ */
+ laps_collector const& get_laps_collector() BOOST_NOEXCEPT
+ {
+ return laps_collector_;
+ }
+
+ /**
+ * Useful typedef for scoped run
+ */
+ typedef stopwatch_runner<stopwatch<Clock, LapsCollector> >
+ scoped_run;
+ /**
+ * Useful typedef for scoped stop
+ */
+ typedef stopwatch_stopper<stopwatch<Clock, LapsCollector> >
+ scoped_stop;
+
+ private:
+ time_point start_;
+ bool running_;
+ laps_collector laps_collector_;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+#endif // header
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch_scoped.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch_scoped.hpp
new file mode 100644
index 0000000000..836d0a9552
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/stopwatch_scoped.hpp
@@ -0,0 +1,142 @@
+// boost/chrono/stopwatches/stopwatch_scoped.hpp ------------------------------------------------------------//
+// Copyright 2009-2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_STOPWATCH_SCOPED_HPP
+#define BOOST_CHRONO_STOPWATCHES_STOPWATCH_SCOPED_HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/detail/system.hpp>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch>
+ class stopwatch_runner
+ {
+ public:
+ typedef Stopwatch stopwatch;
+ stopwatch_runner(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.start();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_runner(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
+ {
+ stopwatch_.start(ec);
+ }
+#endif
+ ~stopwatch_runner()
+ {
+ stopwatch_.stop();
+ }
+ private:
+ stopwatch& stopwatch_;
+ stopwatch_runner();//= delete;
+ stopwatch_runner(const stopwatch_runner&); // = delete;
+ stopwatch_runner& operator=(const stopwatch_runner&); // = delete;
+
+ };
+
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch>
+ class stopwatch_stopper
+ {
+ public:
+ typedef Stopwatch stopwatch;
+ stopwatch_stopper(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.stop();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_stopper(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
+ {
+ stopwatch_.stop(ec);
+ }
+#endif
+ ~stopwatch_stopper()
+ {
+ stopwatch_.start();
+ }
+ private:
+ stopwatch& stopwatch_;
+ stopwatch_stopper();//= delete;
+ stopwatch_stopper(const stopwatch_stopper&); // = delete;
+ stopwatch_stopper& operator=(const stopwatch_stopper&); // = delete;
+
+ };
+
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch>
+ class stopwatch_suspender
+ {
+ public:
+ typedef Stopwatch stopwatch;
+ stopwatch_suspender(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.suspend();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_suspender(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
+ {
+ stopwatch_.suspend(ec);
+ }
+#endif
+
+ ~stopwatch_suspender()
+ {
+ stopwatch_.resume();
+ }
+ private:
+ stopwatch& stopwatch_;
+ stopwatch_suspender(); // = delete;
+ stopwatch_suspender(const stopwatch_suspender&); // = delete;
+ stopwatch_suspender& operator=(const stopwatch_suspender&); // = delete;
+ };
+
+ //--------------------------------------------------------------------------------------//
+ template<class Stopwatch>
+ class stopwatch_resumer
+ {
+ public:
+ typedef Stopwatch stopwatch;
+ stopwatch_resumer(stopwatch & a) :
+ stopwatch_(a)
+ {
+ stopwatch_.resume();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ stopwatch_resumer(stopwatch & a, system::error_code & ec) :
+ stopwatch_(a)
+ {
+ stopwatch_.resume(ec);
+ }
+#endif
+ ~stopwatch_resumer()
+ {
+ stopwatch_.suspend();
+ }
+ private:
+ stopwatch& stopwatch_;
+ stopwatch_resumer(); // = delete;
+ stopwatch_resumer(const stopwatch_resumer&); // = delete;
+ stopwatch_resumer& operator=(const stopwatch_resumer&); // = delete;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/strict_stopwatch.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/strict_stopwatch.hpp
new file mode 100644
index 0000000000..ceb0be66da
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/strict_stopwatch.hpp
@@ -0,0 +1,115 @@
+// boost/chrono/stopwatches/strict_stopwatch.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_STRICT_STOPWATCH__HPP
+#define BOOST_CHRONO_STOPWATCHES_STRICT_STOPWATCH__HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/chrono.hpp>
+#include <boost/chrono/detail/system.hpp>
+#include <boost/chrono/thread_clock.hpp>
+#include <boost/chrono/process_cpu_clocks.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ /**
+ * This class provides the simpler stopwatch which is just able to give the elapsed time since its construction.
+ */
+ template<typename Clock=high_resolution_clock>
+ class strict_stopwatch
+ {
+ public:
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+
+ strict_stopwatch() :
+ start_(clock::now())
+ {
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit strict_stopwatch(system::error_code & ec) :
+ start_(duration::zero())
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ {
+ return;
+ }
+ }
+ start_ = tmp;
+ }
+#endif
+
+ ~strict_stopwatch() BOOST_NOEXCEPT
+ {
+ }
+
+ duration elapsed()
+ {
+ return clock::now() - start_;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ duration elapsed(system::error_code & ec)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec))
+ {
+ if (ec)
+ return duration::zero();
+ }
+ return tmp - start_;
+ }
+#endif
+ /**
+ * States if the Stopwatch is running.
+ */
+ bool is_running() const {
+ return true;
+ }
+ private:
+ time_point start_;
+ strict_stopwatch(const strict_stopwatch&); // = delete;
+ strict_stopwatch& operator=(const strict_stopwatch&); // = delete;
+ };
+
+ typedef strict_stopwatch<system_clock> system_strict_stopwatch;
+#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
+ typedef strict_stopwatch<steady_clock> steady_strict_stopwatch;
+#endif
+ typedef strict_stopwatch<high_resolution_clock> high_resolution_strict_stopwatch;
+
+#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
+ typedef strict_stopwatch<process_real_cpu_clock> process_real_cpu_strict_stopwatch;
+#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
+ typedef strict_stopwatch<process_user_cpu_clock> process_user_cpu_strict_stopwatch;
+ typedef strict_stopwatch<process_system_cpu_clock> process_system_cpu_strict_stopwatch;
+ typedef strict_stopwatch<process_cpu_clock> process_cpu_strict_stopwatch;
+#endif
+#endif
+
+#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
+ typedef strict_stopwatch<thread_clock> thread_strict_stopwatch;
+#endif
+
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/suspendable_stopwatch.hpp b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/suspendable_stopwatch.hpp
new file mode 100644
index 0000000000..5af8e948f6
--- /dev/null
+++ b/contrib/restricted/boost/libs/chrono/stopwatches/include/boost/chrono/stopwatches/suspendable_stopwatch.hpp
@@ -0,0 +1,334 @@
+// boost/chrono/stopwatches/suspendable_stopwatch.hpp ------------------------------------------------------------//
+// Copyright 2011 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+// See http://www.boost.org/libs/libs/chrono/stopwatches for documentation.
+
+#ifndef BOOST_CHRONO_STOPWATCHES_SUSPENDABLE_STOPWATCH__HPP
+#define BOOST_CHRONO_STOPWATCHES_SUSPENDABLE_STOPWATCH__HPP
+
+#include <boost/chrono/config.hpp>
+
+#include <boost/chrono/stopwatches/stopwatch_scoped.hpp>
+#include <boost/chrono/stopwatches/collectors/no_memory.hpp> // default laps_collector
+#include <boost/chrono/stopwatches/dont_start.hpp>
+#include <boost/chrono/detail/system.hpp>
+#include <boost/chrono/system_clocks.hpp>
+#include <utility>
+
+namespace boost
+{
+ namespace chrono
+ {
+
+ template<typename Clock=high_resolution_clock, typename LapsCollector=no_memory<typename Clock::duration> >
+ class suspendable_stopwatch
+ {
+ public:
+ typedef LapsCollector laps_collector;
+ typedef Clock clock;
+ typedef typename Clock::duration duration;
+ typedef typename Clock::time_point time_point;
+ typedef typename Clock::rep rep;
+ typedef typename Clock::period period;
+ BOOST_STATIC_CONSTEXPR bool is_steady = Clock::is_steady;
+
+ suspendable_stopwatch() :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(),
+ partial_(duration::zero())
+ {
+ start();
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit suspendable_stopwatch(
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(),
+ partial_(duration::zero())
+ {
+ start(ec);
+ }
+#endif
+
+ explicit suspendable_stopwatch(
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(),
+ partial_(duration::zero())
+ {
+ }
+
+ explicit suspendable_stopwatch(
+ laps_collector const& acc
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(acc),
+ partial_(duration::zero())
+ {
+ start();
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ explicit suspendable_stopwatch(
+ laps_collector const& acc,
+ system::error_code & ec
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(acc),
+ partial_(duration::zero())
+ {
+ start(ec);
+ }
+#endif
+
+ suspendable_stopwatch(
+ laps_collector const& acc,
+ const dont_start_t&
+ ) :
+ start_(duration::zero()),
+ running_(false),
+ suspended_(false),
+ laps_collector_(acc),
+ partial_(duration::zero())
+ {
+ }
+
+ ~suspendable_stopwatch()
+ {
+ stop();
+ }
+
+ void restart()
+ {
+ time_point tmp = clock::now();
+
+ if (running_)
+ {
+ partial_ += tmp - start_;
+ laps_collector_.store(partial_);
+ partial_ = duration::zero();
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void restart(system::error_code & ec)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ if (running_)
+ {
+ partial_ += tmp - start_;
+ laps_collector_.store(partial_);
+ partial_ = duration::zero();
+ }
+ else
+ {
+ running_ = true;
+ }
+ start_ = tmp;
+ }
+#endif
+
+ void start()
+ {
+ start_ = clock::now();;
+ partial_ = duration::zero();
+ running_ = true;
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void start(system::error_code & ec)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ partial_ = duration::zero();
+ start_ = tmp;
+ running_ = true;
+ }
+#endif
+
+ void stop()
+ {
+ partial_ += clock::now() - start_;
+ laps_collector_.store(partial_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ suspended_ = false;
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void stop(system::error_code & ec)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ partial_ += tmp - start_;
+ laps_collector_.store(partial_);
+ start_ = time_point(duration::zero());
+ running_ = false;
+ suspended_ = false;
+ }
+#endif
+
+ void suspend()
+ {
+ if (is_running())
+ {
+ if (!suspended_)
+ {
+ partial_ += clock::now() - start_;
+ suspended_ = true;
+ }
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void suspend(system::error_code & ec)
+ {
+ if (is_running())
+ {
+ if (!suspended_)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ partial_ += tmp - start_;
+ suspended_ = true;
+ }
+ else
+ {
+ ec.clear();
+ }
+ } else
+ {
+ ec.clear();
+ }
+ }
+#endif
+
+ void resume()
+ {
+ if (suspended_)
+ {
+ start_ = clock::now();
+ suspended_ = false;
+ }
+ }
+
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ void resume(system::error_code & ec)
+ {
+ if (suspended_)
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return;
+
+ start_ = tmp;
+ suspended_ = false;
+ } else
+ {
+ ec.clear();
+ }
+ }
+#endif
+
+ bool is_running() const {
+ return running_;
+ }
+ bool is_suspended() const {
+ return suspended_;
+ }
+
+ duration elapsed() const
+ {
+ if (is_running())
+ {
+ if (suspended_) {
+ return partial_;
+ }
+ else
+ {
+ return partial_ + clock::now() - start_;
+ }
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
+ duration elapsed(system::error_code & ec) const
+ {
+ if (is_running())
+ {
+ if (suspended_) {
+ return partial_;
+ }
+ else
+ {
+ time_point tmp = clock::now(ec);
+ if (!BOOST_CHRONO_IS_THROWS(ec) && ec) return duration::zero();
+
+ return partial_ + tmp - start_;
+ }
+ } else
+ {
+ return duration::zero();
+ }
+ }
+#endif
+
+ void reset(
+ )
+ {
+ laps_collector_.reset();
+ running_ = false;
+ suspended_ = false;
+ partial_ = duration::zero();
+ start_ = time_point(duration::zero());
+ }
+
+ laps_collector const& get_laps_collector()
+ {
+ return laps_collector_;
+ }
+
+
+ typedef stopwatch_runner<suspendable_stopwatch<Clock, LapsCollector> >
+ scoped_run;
+ typedef stopwatch_stopper<suspendable_stopwatch<Clock, LapsCollector> >
+ scoped_stop;
+ typedef stopwatch_suspender<suspendable_stopwatch<Clock, LapsCollector> >
+ scoped_suspend;
+ typedef stopwatch_resumer<suspendable_stopwatch<Clock, LapsCollector> >
+ scoped_resume;
+ private:
+ time_point start_;
+ bool running_;
+ bool suspended_;
+ laps_collector laps_collector_;
+ duration partial_;
+ };
+
+ } // namespace chrono
+} // namespace boost
+
+#endif
diff --git a/contrib/restricted/boost/libs/container/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/container/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..86ed39445e
--- /dev/null
+++ b/contrib/restricted/boost/libs/container/.yandex_meta/licenses.list.txt
@@ -0,0 +1,65 @@
+====================BSL-1.0====================
+// (C) Copyright Ion Gaztanaga 2007-2015. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// (C) Copyright Ion Gaztanaga 2012-2013. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================CC0-1.0====================
+ Doug Lea and released to the public domain, as explained at
+ http://creativecommons.org/publicdomain/zero/1.0/ Send questions,
+
+
+====================COPYRIGHT====================
+// (C) Copyright Ion Gaztanaga 2007-2015. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Ion Gaztanaga 2012-2013. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/context/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/context/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..79fa1e073c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/.yandex_meta/licenses.list.txt
@@ -0,0 +1,91 @@
+====================BSL-1.0====================
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Oliver Kowalke 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Oliver Kowalke 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
new file mode 100644
index 0000000000..1b8ce9eddb
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_elf_gas.S
@@ -0,0 +1,113 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.align 2
+.global jump_fcontext
+.type jump_fcontext, %function
+jump_fcontext:
+ # prepare stack for GP + FPU
+ sub sp, sp, #0xb0
+
+ # save d8 - d15
+ stp d8, d9, [sp, #0x00]
+ stp d10, d11, [sp, #0x10]
+ stp d12, d13, [sp, #0x20]
+ stp d14, d15, [sp, #0x30]
+
+ # save x19-x30
+ stp x19, x20, [sp, #0x40]
+ stp x21, x22, [sp, #0x50]
+ stp x23, x24, [sp, #0x60]
+ stp x25, x26, [sp, #0x70]
+ stp x27, x28, [sp, #0x80]
+ stp x29, x30, [sp, #0x90]
+
+ # save LR as PC
+ str x30, [sp, #0xa0]
+
+ # store RSP (pointing to context-data) in X0
+ mov x4, sp
+
+ # restore RSP (pointing to context-data) from X1
+ mov sp, x0
+
+ # load d8 - d15
+ ldp d8, d9, [sp, #0x00]
+ ldp d10, d11, [sp, #0x10]
+ ldp d12, d13, [sp, #0x20]
+ ldp d14, d15, [sp, #0x30]
+
+ # load x19-x30
+ ldp x19, x20, [sp, #0x40]
+ ldp x21, x22, [sp, #0x50]
+ ldp x23, x24, [sp, #0x60]
+ ldp x25, x26, [sp, #0x70]
+ ldp x27, x28, [sp, #0x80]
+ ldp x29, x30, [sp, #0x90]
+
+ # return transfer_t from jump
+ # pass transfer_t as first arg in context function
+ # X0 == FCTX, X1 == DATA
+ mov x0, x4
+
+ # load pc
+ ldr x4, [sp, #0xa0]
+
+ # restore stack from GP + FPU
+ add sp, sp, #0xb0
+
+ ret x4
+.size jump_fcontext,.-jump_fcontext
+# Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_macho_gas.S
new file mode 100644
index 0000000000..31738f7453
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm64_aapcs_macho_gas.S
@@ -0,0 +1,109 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _jump_fcontext
+.balign 16
+_jump_fcontext:
+ ; prepare stack for GP + FPU
+ sub sp, sp, #0xb0
+
+ ; save d8 - d15
+ stp d8, d9, [sp, #0x00]
+ stp d10, d11, [sp, #0x10]
+ stp d12, d13, [sp, #0x20]
+ stp d14, d15, [sp, #0x30]
+
+ ; save x19-x30
+ stp x19, x20, [sp, #0x40]
+ stp x21, x22, [sp, #0x50]
+ stp x23, x24, [sp, #0x60]
+ stp x25, x26, [sp, #0x70]
+ stp x27, x28, [sp, #0x80]
+ stp fp, lr, [sp, #0x90]
+
+ ; save LR as PC
+ str lr, [sp, #0xa0]
+
+ ; store RSP (pointing to context-data) in X0
+ mov x4, sp
+
+ ; restore RSP (pointing to context-data) from X1
+ mov sp, x0
+
+ ; load d8 - d15
+ ldp d8, d9, [sp, #0x00]
+ ldp d10, d11, [sp, #0x10]
+ ldp d12, d13, [sp, #0x20]
+ ldp d14, d15, [sp, #0x30]
+
+ ; load x19-x30
+ ldp x19, x20, [sp, #0x40]
+ ldp x21, x22, [sp, #0x50]
+ ldp x23, x24, [sp, #0x60]
+ ldp x25, x26, [sp, #0x70]
+ ldp x27, x28, [sp, #0x80]
+ ldp fp, lr, [sp, #0x90]
+
+ ; return transfer_t from jump
+ ; pass transfer_t as first arg in context function
+ ; X0 == FCTX, X1 == DATA
+ mov x0, x4
+
+ ; load pc
+ ldr x4, [sp, #0xa0]
+
+ ; restore stack from GP + FPU
+ add sp, sp, #0xb0
+
+ ret x4
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_elf_gas.S
new file mode 100644
index 0000000000..d0f7fa24c6
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_elf_gas.S
@@ -0,0 +1,86 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl jump_fcontext
+.align 2
+.type jump_fcontext,%function
+jump_fcontext:
+ @ save LR as PC
+ push {lr}
+ @ save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ @ prepare stack for FPU
+ sub sp, sp, #64
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ save S16-S31
+ vstmia sp, {d8-d15}
+#endif
+
+ @ store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ @ restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ restore S16-S31
+ vldmia sp, {d8-d15}
+#endif
+ @ prepare stack for FPU
+ add sp, sp, #64
+
+ @ restore hidden,V1-V8,LR
+ pop {a4,v1-v8,lr}
+
+ @ return transfer_t from jump
+ str a1, [a4, #0]
+ str a3, [a4, #4]
+ @ pass transfer_t as first arg in context function
+ @ A1 == FCTX, A2 == DATA
+ mov a2, a3
+
+ @ restore PC
+ pop {pc}
+.size jump_fcontext,.-jump_fcontext
+
+@ Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_macho_gas.S
new file mode 100644
index 0000000000..077c36409e
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_macho_gas.S
@@ -0,0 +1,95 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | v7 | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _jump_fcontext
+.align 2
+_jump_fcontext:
+ @ save LR as PC
+ push {lr}
+ @ save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ @ locate TLS to save/restore SjLj handler
+ mrc p15, 0, v2, c13, c0, #3
+ bic v2, v2, #3
+
+ @ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key]
+ ldr v1, [v2, #72]
+ @ save SjLj handler
+ push {v1}
+
+ @ prepare stack for FPU
+ sub sp, sp, #64
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ save S16-S31
+ vstmia sp, {d8-d15}
+#endif
+
+ @ store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ @ restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ restore S16-S31
+ vldmia sp, {d8-d15}
+#endif
+ @ prepare stack for FPU
+ add sp, sp, #64
+
+ @ r#estore SjLj handler
+ pop {v1}
+ @ store SjLj handler in TLS
+ str v1, [v2, #72]
+
+ @ restore hidden,V1-V8,LR
+ pop {a4,v1-v8,lr}
+
+ @ return transfer_t from jump
+ str a1, [a4, #0]
+ str a3, [a4, #4]
+ @ pass transfer_t as first arg in context function
+ @ A1 == FCTX, A2 == DATA
+ mov a2, a3
+
+ @ restore PC
+ pop {pc}
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.asm b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.asm
new file mode 100644
index 0000000000..bca923c6c7
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.asm
@@ -0,0 +1,81 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT jump_fcontext
+
+jump_fcontext PROC
+ ; save LR as PC
+ push {lr}
+ ; save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ ; load TIB to save/restore thread size and limit.
+ ; we do not need preserve CPU flag and can use it's arg register
+ mrc p15, #0, v1, c13, c0, #2
+
+ ; save current stack base
+ ldr a5, [v1, #0x04]
+ push {a5}
+ ; save current stack limit
+ ldr a5, [v1, #0x08]
+ push {a5}
+ ; save current deallocation stack
+ ldr a5, [v1, #0xe0c]
+ push {a5}
+
+ ; store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ ; restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+ ; restore deallocation stack
+ pop {a5}
+ str a5, [v1, #0xe0c]
+ ; restore stack limit
+ pop {a5}
+ str a5, [v1, #0x08]
+ ; restore stack base
+ pop {a5}
+ str a5, [v1, #0x04]
+
+ ; restore hidden,V1-V8,LR
+ pop {a4,v1-v8,lr}
+
+ ; return transfer_t from jump
+ str a1, [a4, #0]
+ str a3, [a4, #4]
+ ; pass transfer_t as first arg in context function
+ ; A1 == FCTX, A2 == DATA
+ mov a2, a3
+
+ ; restore PC
+ pop {pc}
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.masm b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.masm
new file mode 100644
index 0000000000..bca923c6c7
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_arm_aapcs_pe_armasm.masm
@@ -0,0 +1,81 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT jump_fcontext
+
+jump_fcontext PROC
+ ; save LR as PC
+ push {lr}
+ ; save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ ; load TIB to save/restore thread size and limit.
+ ; we do not need preserve CPU flag and can use it's arg register
+ mrc p15, #0, v1, c13, c0, #2
+
+ ; save current stack base
+ ldr a5, [v1, #0x04]
+ push {a5}
+ ; save current stack limit
+ ldr a5, [v1, #0x08]
+ push {a5}
+ ; save current deallocation stack
+ ldr a5, [v1, #0xe0c]
+ push {a5}
+
+ ; store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ ; restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+ ; restore deallocation stack
+ pop {a5}
+ str a5, [v1, #0xe0c]
+ ; restore stack limit
+ pop {a5}
+ str a5, [v1, #0x08]
+ ; restore stack base
+ pop {a5}
+ str a5, [v1, #0x04]
+
+ ; restore hidden,V1-V8,LR
+ pop {a4,v1-v8,lr}
+
+ ; return transfer_t from jump
+ str a1, [a4, #0]
+ str a3, [a4, #4]
+ ; pass transfer_t as first arg in context function
+ ; A1 == FCTX, A2 == DATA
+ mov a2, a3
+
+ ; restore PC
+ pop {pc}
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_combined_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_combined_sysv_macho_gas.S
new file mode 100644
index 0000000000..1d27afad10
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_combined_sysv_macho_gas.S
@@ -0,0 +1,20 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "jump_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "jump_x86_64_sysv_macho_gas.S"
+#elif defined(__ppc__)
+ #include "jump_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "jump_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_gas.asm
new file mode 100644
index 0000000000..8512a3d088
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_gas.asm
@@ -0,0 +1,117 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* --------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* --------------------------------------------------------------------------------- *
+* | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | *
+* --------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI | *
+* --------------------------------------------------------------------------------- *
+* --------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* --------------------------------------------------------------------------------- *
+* | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
+* --------------------------------------------------------------------------------- *
+* | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR| *
+* --------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "jump_i386_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl _jump_fcontext
+.def _jump_fcontext; .scl 2; .type 32; .endef
+_jump_fcontext:
+ /* prepare stack */
+ leal -0x2c(%esp), %esp
+
+#if !defined(BOOST_USE_TSX)
+ /* save MMX control- and status-word */
+ stmxcsr (%esp)
+ /* save x87 control-word */
+ fnstcw 0x4(%esp)
+#endif
+
+ /* load NT_TIB */
+ movl %fs:(0x18), %edx
+ /* load fiber local storage */
+ movl 0x10(%edx), %eax
+ movl %eax, 0x8(%esp)
+ /* load current dealloction stack */
+ movl 0xe0c(%edx), %eax
+ movl %eax, 0xc(%esp)
+ /* load current stack limit */
+ movl 0x8(%edx), %eax
+ movl %eax, 0x10(%esp)
+ /* load current stack base */
+ movl 0x4(%edx), %eax
+ movl %eax, 0x14(%esp)
+ /* load current SEH exception list */
+ movl (%edx), %eax
+ movl %eax, 0x18(%esp)
+
+ movl %edi, 0x1c(%esp) /* save EDI */
+ movl %esi, 0x20(%esp) /* save ESI */
+ movl %ebx, 0x24(%esp) /* save EBX */
+ movl %ebp, 0x28(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in EAX */
+ movl %esp, %eax
+
+ /* firstarg of jump_fcontext() == fcontext to jump to */
+ movl 0x30(%esp), %ecx
+
+ /* restore ESP (pointing to context-data) from ECX */
+ movl %ecx, %esp
+
+#if !defined(BOOST_USE_TSX)
+ /* restore MMX control- and status-word */
+ ldmxcsr (%esp)
+ /* restore x87 control-word */
+ fldcw 0x4(%esp)
+#endif
+
+ /* restore NT_TIB into EDX */
+ movl %fs:(0x18), %edx
+ /* restore fiber local storage */
+ movl 0x8(%esp), %ecx
+ movl %ecx, 0x10(%edx)
+ /* restore current deallocation stack */
+ movl 0xc(%esp), %ecx
+ movl %ecx, 0xe0c(%edx)
+ /* restore current stack limit */
+ movl 0x10(%esp), %ecx
+ movl %ecx, 0x8(%edx)
+ /* restore current stack base */
+ movl 0x14(%esp), %ecx
+ movl %ecx, 0x4(%edx)
+ /* restore current SEH exception list */
+ movl 0x18(%esp), %ecx
+ movl %ecx, (%edx)
+
+ movl 0x2c(%esp), %ecx /* restore EIP */
+
+ movl 0x1c(%esp), %edi /* restore EDI */
+ movl 0x20(%esp), %esi /* restore ESI */
+ movl 0x24(%esp), %ebx /* restore EBX */
+ movl 0x28(%esp), %ebp /* restore EBP */
+
+ /* prepare stack */
+ leal 0x30(%esp), %esp
+
+ /* return transfer_t */
+ /* FCTX == EAX, DATA == EDX */
+ movl 0x34(%eax), %edx
+
+ /* jump to context */
+ jmp *%ecx
+
+.section .drectve
+.ascii " -export:\"jump_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.asm
new file mode 100644
index 0000000000..7a9e848f1c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.asm
@@ -0,0 +1,116 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+.code
+
+jump_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; prepare stack
+ lea esp, [esp-02ch]
+
+IFNDEF BOOST_USE_TSX
+ ; save MMX control- and status-word
+ stmxcsr [esp]
+ ; save x87 control-word
+ fnstcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; load fiber local storage
+ mov eax, [edx+010h]
+ mov [esp+08h], eax
+ ; load current deallocation stack
+ mov eax, [edx+0e0ch]
+ mov [esp+0ch], eax
+ ; load current stack limit
+ mov eax, [edx+08h]
+ mov [esp+010h], eax
+ ; load current stack base
+ mov eax, [edx+04h]
+ mov [esp+014h], eax
+ ; load current SEH exception list
+ mov eax, [edx]
+ mov [esp+018h], eax
+
+ mov [esp+01ch], edi ; save EDI
+ mov [esp+020h], esi ; save ESI
+ mov [esp+024h], ebx ; save EBX
+ mov [esp+028h], ebp ; save EBP
+
+ ; store ESP (pointing to context-data) in EAX
+ mov eax, esp
+
+ ; firstarg of jump_fcontext() == fcontext to jump to
+ mov ecx, [esp+030h]
+
+ ; restore ESP (pointing to context-data) from ECX
+ mov esp, ecx
+
+IFNDEF BOOST_USE_TSX
+ ; restore MMX control- and status-word
+ ldmxcsr [esp]
+ ; restore x87 control-word
+ fldcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into EDX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; restore fiber local storage
+ mov ecx, [esp+08h]
+ mov [edx+010h], ecx
+ ; restore current deallocation stack
+ mov ecx, [esp+0ch]
+ mov [edx+0e0ch], ecx
+ ; restore current stack limit
+ mov ecx, [esp+010h]
+ mov [edx+08h], ecx
+ ; restore current stack base
+ mov ecx, [esp+014h]
+ mov [edx+04h], ecx
+ ; restore current SEH exception list
+ mov ecx, [esp+018h]
+ mov [edx], ecx
+
+ mov ecx, [esp+02ch] ; restore EIP
+
+ mov edi, [esp+01ch] ; restore EDI
+ mov esi, [esp+020h] ; restore ESI
+ mov ebx, [esp+024h] ; restore EBX
+ mov ebp, [esp+028h] ; restore EBP
+
+ ; prepare stack
+ lea esp, [esp+030h]
+
+ ; return transfer_t
+ ; FCTX == EAX, DATA == EDX
+ mov edx, [eax+034h]
+
+ ; jump to context
+ jmp ecx
+jump_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.masm
new file mode 100644
index 0000000000..7a9e848f1c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_ms_pe_masm.masm
@@ -0,0 +1,116 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+.code
+
+jump_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; prepare stack
+ lea esp, [esp-02ch]
+
+IFNDEF BOOST_USE_TSX
+ ; save MMX control- and status-word
+ stmxcsr [esp]
+ ; save x87 control-word
+ fnstcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; load fiber local storage
+ mov eax, [edx+010h]
+ mov [esp+08h], eax
+ ; load current deallocation stack
+ mov eax, [edx+0e0ch]
+ mov [esp+0ch], eax
+ ; load current stack limit
+ mov eax, [edx+08h]
+ mov [esp+010h], eax
+ ; load current stack base
+ mov eax, [edx+04h]
+ mov [esp+014h], eax
+ ; load current SEH exception list
+ mov eax, [edx]
+ mov [esp+018h], eax
+
+ mov [esp+01ch], edi ; save EDI
+ mov [esp+020h], esi ; save ESI
+ mov [esp+024h], ebx ; save EBX
+ mov [esp+028h], ebp ; save EBP
+
+ ; store ESP (pointing to context-data) in EAX
+ mov eax, esp
+
+ ; firstarg of jump_fcontext() == fcontext to jump to
+ mov ecx, [esp+030h]
+
+ ; restore ESP (pointing to context-data) from ECX
+ mov esp, ecx
+
+IFNDEF BOOST_USE_TSX
+ ; restore MMX control- and status-word
+ ldmxcsr [esp]
+ ; restore x87 control-word
+ fldcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into EDX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; restore fiber local storage
+ mov ecx, [esp+08h]
+ mov [edx+010h], ecx
+ ; restore current deallocation stack
+ mov ecx, [esp+0ch]
+ mov [edx+0e0ch], ecx
+ ; restore current stack limit
+ mov ecx, [esp+010h]
+ mov [edx+08h], ecx
+ ; restore current stack base
+ mov ecx, [esp+014h]
+ mov [edx+04h], ecx
+ ; restore current SEH exception list
+ mov ecx, [esp+018h]
+ mov [edx], ecx
+
+ mov ecx, [esp+02ch] ; restore EIP
+
+ mov edi, [esp+01ch] ; restore EDI
+ mov esi, [esp+020h] ; restore ESI
+ mov ebx, [esp+024h] ; restore EBX
+ mov ebp, [esp+028h] ; restore EBP
+
+ ; prepare stack
+ lea esp, [esp+030h]
+
+ ; return transfer_t
+ ; FCTX == EAX, DATA == EDX
+ mov edx, [eax+034h]
+
+ ; jump to context
+ jmp ecx
+jump_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_elf_gas.S
new file mode 100644
index 0000000000..c56ef14202
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_elf_gas.S
@@ -0,0 +1,92 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| guard | EDI | ESI | EBX | EBP | EIP | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | 0x24 | 0x28 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | hidden | to | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl jump_fcontext
+.align 2
+.type jump_fcontext,@function
+jump_fcontext:
+ leal -0x1c(%esp), %esp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ stmxcsr (%esp) /* save MMX control- and status-word */
+ fnstcw 0x4(%esp) /* save x87 control-word */
+#endif
+
+#if defined(TLS_STACK_PROTECTOR)
+ movl %gs:0x14, %ecx /* read stack guard from TLS record */
+ movl %ecx, 0x8(%esp) /* save stack guard */
+#endif
+
+ movl %edi, 0xc(%esp) /* save EDI */
+ movl %esi, 0x10(%esp) /* save ESI */
+ movl %ebx, 0x14(%esp) /* save EBX */
+ movl %ebp, 0x18(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of jump_fcontext() == fcontext to jump to */
+ movl 0x24(%esp), %eax
+
+ /* second arg of jump_fcontext() == data to be transferred */
+ movl 0x28(%esp), %edx
+
+ /* restore ESP (pointing to context-data) from EAX */
+ movl %eax, %esp
+
+ /* address of returned transport_t */
+ movl 0x20(%esp), %eax
+ /* return parent fcontext_t */
+ movl %ecx, (%eax)
+ /* return data */
+ movl %edx, 0x4(%eax)
+
+ movl 0x1c(%esp), %ecx /* restore EIP */
+
+#if !defined(BOOST_USE_TSX)
+ ldmxcsr (%esp) /* restore MMX control- and status-word */
+ fldcw 0x4(%esp) /* restore x87 control-word */
+#endif
+
+#if defined(TLS_STACK_PROTECTOR)
+ movl 0x8(%esp), %edx /* load stack guard */
+ movl %edx, %gs:0x14 /* restore stack guard to TLS record */
+#endif
+
+ movl 0xc(%esp), %edi /* restore EDI */
+ movl 0x10(%esp), %esi /* restore ESI */
+ movl 0x14(%esp), %ebx /* restore EBX */
+ movl 0x18(%esp), %ebp /* restore EBP */
+
+ leal 0x24(%esp), %esp /* prepare stack */
+
+ /* jump to context */
+ jmp *%ecx
+.size jump_fcontext,.-jump_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_macho_gas.S
new file mode 100644
index 0000000000..bfa3e23ed1
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_sysv_macho_gas.S
@@ -0,0 +1,74 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | to | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl _jump_fcontext
+.align 2
+_jump_fcontext:
+ leal -0x18(%esp), %esp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ stmxcsr (%esp) /* save MMX control- and status-word */
+ fnstcw 0x4(%esp) /* save x87 control-word */
+#endif
+
+ movl %edi, 0x8(%esp) /* save EDI */
+ movl %esi, 0xc(%esp) /* save ESI */
+ movl %ebx, 0x10(%esp) /* save EBX */
+ movl %ebp, 0x14(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of jump_fcontext() == fcontext to jump to */
+ movl 0x1c(%esp), %eax
+
+ /* second arg of jump_fcontext() == data to be transferred */
+ movl 0x20(%esp), %edx
+
+ /* restore ESP (pointing to context-data) from EAX */
+ movl %eax, %esp
+
+ /* return parent fcontext_t */
+ movl %ecx, %eax
+ /* returned data is stored in EDX */
+
+ movl 0x18(%esp), %ecx /* restore EIP */
+
+#if !defined(BOOST_USE_TSX)
+ ldmxcsr (%esp) /* restore MMX control- and status-word */
+ fldcw 0x4(%esp) /* restore x87 control-word */
+#endif
+
+ movl 0x8(%esp), %edi /* restore EDI */
+ movl 0xc(%esp), %esi /* restore ESI */
+ movl 0x10(%esp), %ebx /* restore EBX */
+ movl 0x14(%esp), %ebp /* restore EBP */
+
+ leal 0x1c(%esp), %esp /* prepare stack */
+
+ /* jump to context */
+ jmp *%ecx
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
new file mode 100644
index 0000000000..959ddac16f
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "jump_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "jump_x86_64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_mips32_o32_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_mips32_o32_elf_gas.S
new file mode 100644
index 0000000000..a6671d323b
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_mips32_o32_elf_gas.S
@@ -0,0 +1,118 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F20 | F22 | F24 | F26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F28 | F30 | S0 | S1 | S2 | S3 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | ABI ARGS | GP | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ * *****************************************************/
+
+.text
+.globl jump_fcontext
+.align 2
+.type jump_fcontext,@function
+.ent jump_fcontext
+jump_fcontext:
+ # reserve space on stack
+ addiu $sp, $sp, -96
+
+ sw $s0, 48($sp) # save S0
+ sw $s1, 52($sp) # save S1
+ sw $s2, 56($sp) # save S2
+ sw $s3, 60($sp) # save S3
+ sw $s4, 64($sp) # save S4
+ sw $s5, 68($sp) # save S5
+ sw $s6, 72($sp) # save S6
+ sw $s7, 76($sp) # save S7
+ sw $fp, 80($sp) # save FP
+ sw $a0, 84($sp) # save hidden, address of returned transfer_t
+ sw $ra, 88($sp) # save RA
+ sw $ra, 92($sp) # save RA as PC
+
+#if defined(__mips_hard_float)
+ s.d $f20, ($sp) # save F20
+ s.d $f22, 8($sp) # save F22
+ s.d $f24, 16($sp) # save F24
+ s.d $f26, 24($sp) # save F26
+ s.d $f28, 32($sp) # save F28
+ s.d $f30, 40($sp) # save F30
+#endif
+
+ # store SP (pointing to context-data) in A0
+ move $a0, $sp
+
+ # restore SP (pointing to context-data) from A1
+ move $sp, $a1
+
+#if defined(__mips_hard_float)
+ l.d $f20, ($sp) # restore F20
+ l.d $f22, 8($sp) # restore F22
+ l.d $f24, 16($sp) # restore F24
+ l.d $f26, 24($sp) # restore F26
+ l.d $f28, 32($sp) # restore F28
+ l.d $f30, 40($sp) # restore F30
+#endif
+
+ lw $s0, 48($sp) # restore S0
+ lw $s1, 52($sp) # restore S1
+ lw $s2, 56($sp) # restore S2
+ lw $s3, 60($sp) # restore S3
+ lw $s4, 64($sp) # restore S4
+ lw $s5, 68($sp) # restore S5
+ lw $s6, 72($sp) # restore S6
+ lw $s7, 76($sp) # restore S7
+ lw $fp, 80($sp) # restore FP
+ lw $v0, 84($sp) # restore hidden, address of returned transfer_t
+ lw $ra, 88($sp) # restore RA
+
+ # load PC
+ lw $t9, 92($sp)
+
+ # adjust stack
+ addiu $sp, $sp, 96
+
+ # return transfer_t from jump
+ sw $a0, ($v0) # fctx of transfer_t
+ sw $a2, 4($v0) # data of transfer_t
+ # pass transfer_t as first arg in context function
+ # A0 == fctx, A1 == data
+ move $a1, $a2
+
+ # jump to context
+ jr $t9
+.end jump_fcontext
+.size jump_fcontext, .-jump_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..f175e31233
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_ppc64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__ppc__)
+ #include "jump_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "jump_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S
new file mode 100644
index 0000000000..5ade6b1ea7
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_elf_gas.S
@@ -0,0 +1,206 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl jump_fcontext
+.align 2
+.type jump_fcontext,@function
+jump_fcontext:
+ # reserve space on stack
+ subi %r1, %r1, 244
+
+ stfd %f14, 0(%r1) # save F14
+ stfd %f15, 8(%r1) # save F15
+ stfd %f16, 16(%r1) # save F16
+ stfd %f17, 24(%r1) # save F17
+ stfd %f18, 32(%r1) # save F18
+ stfd %f19, 40(%r1) # save F19
+ stfd %f20, 48(%r1) # save F20
+ stfd %f21, 56(%r1) # save F21
+ stfd %f22, 64(%r1) # save F22
+ stfd %f23, 72(%r1) # save F23
+ stfd %f24, 80(%r1) # save F24
+ stfd %f25, 88(%r1) # save F25
+ stfd %f26, 96(%r1) # save F26
+ stfd %f27, 104(%r1) # save F27
+ stfd %f28, 112(%r1) # save F28
+ stfd %f29, 120(%r1) # save F29
+ stfd %f30, 128(%r1) # save F30
+ stfd %f31, 136(%r1) # save F31
+ mffs %f0 # load FPSCR
+ stfd %f0, 144(%r1) # save FPSCR
+
+ stw %r13, 152(%r1) # save R13
+ stw %r14, 156(%r1) # save R14
+ stw %r15, 160(%r1) # save R15
+ stw %r16, 164(%r1) # save R16
+ stw %r17, 168(%r1) # save R17
+ stw %r18, 172(%r1) # save R18
+ stw %r19, 176(%r1) # save R19
+ stw %r20, 180(%r1) # save R20
+ stw %r21, 184(%r1) # save R21
+ stw %r22, 188(%r1) # save R22
+ stw %r23, 192(%r1) # save R23
+ stw %r24, 196(%r1) # save R24
+ stw %r25, 200(%r1) # save R25
+ stw %r26, 204(%r1) # save R26
+ stw %r27, 208(%r1) # save R27
+ stw %r28, 212(%r1) # save R28
+ stw %r29, 216(%r1) # save R29
+ stw %r30, 220(%r1) # save R30
+ stw %r31, 224(%r1) # save R31
+ stw %r3, 228(%r1) # save hidden
+
+ # save CR
+ mfcr %r0
+ stw %r0, 232(%r1)
+ # save LR
+ mflr %r0
+ stw %r0, 236(%r1)
+ # save LR as PC
+ stw %r0, 240(%r1)
+
+ # store RSP (pointing to context-data) in R6
+ mr %r6, %r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr %r1, %r4
+
+ lfd %f14, 0(%r1) # restore F14
+ lfd %f15, 8(%r1) # restore F15
+ lfd %f16, 16(%r1) # restore F16
+ lfd %f17, 24(%r1) # restore F17
+ lfd %f18, 32(%r1) # restore F18
+ lfd %f19, 40(%r1) # restore F19
+ lfd %f20, 48(%r1) # restore F20
+ lfd %f21, 56(%r1) # restore F21
+ lfd %f22, 64(%r1) # restore F22
+ lfd %f23, 72(%r1) # restore F23
+ lfd %f24, 80(%r1) # restore F24
+ lfd %f25, 88(%r1) # restore F25
+ lfd %f26, 96(%r1) # restore F26
+ lfd %f27, 104(%r1) # restore F27
+ lfd %f28, 112(%r1) # restore F28
+ lfd %f29, 120(%r1) # restore F29
+ lfd %f30, 128(%r1) # restore F30
+ lfd %f31, 136(%r1) # restore F31
+ lfd %f0, 144(%r1) # load FPSCR
+ mtfsf 0xff, %f0 # restore FPSCR
+
+ lwz %r13, 152(%r1) # restore R13
+ lwz %r14, 156(%r1) # restore R14
+ lwz %r15, 160(%r1) # restore R15
+ lwz %r16, 164(%r1) # restore R16
+ lwz %r17, 168(%r1) # restore R17
+ lwz %r18, 172(%r1) # restore R18
+ lwz %r19, 176(%r1) # restore R19
+ lwz %r20, 180(%r1) # restore R20
+ lwz %r21, 184(%r1) # restore R21
+ lwz %r22, 188(%r1) # restore R22
+ lwz %r23, 192(%r1) # restore R23
+ lwz %r24, 196(%r1) # restore R24
+ lwz %r25, 200(%r1) # restore R25
+ lwz %r26, 204(%r1) # restore R26
+ lwz %r27, 208(%r1) # restore R27
+ lwz %r28, 212(%r1) # restore R28
+ lwz %r29, 216(%r1) # restore R29
+ lwz %r30, 220(%r1) # restore R30
+ lwz %r31, 224(%r1) # restore R31
+ lwz %r3, 228(%r1) # restore hidden
+
+ # restore CR
+ lwz %r0, 232(%r1)
+ mtcr %r0
+ # restore LR
+ lwz %r0, 236(%r1)
+ mtlr %r0
+ # load PC
+ lwz %r0, 240(%r1)
+ # restore CTR
+ mtctr %r0
+
+ # adjust stack
+ addi %r1, %r1, 244
+
+ # return transfer_t
+ stw %r6, 0(%r3)
+ stw %r5, 4(%r3)
+
+ # jump to context
+ bctr
+.size jump_fcontext, .-jump_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_macho_gas.S
new file mode 100644
index 0000000000..c555237afa
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_macho_gas.S
@@ -0,0 +1,201 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _jump_fcontext
+.align 2
+_jump_fcontext:
+ ; reserve space on stack
+ subi r1, r1, 244
+
+ stfd f14, 0(r1) # save F14
+ stfd f15, 8(r1) # save F15
+ stfd f16, 16(r1) # save F16
+ stfd f17, 24(r1) # save F17
+ stfd f18, 32(r1) # save F18
+ stfd f19, 40(r1) # save F19
+ stfd f20, 48(r1) # save F20
+ stfd f21, 56(r1) # save F21
+ stfd f22, 64(r1) # save F22
+ stfd f23, 72(r1) # save F23
+ stfd f24, 80(r1) # save F24
+ stfd f25, 88(r1) # save F25
+ stfd f26, 96(r1) # save F26
+ stfd f27, 104(r1) # save F27
+ stfd f28, 112(r1) # save F28
+ stfd f29, 120(r1) # save F29
+ stfd f30, 128(r1) # save F30
+ stfd f31, 136(r1) # save F31
+ mffs f0 # load FPSCR
+ stfd f0, 144(r1) # save FPSCR
+
+ stw r13, 152(r1) # save R13
+ stw r14, 156(r1) # save R14
+ stw r15, 160(r1) # save R15
+ stw r16, 164(r1) # save R16
+ stw r17, 168(r1) # save R17
+ stw r18, 172(r1) # save R18
+ stw r19, 176(r1) # save R19
+ stw r20, 180(r1) # save R20
+ stw r21, 184(r1) # save R21
+ stw r22, 188(r1) # save R22
+ stw r23, 192(r1) # save R23
+ stw r24, 196(r1) # save R24
+ stw r25, 200(r1) # save R25
+ stw r26, 204(r1) # save R26
+ stw r27, 208(r1) # save R27
+ stw r28, 212(r1) # save R28
+ stw r29, 216(r1) # save R29
+ stw r30, 220(r1) # save R30
+ stw r31, 224(r1) # save R31
+ stw r3, 228(r1) # save hidden
+
+ # save CR
+ mfcr r0
+ stw r0, 232(r1)
+ # save LR
+ mflr r0
+ stw r0, 236(r1)
+ # save LR as PC
+ stw r0, 240(r1)
+
+ # store RSP (pointing to context-data) in R6
+ mr r6, r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ lfd f14, 0(r1) # restore F14
+ lfd f15, 8(r1) # restore F15
+ lfd f16, 16(r1) # restore F16
+ lfd f17, 24(r1) # restore F17
+ lfd f18, 32(r1) # restore F18
+ lfd f19, 40(r1) # restore F19
+ lfd f20, 48(r1) # restore F20
+ lfd f21, 56(r1) # restore F21
+ lfd f22, 64(r1) # restore F22
+ lfd f23, 72(r1) # restore F23
+ lfd f24, 80(r1) # restore F24
+ lfd f25, 88(r1) # restore F25
+ lfd f26, 96(r1) # restore F26
+ lfd f27, 104(r1) # restore F27
+ lfd f28, 112(r1) # restore F28
+ lfd f29, 120(r1) # restore F29
+ lfd f30, 128(r1) # restore F30
+ lfd f31, 136(r1) # restore F31
+ lfd f0, 144(r1) # load FPSCR
+ mtfsf 0xff, f0 # restore FPSCR
+
+ lwz r13, 152(r1) # restore R13
+ lwz r14, 156(r1) # restore R14
+ lwz r15, 160(r1) # restore R15
+ lwz r16, 164(r1) # restore R16
+ lwz r17, 168(r1) # restore R17
+ lwz r18, 172(r1) # restore R18
+ lwz r19, 176(r1) # restore R19
+ lwz r20, 180(r1) # restore R20
+ lwz r21, 184(r1) # restore R21
+ lwz r22, 188(r1) # restore R22
+ lwz r23, 192(r1) # restore R23
+ lwz r24, 196(r1) # restore R24
+ lwz r25, 200(r1) # restore R25
+ lwz r26, 204(r1) # restore R26
+ lwz r27, 208(r1) # restore R27
+ lwz r28, 212(r1) # restore R28
+ lwz r29, 216(r1) # restore R29
+ lwz r30, 220(r1) # restore R30
+ lwz r31, 224(r1) # restore R31
+ lwz r3, 228(r1) # restore hidden
+
+ # restore CR
+ lwz r0, 232(r1)
+ mtcr r0
+ # restore LR
+ lwz r0, 236(r1)
+ mtlr r0
+ # load PC
+ lwz r0, 240(r1)
+ # restore CTR
+ mtctr r0
+
+ # adjust stack
+ addi r1, r1, 244
+
+ # return transfer_t
+ stw r6, 0(r3)
+ stw r5, 4(r3)
+
+ # jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..5a967726ad
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc32_sysv_xcoff_gas.S
@@ -0,0 +1,203 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+.globl .jump_fcontext
+.globl jump_fcontext[DS]
+.align 2
+.csect jump_fcontext[DS]
+jump_fcontext:
+ .long .jump_fcontext
+.jump_fcontext:
+ # reserve space on stack
+ subi r1, r1, 244
+
+ stfd f14, 0(r1) # save F14
+ stfd f15, 8(r1) # save F15
+ stfd f16, 16(r1) # save F16
+ stfd f17, 24(r1) # save F17
+ stfd f18, 32(r1) # save F18
+ stfd f19, 40(r1) # save F19
+ stfd f20, 48(r1) # save F20
+ stfd f21, 56(r1) # save F21
+ stfd f22, 64(r1) # save F22
+ stfd f23, 72(r1) # save F23
+ stfd f24, 80(r1) # save F24
+ stfd f25, 88(r1) # save F25
+ stfd f26, 96(r1) # save F26
+ stfd f27, 104(r1) # save F27
+ stfd f28, 112(r1) # save F28
+ stfd f29, 120(r1) # save F29
+ stfd f30, 128(r1) # save F30
+ stfd f31, 136(r1) # save F31
+ mffs f0 # load FPSCR
+ stfd f0, 144(r1) # save FPSCR
+
+ stw r13, 152(r1) # save R13
+ stw r14, 156(r1) # save R14
+ stw r15, 160(r1) # save R15
+ stw r16, 164(r1) # save R16
+ stw r17, 168(r1) # save R17
+ stw r18, 172(r1) # save R18
+ stw r19, 176(r1) # save R19
+ stw r20, 180(r1) # save R20
+ stw r21, 184(r1) # save R21
+ stw r22, 188(r1) # save R22
+ stw r23, 192(r1) # save R23
+ stw r24, 196(r1) # save R24
+ stw r25, 200(r1) # save R25
+ stw r26, 204(r1) # save R26
+ stw r27, 208(r1) # save R27
+ stw r28, 212(r1) # save R28
+ stw r29, 216(r1) # save R29
+ stw r30, 220(r1) # save R30
+ stw r31, 224(r1) # save R31
+ stw r3, 228(r1) # save hidden
+
+ # save CR
+ mfcr r0
+ stw r0, 232(r1)
+ # save LR
+ mflr r0
+ stw r0, 236(r1)
+ # save LR as PC
+ stw r0, 240(r1)
+
+ # store RSP (pointing to context-data) in R6
+ mr r6, r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ lfd f14, 0(r1) # restore F14
+ lfd f15, 8(r1) # restore F15
+ lfd f16, 16(r1) # restore F16
+ lfd f17, 24(r1) # restore F17
+ lfd f18, 32(r1) # restore F18
+ lfd f19, 40(r1) # restore F19
+ lfd f20, 48(r1) # restore F20
+ lfd f21, 56(r1) # restore F21
+ lfd f22, 64(r1) # restore F22
+ lfd f23, 72(r1) # restore F23
+ lfd f24, 80(r1) # restore F24
+ lfd f25, 88(r1) # restore F25
+ lfd f26, 96(r1) # restore F26
+ lfd f27, 104(r1) # restore F27
+ lfd f28, 112(r1) # restore F28
+ lfd f29, 120(r1) # restore F29
+ lfd f30, 128(r1) # restore F30
+ lfd f31, 136(r1) # restore F31
+ lfd f0, 144(r1) # load FPSCR
+ mtfsf 0xff, f0 # restore FPSCR
+
+ lwz r13, 152(r1) # restore R13
+ lwz r14, 156(r1) # restore R14
+ lwz r15, 160(r1) # restore R15
+ lwz r16, 164(r1) # restore R16
+ lwz r17, 168(r1) # restore R17
+ lwz r18, 172(r1) # restore R18
+ lwz r19, 176(r1) # restore R19
+ lwz r20, 180(r1) # restore R20
+ lwz r21, 184(r1) # restore R21
+ lwz r22, 188(r1) # restore R22
+ lwz r23, 192(r1) # restore R23
+ lwz r24, 196(r1) # restore R24
+ lwz r25, 200(r1) # restore R25
+ lwz r26, 204(r1) # restore R26
+ lwz r27, 208(r1) # restore R27
+ lwz r28, 212(r1) # restore R28
+ lwz r29, 216(r1) # restore R29
+ lwz r30, 220(r1) # restore R30
+ lwz r31, 224(r1) # restore R31
+ lwz r3, 228(r1) # restore hidden
+
+ # restore CR
+ lwz r0, 232(r1)
+ mtcr r0
+ # restore LR
+ lwz r0, 236(r1)
+ mtlr r0
+ # load PC
+ lwz r0, 240(r1)
+ # restore CTR
+ mtctr r0
+
+ # adjust stack
+ addi r1, r1, 244
+
+ # return transfer_t
+ stw r6, 0(r3)
+ stw r5, 4(r3)
+
+ # jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
new file mode 100644
index 0000000000..a27e606e6b
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_elf_gas.S
@@ -0,0 +1,220 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.globl jump_fcontext
+#if _CALL_ELF == 2
+ .text
+ .align 2
+jump_fcontext:
+ addis %r2, %r12, .TOC.-jump_fcontext@ha
+ addi %r2, %r2, .TOC.-jump_fcontext@l
+ .localentry jump_fcontext, . - jump_fcontext
+#else
+ .section ".opd","aw"
+ .align 3
+jump_fcontext:
+# ifdef _CALL_LINUX
+ .quad .L.jump_fcontext,.TOC.@tocbase,0
+ .type jump_fcontext,@function
+ .text
+ .align 2
+.L.jump_fcontext:
+# else
+ .hidden .jump_fcontext
+ .globl .jump_fcontext
+ .quad .jump_fcontext,.TOC.@tocbase,0
+ .size jump_fcontext,24
+ .type .jump_fcontext,@function
+ .text
+ .align 2
+.jump_fcontext:
+# endif
+#endif
+ # reserve space on stack
+ subi %r1, %r1, 184
+
+#if _CALL_ELF != 2
+ std %r2, 0(%r1) # save TOC
+#endif
+ std %r14, 8(%r1) # save R14
+ std %r15, 16(%r1) # save R15
+ std %r16, 24(%r1) # save R16
+ std %r17, 32(%r1) # save R17
+ std %r18, 40(%r1) # save R18
+ std %r19, 48(%r1) # save R19
+ std %r20, 56(%r1) # save R20
+ std %r21, 64(%r1) # save R21
+ std %r22, 72(%r1) # save R22
+ std %r23, 80(%r1) # save R23
+ std %r24, 88(%r1) # save R24
+ std %r25, 96(%r1) # save R25
+ std %r26, 104(%r1) # save R26
+ std %r27, 112(%r1) # save R27
+ std %r28, 120(%r1) # save R28
+ std %r29, 128(%r1) # save R29
+ std %r30, 136(%r1) # save R30
+ std %r31, 144(%r1) # save R31
+#if _CALL_ELF != 2
+ std %r3, 152(%r1) # save hidden
+#endif
+
+ # save CR
+ mfcr %r0
+ std %r0, 160(%r1)
+ # save LR
+ mflr %r0
+ std %r0, 168(%r1)
+ # save LR as PC
+ std %r0, 176(%r1)
+
+ # store RSP (pointing to context-data) in R6
+ mr %r6, %r1
+
+#if _CALL_ELF == 2
+ # restore RSP (pointing to context-data) from R3
+ mr %r1, %r3
+#else
+ # restore RSP (pointing to context-data) from R4
+ mr %r1, %r4
+
+ ld %r2, 0(%r1) # restore TOC
+#endif
+ ld %r14, 8(%r1) # restore R14
+ ld %r15, 16(%r1) # restore R15
+ ld %r16, 24(%r1) # restore R16
+ ld %r17, 32(%r1) # restore R17
+ ld %r18, 40(%r1) # restore R18
+ ld %r19, 48(%r1) # restore R19
+ ld %r20, 56(%r1) # restore R20
+ ld %r21, 64(%r1) # restore R21
+ ld %r22, 72(%r1) # restore R22
+ ld %r23, 80(%r1) # restore R23
+ ld %r24, 88(%r1) # restore R24
+ ld %r25, 96(%r1) # restore R25
+ ld %r26, 104(%r1) # restore R26
+ ld %r27, 112(%r1) # restore R27
+ ld %r28, 120(%r1) # restore R28
+ ld %r29, 128(%r1) # restore R29
+ ld %r30, 136(%r1) # restore R30
+ ld %r31, 144(%r1) # restore R31
+#if _CALL_ELF != 2
+ ld %r3, 152(%r1) # restore hidden
+#endif
+
+ # restore CR
+ ld %r0, 160(%r1)
+ mtcr %r0
+ # restore LR
+ ld %r0, 168(%r1)
+ mtlr %r0
+
+ # load PC
+ ld %r12, 176(%r1)
+ # restore CTR
+ mtctr %r12
+
+ # adjust stack
+ addi %r1, %r1, 184
+
+#if _CALL_ELF == 2
+ # copy transfer_t into transfer_fn arg registers
+ mr %r3, %r6
+ # arg pointer already in %r4
+
+ # jump to context
+ bctr
+ .size jump_fcontext, .-jump_fcontext
+#else
+ # zero in r3 indicates first jump to context-function
+ cmpdi %r3, 0
+ beq use_entry_arg
+
+ # return transfer_t
+ std %r6, 0(%r3)
+ std %r5, 8(%r3)
+
+ # jump to context
+ bctr
+
+use_entry_arg:
+ # copy transfer_t into transfer_fn arg registers
+ mr %r3, %r6
+ mr %r4, %r5
+
+ # jump to context
+ bctr
+# ifdef _CALL_LINUX
+ .size .jump_fcontext, .-.L.jump_fcontext
+# else
+ .size .jump_fcontext, .-.jump_fcontext
+# endif
+#endif
+
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..74fcb2ab35
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_macho_gas.S
@@ -0,0 +1,164 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.align 2
+.globl _jump_fcontext
+
+_jump_fcontext:
+ ; reserve space on stack
+ subi r1, r1, 184
+
+ std r14, 8(r1) ; save R14
+ std r15, 16(r1) ; save R15
+ std r16, 24(r1) ; save R16
+ std r17, 32(r1) ; save R17
+ std r18, 40(r1) ; save R18
+ std r19, 48(r1) ; save R19
+ std r20, 56(r1) ; save R20
+ std r21, 64(r1) ; save R21
+ std r22, 72(r1) ; save R22
+ std r23, 80(r1) ; save R23
+ std r24, 88(r1) ; save R24
+ std r25, 96(r1) ; save R25
+ std r26, 104(r1) ; save R26
+ std r27, 112(r1) ; save R27
+ std r28, 120(r1) ; save R28
+ std r29, 128(r1) ; save R29
+ std r30, 136(r1) ; save R30
+ std r31, 144(r1) ; save R31
+ std r3, 152(r1) ; save hidden
+
+ ; save CR
+ mfcr r0
+ std r0, 160(r1)
+ ; save LR
+ mflr r0
+ std r0, 168(r1)
+ ; save LR as PC
+ std r0, 176(r1)
+
+ ; store RSP (pointing to context-data) in R6
+ mr r6, r1
+
+ ; restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ ld r14, 8(r1) ; restore R14
+ ld r15, 16(r1) ; restore R15
+ ld r16, 24(r1) ; restore R16
+ ld r17, 32(r1) ; restore R17
+ ld r18, 40(r1) ; restore R18
+ ld r19, 48(r1) ; restore R19
+ ld r20, 56(r1) ; restore R20
+ ld r21, 64(r1) ; restore R21
+ ld r22, 72(r1) ; restore R22
+ ld r23, 80(r1) ; restore R23
+ ld r24, 88(r1) ; restore R24
+ ld r25, 96(r1) ; restore R25
+ ld r26, 104(r1) ; restore R26
+ ld r27, 112(r1) ; restore R27
+ ld r28, 120(r1) ; restore R28
+ ld r29, 128(r1) ; restore R29
+ ld r30, 136(r1) ; restore R30
+ ld r31, 144(r1) ; restore R31
+ ld r3, 152(r1) ; restore hidden
+
+ ; restore CR
+ ld r0, 160(r1)
+ mtcr r0
+ ; restore LR
+ ld r0, 168(r1)
+ mtlr r0
+
+ ; load PC
+ ld r12, 176(r1)
+ # restore CTR
+ mtctr r12
+
+ # adjust stack
+ addi r1, r1, 184
+
+ # zero in r3 indicates first jump to context-function
+ cmpdi r3, 0
+ beq use_entry_arg
+
+ # return transfer_t
+ std r6, 0(r3)
+ std r5, 8(r3)
+
+ # jump to context
+ bctr
+
+use_entry_arg:
+ # copy transfer_t into transfer_fn arg registers
+ mr r3, r6
+ mr r4, r5
+
+ # jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..013433f312
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_ppc64_sysv_xcoff_gas.S
@@ -0,0 +1,84 @@
+.align 2
+.globl .jump_fcontext
+.jump_fcontext:
+ # reserve space on stack
+ subi 1, 1, 184
+
+ std 13, 0(1) # save R13
+ std 14, 8(1) # save R14
+ std 15, 16(1) # save R15
+ std 16, 24(1) # save R16
+ std 17, 32(1) # save R17
+ std 18, 40(1) # save R18
+ std 19, 48(1) # save R19
+ std 20, 56(1) # save R20
+ std 21, 64(1) # save R21
+ std 22, 72(1) # save R22
+ std 23, 80(1) # save R23
+ std 24, 88(1) # save R24
+ std 25, 96(1) # save R25
+ std 26, 104(1) # save R26
+ std 27, 112(1) # save R27
+ std 29, 120(1) # save R28
+ std 29, 128(1) # save R29
+ std 30, 136(1) # save R30
+ std 31, 144(1) # save R31
+ std 3, 152(1) # save hidden
+
+ # save CR
+ mfcr 0
+ std 0, 160(1)
+ # save LR
+ mflr 0
+ std 0, 168(1)
+ # save LR as PC
+ std 0, 176(1)
+
+ # store RSP (pointing to context-data) in R6
+ mr 6, 1
+
+ # restore RSP (pointing to context-data) from R4
+ mr 1, 4
+
+ ld 13, 0(1) # restore R13
+ ld 14, 8(1) # restore R14
+ ld 15, 16(1) # restore R15
+ ld 16, 24(1) # restore R16
+ ld 17, 32(1) # restore R17
+ ld 18, 40(1) # restore R18
+ ld 19, 48(1) # restore R19
+ ld 20, 56(1) # restore R20
+ ld 21, 64(1) # restore R21
+ ld 22, 72(1) # restore R22
+ ld 23, 80(1) # restore R23
+ ld 24, 88(1) # restore R24
+ ld 25, 96(1) # restore R25
+ ld 26, 104(1) # restore R26
+ ld 27, 112(1) # restore R27
+ ld 28, 120(1) # restore R28
+ ld 29, 128(1) # restore R29
+ ld 30, 136(1) # restore R30
+ ld 31, 144(1) # restore R31
+ ld 3, 152(1) # restore hidden
+
+ # restore CR
+ ld 0, 160(1)
+ mtcr 0
+ # restore LR
+ ld 0, 168(1)
+ mtlr 0
+
+ # load PC
+ ld 0, 176(1)
+ # restore CTR
+ mtctr 0
+
+ # adjust stack
+ addi 1, 1, 184
+
+ # return transfer_t
+ std 6, 0(3)
+ std 5, 8(3)
+
+ # jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm
new file mode 100644
index 0000000000..ec4ecfe946
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_gas.asm
@@ -0,0 +1,209 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* ---------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
+* ---------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
+* ---------------------------------------------------------------------------------- *
+* | limit | base | R12 | R13 | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
+* ---------------------------------------------------------------------------------- *
+* | R14 | R15 | RDI | RSI | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
+* ---------------------------------------------------------------------------------- *
+* | RBX | RBP | hidden | RIP | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
+* ---------------------------------------------------------------------------------- *
+* | parameter area | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
+* ---------------------------------------------------------------------------------- *
+* | FCTX | DATA | | *
+* ---------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "jump_x86_64_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl jump_fcontext
+.def jump_fcontext; .scl 2; .type 32; .endef
+.seh_proc jump_fcontext
+jump_fcontext:
+.seh_endprologue
+
+ leaq -0x118(%rsp), %rsp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ /* save XMM storage */
+ movaps %xmm6, 0x0(%rsp)
+ movaps %xmm7, 0x10(%rsp)
+ movaps %xmm8, 0x20(%rsp)
+ movaps %xmm9, 0x30(%rsp)
+ movaps %xmm10, 0x40(%rsp)
+ movaps %xmm11, 0x50(%rsp)
+ movaps %xmm12, 0x60(%rsp)
+ movaps %xmm13, 0x70(%rsp)
+ movaps %xmm14, 0x80(%rsp)
+ movaps %xmm15, 0x90(%rsp)
+ stmxcsr 0xa0(%rsp) /* save MMX control- and status-word */
+ fnstcw 0xa4(%rsp) /* save x87 control-word */
+#endif
+
+ /* load NT_TIB */
+ movq %gs:(0x30), %r10
+ /* save fiber local storage */
+ movq 0x20(%r10), %rax
+ movq %rax, 0xb0(%rsp)
+ /* save current deallocation stack */
+ movq 0x1478(%r10), %rax
+ movq %rax, 0xb8(%rsp)
+ /* save current stack limit */
+ movq 0x10(%r10), %rax
+ movq %rax, 0xc0(%rsp)
+ /* save current stack base */
+ movq 0x08(%r10), %rax
+ movq %rax, 0xc8(%rsp)
+
+ movq %r12, 0xd0(%rsp) /* save R12 */
+ movq %r13, 0xd8(%rsp) /* save R13 */
+ movq %r14, 0xe0(%rsp) /* save R14 */
+ movq %r15, 0xe8(%rsp) /* save R15 */
+ movq %rdi, 0xf0(%rsp) /* save RDI */
+ movq %rsi, 0xf8(%rsp) /* save RSI */
+ movq %rbx, 0x100(%rsp) /* save RBX */
+ movq %rbp, 0x108(%rsp) /* save RBP */
+
+ movq %rcx, 0x110(%rsp) /* save hidden address of transport_t */
+
+ /* preserve RSP (pointing to context-data) in R9 */
+ movq %rsp, %r9
+
+ /* restore RSP (pointing to context-data) from RDX */
+ movq %rdx, %rsp
+
+#if !defined(BOOST_USE_TSX)
+ /* restore XMM storage */
+ movaps 0x0(%rsp), %xmm6
+ movaps 0x10(%rsp), %xmm7
+ movaps 0x20(%rsp), %xmm8
+ movaps 0x30(%rsp), %xmm9
+ movaps 0x40(%rsp), %xmm10
+ movaps 0x50(%rsp), %xmm11
+ movaps 0x60(%rsp), %xmm12
+ movaps 0x70(%rsp), %xmm13
+ movaps 0x80(%rsp), %xmm14
+ movaps 0x90(%rsp), %xmm15
+ ldmxcsr 0xa0(%rsp) /* restore MMX control- and status-word */
+ fldcw 0xa4(%rsp) /* restore x87 control-word */
+#endif
+
+ /* load NT_TIB */
+ movq %gs:(0x30), %r10
+ /* restore fiber local storage */
+ movq 0xb0(%rsp), %rax
+ movq %rax, 0x20(%r10)
+ /* restore current deallocation stack */
+ movq 0xb8(%rsp), %rax
+ movq %rax, 0x1478(%r10)
+ /* restore current stack limit */
+ movq 0xc0(%rsp), %rax
+ movq %rax, 0x10(%r10)
+ /* restore current stack base */
+ movq 0xc8(%rsp), %rax
+ movq %rax, 0x08(%r10)
+
+ movq 0xd0(%rsp), %r12 /* restore R12 */
+ movq 0xd8(%rsp), %r13 /* restore R13 */
+ movq 0xe0(%rsp), %r14 /* restore R14 */
+ movq 0xe8(%rsp), %r15 /* restore R15 */
+ movq 0xf0(%rsp), %rdi /* restore RDI */
+ movq 0xf8(%rsp), %rsi /* restore RSI */
+ movq 0x100(%rsp), %rbx /* restore RBX */
+ movq 0x108(%rsp), %rbp /* restore RBP */
+
+ movq 0x110(%rsp), %rax /* restore hidden address of transport_t */
+
+ leaq 0x118(%rsp), %rsp /* prepare stack */
+
+ /* restore return-address */
+ popq %r10
+
+ /* transport_t returned in RAX */
+ /* return parent fcontext_t */
+ movq %r9, 0x0(%rax)
+ /* return data */
+ movq %r8, 0x8(%rax)
+
+ /* transport_t as 1.arg of context-function */
+ movq %rax, %rcx
+
+ /* indirect jump to context */
+ jmp *%r10
+.seh_endproc
+
+.section .drectve
+.ascii " -export:\"jump_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm
new file mode 100644
index 0000000000..c8a28a558e
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.asm
@@ -0,0 +1,205 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+.code
+
+jump_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ .endprolog
+
+ ; prepare stack
+ lea rsp, [rsp-0118h]
+
+IFNDEF BOOST_USE_TSX
+ ; save XMM storage
+ movaps [rsp], xmm6
+ movaps [rsp+010h], xmm7
+ movaps [rsp+020h], xmm8
+ movaps [rsp+030h], xmm9
+ movaps [rsp+040h], xmm10
+ movaps [rsp+050h], xmm11
+ movaps [rsp+060h], xmm12
+ movaps [rsp+070h], xmm13
+ movaps [rsp+080h], xmm14
+ movaps [rsp+090h], xmm15
+ ; save MMX control- and status-word
+ stmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fnstcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; save fiber local storage
+ mov rax, [r10+020h]
+ mov [rsp+0b0h], rax
+ ; save current deallocation stack
+ mov rax, [r10+01478h]
+ mov [rsp+0b8h], rax
+ ; save current stack limit
+ mov rax, [r10+010h]
+ mov [rsp+0c0h], rax
+ ; save current stack base
+ mov rax, [r10+08h]
+ mov [rsp+0c8h], rax
+
+ mov [rsp+0d0h], r12 ; save R12
+ mov [rsp+0d8h], r13 ; save R13
+ mov [rsp+0e0h], r14 ; save R14
+ mov [rsp+0e8h], r15 ; save R15
+ mov [rsp+0f0h], rdi ; save RDI
+ mov [rsp+0f8h], rsi ; save RSI
+ mov [rsp+0100h], rbx ; save RBX
+ mov [rsp+0108h], rbp ; save RBP
+
+ mov [rsp+0110h], rcx ; save hidden address of transport_t
+
+ ; preserve RSP (pointing to context-data) in R9
+ mov r9, rsp
+
+ ; restore RSP (pointing to context-data) from RDX
+ mov rsp, rdx
+
+IFNDEF BOOST_USE_TSX
+ ; restore XMM storage
+ movaps xmm6, [rsp]
+ movaps xmm7, [rsp+010h]
+ movaps xmm8, [rsp+020h]
+ movaps xmm9, [rsp+030h]
+ movaps xmm10, [rsp+040h]
+ movaps xmm11, [rsp+050h]
+ movaps xmm12, [rsp+060h]
+ movaps xmm13, [rsp+070h]
+ movaps xmm14, [rsp+080h]
+ movaps xmm15, [rsp+090h]
+ ; restore MMX control- and status-word
+ ldmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fldcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; restore fiber local storage
+ mov rax, [rsp+0b0h]
+ mov [r10+020h], rax
+ ; restore current deallocation stack
+ mov rax, [rsp+0b8h]
+ mov [r10+01478h], rax
+ ; restore current stack limit
+ mov rax, [rsp+0c0h]
+ mov [r10+010h], rax
+ ; restore current stack base
+ mov rax, [rsp+0c8h]
+ mov [r10+08h], rax
+
+ mov r12, [rsp+0d0h] ; restore R12
+ mov r13, [rsp+0d8h] ; restore R13
+ mov r14, [rsp+0e0h] ; restore R14
+ mov r15, [rsp+0e8h] ; restore R15
+ mov rdi, [rsp+0f0h] ; restore RDI
+ mov rsi, [rsp+0f8h] ; restore RSI
+ mov rbx, [rsp+0100h] ; restore RBX
+ mov rbp, [rsp+0108h] ; restore RBP
+
+ mov rax, [rsp+0110h] ; restore hidden address of transport_t
+
+ ; prepare stack
+ lea rsp, [rsp+0118h]
+
+ ; load return-address
+ pop r10
+
+ ; transport_t returned in RAX
+ ; return parent fcontext_t
+ mov [rax], r9
+ ; return data
+ mov [rax+08h], r8
+
+ ; transport_t as 1.arg of context-function
+ mov rcx, rax
+
+ ; indirect jump to context
+ jmp r10
+jump_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.masm
new file mode 100644
index 0000000000..c8a28a558e
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/jump_x86_64_ms_pe_masm.masm
@@ -0,0 +1,205 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+.code
+
+jump_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ .endprolog
+
+ ; prepare stack
+ lea rsp, [rsp-0118h]
+
+IFNDEF BOOST_USE_TSX
+ ; save XMM storage
+ movaps [rsp], xmm6
+ movaps [rsp+010h], xmm7
+ movaps [rsp+020h], xmm8
+ movaps [rsp+030h], xmm9
+ movaps [rsp+040h], xmm10
+ movaps [rsp+050h], xmm11
+ movaps [rsp+060h], xmm12
+ movaps [rsp+070h], xmm13
+ movaps [rsp+080h], xmm14
+ movaps [rsp+090h], xmm15
+ ; save MMX control- and status-word
+ stmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fnstcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; save fiber local storage
+ mov rax, [r10+020h]
+ mov [rsp+0b0h], rax
+ ; save current deallocation stack
+ mov rax, [r10+01478h]
+ mov [rsp+0b8h], rax
+ ; save current stack limit
+ mov rax, [r10+010h]
+ mov [rsp+0c0h], rax
+ ; save current stack base
+ mov rax, [r10+08h]
+ mov [rsp+0c8h], rax
+
+ mov [rsp+0d0h], r12 ; save R12
+ mov [rsp+0d8h], r13 ; save R13
+ mov [rsp+0e0h], r14 ; save R14
+ mov [rsp+0e8h], r15 ; save R15
+ mov [rsp+0f0h], rdi ; save RDI
+ mov [rsp+0f8h], rsi ; save RSI
+ mov [rsp+0100h], rbx ; save RBX
+ mov [rsp+0108h], rbp ; save RBP
+
+ mov [rsp+0110h], rcx ; save hidden address of transport_t
+
+ ; preserve RSP (pointing to context-data) in R9
+ mov r9, rsp
+
+ ; restore RSP (pointing to context-data) from RDX
+ mov rsp, rdx
+
+IFNDEF BOOST_USE_TSX
+ ; restore XMM storage
+ movaps xmm6, [rsp]
+ movaps xmm7, [rsp+010h]
+ movaps xmm8, [rsp+020h]
+ movaps xmm9, [rsp+030h]
+ movaps xmm10, [rsp+040h]
+ movaps xmm11, [rsp+050h]
+ movaps xmm12, [rsp+060h]
+ movaps xmm13, [rsp+070h]
+ movaps xmm14, [rsp+080h]
+ movaps xmm15, [rsp+090h]
+ ; restore MMX control- and status-word
+ ldmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fldcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; restore fiber local storage
+ mov rax, [rsp+0b0h]
+ mov [r10+020h], rax
+ ; restore current deallocation stack
+ mov rax, [rsp+0b8h]
+ mov [r10+01478h], rax
+ ; restore current stack limit
+ mov rax, [rsp+0c0h]
+ mov [r10+010h], rax
+ ; restore current stack base
+ mov rax, [rsp+0c8h]
+ mov [r10+08h], rax
+
+ mov r12, [rsp+0d0h] ; restore R12
+ mov r13, [rsp+0d8h] ; restore R13
+ mov r14, [rsp+0e0h] ; restore R14
+ mov r15, [rsp+0e8h] ; restore R15
+ mov rdi, [rsp+0f0h] ; restore RDI
+ mov rsi, [rsp+0f8h] ; restore RSI
+ mov rbx, [rsp+0100h] ; restore RBX
+ mov rbp, [rsp+0108h] ; restore RBP
+
+ mov rax, [rsp+0110h] ; restore hidden address of transport_t
+
+ ; prepare stack
+ lea rsp, [rsp+0118h]
+
+ ; load return-address
+ pop r10
+
+ ; transport_t returned in RAX
+ ; return parent fcontext_t
+ mov [rax], r9
+ ; return data
+ mov [rax+08h], r8
+
+ ; transport_t as 1.arg of context-function
+ mov rcx, rax
+
+ ; indirect jump to context
+ jmp r10
+jump_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
new file mode 100644
index 0000000000..c1fa84387d
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_elf_gas.S
@@ -0,0 +1,84 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.align 2
+.global make_fcontext
+.type make_fcontext, %function
+make_fcontext:
+ # shift address in x0 (allocated stack) to lower 16 byte boundary
+ and x0, x0, ~0xF
+
+ # reserve space for context-data on context-stack
+ sub x0, x0, #0xb0
+
+ # third arg of make_fcontext() == address of context-function
+ # store address as a PC to jump in
+ str x2, [x0, #0xa0]
+
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns (LR register)
+ adr x1, finish
+ str x1, [x0, #0x98]
+
+ ret x30 // return pointer to context-data (x0)
+
+finish:
+ # exit code is zero
+ mov x0, #0
+ # exit application
+ bl _exit
+
+.size make_fcontext,.-make_fcontext
+# Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_macho_gas.S
new file mode 100644
index 0000000000..a3716ff085
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm64_aapcs_macho_gas.S
@@ -0,0 +1,88 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _make_fcontext
+.balign 16
+
+_make_fcontext:
+ ; shift address in x0 (allocated stack) to lower 16 byte boundary
+ and x0, x0, ~0xF
+
+ ; reserve space for context-data on context-stack
+ sub x0, x0, #0xb0
+
+ ; third arg of make_fcontext() == address of context-function
+ ; store address as a PC to jump in
+ str x2, [x0, #0xa0]
+
+ ; compute abs address of label finish
+ ; 0x0c = 3 instructions * size (4) before label 'finish'
+
+ ; TODO: Numeric offset since llvm still does not support labels in ADR. Fix:
+ ; http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140407/212336.html
+ adr x1, 0x0c
+
+ ; save address of finish as return-address for context-function
+ ; will be entered after context-function returns (LR register)
+ str x1, [x0, #0x98]
+
+ ret lr ; return pointer to context-data (x0)
+
+finish:
+ ; exit code is zero
+ mov x0, #0
+ ; exit application
+ bl __exit
+
+
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_elf_gas.S
new file mode 100644
index 0000000000..98819a2a5f
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_elf_gas.S
@@ -0,0 +1,79 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl make_fcontext
+.align 2
+.type make_fcontext,%function
+make_fcontext:
+ @ shift address in A1 to lower 16 byte boundary
+ bic a1, a1, #15
+
+ @ reserve space for context-data on context-stack
+ sub a1, a1, #124
+
+ @ third arg of make_fcontext() == address of context-function
+ str a3, [a1, #104]
+
+ @ compute address of returned transfer_t
+ add a2, a1, #108
+ mov a3, a2
+ str a3, [a1, #64]
+
+ @ compute abs address of label finish
+ adr a2, finish
+ @ save address of finish as return-address for context-function
+ @ will be entered after context-function returns
+ str a2, [a1, #100]
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+#endif
+
+ bx lr @ return pointer to context-data
+
+finish:
+ @ exit code is zero
+ mov a1, #0
+ @ exit application
+ bl _exit@PLT
+.size make_fcontext,.-make_fcontext
+
+@ Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_macho_gas.S
new file mode 100644
index 0000000000..c909ae9d43
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_macho_gas.S
@@ -0,0 +1,71 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | v7 | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _make_fcontext
+.align 2
+_make_fcontext:
+ @ shift address in A1 to lower 16 byte boundary
+ bic a1, a1, #15
+
+ @ reserve space for context-data on context-stack
+ sub a1, a1, #124
+
+ @ third arg of make_fcontext() == address of context-function
+ str a3, [a1, #108]
+
+ @ compute address of returned transfer_t
+ add a2, a1, #112
+ mov a3, a2
+ str a3, [a1, #68]
+
+ @ compute abs address of label finish
+ adr a2, finish
+ @ save address of finish as return-address for context-function
+ @ will be entered after context-function returns
+ str a2, [a1, #104]
+
+ bx lr @ return pointer to context-data
+
+finish:
+ @ exit code is zero
+ mov a1, #0
+ @ exit application
+ bl __exit
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.asm b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.asm
new file mode 100644
index 0000000000..27cbfb0825
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.asm
@@ -0,0 +1,77 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT make_fcontext
+ IMPORT _exit
+
+make_fcontext PROC
+ ; first arg of make_fcontext() == top of context-stack
+ ; save top of context-stack (base) A4
+ mov a4, a1
+
+ ; shift address in A1 to lower 16 byte boundary
+ bic a1, a1, #0x0f
+
+ ; reserve space for context-data on context-stack
+ sub a1, a1, #0x48
+
+ ; save top address of context_stack as 'base'
+ str a4, [a1, #0x8]
+ ; second arg of make_fcontext() == size of context-stack
+ ; compute bottom address of context-stack (limit)
+ sub a4, a4, a2
+ ; save bottom address of context-stack as 'limit'
+ str a4, [a1, #0x4]
+ ; save bottom address of context-stack as 'dealloction stack'
+ str a4, [a1, #0x0]
+
+ ; third arg of make_fcontext() == address of context-function
+ str a3, [a1, #0x34]
+
+ ; compute address of returned transfer_t
+ add a2, a1, #0x38
+ mov a3, a2
+ str a3, [a1, #0xc]
+
+ ; compute abs address of label finish
+ adr a2, finish
+ ; save address of finish as return-address for context-function
+ ; will be entered after context-function returns
+ str a2, [a1, #0x30]
+
+ bx lr ; return pointer to context-data
+
+finish
+ ; exit code is zero
+ mov a1, #0
+ ; exit application
+ bl _exit
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.masm b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.masm
new file mode 100644
index 0000000000..27cbfb0825
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_arm_aapcs_pe_armasm.masm
@@ -0,0 +1,77 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT make_fcontext
+ IMPORT _exit
+
+make_fcontext PROC
+ ; first arg of make_fcontext() == top of context-stack
+ ; save top of context-stack (base) A4
+ mov a4, a1
+
+ ; shift address in A1 to lower 16 byte boundary
+ bic a1, a1, #0x0f
+
+ ; reserve space for context-data on context-stack
+ sub a1, a1, #0x48
+
+ ; save top address of context_stack as 'base'
+ str a4, [a1, #0x8]
+ ; second arg of make_fcontext() == size of context-stack
+ ; compute bottom address of context-stack (limit)
+ sub a4, a4, a2
+ ; save bottom address of context-stack as 'limit'
+ str a4, [a1, #0x4]
+ ; save bottom address of context-stack as 'dealloction stack'
+ str a4, [a1, #0x0]
+
+ ; third arg of make_fcontext() == address of context-function
+ str a3, [a1, #0x34]
+
+ ; compute address of returned transfer_t
+ add a2, a1, #0x38
+ mov a3, a2
+ str a3, [a1, #0xc]
+
+ ; compute abs address of label finish
+ adr a2, finish
+ ; save address of finish as return-address for context-function
+ ; will be entered after context-function returns
+ str a2, [a1, #0x30]
+
+ bx lr ; return pointer to context-data
+
+finish
+ ; exit code is zero
+ mov a1, #0
+ ; exit application
+ bl _exit
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_combined_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_combined_sysv_macho_gas.S
new file mode 100644
index 0000000000..727e9045fc
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_combined_sysv_macho_gas.S
@@ -0,0 +1,20 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "make_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "make_x86_64_sysv_macho_gas.S"
+#elif defined(__ppc__)
+ #include "make_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "make_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_gas.asm
new file mode 100644
index 0000000000..dcb77000fa
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_gas.asm
@@ -0,0 +1,147 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* --------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* --------------------------------------------------------------------------------- *
+* | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | *
+* --------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI | *
+* --------------------------------------------------------------------------------- *
+* --------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* --------------------------------------------------------------------------------- *
+* | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
+* --------------------------------------------------------------------------------- *
+* | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR| *
+* --------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "make_i386_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl _make_fcontext
+.def _make_fcontext; .scl 2; .type 32; .endef
+_make_fcontext:
+ /* first arg of make_fcontext() == top of context-stack */
+ movl 0x04(%esp), %eax
+
+ /* reserve space for first argument of context-function */
+ /* EAX might already point to a 16byte border */
+ leal -0x8(%eax), %eax
+
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+ /* reserve space for context-data on context-stack */
+ /* size for fc_mxcsr .. EIP + return-address for context-function */
+ /* on context-function entry: (ESP -0x4) % 8 == 0 */
+ /* additional space is required for SEH */
+ leal -0x40(%eax), %eax
+
+ /* save MMX control- and status-word */
+ stmxcsr (%eax)
+ /* save x87 control-word */
+ fnstcw 0x4(%eax)
+
+ /* first arg of make_fcontext() == top of context-stack */
+ movl 0x4(%esp), %ecx
+ /* save top address of context stack as 'base' */
+ movl %ecx, 0x14(%eax)
+ /* second arg of make_fcontext() == size of context-stack */
+ movl 0x8(%esp), %edx
+ /* negate stack size for LEA instruction (== substraction) */
+ negl %edx
+ /* compute bottom address of context stack (limit) */
+ leal (%ecx,%edx), %ecx
+ /* save bottom address of context-stack as 'limit' */
+ movl %ecx, 0x10(%eax)
+ /* save bottom address of context-stack as 'dealloction stack' */
+ movl %ecx, 0xc(%eax)
+ /* set fiber-storage to zero */
+ xorl %ecx, %ecx
+ movl %ecx, 0x8(%eax)
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */
+ movl 0xc(%esp), %ecx
+ movl %ecx, 0x24(%eax)
+
+ /* compute abs address of label trampoline */
+ movl $trampoline, %ecx
+ /* save address of trampoline as return-address for context-function */
+ /* will be entered after calling jump_fcontext() first time */
+ movl %ecx, 0x2c(%eax)
+
+ /* compute abs address of label finish */
+ movl $finish, %ecx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after context-function returns */
+ movl %ecx, 0x28(%eax)
+
+ /* traverse current seh chain to get the last exception handler installed by Windows */
+ /* note that on Windows Server 2008 and 2008 R2, SEHOP is activated by default */
+ /* the exception handler chain is tested for the presence of ntdll.dll!FinalExceptionHandler */
+ /* at its end by RaiseException all seh andlers are disregarded if not present and the */
+ /* program is aborted */
+ /* load NT_TIB into ECX */
+ movl %fs:(0x0), %ecx
+
+walk:
+ /* load 'next' member of current SEH into EDX */
+ movl (%ecx), %edx
+ /* test if 'next' of current SEH is last (== 0xffffffff) */
+ incl %edx
+ jz found
+ decl %edx
+ /* exchange content; ECX contains address of next SEH */
+ xchgl %ecx, %edx
+ /* inspect next SEH */
+ jmp walk
+
+found:
+ /* load 'handler' member of SEH == address of last SEH handler installed by Windows */
+ movl 0x04(%ecx), %ecx
+ /* save address in ECX as SEH handler for context */
+ movl %ecx, 0x3c(%eax)
+ /* set ECX to -1 */
+ movl $0xffffffff, %ecx
+ /* save ECX as next SEH item */
+ movl %ecx, 0x38(%eax)
+ /* load address of next SEH item */
+ leal 0x38(%eax), %ecx
+ /* save next SEH */
+ movl %ecx, 0x18(%eax)
+
+ /* return pointer to context-data */
+ ret
+
+trampoline:
+ /* move transport_t for entering context-function */
+ /* FCTX == EAX, DATA == EDX */
+ movl %eax, (%esp)
+ movl %edx, 0x4(%esp)
+ /* label finish as return-address */
+ pushl %ebp
+ /* jump to context-function */
+ jmp *%ebx
+
+finish:
+ /* ESP points to same address as ESP on entry of context function + 0x4 */
+ xorl %eax, %eax
+ /* exit code is zero */
+ movl %eax, (%esp)
+ /* exit application */
+ call __exit
+ hlt
+
+.def __exit; .scl 2; .type 32; .endef /* standard C library function */
+
+.section .drectve
+.ascii " -export:\"make_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.asm
new file mode 100644
index 0000000000..5246465cb9
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.asm
@@ -0,0 +1,140 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+; standard C library function
+_exit PROTO, value:SDWORD
+.code
+
+make_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; first arg of make_fcontext() == top of context-stack
+ mov eax, [esp+04h]
+
+ ; reserve space for first argument of context-function
+ ; EAX might already point to a 16byte border
+ lea eax, [eax-08h]
+
+ ; shift address in EAX to lower 16 byte boundary
+ and eax, -16
+
+ ; reserve space for context-data on context-stack
+ ; on context-function entry: (ESP -0x4) % 8 == 0
+ ; additional space is required for SEH
+ lea eax, [eax-040h]
+
+ ; save MMX control- and status-word
+ stmxcsr [eax]
+ ; save x87 control-word
+ fnstcw [eax+04h]
+
+ ; first arg of make_fcontext() == top of context-stack
+ mov ecx, [esp+04h]
+ ; save top address of context stack as 'base'
+ mov [eax+014h], ecx
+ ; second arg of make_fcontext() == size of context-stack
+ mov edx, [esp+08h]
+ ; negate stack size for LEA instruction (== substraction)
+ neg edx
+ ; compute bottom address of context stack (limit)
+ lea ecx, [ecx+edx]
+ ; save bottom address of context-stack as 'limit'
+ mov [eax+010h], ecx
+ ; save bottom address of context-stack as 'dealloction stack'
+ mov [eax+0ch], ecx
+ ; set fiber-storage to zero
+ xor ecx, ecx
+ mov [eax+08h], ecx
+
+ ; third arg of make_fcontext() == address of context-function
+ ; stored in EBX
+ mov ecx, [esp+0ch]
+ mov [eax+024h], ecx
+
+ ; compute abs address of label trampoline
+ mov ecx, trampoline
+ ; save address of trampoline as return-address for context-function
+ ; will be entered after calling jump_fcontext() first time
+ mov [eax+02ch], ecx
+
+ ; compute abs address of label finish
+ mov ecx, finish
+ ; save address of finish as return-address for context-function in EBP
+ ; will be entered after context-function returns
+ mov [eax+028h], ecx
+
+ ; traverse current seh chain to get the last exception handler installed by Windows
+ ; note that on Windows Server 2008 and 2008 R2, SEHOP is activated by default
+ ; the exception handler chain is tested for the presence of ntdll.dll!FinalExceptionHandler
+ ; at its end by RaiseException all seh-handlers are disregarded if not present and the
+ ; program is aborted
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov ecx, fs:[0h]
+ assume fs:error
+
+walk:
+ ; load 'next' member of current SEH into EDX
+ mov edx, [ecx]
+ ; test if 'next' of current SEH is last (== 0xffffffff)
+ inc edx
+ jz found
+ dec edx
+ ; exchange content; ECX contains address of next SEH
+ xchg edx, ecx
+ ; inspect next SEH
+ jmp walk
+
+found:
+ ; load 'handler' member of SEH == address of last SEH handler installed by Windows
+ mov ecx, [ecx+04h]
+ ; save address in ECX as SEH handler for context
+ mov [eax+03ch], ecx
+ ; set ECX to -1
+ mov ecx, 0ffffffffh
+ ; save ECX as next SEH item
+ mov [eax+038h], ecx
+ ; load address of next SEH item
+ lea ecx, [eax+038h]
+ ; save next SEH
+ mov [eax+018h], ecx
+
+ ret ; return pointer to context-data
+
+trampoline:
+ ; move transport_t for entering context-function
+ ; FCTX == EAX, DATA == EDX
+ mov [esp], eax
+ mov [esp+04h], edx
+ push ebp
+ ; jump to context-function
+ jmp ebx
+
+finish:
+ ; exit code is zero
+ xor eax, eax
+ mov [esp], eax
+ ; exit application
+ call _exit
+ hlt
+make_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.masm
new file mode 100644
index 0000000000..5246465cb9
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_ms_pe_masm.masm
@@ -0,0 +1,140 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+; standard C library function
+_exit PROTO, value:SDWORD
+.code
+
+make_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; first arg of make_fcontext() == top of context-stack
+ mov eax, [esp+04h]
+
+ ; reserve space for first argument of context-function
+ ; EAX might already point to a 16byte border
+ lea eax, [eax-08h]
+
+ ; shift address in EAX to lower 16 byte boundary
+ and eax, -16
+
+ ; reserve space for context-data on context-stack
+ ; on context-function entry: (ESP -0x4) % 8 == 0
+ ; additional space is required for SEH
+ lea eax, [eax-040h]
+
+ ; save MMX control- and status-word
+ stmxcsr [eax]
+ ; save x87 control-word
+ fnstcw [eax+04h]
+
+ ; first arg of make_fcontext() == top of context-stack
+ mov ecx, [esp+04h]
+ ; save top address of context stack as 'base'
+ mov [eax+014h], ecx
+ ; second arg of make_fcontext() == size of context-stack
+ mov edx, [esp+08h]
+ ; negate stack size for LEA instruction (== substraction)
+ neg edx
+ ; compute bottom address of context stack (limit)
+ lea ecx, [ecx+edx]
+ ; save bottom address of context-stack as 'limit'
+ mov [eax+010h], ecx
+ ; save bottom address of context-stack as 'dealloction stack'
+ mov [eax+0ch], ecx
+ ; set fiber-storage to zero
+ xor ecx, ecx
+ mov [eax+08h], ecx
+
+ ; third arg of make_fcontext() == address of context-function
+ ; stored in EBX
+ mov ecx, [esp+0ch]
+ mov [eax+024h], ecx
+
+ ; compute abs address of label trampoline
+ mov ecx, trampoline
+ ; save address of trampoline as return-address for context-function
+ ; will be entered after calling jump_fcontext() first time
+ mov [eax+02ch], ecx
+
+ ; compute abs address of label finish
+ mov ecx, finish
+ ; save address of finish as return-address for context-function in EBP
+ ; will be entered after context-function returns
+ mov [eax+028h], ecx
+
+ ; traverse current seh chain to get the last exception handler installed by Windows
+ ; note that on Windows Server 2008 and 2008 R2, SEHOP is activated by default
+ ; the exception handler chain is tested for the presence of ntdll.dll!FinalExceptionHandler
+ ; at its end by RaiseException all seh-handlers are disregarded if not present and the
+ ; program is aborted
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov ecx, fs:[0h]
+ assume fs:error
+
+walk:
+ ; load 'next' member of current SEH into EDX
+ mov edx, [ecx]
+ ; test if 'next' of current SEH is last (== 0xffffffff)
+ inc edx
+ jz found
+ dec edx
+ ; exchange content; ECX contains address of next SEH
+ xchg edx, ecx
+ ; inspect next SEH
+ jmp walk
+
+found:
+ ; load 'handler' member of SEH == address of last SEH handler installed by Windows
+ mov ecx, [ecx+04h]
+ ; save address in ECX as SEH handler for context
+ mov [eax+03ch], ecx
+ ; set ECX to -1
+ mov ecx, 0ffffffffh
+ ; save ECX as next SEH item
+ mov [eax+038h], ecx
+ ; load address of next SEH item
+ lea ecx, [eax+038h]
+ ; save next SEH
+ mov [eax+018h], ecx
+
+ ret ; return pointer to context-data
+
+trampoline:
+ ; move transport_t for entering context-function
+ ; FCTX == EAX, DATA == EDX
+ mov [esp], eax
+ mov [esp+04h], edx
+ push ebp
+ ; jump to context-function
+ jmp ebx
+
+finish:
+ ; exit code is zero
+ xor eax, eax
+ mov [esp], eax
+ ; exit application
+ call _exit
+ hlt
+make_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_elf_gas.S
new file mode 100644
index 0000000000..3ad353cfa2
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_elf_gas.S
@@ -0,0 +1,112 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| guard | EDI | ESI | EBX | EBP | EIP | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | 0x24 | 0x28 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | hidden | to | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl make_fcontext
+.align 2
+.type make_fcontext,@function
+make_fcontext:
+ /* first arg of make_fcontext() == top of context-stack */
+ movl 0x4(%esp), %eax
+
+ /* reserve space for first argument of context-function
+ eax might already point to a 16byte border */
+ leal -0x8(%eax), %eax
+
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+ /* reserve space for context-data on context-stack */
+ leal -0x2c(%eax), %eax
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */
+ movl 0xc(%esp), %ecx
+ movl %ecx, 0x14(%eax)
+
+ /* save MMX control- and status-word */
+ stmxcsr (%eax)
+ /* save x87 control-word */
+ fnstcw 0x4(%eax)
+
+#if defined(TLS_STACK_PROTECTOR)
+ /* save stack guard */
+ movl %gs:0x14, %ecx /* read stack guard from TLS record */
+ movl %ecx, 0x8(%eax) /* save stack guard */
+#endif
+
+ /* return transport_t */
+ /* FCTX == EDI, DATA == ESI */
+ leal 0xc(%eax), %ecx
+ movl %ecx, 0x20(%eax)
+
+ /* compute abs address of label trampoline */
+ call 1f
+ /* address of trampoline 1 */
+1: popl %ecx
+ /* compute abs address of label trampoline */
+ addl $trampoline-1b, %ecx
+ /* save address of trampoline as return address */
+ /* will be entered after calling jump_fcontext() first time */
+ movl %ecx, 0x1c(%eax)
+
+ /* compute abs address of label finish */
+ call 2f
+ /* address of label 2 */
+2: popl %ecx
+ /* compute abs address of label finish */
+ addl $finish-2b, %ecx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after context-function returns */
+ movl %ecx, 0x18(%eax)
+
+ ret /* return pointer to context-data */
+
+trampoline:
+ /* move transport_t for entering context-function */
+ movl %edi, (%esp)
+ movl %esi, 0x4(%esp)
+ pushl %ebp
+ /* jump to context-function */
+ jmp *%ebx
+
+finish:
+ call 3f
+ /* address of label 3 */
+3: popl %ebx
+ /* compute address of GOT and store it in EBX */
+ addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %ebx
+
+ /* exit code is zero */
+ xorl %eax, %eax
+ movl %eax, (%esp)
+ /* exit application */
+ call _exit@PLT
+ hlt
+.size make_fcontext,.-make_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_macho_gas.S
new file mode 100644
index 0000000000..fdcdb7c80f
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_sysv_macho_gas.S
@@ -0,0 +1,90 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | to | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl _make_fcontext
+.align 2
+_make_fcontext:
+ /* first arg of make_fcontext() == top of context-stack */
+ movl 0x4(%esp), %eax
+
+ /* reserve space for first argument of context-function
+ eax might already point to a 16byte border */
+ leal -0x8(%eax), %eax
+
+ /* shift address in EAX to lower 16 byte boundary */
+ andl $-16, %eax
+
+ /* reserve space for context-data on context-stack */
+ leal -0x2c(%eax), %eax
+
+ /* third arg of make_fcontext() == address of context-function */
+ /* stored in EBX */
+ movl 0xc(%esp), %ecx
+ movl %ecx, 0x10(%eax)
+
+ /* save MMX control- and status-word */
+ stmxcsr (%eax)
+ /* save x87 control-word */
+ fnstcw 0x4(%eax)
+
+ /* compute abs address of label trampoline */
+ call 1f
+ /* address of trampoline 1 */
+1: popl %ecx
+ /* compute abs address of label trampoline */
+ addl $trampoline-1b, %ecx
+ /* save address of trampoline as return address */
+ /* will be entered after calling jump_fcontext() first time */
+ movl %ecx, 0x18(%eax)
+
+ /* compute abs address of label finish */
+ call 2f
+ /* address of label 2 */
+2: popl %ecx
+ /* compute abs address of label finish */
+ addl $finish-2b, %ecx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after context-function returns */
+ movl %ecx, 0x14(%eax)
+
+ ret /* return pointer to context-data */
+
+trampoline:
+ /* move transport_t for entering context-function */
+ movl %eax, (%esp)
+ movl %edx, 0x4(%esp)
+ pushl %ebp
+ /* jump to context-function */
+ jmp *%ebx
+
+finish:
+ /* exit code is zero */
+ xorl %eax, %eax
+ movl %eax, (%esp)
+ /* exit application */
+ call __exit
+ hlt
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
new file mode 100644
index 0000000000..e364b2db62
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "make_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "make_x86_64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_mips32_o32_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_mips32_o32_elf_gas.S
new file mode 100644
index 0000000000..ff4e78488d
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_mips32_o32_elf_gas.S
@@ -0,0 +1,96 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F20 | F22 | F24 | F26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F28 | F30 | S0 | S1 | S2 | S3 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | ABI ARGS | GP | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ * *****************************************************/
+
+.text
+.globl make_fcontext
+.align 2
+.type make_fcontext,@function
+.ent make_fcontext
+make_fcontext:
+#ifdef __PIC__
+.set noreorder
+.cpload $t9
+.set reorder
+#endif
+ # shift address in A0 to lower 16 byte boundary
+ li $v1, -16 # 0xfffffffffffffff0
+ and $v0, $v1, $a0
+
+ # reserve space for context-data on context-stack
+ # includes an extra 32 bytes for:
+ # - 16-byte incoming argument area required by mips ABI used when
+ # jump_context calls the initial function
+ # - 4 bytes to save our GP register used in finish
+ # - 8 bytes to as space for transfer_t returned to finish
+ # - 4 bytes for alignment
+ addiu $v0, $v0, -128
+
+ # third arg of make_fcontext() == address of context-function
+ sw $a2, 92($v0)
+ # save global pointer in context-data
+ sw $gp, 112($v0)
+
+ # compute address of returned transfer_t
+ addiu $t0, $v0, 116
+ sw $t0, 84($v0)
+
+ # compute abs address of label finish
+ la $t9, finish
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ sw $t9, 88($v0)
+
+ jr $ra # return pointer to context-data
+
+finish:
+ # reload our gp register (needed for la)
+ lw $gp, 16($sp)
+
+ # call _exit(0)
+ # the previous function should have left the 16 bytes incoming argument
+ # area on the stack which we reuse for calling _exit
+ la $t9, _exit
+ move $a0, $zero
+ jr $t9
+.end make_fcontext
+.size make_fcontext, .-make_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc32_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..52e7220933
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_ppc64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__ppc__)
+ #include "make_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "make_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
new file mode 100644
index 0000000000..d009036367
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_elf_gas.S
@@ -0,0 +1,142 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl make_fcontext
+.align 2
+.type make_fcontext,@function
+make_fcontext:
+ # save return address into R6
+ mflr %r6
+
+ # first arg of make_fcontext() == top address of context-function
+ # shift address in R3 to lower 16 byte boundary
+ clrrwi %r3, %r3, 4
+
+ # reserve space for context-data on context-stack
+ # including 64 byte of linkage + parameter area (R1 % 16 == 0)
+ subi %r3, %r3, 336
+
+ # third arg of make_fcontext() == address of context-function
+ stw %r5, 240(%r3)
+
+ # set back-chain to zero
+ li %r0, 0
+ stw %r0, 244(%r3)
+
+ mffs %f0 # load FPSCR
+ stfd %f0, 144(%r3) # save FPSCR
+
+ # compute address of returned transfer_t
+ addi %r0, %r3, 252
+ mr %r4, %r0
+ stw %r4, 228(%r3)
+
+ # load LR
+ mflr %r0
+ # jump to label 1
+ bl 1f
+1:
+ # load LR into R4
+ mflr %r4
+ # compute abs address of label finish
+ addi %r4, %r4, finish - 1b
+ # restore LR
+ mtlr %r0
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ stw %r4, 236(%r3)
+
+ # restore return address from R6
+ mtlr %r6
+
+ blr # return pointer to context-data
+
+finish:
+ # save return address into R0
+ mflr %r0
+ # save return address on stack, set up stack frame
+ stw %r0, 4(%r1)
+ # allocate stack space, R1 % 16 == 0
+ stwu %r1, -16(%r1)
+
+ # exit code is zero
+ li %r3, 0
+ # exit application
+ bl _exit@plt
+.size make_fcontext, .-make_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_macho_gas.S
new file mode 100644
index 0000000000..8f35eff9ab
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_macho_gas.S
@@ -0,0 +1,137 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _make_fcontext
+.align 2
+_make_fcontext:
+ # save return address into R6
+ mflr r6
+
+ # first arg of make_fcontext() == top address of context-function
+ # shift address in R3 to lower 16 byte boundary
+ clrrwi r3, r3, 4
+
+ # reserve space for context-data on context-stack
+ # including 64 byte of linkage + parameter area (R1 16 == 0)
+ subi r3, r3, 336
+
+ # third arg of make_fcontext() == address of context-function
+ stw r5, 240(r3)
+
+ # set back-chain to zero
+ li r0, 0
+ stw r0, 244(r3)
+
+ mffs f0 # load FPSCR
+ stfd f0, 144(r3) # save FPSCR
+
+ # compute address of returned transfer_t
+ addi r0, r3, 252
+ mr r4, r0
+ stw r4, 228(r3)
+
+ # load LR
+ mflr r0
+ # jump to label 1
+ bl 1f
+1:
+ # load LR into R4
+ mflr r4
+ # compute abs address of label finish
+ addi r4, r4, finish - 1b
+ # restore LR
+ mtlr r0
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ stw r4, 236(r3)
+
+ # restore return address from R6
+ mtlr r6
+
+ blr # return pointer to context-data
+
+finish:
+ # save return address into R0
+ mflr r0
+ # save return address on stack, set up stack frame
+ stw r0, 4(r1)
+ # allocate stack space, R1 16 == 0
+ stwu r1, -16(r1)
+
+ # exit code is zero
+ li r3, 0
+ # exit application
+ bl _exit@plt
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..f257258060
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc32_sysv_xcoff_gas.S
@@ -0,0 +1,138 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+ .globl make_fcontext[DS]
+ .globl .make_fcontext[PR]
+ .align 2
+ .csect make_fcontext[DS]
+make_fcontext:
+ .long .make_fcontext[PR]
+ .csect .make_fcontext[PR], 3
+#.make_fcontext:
+ # save return address into R6
+ mflr 6
+
+ # first arg of make_fcontext() == top address of context-function
+ # shift address in R3 to lower 16 byte boundary
+ clrrwi 3, 3, 4
+
+ # reserve space for context-data on context-stack
+ # including 64 byte of linkage + parameter area (R1 % 16 == 0)
+ subi 3, 3, 336
+
+ # third arg of make_fcontext() == address of context-function
+ stw 5, 240(3)
+
+ # set back-chain to zero
+ li 0, 0
+ stw 0, 244(3)
+
+ # compute address of returned transfer_t
+ addi 0, 3, 252
+ mr 4, 0
+ stw 4, 228(3)
+
+ # load LR
+ mflr 0
+ # jump to label 1
+ bl .Label
+.Label:
+ # load LR into R4
+ mflr 4
+ # compute abs address of label .L_finish
+ addi 4, 4, .L_finish - .Label
+ # restore LR
+ mtlr 0
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ stw 4, 236(3)
+
+ # restore return address from R6
+ mtlr 6
+
+ blr # return pointer to context-data
+
+.L_finish:
+ # save return address into R0
+ mflr 0
+ # save return address on stack, set up stack frame
+ stw 0, 4(1)
+ # allocate stack space, R1 % 16 == 0
+ stwu 1, -16(1)
+
+ # exit code is zero
+ li 3, 0
+ # exit application
+ bl ._exit
+ nop
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
new file mode 100644
index 0000000000..28188dfc8c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_elf_gas.S
@@ -0,0 +1,176 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.globl make_fcontext
+#if _CALL_ELF == 2
+ .text
+ .align 2
+make_fcontext:
+ addis %r2, %r12, .TOC.-make_fcontext@ha
+ addi %r2, %r2, .TOC.-make_fcontext@l
+ .localentry make_fcontext, . - make_fcontext
+#else
+ .section ".opd","aw"
+ .align 3
+make_fcontext:
+# ifdef _CALL_LINUX
+ .quad .L.make_fcontext,.TOC.@tocbase,0
+ .type make_fcontext,@function
+ .text
+ .align 2
+.L.make_fcontext:
+# else
+ .hidden .make_fcontext
+ .globl .make_fcontext
+ .quad .make_fcontext,.TOC.@tocbase,0
+ .size make_fcontext,24
+ .type .make_fcontext,@function
+ .text
+ .align 2
+.make_fcontext:
+# endif
+#endif
+ # save return address into R6
+ mflr %r6
+
+ # first arg of make_fcontext() == top address of context-stack
+ # shift address in R3 to lower 16 byte boundary
+ clrrdi %r3, %r3, 4
+
+ # reserve space for context-data on context-stack
+ # including 64 byte of linkage + parameter area (R1 % 16 == 0)
+ subi %r3, %r3, 248
+
+ # third arg of make_fcontext() == address of context-function
+ # entry point (ELFv2) or descriptor (ELFv1)
+#if _CALL_ELF == 2
+ # save address of context-function entry point
+ std %r5, 176(%r3)
+#else
+ # save address of context-function entry point
+ ld %r4, 0(%r5)
+ std %r4, 176(%r3)
+ # save TOC of context-function
+ ld %r4, 8(%r5)
+ std %r4, 0(%r3)
+#endif
+
+ # set back-chain to zero
+ li %r0, 0
+ std %r0, 184(%r3)
+
+#if _CALL_ELF != 2
+ # zero in r3 indicates first jump to context-function
+ std %r0, 152(%r3)
+#endif
+
+ # load LR
+ mflr %r0
+ # jump to label 1
+ bl 1f
+1:
+ # load LR into R4
+ mflr %r4
+ # compute abs address of label finish
+ addi %r4, %r4, finish - 1b
+ # restore LR
+ mtlr %r0
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ std %r4, 168(%r3)
+
+ # restore return address from R6
+ mtlr %r6
+
+ blr # return pointer to context-data
+
+finish:
+ # save return address into R0
+ mflr %r0
+ # save return address on stack, set up stack frame
+ std %r0, 8(%r1)
+ # allocate stack space, R1 % 16 == 0
+ stdu %r1, -32(%r1)
+
+ # exit code is zero
+ li %r3, 0
+ # exit application
+ bl _exit
+ nop
+#if _CALL_ELF == 2
+ .size make_fcontext, .-make_fcontext
+#else
+# ifdef _CALL_LINUX
+ .size .make_fcontext, .-.L.make_fcontext
+# else
+ .size .make_fcontext, .-.make_fcontext
+# endif
+#endif
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..7b947bb6b0
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_macho_gas.S
@@ -0,0 +1,126 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+
+.text
+.globl _make_fcontext
+_make_fcontext:
+ ; save return address into R6
+ mflr r6
+
+ ; first arg of make_fcontext() == top address of context-function
+ ; shift address in R3 to lower 16 byte boundary
+ clrrwi r3, r3, 4
+
+ ; reserve space for context-data on context-stack
+ ; including 64 byte of linkage + parameter area (R1 16 == 0)
+ subi r3, r3, 248
+
+ ; third arg of make_fcontext() == address of context-function
+ stw r5, 176(r3)
+
+ ; set back-chain to zero
+ li %r0, 0
+ std %r0, 184(%r3)
+
+ ; compute address of returned transfer_t
+ addi %r0, %r3, 232
+ mr %r4, %r0
+ std %r4, 152(%r3)
+
+ ; load LR
+ mflr r0
+ ; jump to label 1
+ bl l1
+l1:
+ ; load LR into R4
+ mflr r4
+ ; compute abs address of label finish
+ addi r4, r4, lo16((finish - .) + 4)
+ ; restore LR
+ mtlr r0
+ ; save address of finish as return-address for context-function
+ ; will be entered after context-function returns
+ std r4, 168(r3)
+
+ ; restore return address from R6
+ mtlr r6
+
+ blr ; return pointer to context-data
+
+finish:
+ ; save return address into R0
+ mflr r0
+ ; save return address on stack, set up stack frame
+ stw r0, 8(r1)
+ ; allocate stack space, R1 16 == 0
+ stwu r1, -32(r1)
+
+ ; set return value to zero
+ li r3, 0
+ ; exit application
+ bl __exit
+ nop
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..b229ab1b36
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_ppc64_sysv_xcoff_gas.S
@@ -0,0 +1,62 @@
+ .globl make_fcontext[DS]
+ .globl .make_fcontext[PR]
+ .align 2
+ .csect .make_fcontext[PR], 3
+ .globl _make_fcontext
+#._make_fcontext:
+ # save return address into R6
+ mflr 6
+
+ # first arg of make_fcontext() == top address of context-function
+ # shift address in R3 to lower 16 byte boundary
+ clrrwi 3, 3, 4
+
+ # reserve space for context-data on context-stack
+ # including 64 byte of linkage + parameter area (R1 % 16 == 0)
+ subi 3, 3, 248
+
+ # third arg of make_fcontext() == address of context-function
+ stw 5, 176(3)
+
+ # set back-chain to zero
+ li 0, 0
+ std 0, 184(3)
+
+ # compute address of returned transfer_t
+ addi 0, 3, 232
+ mr 4, 0
+ std 4, 152(3)
+
+ # load LR
+ mflr 0
+ # jump to label 1
+ bl .Label
+.Label:
+ # load LR into R4
+ mflr 4
+ # compute abs address of label .L_finish
+ addi 4, 4, .L_finish - .Label
+ # restore LR
+ mtlr 0
+ # save address of finish as return-address for context-function
+ # will be entered after context-function returns
+ stw 4, 168(3)
+
+ # restore return address from R6
+ mtlr 6
+
+ blr # return pointer to context-data
+
+.L_finish:
+ # save return address into R0
+ mflr 0
+ # save return address on stack, set up stack frame
+ stw 0, 8(1)
+ # allocate stack space, R1 % 16 == 0
+ stwu 1, -32(1)
+
+ # exit code is zero
+ li 3, 0
+ # exit application
+ bl ._exit
+ nop
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_gas.asm
new file mode 100644
index 0000000000..958a2a7b6d
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_gas.asm
@@ -0,0 +1,174 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* ---------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
+* ---------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
+* ---------------------------------------------------------------------------------- *
+* | limit | base | R12 | R13 | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
+* ---------------------------------------------------------------------------------- *
+* | R14 | R15 | RDI | RSI | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
+* ---------------------------------------------------------------------------------- *
+* | RBX | RBP | hidden | RIP | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
+* ---------------------------------------------------------------------------------- *
+* | parameter area | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
+* ---------------------------------------------------------------------------------- *
+* | FCTX | DATA | | *
+* ---------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "make_x86_64_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl make_fcontext
+.def make_fcontext; .scl 2; .type 32; .endef
+.seh_proc make_fcontext
+make_fcontext:
+.seh_endprologue
+
+ /* first arg of make_fcontext() == top of context-stack */
+ movq %rcx, %rax
+
+ /* shift address in RAX to lower 16 byte boundary */
+ /* == pointer to fcontext_t and address of context stack */
+ andq $-16, %rax
+
+ /* reserve space for context-data on context-stack */
+ /* on context-function entry: (RSP -0x8) % 16 == 0 */
+ leaq -0x150(%rax), %rax
+
+ /* third arg of make_fcontext() == address of context-function */
+ movq %r8, 0x100(%rax)
+
+ /* first arg of make_fcontext() == top of context-stack */
+ /* save top address of context stack as 'base' */
+ movq %rcx, 0xc8(%rax)
+ /* second arg of make_fcontext() == size of context-stack */
+ /* negate stack size for LEA instruction (== substraction) */
+ negq %rdx
+ /* compute bottom address of context stack (limit) */
+ leaq (%rcx,%rdx), %rcx
+ /* save bottom address of context stack as 'limit' */
+ movq %rcx, 0xc0(%rax)
+ /* save address of context stack limit as 'dealloction stack' */
+ movq %rcx, 0xb8(%rax)
+ /* set fiber-storage to zero */
+ xorq %rcx, %rcx
+ movq %rcx, 0xb0(%rax)
+
+ /* save MMX control- and status-word */
+ stmxcsr 0xa0(%rax)
+ /* save x87 control-word */
+ fnstcw 0xa4(%rax)
+
+ /* compute address of transport_t */
+ leaq 0x140(%rax), %rcx
+ /* store address of transport_t in hidden field */
+ movq %rcx, 0x110(%rax)
+
+ /* compute abs address of label trampoline */
+ leaq trampoline(%rip), %rcx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after jump_fcontext() first time */
+ movq %rcx, 0x118(%rax)
+
+ /* compute abs address of label finish */
+ leaq finish(%rip), %rcx
+ /* save address of finish as return-address for context-function */
+ /* will be entered after context-function returns */
+ movq %rcx, 0x108(%rax)
+
+ ret /* return pointer to context-data */
+
+trampoline:
+ /* store return address on stack */
+ /* fix stack alignment */
+ pushq %rbp
+ /* jump to context-function */
+ jmp *%rbx
+
+finish:
+ /* 32byte shadow-space for _exit() */
+ andq $-32, %rsp
+ /* 32byte shadow-space for _exit() are */
+ /* already reserved by make_fcontext() */
+ /* exit code is zero */
+ xorq %rcx, %rcx
+ /* exit application */
+ call _exit
+ hlt
+.seh_endproc
+
+.def _exit; .scl 2; .type 32; .endef /* standard C library function */
+
+.section .drectve
+.ascii " -export:\"make_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.asm
new file mode 100644
index 0000000000..8f6c959a83
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.asm
@@ -0,0 +1,163 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+; standard C library function
+EXTERN _exit:PROC
+.code
+
+; generate function table entry in .pdata and unwind information in
+make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ ; .xdata for a function's structured exception handling unwind behavior
+ .endprolog
+
+ ; first arg of make_fcontext() == top of context-stack
+ mov rax, rcx
+
+ ; shift address in RAX to lower 16 byte boundary
+ ; == pointer to fcontext_t and address of context stack
+ and rax, -16
+
+ ; reserve space for context-data on context-stack
+ ; on context-function entry: (RSP -0x8) % 16 == 0
+ sub rax, 0150h
+
+ ; third arg of make_fcontext() == address of context-function
+ ; stored in RBX
+ mov [rax+0100h], r8
+
+ ; first arg of make_fcontext() == top of context-stack
+ ; save top address of context stack as 'base'
+ mov [rax+0c8h], rcx
+ ; second arg of make_fcontext() == size of context-stack
+ ; negate stack size for LEA instruction (== substraction)
+ neg rdx
+ ; compute bottom address of context stack (limit)
+ lea rcx, [rcx+rdx]
+ ; save bottom address of context stack as 'limit'
+ mov [rax+0c0h], rcx
+ ; save address of context stack limit as 'dealloction stack'
+ mov [rax+0b8h], rcx
+ ; set fiber-storage to zero
+ xor rcx, rcx
+ mov [rax+0b0h], rcx
+
+ ; save MMX control- and status-word
+ stmxcsr [rax+0a0h]
+ ; save x87 control-word
+ fnstcw [rax+0a4h]
+
+ ; compute address of transport_t
+ lea rcx, [rax+0140h]
+ ; store address of transport_t in hidden field
+ mov [rax+0110h], rcx
+
+ ; compute abs address of label trampoline
+ lea rcx, trampoline
+ ; save address of trampoline as return-address for context-function
+ ; will be entered after calling jump_fcontext() first time
+ mov [rax+0118h], rcx
+
+ ; compute abs address of label finish
+ lea rcx, finish
+ ; save address of finish as return-address for context-function in RBP
+ ; will be entered after context-function returns
+ mov [rax+0108h], rcx
+
+ ret ; return pointer to context-data
+
+trampoline:
+ ; store return address on stack
+ ; fix stack alignment
+ push rbp
+ ; jump to context-function
+ jmp rbx
+
+finish:
+ ; exit code is zero
+ xor rcx, rcx
+ ; exit application
+ call _exit
+ hlt
+make_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.masm
new file mode 100644
index 0000000000..8f6c959a83
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/make_x86_64_ms_pe_masm.masm
@@ -0,0 +1,163 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+; standard C library function
+EXTERN _exit:PROC
+.code
+
+; generate function table entry in .pdata and unwind information in
+make_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ ; .xdata for a function's structured exception handling unwind behavior
+ .endprolog
+
+ ; first arg of make_fcontext() == top of context-stack
+ mov rax, rcx
+
+ ; shift address in RAX to lower 16 byte boundary
+ ; == pointer to fcontext_t and address of context stack
+ and rax, -16
+
+ ; reserve space for context-data on context-stack
+ ; on context-function entry: (RSP -0x8) % 16 == 0
+ sub rax, 0150h
+
+ ; third arg of make_fcontext() == address of context-function
+ ; stored in RBX
+ mov [rax+0100h], r8
+
+ ; first arg of make_fcontext() == top of context-stack
+ ; save top address of context stack as 'base'
+ mov [rax+0c8h], rcx
+ ; second arg of make_fcontext() == size of context-stack
+ ; negate stack size for LEA instruction (== substraction)
+ neg rdx
+ ; compute bottom address of context stack (limit)
+ lea rcx, [rcx+rdx]
+ ; save bottom address of context stack as 'limit'
+ mov [rax+0c0h], rcx
+ ; save address of context stack limit as 'dealloction stack'
+ mov [rax+0b8h], rcx
+ ; set fiber-storage to zero
+ xor rcx, rcx
+ mov [rax+0b0h], rcx
+
+ ; save MMX control- and status-word
+ stmxcsr [rax+0a0h]
+ ; save x87 control-word
+ fnstcw [rax+0a4h]
+
+ ; compute address of transport_t
+ lea rcx, [rax+0140h]
+ ; store address of transport_t in hidden field
+ mov [rax+0110h], rcx
+
+ ; compute abs address of label trampoline
+ lea rcx, trampoline
+ ; save address of trampoline as return-address for context-function
+ ; will be entered after calling jump_fcontext() first time
+ mov [rax+0118h], rcx
+
+ ; compute abs address of label finish
+ lea rcx, finish
+ ; save address of finish as return-address for context-function in RBP
+ ; will be entered after context-function returns
+ mov [rax+0108h], rcx
+
+ ret ; return pointer to context-data
+
+trampoline:
+ ; store return address on stack
+ ; fix stack alignment
+ push rbp
+ ; jump to context-function
+ jmp rbx
+
+finish:
+ ; exit code is zero
+ xor rcx, rcx
+ ; exit application
+ call _exit
+ hlt
+make_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
new file mode 100644
index 0000000000..02a3b07fde
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_elf_gas.S
@@ -0,0 +1,112 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.align 2
+.global ontop_fcontext
+.type ontop_fcontext, %function
+ontop_fcontext:
+ # prepare stack for GP + FPU
+ sub sp, sp, #0xb0
+
+ # save d8 - d15
+ stp d8, d9, [sp, #0x00]
+ stp d10, d11, [sp, #0x10]
+ stp d12, d13, [sp, #0x20]
+ stp d14, d15, [sp, #0x30]
+
+ # save x19-x30
+ stp x19, x20, [sp, #0x40]
+ stp x21, x22, [sp, #0x50]
+ stp x23, x24, [sp, #0x60]
+ stp x25, x26, [sp, #0x70]
+ stp x27, x28, [sp, #0x80]
+ stp x29, x30, [sp, #0x90]
+
+ # save LR as PC
+ str x30, [sp, #0xa0]
+
+ # store RSP (pointing to context-data) in X5
+ mov x4, sp
+
+ # restore RSP (pointing to context-data) from X1
+ mov sp, x0
+
+ # load d8 - d15
+ ldp d8, d9, [sp, #0x00]
+ ldp d10, d11, [sp, #0x10]
+ ldp d12, d13, [sp, #0x20]
+ ldp d14, d15, [sp, #0x30]
+
+ # load x19-x30
+ ldp x19, x20, [sp, #0x40]
+ ldp x21, x22, [sp, #0x50]
+ ldp x23, x24, [sp, #0x60]
+ ldp x25, x26, [sp, #0x70]
+ ldp x27, x28, [sp, #0x80]
+ ldp x29, x30, [sp, #0x90]
+
+ # return transfer_t from jump
+ # pass transfer_t as first arg in context function
+ # X0 == FCTX, X1 == DATA
+ mov x0, x4
+
+ # skip pc
+ # restore stack from GP + FPU
+ add sp, sp, #0xb0
+
+ # jump to ontop-function
+ ret x2
+.size ontop_fcontext,.-ontop_fcontext
+# Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_macho_gas.S
new file mode 100644
index 0000000000..a387d06dd2
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm64_aapcs_macho_gas.S
@@ -0,0 +1,108 @@
+/*
+ Copyright Edward Nevill + Oliver Kowalke 2015
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | d8 | d9 | d10 | d11 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | d12 | d13 | d14 | d15 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * | x19 | x20 | x21 | x22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | x23 | x24 | x25 | x26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 0x80| 0x84| 0x88| 0x8c| 0x90| 0x94| 0x98| 0x9c| *
+ * ------------------------------------------------- *
+ * | x27 | x28 | FP | LR | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | | | *
+ * ------------------------------------------------- *
+ * | 0xa0| 0xa4| 0xa8| 0xac| | | *
+ * ------------------------------------------------- *
+ * | PC | align | | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.global _ontop_fcontext
+.balign 16
+_ontop_fcontext:
+ ; prepare stack for GP + FPU
+ sub sp, sp, #0xb0
+
+ ; save d8 - d15
+ stp d8, d9, [sp, #0x00]
+ stp d10, d11, [sp, #0x10]
+ stp d12, d13, [sp, #0x20]
+ stp d14, d15, [sp, #0x30]
+
+ ; save x19-x30
+ stp x19, x20, [sp, #0x40]
+ stp x21, x22, [sp, #0x50]
+ stp x23, x24, [sp, #0x60]
+ stp x25, x26, [sp, #0x70]
+ stp x27, x28, [sp, #0x80]
+ stp x29, x30, [sp, #0x90]
+
+ ; save LR as PC
+ str x30, [sp, #0xa0]
+
+ ; store RSP (pointing to context-data) in X5
+ mov x4, sp
+
+ ; restore RSP (pointing to context-data) from X1
+ mov sp, x0
+
+ ; load d8 - d15
+ ldp d8, d9, [sp, #0x00]
+ ldp d10, d11, [sp, #0x10]
+ ldp d12, d13, [sp, #0x20]
+ ldp d14, d15, [sp, #0x30]
+
+ ; load x19-x30
+ ldp x19, x20, [sp, #0x40]
+ ldp x21, x22, [sp, #0x50]
+ ldp x23, x24, [sp, #0x60]
+ ldp x25, x26, [sp, #0x70]
+ ldp x27, x28, [sp, #0x80]
+ ldp x29, x30, [sp, #0x90]
+
+ ; return transfer_t from jump
+ ; pass transfer_t as first arg in context function
+ ; X0 == FCTX, X1 == DATA
+ mov x0, x4
+
+ ; skip pc
+ ; restore stack from GP + FPU
+ add sp, sp, #0xb0
+
+ ; jump to ontop-function
+ ret x2
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_elf_gas.S
new file mode 100644
index 0000000000..9d9198fc55
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_elf_gas.S
@@ -0,0 +1,91 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58| 0x5c| *
+ * ------------------------------------------------- *
+ * |hiddn| v1 | v2 | v3 | v4 | v5 | v6 | v7 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x60| 0x64| 0x68| 0x6c| 0x70| 0x74| 0x78| 0x7c| *
+ * ------------------------------------------------- *
+ * | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl ontop_fcontext
+.align 2
+.type ontop_fcontext,%function
+ontop_fcontext:
+ @ save LR as PC
+ push {lr}
+ @ save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ @ prepare stack for FPU
+ sub sp, sp, #64
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ save S16-S31
+ vstmia sp, {d8-d15}
+#endif
+
+ @ store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ @ restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+ @ store parent context in A2
+ mov a2, a1
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ restore S16-S31
+ vldmia sp, {d8-d15}
+#endif
+ @ prepare stack for FPU
+ add sp, sp, #64
+
+ @ restore hidden,V1-V8,LR
+ pop {a1,v1-v8,lr}
+
+ @ return transfer_t from jump
+ str a2, [a1, #0]
+ str a3, [a1, #4]
+ @ pass transfer_t as first arg in context function
+ @ A1 == hidden, A2 == FCTX, A3 == DATA
+
+ @ skip PC
+ add sp, sp, #4
+
+ @ jump to ontop-function
+ bx a4
+.size ontop_fcontext,.-ontop_fcontext
+
+@ Mark that we don't need executable stack.
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_macho_gas.S
new file mode 100644
index 0000000000..3633aca641
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_macho_gas.S
@@ -0,0 +1,100 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | s24 | s25 | s26 | s27 | s28 | s29 | s30 | s31 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+ * ------------------------------------------------- *
+ * | sjlj|hiddn| v1 | v2 | v3 | v4 | v5 | v6 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+ * ------------------------------------------------- *
+ * | v7 | v8 | lr | pc | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _ontop_fcontext
+.align 2
+_ontop_fcontext:
+ @ save LR as PC
+ push {lr}
+ @ save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ @ locate TLS to save/restore SjLj handler
+ mrc p15, 0, v2, c13, c0, #3
+ bic v2, v2, #3
+
+ @ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key]
+ ldr v1, [v2, #72]
+ @ save SjLj handler
+ push {v1}
+
+ @ prepare stack for FPU
+ sub sp, sp, #64
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ save S16-S31
+ vstmia sp, {d8-d15}
+#endif
+
+ @ store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ @ restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
+ @ restore S16-S31
+ vldmia sp, {d8-d15}
+#endif
+ @ prepare stack for FPU
+ add sp, sp, #64
+
+ @ restore SjLj handler
+ pop {v1}
+ @ store SjLj handler in TLS
+ str v1, [v2, #72]
+
+ @ store parent context in A2
+ mov a2, a1
+
+ @ restore hidden,V1-V8,LR
+ pop {a1,v1-v8,lr}
+
+ @ return transfer_t from jump
+ str a2, [a1, #0]
+ str a3, [a1, #4]
+ @ pass transfer_t as first arg in context function
+ @ A1 == hidden, A2 == FCTX, A3 == DATA
+
+ @ skip PC
+ add sp, sp, #4
+
+ @ jump to ontop-function
+ bx a4
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.asm b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.asm
new file mode 100644
index 0000000000..f360a8ffca
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.asm
@@ -0,0 +1,86 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT ontop_fcontext
+
+ontop_fcontext PROC
+ ; save LR as PC
+ push {lr}
+ ; save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ ; load TIB to save/restore thread size and limit.
+ ; we do not need preserve CPU flag and can use it's arg register
+ mrc p15, #0, v1, c13, c0, #2
+
+ ; save current stack base
+ ldr a1, [v1, #0x04]
+ push {a1}
+ ; save current stack limit
+ ldr a1, [v1, #0x08]
+ push {a1}
+ ; save current deallocation stack
+ ldr a1, [v1, #0xe0c]
+ push {a1}
+
+ ; store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ ; restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+ ; restore stack base
+ pop {a1}
+ str a1, [v1, #0x04]
+ ; restore stack limit
+ pop {a1}
+ str a1, [v1, #0x08]
+ ; restore deallocation stack
+ pop {a1}
+ str a1, [v1, #0xe0c]
+
+ ; store parent context in A2
+ mov a2, a1
+
+ ; restore hidden,V1-V8,LR
+ pop {a1,v1-v8,lr}
+
+ ; return transfer_t from jump
+ str a2, [a1, #0]
+ str a3, [a1, #4]
+ ; pass transfer_t as first arg in context function
+ ; A1 == hidden, A2 == FCTX, A3 == DATA
+
+ ; skip PC
+ add sp, sp, #4
+
+ ; jump to ontop-function
+ bx a4
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.masm b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.masm
new file mode 100644
index 0000000000..f360a8ffca
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_arm_aapcs_pe_armasm.masm
@@ -0,0 +1,86 @@
+;/*
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+;*/
+
+; *******************************************************
+; * *
+; * ------------------------------------------------- *
+; * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+; * ------------------------------------------------- *
+; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| *
+; * ------------------------------------------------- *
+; * |deall|limit| base|hiddn| v1 | v2 | v3 | v4 | *
+; * ------------------------------------------------- *
+; * ------------------------------------------------- *
+; * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+; * ------------------------------------------------- *
+; * | 0x20| 0x24| 0x28| 0x2c| 0x30| 0x34| 0x38| 0x3c| *
+; * ------------------------------------------------- *
+; * | v5 | v6 | v7 | v8 | lr | pc | FCTX| DATA| *
+; * ------------------------------------------------- *
+; * *
+; *******************************************************
+
+ AREA |.text|, CODE
+ ALIGN 4
+ EXPORT ontop_fcontext
+
+ontop_fcontext PROC
+ ; save LR as PC
+ push {lr}
+ ; save hidden,V1-V8,LR
+ push {a1,v1-v8,lr}
+
+ ; load TIB to save/restore thread size and limit.
+ ; we do not need preserve CPU flag and can use it's arg register
+ mrc p15, #0, v1, c13, c0, #2
+
+ ; save current stack base
+ ldr a1, [v1, #0x04]
+ push {a1}
+ ; save current stack limit
+ ldr a1, [v1, #0x08]
+ push {a1}
+ ; save current deallocation stack
+ ldr a1, [v1, #0xe0c]
+ push {a1}
+
+ ; store RSP (pointing to context-data) in A1
+ mov a1, sp
+
+ ; restore RSP (pointing to context-data) from A2
+ mov sp, a2
+
+ ; restore stack base
+ pop {a1}
+ str a1, [v1, #0x04]
+ ; restore stack limit
+ pop {a1}
+ str a1, [v1, #0x08]
+ ; restore deallocation stack
+ pop {a1}
+ str a1, [v1, #0xe0c]
+
+ ; store parent context in A2
+ mov a2, a1
+
+ ; restore hidden,V1-V8,LR
+ pop {a1,v1-v8,lr}
+
+ ; return transfer_t from jump
+ str a2, [a1, #0]
+ str a3, [a1, #4]
+ ; pass transfer_t as first arg in context function
+ ; A1 == hidden, A2 == FCTX, A3 == DATA
+
+ ; skip PC
+ add sp, sp, #4
+
+ ; jump to ontop-function
+ bx a4
+
+ ENDP
+ END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_combined_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_combined_sysv_macho_gas.S
new file mode 100644
index 0000000000..20cbeb9f22
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_combined_sysv_macho_gas.S
@@ -0,0 +1,20 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "ontop_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "ontop_x86_64_sysv_macho_gas.S"
+#elif defined(__ppc__)
+ #include "ontop_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "ontop_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_gas.asm
new file mode 100644
index 0000000000..41f15f5b02
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_gas.asm
@@ -0,0 +1,125 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* --------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* --------------------------------------------------------------------------------- *
+* | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch | *
+* --------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI | *
+* --------------------------------------------------------------------------------- *
+* --------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* --------------------------------------------------------------------------------- *
+* | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch | *
+* --------------------------------------------------------------------------------- *
+* | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR| *
+* --------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "ontop_i386_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl _ontop_fcontext
+.def _ontop_fcontext; .scl 2; .type 32; .endef
+_ontop_fcontext:
+ /* prepare stack */
+ leal -0x2c(%esp), %esp
+
+#if !defined(BOOST_USE_TSX)
+ /* save MMX control- and status-word */
+ stmxcsr (%esp)
+ /* save x87 control-word */
+ fnstcw 0x4(%esp)
+#endif
+
+ /* load NT_TIB */
+ movl %fs:(0x18), %edx
+ /* load fiber local storage */
+ movl 0x10(%edx), %eax
+ movl %eax, 0x8(%esp)
+ /* load current dealloction stack */
+ movl 0xe0c(%edx), %eax
+ movl %eax, 0xc(%esp)
+ /* load current stack limit */
+ movl 0x8(%edx), %eax
+ movl %eax, 0x10(%esp)
+ /* load current stack base */
+ movl 0x4(%edx), %eax
+ movl %eax, 0x14(%esp)
+ /* load current SEH exception list */
+ movl (%edx), %eax
+ movl %eax, 0x18(%esp)
+
+ movl %edi, 0x1c(%esp) /* save EDI */
+ movl %esi, 0x20(%esp) /* save ESI */
+ movl %ebx, 0x24(%esp) /* save EBX */
+ movl %ebp, 0x28(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of ontop_fcontext() == fcontext to jump to */
+ movl 0x30(%esp), %eax
+
+ /* pass parent fcontext_t */
+ movl %ecx, 0x30(%eax)
+
+ /* second arg of ontop_fcontext() == data to be transferred */
+ movl 0x34(%esp), %ecx
+
+ /* pass data */
+ movl %ecx, 0x34(%eax)
+
+ /* third arg of ontop_fcontext() == ontop-function */
+ movl 0x38(%esp), %ecx
+
+ /* restore ESP (pointing to context-data) from EDX */
+ movl %eax, %esp
+
+#if !defined(BOOST_USE_TSX)
+ /* restore MMX control- and status-word */
+ ldmxcsr (%esp)
+ /* restore x87 control-word */
+ fldcw 0x4(%esp)
+#endif
+
+ /* restore NT_TIB into EDX */
+ movl %fs:(0x18), %edx
+ /* restore fiber local storage */
+ movl 0x8(%esp), %eax
+ movl %eax, 0x10(%edx)
+ /* restore current deallocation stack */
+ movl 0xc(%esp), %eax
+ movl %eax, 0xe0c(%edx)
+ /* restore current stack limit */
+ movl 0x10(%esp), %eax
+ movl %eax, 0x08(%edx)
+ /* restore current stack base */
+ movl 0x14(%esp), %eax
+ movl %eax, 0x04(%edx)
+ /* restore current SEH exception list */
+ movl 0x18(%esp), %eax
+ movl %eax, (%edx)
+
+ movl 0x1c(%esp), %edi /* restore EDI */
+ movl 0x20(%esp), %esi /* restore ESI */
+ movl 0x24(%esp), %ebx /* restore EBX */
+ movl 0x28(%esp), %ebp /* restore EBP */
+
+ /* prepare stack */
+ leal 0x2c(%esp), %esp
+
+ /* keep return-address on stack */
+
+ /* jump to context */
+ jmp *%ecx
+
+.section .drectve
+.ascii " -export:\"ontop_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.asm
new file mode 100644
index 0000000000..82246a4a2c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.asm
@@ -0,0 +1,124 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+.code
+
+ontop_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; prepare stack
+ lea esp, [esp-02ch]
+
+IFNDEF BOOST_USE_TSX
+ ; save MMX control- and status-word
+ stmxcsr [esp]
+ ; save x87 control-word
+ fnstcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; load fiber local storage
+ mov eax, [edx+010h]
+ mov [esp+08h], eax
+ ; load current deallocation stack
+ mov eax, [edx+0e0ch]
+ mov [esp+0ch], eax
+ ; load current stack limit
+ mov eax, [edx+08h]
+ mov [esp+010h], eax
+ ; load current stack base
+ mov eax, [edx+04h]
+ mov [esp+014h], eax
+ ; load current SEH exception list
+ mov eax, [edx]
+ mov [esp+018h], eax
+
+ mov [esp+01ch], edi ; save EDI
+ mov [esp+020h], esi ; save ESI
+ mov [esp+024h], ebx ; save EBX
+ mov [esp+028h], ebp ; save EBP
+
+ ; store ESP (pointing to context-data) in ECX
+ mov ecx, esp
+
+ ; first arg of ontop_fcontext() == fcontext to jump to
+ mov eax, [esp+030h]
+
+ ; pass parent fcontext_t
+ mov [eax+030h], ecx
+
+ ; second arg of ontop_fcontext() == data to be transferred
+ mov ecx, [esp+034h]
+
+ ; pass data
+ mov [eax+034h], ecx
+
+ ; third arg of ontop_fcontext() == ontop-function
+ mov ecx, [esp+038h]
+
+ ; restore ESP (pointing to context-data) from EAX
+ mov esp, eax
+
+IFNDEF BOOST_USE_TSX
+ ; restore MMX control- and status-word
+ ldmxcsr [esp]
+ ; restore x87 control-word
+ fldcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into EDX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; restore fiber local storage
+ mov eax, [esp+08h]
+ mov [edx+010h], eax
+ ; restore current deallocation stack
+ mov eax, [esp+0ch]
+ mov [edx+0e0ch], eax
+ ; restore current stack limit
+ mov eax, [esp+010h]
+ mov [edx+08h], eax
+ ; restore current stack base
+ mov eax, [esp+014h]
+ mov [edx+04h], eax
+ ; restore current SEH exception list
+ mov eax, [esp+018h]
+ mov [edx], eax
+
+ mov edi, [esp+01ch] ; restore EDI
+ mov esi, [esp+020h] ; restore ESI
+ mov ebx, [esp+024h] ; restore EBX
+ mov ebp, [esp+028h] ; restore EBP
+
+ ; prepare stack
+ lea esp, [esp+02ch]
+
+ ; keep return-address on stack
+
+ ; jump to context
+ jmp ecx
+ontop_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.masm
new file mode 100644
index 0000000000..82246a4a2c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_ms_pe_masm.masm
@@ -0,0 +1,124 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ---------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ---------------------------------------------------------------------------------
+; | 0h | 04h | 08h | 0ch | 010h | 014h | 018h | 01ch |
+; ---------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| fc_strg |fc_deallo| limit | base | fc_seh | EDI |
+; ---------------------------------------------------------------------------------
+; ---------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ---------------------------------------------------------------------------------
+; | 020h | 024h | 028h | 02ch | 030h | 034h | 038h | 03ch |
+; ---------------------------------------------------------------------------------
+; | ESI | EBX | EBP | EIP | to | data | EH NXT |SEH HNDLR|
+; ---------------------------------------------------------------------------------
+
+.386
+.XMM
+.model flat, c
+.code
+
+ontop_fcontext PROC BOOST_CONTEXT_EXPORT
+ ; prepare stack
+ lea esp, [esp-02ch]
+
+IFNDEF BOOST_USE_TSX
+ ; save MMX control- and status-word
+ stmxcsr [esp]
+ ; save x87 control-word
+ fnstcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into ECX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; load fiber local storage
+ mov eax, [edx+010h]
+ mov [esp+08h], eax
+ ; load current deallocation stack
+ mov eax, [edx+0e0ch]
+ mov [esp+0ch], eax
+ ; load current stack limit
+ mov eax, [edx+08h]
+ mov [esp+010h], eax
+ ; load current stack base
+ mov eax, [edx+04h]
+ mov [esp+014h], eax
+ ; load current SEH exception list
+ mov eax, [edx]
+ mov [esp+018h], eax
+
+ mov [esp+01ch], edi ; save EDI
+ mov [esp+020h], esi ; save ESI
+ mov [esp+024h], ebx ; save EBX
+ mov [esp+028h], ebp ; save EBP
+
+ ; store ESP (pointing to context-data) in ECX
+ mov ecx, esp
+
+ ; first arg of ontop_fcontext() == fcontext to jump to
+ mov eax, [esp+030h]
+
+ ; pass parent fcontext_t
+ mov [eax+030h], ecx
+
+ ; second arg of ontop_fcontext() == data to be transferred
+ mov ecx, [esp+034h]
+
+ ; pass data
+ mov [eax+034h], ecx
+
+ ; third arg of ontop_fcontext() == ontop-function
+ mov ecx, [esp+038h]
+
+ ; restore ESP (pointing to context-data) from EAX
+ mov esp, eax
+
+IFNDEF BOOST_USE_TSX
+ ; restore MMX control- and status-word
+ ldmxcsr [esp]
+ ; restore x87 control-word
+ fldcw [esp+04h]
+ENDIF
+
+ assume fs:nothing
+ ; load NT_TIB into EDX
+ mov edx, fs:[018h]
+ assume fs:error
+ ; restore fiber local storage
+ mov eax, [esp+08h]
+ mov [edx+010h], eax
+ ; restore current deallocation stack
+ mov eax, [esp+0ch]
+ mov [edx+0e0ch], eax
+ ; restore current stack limit
+ mov eax, [esp+010h]
+ mov [edx+08h], eax
+ ; restore current stack base
+ mov eax, [esp+014h]
+ mov [edx+04h], eax
+ ; restore current SEH exception list
+ mov eax, [esp+018h]
+ mov [edx], eax
+
+ mov edi, [esp+01ch] ; restore EDI
+ mov esi, [esp+020h] ; restore ESI
+ mov ebx, [esp+024h] ; restore EBX
+ mov ebp, [esp+028h] ; restore EBP
+
+ ; prepare stack
+ lea esp, [esp+02ch]
+
+ ; keep return-address on stack
+
+ ; jump to context
+ jmp ecx
+ontop_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_elf_gas.S
new file mode 100644
index 0000000000..03eb0f0c09
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_elf_gas.S
@@ -0,0 +1,99 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| guard | EDI | ESI | EBX | EBP | EIP | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | 0x24 | 0x28 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | hidden | to | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl ontop_fcontext
+.align 2
+.type ontop_fcontext,@function
+ontop_fcontext:
+ leal -0x1c(%esp), %esp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ stmxcsr (%esp) /* save MMX control- and status-word */
+ fnstcw 0x4(%esp) /* save x87 control-word */
+#endif
+
+#if defined(TLS_STACK_PROTECTOR)
+ movl %gs:0x14, %ecx /* read stack guard from TLS record */
+ movl %ecx, 0x8(%esp) /* save stack guard */
+#endif
+
+ movl %edi, 0xc(%esp) /* save EDI */
+ movl %esi, 0x10(%esp) /* save ESI */
+ movl %ebx, 0x14(%esp) /* save EBX */
+ movl %ebp, 0x18(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of ontop_fcontext() == fcontext to jump to */
+ movl 0x24(%esp), %eax
+
+ /* pass parent fcontext_t */
+ movl %ecx, 0x24(%eax)
+
+ /* second arg of ontop_fcontext() == data to be transferred */
+ movl 0x28(%esp), %ecx
+
+ /* pass data */
+ movl %ecx, 0x28(%eax)
+
+ /* third arg of ontop_fcontext() == ontop-function */
+ movl 0x2c(%esp), %ecx
+
+ /* restore ESP (pointing to context-data) from EAX */
+ movl %eax, %esp
+
+ /* address of returned transport_t */
+ movl 0x20(%esp), %eax
+ /* return parent fcontext_t */
+ movl %ecx, (%eax)
+ /* return data */
+ movl %edx, 0x4(%eax)
+
+#if !defined(BOOST_USE_TSX)
+ ldmxcsr (%esp) /* restore MMX control- and status-word */
+ fldcw 0x4(%esp) /* restore x87 control-word */
+#endif
+
+#if defined(TLS_STACK_PROTECTOR)
+ movl 0x8(%esp), %edx /* load stack guard */
+ movl %edx, %gs:0x14 /* restore stack guard to TLS record */
+#endif
+
+ movl 0xc(%esp), %edi /* restore EDI */
+ movl 0x10(%esp), %esi /* restore ESI */
+ movl 0x14(%esp), %ebx /* restore EBX */
+ movl 0x18(%esp), %ebp /* restore EBP */
+
+ leal 0x1c(%esp), %esp /* prepare stack */
+
+ /* jump to context */
+ jmp *%ecx
+.size ontop_fcontext,.-ontop_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_macho_gas.S
new file mode 100644
index 0000000000..3a88372b3a
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_sysv_macho_gas.S
@@ -0,0 +1,81 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/****************************************************************************************
+ * *
+ * ---------------------------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+ * ---------------------------------------------------------------------------------- *
+ * | fc_mxcsr|fc_x87_cw| EDI | ESI | EBX | EBP | EIP | to | *
+ * ---------------------------------------------------------------------------------- *
+ * ---------------------------------------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ---------------------------------------------------------------------------------- *
+ * | 0x20 | | *
+ * ---------------------------------------------------------------------------------- *
+ * | data | | *
+ * ---------------------------------------------------------------------------------- *
+ * *
+ ****************************************************************************************/
+
+.text
+.globl _ontop_fcontext
+.align 2
+_ontop_fcontext:
+ leal -0x18(%esp), %esp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ stmxcsr (%esp) /* save MMX control- and status-word */
+ fnstcw 0x4(%esp) /* save x87 control-word */
+#endif
+
+ movl %edi, 0x8(%esp) /* save EDI */
+ movl %esi, 0xc(%esp) /* save ESI */
+ movl %ebx, 0x10(%esp) /* save EBX */
+ movl %ebp, 0x14(%esp) /* save EBP */
+
+ /* store ESP (pointing to context-data) in ECX */
+ movl %esp, %ecx
+
+ /* first arg of ontop_fcontext() == fcontext to jump to */
+ movl 0x1c(%esp), %eax
+
+ /* pass parent fcontext_t */
+ movl %ecx, 0x1c(%eax)
+
+ /* second arg of ontop_fcontext() == data to be transferred */
+ movl 0x20(%esp), %ecx
+
+ /* pass data */
+ movl %ecx, 0x20(%eax)
+
+ /* third arg of ontop_fcontext() == ontop-function */
+ movl 0x24(%esp), %ecx
+
+ /* restore ESP (pointing to context-data) from EAX */
+ movl %eax, %esp
+
+ /* return parent fcontext_t */
+ movl %ecx, %eax
+ /* returned data is stored in EDX */
+
+#if !defined(BOOST_USE_TSX)
+ ldmxcsr (%esp) /* restore MMX control- and status-word */
+ fldcw 0x4(%esp) /* restore x87 control-word */
+#endif
+
+ movl 0x8(%esp), %edi /* restore EDI */
+ movl 0xc(%esp), %esi /* restore ESI */
+ movl 0x10(%esp), %ebx /* restore EBX */
+ movl 0x14(%esp), %ebp /* restore EBP */
+
+ leal 0x18(%esp), %esp /* prepare stack */
+
+ /* jump to context */
+ jmp *%ecx
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_i386_x86_64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_x86_64_sysv_macho_gas.S
new file mode 100644
index 0000000000..393c5fe43e
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_i386_x86_64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "ontop_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "ontop_x86_64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_mips32_o32_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_mips32_o32_elf_gas.S
new file mode 100644
index 0000000000..238c00ecd7
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_mips32_o32_elf_gas.S
@@ -0,0 +1,119 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F20 | F22 | F24 | F26 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F28 | F30 | S0 | S1 | S2 | S3 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | S4 | S5 | S6 | S7 | FP |hiddn| RA | PC | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | ABI ARGS | GP | FCTX| DATA| | *
+ * ------------------------------------------------- *
+ * *
+ * *****************************************************/
+
+.text
+.globl ontop_fcontext
+.align 2
+.type ontop_fcontext,@function
+.ent ontop_fcontext
+ontop_fcontext:
+ # reserve space on stack
+ addiu $sp, $sp, -96
+
+ sw $s0, 48($sp) # save S0
+ sw $s1, 52($sp) # save S1
+ sw $s2, 56($sp) # save S2
+ sw $s3, 60($sp) # save S3
+ sw $s4, 64($sp) # save S4
+ sw $s5, 68($sp) # save S5
+ sw $s6, 72($sp) # save S6
+ sw $s7, 76($sp) # save S7
+ sw $fp, 80($sp) # save FP
+ sw $a0, 84($sp) # save hidden, address of returned transfer_t
+ sw $ra, 88($sp) # save RA
+ sw $ra, 92($sp) # save RA as PC
+
+#if defined(__mips_hard_float)
+ s.d $f20, ($sp) # save F20
+ s.d $f22, 8($sp) # save F22
+ s.d $f24, 16($sp) # save F24
+ s.d $f26, 24($sp) # save F26
+ s.d $f28, 32($sp) # save F28
+ s.d $f30, 40($sp) # save F30
+#endif
+
+ # store SP (pointing to context-data) in A0
+ move $a0, $sp
+
+ # restore SP (pointing to context-data) from A1
+ move $sp, $a1
+
+#if defined(__mips_hard_float)
+ l.d $f20, ($sp) # restore F20
+ l.d $f22, 8($sp) # restore F22
+ l.d $f24, 16($sp) # restore F24
+ l.d $f26, 24($sp) # restore F26
+ l.d $f28, 32($sp) # restore F28
+ l.d $f30, 40($sp) # restore F30
+#endif
+
+ lw $s0, 48($sp) # restore S0
+ lw $s1, 52($sp) # restore S1
+ lw $s2, 56($sp) # restore S2
+ lw $s3, 60($sp) # restore S3
+ lw $s4, 64($sp) # restore S4
+ lw $s5, 68($sp) # restore S5
+ lw $s6, 72($sp) # restore S6
+ lw $s7, 76($sp) # restore S7
+ lw $fp, 80($sp) # restore FP
+ lw $v0, 84($sp) # restore hidden, address of returned transfer_t
+ lw $ra, 88($sp) # restore RA
+
+ # load PC
+ move $t9, $a3
+
+ # adjust stack
+ addiu $sp, $sp, 96
+
+ # return transfer_t from jump
+ sw $a0, ($v0) # fctx of transfer_t
+ sw $a2, 4($v0) # data of transfer_t
+ # pass transfer_t as first arg in context function
+ # A0 == hidden, A1 == fctx, A2 == data
+ move $a1, $a0
+ move $a0, $v0
+
+ # jump to context
+ jr $t9
+.end ontop_fcontext
+.size ontop_fcontext, .-ontop_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..4632f4cc9e
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_ppc64_sysv_macho_gas.S
@@ -0,0 +1,16 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+// Stub file for universal binary
+
+#if defined(__ppc__)
+ #include "ontop_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "ontop_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_elf_gas.S
new file mode 100644
index 0000000000..54072694ef
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_elf_gas.S
@@ -0,0 +1,206 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl ontop_fcontext
+.align 2
+.type ontop_fcontext,@function
+ontop_fcontext:
+ # reserve space on stack
+ subi %r1, %r1, 244
+
+ stfd %f14, 0(%r1) # save F14
+ stfd %f15, 8(%r1) # save F15
+ stfd %f16, 16(%r1) # save F16
+ stfd %f17, 24(%r1) # save F17
+ stfd %f18, 32(%r1) # save F18
+ stfd %f19, 40(%r1) # save F19
+ stfd %f20, 48(%r1) # save F20
+ stfd %f21, 56(%r1) # save F21
+ stfd %f22, 64(%r1) # save F22
+ stfd %f23, 72(%r1) # save F23
+ stfd %f24, 80(%r1) # save F24
+ stfd %f25, 88(%r1) # save F25
+ stfd %f26, 96(%r1) # save F26
+ stfd %f27, 104(%r1) # save F27
+ stfd %f28, 112(%r1) # save F28
+ stfd %f29, 120(%r1) # save F29
+ stfd %f30, 128(%r1) # save F30
+ stfd %f31, 136(%r1) # save F31
+ mffs %f0 # load FPSCR
+ stfd %f0, 144(%r1) # save FPSCR
+
+ stw %r13, 152(%r1) # save R13
+ stw %r14, 156(%r1) # save R14
+ stw %r15, 160(%r1) # save R15
+ stw %r16, 164(%r1) # save R16
+ stw %r17, 168(%r1) # save R17
+ stw %r18, 172(%r1) # save R18
+ stw %r19, 176(%r1) # save R19
+ stw %r20, 180(%r1) # save R20
+ stw %r21, 184(%r1) # save R21
+ stw %r22, 188(%r1) # save R22
+ stw %r23, 192(%r1) # save R23
+ stw %r24, 196(%r1) # save R24
+ stw %r25, 200(%r1) # save R25
+ stw %r26, 204(%r1) # save R26
+ stw %r27, 208(%r1) # save R27
+ stw %r28, 212(%r1) # save R28
+ stw %r29, 216(%r1) # save R29
+ stw %r30, 220(%r1) # save R30
+ stw %r31, 224(%r1) # save R31
+ stw %r3, 228(%r1) # save hidden
+
+ # save CR
+ mfcr %r0
+ stw %r0, 232(%r1)
+ # save LR
+ mflr %r0
+ stw %r0, 236(%r1)
+ # save LR as PC
+ stw %r0, 240(%r1)
+
+ # store RSP (pointing to context-data) in R7
+ mr %r7, %r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr %r1, %r4
+
+ lfd %f14, 0(%r1) # restore F14
+ lfd %f15, 8(%r1) # restore F15
+ lfd %f16, 16(%r1) # restore F16
+ lfd %f17, 24(%r1) # restore F17
+ lfd %f18, 32(%r1) # restore F18
+ lfd %f19, 40(%r1) # restore F19
+ lfd %f20, 48(%r1) # restore F20
+ lfd %f21, 56(%r1) # restore F21
+ lfd %f22, 64(%r1) # restore F22
+ lfd %f23, 72(%r1) # restore F23
+ lfd %f24, 80(%r1) # restore F24
+ lfd %f25, 88(%r1) # restore F25
+ lfd %f26, 96(%r1) # restore F26
+ lfd %f27, 104(%r1) # restore F27
+ lfd %f28, 112(%r1) # restore F28
+ lfd %f29, 120(%r1) # restore F29
+ lfd %f30, 128(%r1) # restore F30
+ lfd %f31, 136(%r1) # restore F31
+ lfd %f0, 144(%r1) # load FPSCR
+ mtfsf 0xff, %f0 # restore FPSCR
+
+ lwz %r13, 152(%r1) # restore R13
+ lwz %r14, 156(%r1) # restore R14
+ lwz %r15, 160(%r1) # restore R15
+ lwz %r16, 164(%r1) # restore R16
+ lwz %r17, 168(%r1) # restore R17
+ lwz %r18, 172(%r1) # restore R18
+ lwz %r19, 176(%r1) # restore R19
+ lwz %r20, 180(%r1) # restore R20
+ lwz %r21, 184(%r1) # restore R21
+ lwz %r22, 188(%r1) # restore R22
+ lwz %r23, 192(%r1) # restore R23
+ lwz %r24, 196(%r1) # restore R24
+ lwz %r25, 200(%r1) # restore R25
+ lwz %r26, 204(%r1) # restore R26
+ lwz %r27, 208(%r1) # restore R27
+ lwz %r28, 212(%r1) # restore R28
+ lwz %r29, 216(%r1) # restore R29
+ lwz %r30, 220(%r1) # restore R30
+ lwz %r31, 224(%r1) # restore R31
+ lwz %r4, 228(%r1) # restore hidden
+
+ # restore CR
+ lwz %r0, 232(%r1)
+ mtcr %r0
+ # restore LR
+ lwz %r0, 236(%r1)
+ mtlr %r0
+ # ignore PC
+
+ # adjust stack
+ addi %r1, %r1, 244
+
+ # return transfer_t
+ stw %r7, 0(%r4)
+ stw %r5, 4(%r4)
+
+ # restore CTR
+ mtctr %r6
+
+ # jump to ontop-function
+ bctr
+.size ontop_fcontext, .-ontop_fcontext
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_macho_gas.S
new file mode 100644
index 0000000000..1eb5f9340c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_macho_gas.S
@@ -0,0 +1,201 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.globl _ontop_fcontext
+.align 2
+_ontop_fcontext:
+ # reserve space on stack
+ subi r1, r1, 244
+
+ stfd f14, 0(r1) # save F14
+ stfd f15, 8(r1) # save F15
+ stfd f16, 16(r1) # save F16
+ stfd f17, 24(r1) # save F17
+ stfd f18, 32(r1) # save F18
+ stfd f19, 40(r1) # save F19
+ stfd f20, 48(r1) # save F20
+ stfd f21, 56(r1) # save F21
+ stfd f22, 64(r1) # save F22
+ stfd f23, 72(r1) # save F23
+ stfd f24, 80(r1) # save F24
+ stfd f25, 88(r1) # save F25
+ stfd f26, 96(r1) # save F26
+ stfd f27, 104(r1) # save F27
+ stfd f28, 112(r1) # save F28
+ stfd f29, 120(r1) # save F29
+ stfd f30, 128(r1) # save F30
+ stfd f31, 136(r1) # save F31
+ mffs f0 # load FPSCR
+ stfd f0, 144(r1) # save FPSCR
+
+ stw r13, 152(r1) # save R13
+ stw r14, 156(r1) # save R14
+ stw r15, 160(r1) # save R15
+ stw r16, 164(r1) # save R16
+ stw r17, 168(r1) # save R17
+ stw r18, 172(r1) # save R18
+ stw r19, 176(r1) # save R19
+ stw r20, 180(r1) # save R20
+ stw r21, 184(r1) # save R21
+ stw r22, 188(r1) # save R22
+ stw r23, 192(r1) # save R23
+ stw r24, 196(r1) # save R24
+ stw r25, 200(r1) # save R25
+ stw r26, 204(r1) # save R26
+ stw r27, 208(r1) # save R27
+ stw r28, 212(r1) # save R28
+ stw r29, 216(r1) # save R29
+ stw r30, 220(r1) # save R30
+ stw r31, 224(r1) # save R31
+ stw r3, 228(r1) # save hidden
+
+ # save CR
+ mfcr r0
+ stw r0, 232(r1)
+ # save LR
+ mflr r0
+ stw r0, 236(r1)
+ # save LR as PC
+ stw r0, 240(r1)
+
+ # store RSP (pointing to context-data) in R7
+ mr r7, r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ lfd f14, 0(r1) # restore F14
+ lfd f15, 8(r1) # restore F15
+ lfd f16, 16(r1) # restore F16
+ lfd f17, 24(r1) # restore F17
+ lfd f18, 32(r1) # restore F18
+ lfd f19, 40(r1) # restore F19
+ lfd f20, 48(r1) # restore F20
+ lfd f21, 56(r1) # restore F21
+ lfd f22, 64(r1) # restore F22
+ lfd f23, 72(r1) # restore F23
+ lfd f24, 80(r1) # restore F24
+ lfd f25, 88(r1) # restore F25
+ lfd f26, 96(r1) # restore F26
+ lfd f27, 104(r1) # restore F27
+ lfd f28, 112(r1) # restore F28
+ lfd f29, 120(r1) # restore F29
+ lfd f30, 128(r1) # restore F30
+ lfd f31, 136(r1) # restore F31
+ lfd f0, 144(r1) # load FPSCR
+ mtfsf 0xff, f0 # restore FPSCR
+
+ lwz r13, 152(r1) # restore R13
+ lwz r14, 156(r1) # restore R14
+ lwz r15, 160(r1) # restore R15
+ lwz r16, 164(r1) # restore R16
+ lwz r17, 168(r1) # restore R17
+ lwz r18, 172(r1) # restore R18
+ lwz r19, 176(r1) # restore R19
+ lwz r20, 180(r1) # restore R20
+ lwz r21, 184(r1) # restore R21
+ lwz r22, 188(r1) # restore R22
+ lwz r23, 192(r1) # restore R23
+ lwz r24, 196(r1) # restore R24
+ lwz r25, 200(r1) # restore R25
+ lwz r26, 204(r1) # restore R26
+ lwz r27, 208(r1) # restore R27
+ lwz r28, 212(r1) # restore R28
+ lwz r29, 216(r1) # restore R29
+ lwz r30, 220(r1) # restore R30
+ lwz r31, 224(r1) # restore R31
+ lwz r4, 228(r1) # restore hidden
+
+ # restore CR
+ lwz r0, 232(r1)
+ mtcr r0
+ # restore LR
+ lwz r0, 236(r1)
+ mtlr r0
+ # ignore PC
+
+ # adjust stack
+ addi r1, r1, 244
+
+ # return transfer_t
+ stw r7, 0(r4)
+ stw r5, 4(r4)
+
+ # restore CTR
+ mtctr r6
+
+ # jump to ontop-function
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..a3c9fa2336
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc32_sysv_xcoff_gas.S
@@ -0,0 +1,203 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | F18 | F19 | F20 | F21 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | F22 | F23 | F24 | F25 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | F26 | F27 | F28 | F29 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | F30 | F31 | fpscr | R13 | R14 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | R31 |hiddn| CR | LR | PC |bchai|linkr| FCTX| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 64 | | *
+ * ------------------------------------------------- *
+ * | 256 | | *
+ * ------------------------------------------------- *
+ * | DATA| | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+.globl .ontop_fcontext
+.globl ontop_fcontext[DS]
+.align 2
+.csect ontop_fcontext[DS]
+ontop_fcontext:
+ .long .ontop_fcontext
+.ontop_fcontext:
+ # reserve space on stack
+ subi r1, r1, 244
+
+ stfd f14, 0(r1) # save F14
+ stfd f15, 8(r1) # save F15
+ stfd f16, 16(r1) # save F16
+ stfd f17, 24(r1) # save F17
+ stfd f18, 32(r1) # save F18
+ stfd f19, 40(r1) # save F19
+ stfd f20, 48(r1) # save F20
+ stfd f21, 56(r1) # save F21
+ stfd f22, 64(r1) # save F22
+ stfd f23, 72(r1) # save F23
+ stfd f24, 80(r1) # save F24
+ stfd f25, 88(r1) # save F25
+ stfd f26, 96(r1) # save F26
+ stfd f27, 104(r1) # save F27
+ stfd f28, 112(r1) # save F28
+ stfd f29, 120(r1) # save F29
+ stfd f30, 128(r1) # save F30
+ stfd f31, 136(r1) # save F31
+ mffs f0 # load FPSCR
+ stfd f0, 144(r1) # save FPSCR
+
+ stw r13, 152(r1) # save R13
+ stw r14, 156(r1) # save R14
+ stw r15, 160(r1) # save R15
+ stw r16, 164(r1) # save R16
+ stw r17, 168(r1) # save R17
+ stw r18, 172(r1) # save R18
+ stw r19, 176(r1) # save R19
+ stw r20, 180(r1) # save R20
+ stw r21, 184(r1) # save R21
+ stw r22, 188(r1) # save R22
+ stw r23, 192(r1) # save R23
+ stw r24, 196(r1) # save R24
+ stw r25, 200(r1) # save R25
+ stw r26, 204(r1) # save R26
+ stw r27, 208(r1) # save R27
+ stw r28, 212(r1) # save R28
+ stw r29, 216(r1) # save R29
+ stw r30, 220(r1) # save R30
+ stw r31, 224(r1) # save R31
+ stw r3, 228(r1) # save hidden
+
+ # save CR
+ mfcr r0
+ stw r0, 232(r1)
+ # save LR
+ mflr r0
+ stw r0, 236(r1)
+ # save LR as PC
+ stw r0, 240(r1)
+
+ # store RSP (pointing to context-data) in R7
+ mr r7, r1
+
+ # restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ lfd f14, 0(r1) # restore F14
+ lfd f15, 8(r1) # restore F15
+ lfd f16, 16(r1) # restore F16
+ lfd f17, 24(r1) # restore F17
+ lfd f18, 32(r1) # restore F18
+ lfd f19, 40(r1) # restore F19
+ lfd f20, 48(r1) # restore F20
+ lfd f21, 56(r1) # restore F21
+ lfd f22, 64(r1) # restore F22
+ lfd f23, 72(r1) # restore F23
+ lfd f24, 80(r1) # restore F24
+ lfd f25, 88(r1) # restore F25
+ lfd f26, 96(r1) # restore F26
+ lfd f27, 104(r1) # restore F27
+ lfd f28, 112(r1) # restore F28
+ lfd f29, 120(r1) # restore F29
+ lfd f30, 128(r1) # restore F30
+ lfd f31, 136(r1) # restore F31
+ lfd f0, 144(r1) # load FPSCR
+ mtfsf 0xff, f0 # restore FPSCR
+
+ lwz r13, 152(r1) # restore R13
+ lwz r14, 156(r1) # restore R14
+ lwz r15, 160(r1) # restore R15
+ lwz r16, 164(r1) # restore R16
+ lwz r17, 168(r1) # restore R17
+ lwz r18, 172(r1) # restore R18
+ lwz r19, 176(r1) # restore R19
+ lwz r20, 180(r1) # restore R20
+ lwz r21, 184(r1) # restore R21
+ lwz r22, 188(r1) # restore R22
+ lwz r23, 192(r1) # restore R23
+ lwz r24, 196(r1) # restore R24
+ lwz r25, 200(r1) # restore R25
+ lwz r26, 204(r1) # restore R26
+ lwz r27, 208(r1) # restore R27
+ lwz r28, 212(r1) # restore R28
+ lwz r29, 216(r1) # restore R29
+ lwz r30, 220(r1) # restore R30
+ lwz r31, 224(r1) # restore R31
+ lwz r4, 228(r1) # restore hidden
+
+ # restore CR
+ lwz r0, 232(r1)
+ mtcr r0
+ # restore LR
+ lwz r0, 236(r1)
+ mtlr r0
+ # ignore PC
+
+ # adjust stack
+ addi r1, r1, 244
+
+ # return transfer_t
+ stw r7, 0(r4)
+ stw r5, 4(r4)
+
+ # restore CTR
+ mtctr r6
+
+ # jump to ontop-function
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S
new file mode 100644
index 0000000000..14981c85a0
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_elf_gas.S
@@ -0,0 +1,240 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.globl ontop_fcontext
+#if _CALL_ELF == 2
+ .text
+ .align 2
+ontop_fcontext:
+ addis %r2, %r12, .TOC.-ontop_fcontext@ha
+ addi %r2, %r2, .TOC.-ontop_fcontext@l
+ .localentry ontop_fcontext, . - ontop_fcontext
+#else
+ .section ".opd","aw"
+ .align 3
+ontop_fcontext:
+# ifdef _CALL_LINUX
+ .quad .L.ontop_fcontext,.TOC.@tocbase,0
+ .type ontop_fcontext,@function
+ .text
+ .align 2
+.L.ontop_fcontext:
+# else
+ .hidden .ontop_fcontext
+ .globl .ontop_fcontext
+ .quad .ontop_fcontext,.TOC.@tocbase,0
+ .size ontop_fcontext,24
+ .type .ontop_fcontext,@function
+ .text
+ .align 2
+.ontop_fcontext:
+# endif
+#endif
+ # reserve space on stack
+ subi %r1, %r1, 184
+
+#if _CALL_ELF != 2
+ std %r2, 0(%r1) # save TOC
+#endif
+ std %r14, 8(%r1) # save R14
+ std %r15, 16(%r1) # save R15
+ std %r16, 24(%r1) # save R16
+ std %r17, 32(%r1) # save R17
+ std %r18, 40(%r1) # save R18
+ std %r19, 48(%r1) # save R19
+ std %r20, 56(%r1) # save R20
+ std %r21, 64(%r1) # save R21
+ std %r22, 72(%r1) # save R22
+ std %r23, 80(%r1) # save R23
+ std %r24, 88(%r1) # save R24
+ std %r25, 96(%r1) # save R25
+ std %r26, 104(%r1) # save R26
+ std %r27, 112(%r1) # save R27
+ std %r28, 120(%r1) # save R28
+ std %r29, 128(%r1) # save R29
+ std %r30, 136(%r1) # save R30
+ std %r31, 144(%r1) # save R31
+#if _CALL_ELF != 2
+ std %r3, 152(%r1) # save hidden
+#endif
+
+ # save CR
+ mfcr %r0
+ std %r0, 160(%r1)
+ # save LR
+ mflr %r0
+ std %r0, 168(%r1)
+ # save LR as PC
+ std %r0, 176(%r1)
+
+ # store RSP (pointing to context-data) in R7
+ mr %r7, %r1
+
+#if _CALL_ELF == 2
+ # restore RSP (pointing to context-data) from R3
+ mr %r1, %r3
+#else
+ # restore RSP (pointing to context-data) from R4
+ mr %r1, %r4
+#endif
+
+ ld %r14, 8(%r1) # restore R14
+ ld %r15, 16(%r1) # restore R15
+ ld %r16, 24(%r1) # restore R16
+ ld %r17, 32(%r1) # restore R17
+ ld %r18, 40(%r1) # restore R18
+ ld %r19, 48(%r1) # restore R19
+ ld %r20, 56(%r1) # restore R20
+ ld %r21, 64(%r1) # restore R21
+ ld %r22, 72(%r1) # restore R22
+ ld %r23, 80(%r1) # restore R23
+ ld %r24, 88(%r1) # restore R24
+ ld %r25, 96(%r1) # restore R25
+ ld %r26, 104(%r1) # restore R26
+ ld %r27, 112(%r1) # restore R27
+ ld %r28, 120(%r1) # restore R28
+ ld %r29, 128(%r1) # restore R29
+ ld %r30, 136(%r1) # restore R30
+ ld %r31, 144(%r1) # restore R31
+#if _CALL_ELF != 2
+ ld %r3, 152(%r1) # restore hidden
+#endif
+
+ # restore CR
+ ld %r0, 160(%r1)
+ mtcr %r0
+
+#if _CALL_ELF == 2
+ # restore CTR
+ mtctr %r5
+
+ # copy transfer_t into ontop_fn arg registers
+ mr %r3, %r7
+ # arg pointer already in %r4
+#else
+ # copy transfer_t into ontop_fn arg registers
+ mr %r4, %r7
+ # arg pointer already in %r5
+ # hidden arg already in %r3
+
+ # restore CTR
+ ld %r7, 0(%r6)
+ mtctr %r7
+ # restore TOC
+ ld %r2, 8(%r6)
+
+ # zero in r3 indicates first jump to context-function
+ cmpdi %r3, 0
+ beq use_entry_arg
+#endif
+
+return_to_ctx:
+ # restore LR
+ ld %r0, 168(%r1)
+ mtlr %r0
+
+ # adjust stack
+ addi %r1, %r1, 184
+
+ # jump to context
+ bctr
+
+#if _CALL_ELF == 2
+ .size ontop_fcontext, .-ontop_fcontext
+#else
+use_entry_arg:
+ # compute return-value struct address
+ # (passed has hidden arg to ontop_fn)
+ addi %r3, %r1, 8
+
+ # jump to context and update LR
+ bctrl
+
+ # restore CTR
+ ld %r7, 176(%r1)
+ mtctr %r7
+#if _CALL_ELF != 2
+ # restore TOC
+ ld %r2, 0(%r1)
+#endif
+
+ # copy returned transfer_t into entry_fn arg registers
+ ld %r3, 8(%r1)
+ ld %r4, 16(%r1)
+
+ b return_to_ctx
+# ifdef _CALL_LINUX
+ .size .ontop_fcontext, .-.L.ontop_fcontext
+# else
+ .size .ontop_fcontext, .-.ontop_fcontext
+# endif
+#endif
+
+
+/* Mark that we don't need executable stack. */
+.section .note.GNU-stack,"",%progbits
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_macho_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_macho_gas.S
new file mode 100644
index 0000000000..5de8acd10c
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_macho_gas.S
@@ -0,0 +1,151 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*******************************************************
+ * *
+ * ------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+ * ------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | *
+ * ------------------------------------------------- *
+ * | TOC | R14 | R15 | R16 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+ * ------------------------------------------------- *
+ * | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | *
+ * ------------------------------------------------- *
+ * | R17 | R18 | R19 | R20 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+ * ------------------------------------------------- *
+ * | 64 | 68 | 72 | 76 | 80 | 84 | 88 | 92 | *
+ * ------------------------------------------------- *
+ * | R21 | R22 | R23 | R24 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+ * ------------------------------------------------- *
+ * | 96 | 100 | 104 | 108 | 112 | 116 | 120 | 124 | *
+ * ------------------------------------------------- *
+ * | R25 | R26 | R27 | R28 | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------- *
+ * | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------- *
+ * | R29 | R30 | R31 | hidden | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | *
+ * ------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | 184 | 188 | *
+ * ------------------------------------------------- *
+ * | CR | LR | PC | back-chain| *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------- *
+ * | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------- *
+ * | cr saved | lr saved | compiler | linker | *
+ * ------------------------------------------------- *
+ * ------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | *
+ * ------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | *
+ * ------------------------------------------------- *
+ * | TOC saved | FCTX | DATA | | *
+ * ------------------------------------------------- *
+ * *
+ *******************************************************/
+
+.text
+.align 2
+.globl _ontop_fcontext
+
+_ontop_fcontext:
+ ; reserve space on stack
+ subi r1, r1, 184
+
+ std r14, 8(r1) ; save R14
+ std r15, 16(r1) ; save R15
+ std r16, 24(r1) ; save R16
+ std r17, 32(r1) ; save R17
+ std r18, 40(r1) ; save R18
+ std r19, 48(r1) ; save R19
+ std r20, 56(r1) ; save R20
+ std r21, 64(r1) ; save R21
+ std r22, 72(r1) ; save R22
+ std r23, 80(r1) ; save R23
+ std r24, 88(r1) ; save R24
+ std r25, 96(r1) ; save R25
+ std r26, 104(r1) ; save R26
+ std r27, 112(r1) ; save R27
+ std r28, 120(r1) ; save R28
+ std r29, 128(r1) ; save R29
+ std r30, 136(r1) ; save R30
+ std r31, 144(r1) ; save R31
+ std r3, 152(r1) ; save hidden
+
+ ; save CR
+ mfcr r0
+ std r0, 160(r1)
+ ; save LR
+ mflr r0
+ std r0, 168(r1)
+ ; save LR as PC
+ std r0, 176(r1)
+
+ ; store RSP (pointing to context-data) in R7
+ mr r7, r1
+
+ ; restore RSP (pointing to context-data) from R4
+ mr r1, r4
+
+ ld r14, 8(r1) ; restore R14
+ ld r15, 16(r1) ; restore R15
+ ld r16, 24(r1) ; restore R16
+ ld r17, 32(r1) ; restore R17
+ ld r18, 40(r1) ; restore R18
+ ld r19, 48(r1) ; restore R19
+ ld r20, 56(r1) ; restore R20
+ ld r21, 64(r1) ; restore R21
+ ld r22, 72(r1) ; restore R22
+ ld r23, 80(r1) ; restore R23
+ ld r24, 88(r1) ; restore R24
+ ld r25, 96(r1) ; restore R25
+ ld r26, 104(r1) ; restore R26
+ ld r27, 112(r1) ; restore R27
+ ld r28, 120(r1) ; restore R28
+ ld r29, 128(r1) ; restore R29
+ ld r30, 136(r1) ; restore R30
+ ld r31, 144(r1) ; restore R31
+ ld r4, 152(r1) ; restore hidden
+
+ ; restore CR
+ ld r0, 160(r1)
+ mtcr r0
+ ; restore LR
+ ld r0, 168(r1)
+ mtlr r0
+ ; ignore PC
+
+ ; adjust stack
+ addi r1, r1, 184
+
+ ; return transfer_t
+ std r7, 0(r4)
+ std r5, 8(r4)
+
+ ; restore CTR
+ mtctr r6
+
+ ; jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_xcoff_gas.S b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_xcoff_gas.S
new file mode 100644
index 0000000000..93f8c23427
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_ppc64_sysv_xcoff_gas.S
@@ -0,0 +1,83 @@
+.align 2
+.globl .ontop_fcontext
+.ontop_fcontext:
+ # reserve space on stack
+ subi 1, 1, 184
+
+ std 13, 0(1) # save R13
+ std 14, 8(1) # save R14
+ std 15, 16(1) # save R15
+ std 16, 24(1) # save R16
+ std 17, 32(1) # save R17
+ std 18, 40(1) # save R18
+ std 19, 48(1) # save R19
+ std 20, 56(1) # save R20
+ std 21, 64(1) # save R21
+ std 22, 72(1) # save R22
+ std 23, 80(1) # save R23
+ std 24, 88(1) # save R24
+ std 25, 96(1) # save R25
+ std 26, 104(1) # save R26
+ std 27, 112(1) # save R27
+ std 29, 120(1) # save R28
+ std 29, 128(1) # save R29
+ std 30, 136(1) # save R30
+ std 31, 144(1) # save R31
+ std 3, 152(1) # save hidden
+
+ # save CR
+ mfcr 0
+ std 0, 160(1)
+ # save LR
+ mflr 0
+ std 0, 168(1)
+ # save LR as PC
+ std 0, 176(1)
+
+ # store RSP (pointing to context-data) in R7
+ mr 7, 1
+
+ # restore RSP (pointing to context-data) from R4
+ mr 1, 4
+
+ ld 13, 0(1) # restore R13
+ ld 14, 8(1) # restore R14
+ ld 15, 16(1) # restore R15
+ ld 16, 24(1) # restore R16
+ ld 17, 32(1) # restore R17
+ ld 18, 40(1) # restore R18
+ ld 19, 48(1) # restore R19
+ ld 20, 56(1) # restore R20
+ ld 21, 64(1) # restore R21
+ ld 22, 72(1) # restore R22
+ ld 23, 80(1) # restore R23
+ ld 24, 88(1) # restore R24
+ ld 25, 96(1) # restore R25
+ ld 26, 104(1) # restore R26
+ ld 27, 112(1) # restore R27
+ ld 28, 120(1) # restore R28
+ ld 29, 128(1) # restore R29
+ ld 30, 136(1) # restore R30
+ ld 31, 144(1) # restore R31
+ ld 4, 152(1) # restore hidden
+
+ # restore CR
+ ld 0, 160(1)
+ mtcr 0
+ # restore LR
+ ld 0, 168(1)
+ mtlr 0
+ # ignore PC
+
+ # adjust stack
+ addi 1, 1, 184
+
+ # return transfer_t
+ std 7, 0(4)
+ std 5, 8(4)
+
+ # restore CTR
+ mtctr 6
+
+ # jump to context
+ bctr
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_gas.asm b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_gas.asm
new file mode 100644
index 0000000000..02e040c9dc
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_gas.asm
@@ -0,0 +1,211 @@
+/*
+ Copyright Oliver Kowalke 2009.
+ Copyright Thomas Sailer 2013.
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+*/
+
+/*************************************************************************************
+* ---------------------------------------------------------------------------------- *
+* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c | *
+* ---------------------------------------------------------------------------------- *
+* | SEE registers (XMM6-XMM15) | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc | *
+* ---------------------------------------------------------------------------------- *
+* | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc | *
+* ---------------------------------------------------------------------------------- *
+* | limit | base | R12 | R13 | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | *
+* ---------------------------------------------------------------------------------- *
+* | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc | *
+* ---------------------------------------------------------------------------------- *
+* | R14 | R15 | RDI | RSI | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c | *
+* ---------------------------------------------------------------------------------- *
+* | RBX | RBP | hidden | RIP | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c | *
+* ---------------------------------------------------------------------------------- *
+* | parameter area | *
+* ---------------------------------------------------------------------------------- *
+* ---------------------------------------------------------------------------------- *
+* | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | *
+* ---------------------------------------------------------------------------------- *
+* | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c | *
+* ---------------------------------------------------------------------------------- *
+* | FCTX | DATA | | *
+* ---------------------------------------------------------------------------------- *
+**************************************************************************************/
+
+.file "ontop_x86_64_ms_pe_gas.asm"
+.text
+.p2align 4,,15
+.globl ontop_fcontext
+.def ontop_fcontext; .scl 2; .type 32; .endef
+.seh_proc ontop_fcontext
+ontop_fcontext:
+.seh_endprologue
+
+ leaq -0x118(%rsp), %rsp /* prepare stack */
+
+#if !defined(BOOST_USE_TSX)
+ /* save XMM storage */
+ movaps %xmm6, 0x0(%rsp)
+ movaps %xmm7, 0x10(%rsp)
+ movaps %xmm8, 0x20(%rsp)
+ movaps %xmm9, 0x30(%rsp)
+ movaps %xmm10, 0x40(%rsp)
+ movaps %xmm11, 0x50(%rsp)
+ movaps %xmm12, 0x60(%rsp)
+ movaps %xmm13, 0x70(%rsp)
+ movaps %xmm14, 0x80(%rsp)
+ movaps %xmm15, 0x90(%rsp)
+ stmxcsr 0xa0(%rsp) /* save MMX control- and status-word */
+ fnstcw 0xa4(%rsp) /* save x87 control-word */
+#endif
+
+ /* load NT_TIB */
+ movq %gs:(0x30), %r10
+ /* save fiber local storage */
+ movq 0x20(%r10), %rax
+ movq %rax, 0xb0(%rsp)
+ /* save current deallocation stack */
+ movq 0x1478(%r10), %rax
+ movq %rax, 0xb8(%rsp)
+ /* save current stack limit */
+ movq 0x10(%r10), %rax
+ movq %rax, 0xc0(%rsp)
+ /* save current stack base */
+ movq 0x08(%r10), %rax
+ movq %rax, 0xc8(%rsp)
+
+ movq %r12, 0xd0(%rsp) /* save R12 */
+ movq %r13, 0xd8(%rsp) /* save R13 */
+ movq %r14, 0xe0(%rsp) /* save R14 */
+ movq %r15, 0xe8(%rsp) /* save R15 */
+ movq %rdi, 0xf0(%rsp) /* save RDI */
+ movq %rsi, 0xf8(%rsp) /* save RSI */
+ movq %rbx, 0x100(%rsp) /* save RBX */
+ movq %rbp, 0x108(%rsp) /* save RBP */
+
+ movq %rcx, 0x110(%rsp) /* save hidden address of transport_t */
+
+ /* preserve RSP (pointing to context-data) in RCX */
+ movq %rsp, %rcx
+
+ /* restore RSP (pointing to context-data) from RDX */
+ movq %rdx, %rsp
+
+#if !defined(BOOST_USE_TSX)
+ /* restore XMM storage */
+ movaps 0x0(%rsp), %xmm6
+ movaps 0x10(%rsp), %xmm7
+ movaps 0x20(%rsp), %xmm8
+ movaps 0x30(%rsp), %xmm9
+ movaps 0x40(%rsp), %xmm10
+ movaps 0x50(%rsp), %xmm11
+ movaps 0x60(%rsp), %xmm12
+ movaps 0x70(%rsp), %xmm13
+ movaps 0x80(%rsp), %xmm14
+ movaps 0x90(%rsp), %xmm15
+ ldmxcsr 0xa0(%rsp) /* restore MMX control- and status-word */
+ fldcw 0xa4(%rsp) /* restore x87 control-word */
+#endif
+
+ /* load NT_TIB */
+ movq %gs:(0x30), %r10
+ /* restore fiber local storage */
+ movq 0xb0(%rsp), %rax
+ movq %rax, 0x20(%r10)
+ /* restore current deallocation stack */
+ movq 0xb8(%rsp), %rax
+ movq %rax, 0x1478(%r10)
+ /* restore current stack limit */
+ movq 0xc0(%rsp), %rax
+ movq %rax, 0x10(%r10)
+ /* restore current stack base */
+ movq 0xc8(%rsp), %rax
+ movq %rax, 0x08(%r10)
+
+ movq 0xd0(%rsp), %r12 /* restore R12 */
+ movq 0xd8(%rsp), %r13 /* restore R13 */
+ movq 0xe0(%rsp), %r14 /* restore R14 */
+ movq 0xe8(%rsp), %r15 /* restore R15 */
+ movq 0xf0(%rsp), %rdi /* restore RDI */
+ movq 0xf8(%rsp), %rsi /* restore RSI */
+ movq 0x100(%rsp), %rbx /* restore RBX */
+ movq 0x108(%rsp), %rbp /* restore RBP */
+
+ movq 0x110(%rsp), %rax /* restore hidden address of transport_t */
+
+ leaq 0x118(%rsp), %rsp /* prepare stack */
+
+ /* keep return-address on stack */
+
+ /* transport_t returned in RAX */
+ /* return parent fcontext_t */
+ movq %rcx, 0x0(%rax)
+ /* return data */
+ movq %r8, 0x8(%rax)
+
+ /* transport_t as 1.arg of context-function */
+ /* RCX contains address of returned (hidden) transfer_t */
+ movq %rax, %rcx
+ /* RDX contains address of passed transfer_t */
+ movq %rax, %rdx
+
+ /* indirect jump to context */
+ jmp *%r9
+.seh_endproc
+
+.section .drectve
+.ascii " -export:\"ontop_fcontext\""
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm
new file mode 100644
index 0000000000..b57dd15884
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.asm
@@ -0,0 +1,207 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+.code
+
+ontop_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ .endprolog
+
+ ; prepare stack
+ lea rsp, [rsp-0118h]
+
+IFNDEF BOOST_USE_TSX
+ ; save XMM storage
+ movaps [rsp], xmm6
+ movaps [rsp+010h], xmm7
+ movaps [rsp+020h], xmm8
+ movaps [rsp+030h], xmm9
+ movaps [rsp+040h], xmm10
+ movaps [rsp+050h], xmm11
+ movaps [rsp+060h], xmm12
+ movaps [rsp+070h], xmm13
+ movaps [rsp+080h], xmm14
+ movaps [rsp+090h], xmm15
+ ; save MMX control- and status-word
+ stmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fnstcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; save fiber local storage
+ mov rax, [r10+020h]
+ mov [rsp+0b0h], rax
+ ; save current deallocation stack
+ mov rax, [r10+01478h]
+ mov [rsp+0b8h], rax
+ ; save current stack limit
+ mov rax, [r10+010h]
+ mov [rsp+0c0h], rax
+ ; save current stack base
+ mov rax, [r10+08h]
+ mov [rsp+0c8h], rax
+
+ mov [rsp+0d0h], r12 ; save R12
+ mov [rsp+0d8h], r13 ; save R13
+ mov [rsp+0e0h], r14 ; save R14
+ mov [rsp+0e8h], r15 ; save R15
+ mov [rsp+0f0h], rdi ; save RDI
+ mov [rsp+0f8h], rsi ; save RSI
+ mov [rsp+0100h], rbx ; save RBX
+ mov [rsp+0108h], rbp ; save RBP
+
+ mov [rsp+0110h], rcx ; save hidden address of transport_t
+
+ ; preserve RSP (pointing to context-data) in RCX
+ mov rcx, rsp
+
+ ; restore RSP (pointing to context-data) from RDX
+ mov rsp, rdx
+
+IFNDEF BOOST_USE_TSX
+ ; restore XMM storage
+ movaps xmm6, [rsp]
+ movaps xmm7, [rsp+010h]
+ movaps xmm8, [rsp+020h]
+ movaps xmm9, [rsp+030h]
+ movaps xmm10, [rsp+040h]
+ movaps xmm11, [rsp+050h]
+ movaps xmm12, [rsp+060h]
+ movaps xmm13, [rsp+070h]
+ movaps xmm14, [rsp+080h]
+ movaps xmm15, [rsp+090h]
+ ; restore MMX control- and status-word
+ ldmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fldcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; restore fiber local storage
+ mov rax, [rsp+0b0h]
+ mov [r10+020h], rax
+ ; restore current deallocation stack
+ mov rax, [rsp+0b8h]
+ mov [r10+01478h], rax
+ ; restore current stack limit
+ mov rax, [rsp+0c0h]
+ mov [r10+010h], rax
+ ; restore current stack base
+ mov rax, [rsp+0c8h]
+ mov [r10+08h], rax
+
+ mov r12, [rsp+0d0h] ; restore R12
+ mov r13, [rsp+0d8h] ; restore R13
+ mov r14, [rsp+0e0h] ; restore R14
+ mov r15, [rsp+0e8h] ; restore R15
+ mov rdi, [rsp+0f0h] ; restore RDI
+ mov rsi, [rsp+0f8h] ; restore RSI
+ mov rbx, [rsp+0100h] ; restore RBX
+ mov rbp, [rsp+0108h] ; restore RBP
+
+ mov rax, [rsp+0110h] ; restore hidden address of transport_t
+
+ ; prepare stack
+ lea rsp, [rsp+0118h]
+
+ ; keep return-address on stack
+
+ ; transport_t returned in RAX
+ ; return parent fcontext_t
+ mov [rax], rcx
+ ; return data
+ mov [rax+08h], r8
+
+ ; transport_t as 1.arg of context-function
+ ; RCX contains address of returned (hidden) transfer_t
+ mov rcx, rax
+ ; RDX contains address of passed transfer_t
+ mov rdx, rax
+
+ ; indirect jump to context
+ jmp r9
+ontop_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.masm b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.masm
new file mode 100644
index 0000000000..b57dd15884
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/asm/ontop_x86_64_ms_pe_masm.masm
@@ -0,0 +1,207 @@
+
+; Copyright Oliver Kowalke 2009.
+; Distributed under the Boost Software License, Version 1.0.
+; (See accompanying file LICENSE_1_0.txt or copy at
+; http://www.boost.org/LICENSE_1_0.txt)
+
+; ----------------------------------------------------------------------------------
+; | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
+; ----------------------------------------------------------------------------------
+; | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
+; ----------------------------------------------------------------------------------
+; | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
+; ----------------------------------------------------------------------------------
+; | 0xe40 | 0x44 | 0x48 | 0x4c | 0x50 | 0x54 | 0x58 | 0x5c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
+; ----------------------------------------------------------------------------------
+; | 0x60 | 0x64 | 0x68 | 0x6c | 0x70 | 0x74 | 0x78 | 0x7c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 32 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
+; ----------------------------------------------------------------------------------
+; | 0x80 | 0x84 | 0x88 | 0x8c | 0x90 | 0x94 | 0x98 | 0x9c |
+; ----------------------------------------------------------------------------------
+; | SEE registers (XMM6-XMM15) |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 |
+; ----------------------------------------------------------------------------------
+; | 0xa0 | 0xa4 | 0xa8 | 0xac | 0xb0 | 0xb4 | 0xb8 | 0xbc |
+; ----------------------------------------------------------------------------------
+; | fc_mxcsr|fc_x87_cw| <alignment> | fbr_strg | fc_dealloc |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |
+; ----------------------------------------------------------------------------------
+; | 0xc0 | 0xc4 | 0xc8 | 0xcc | 0xd0 | 0xd4 | 0xd8 | 0xdc |
+; ----------------------------------------------------------------------------------
+; | limit | base | R12 | R13 |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
+; ----------------------------------------------------------------------------------
+; | 0xe0 | 0xe4 | 0xe8 | 0xec | 0xf0 | 0xf4 | 0xf8 | 0xfc |
+; ----------------------------------------------------------------------------------
+; | R14 | R15 | RDI | RSI |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
+; ----------------------------------------------------------------------------------
+; | 0x100 | 0x104 | 0x108 | 0x10c | 0x110 | 0x114 | 0x118 | 0x11c |
+; ----------------------------------------------------------------------------------
+; | RBX | RBP | hidden | RIP |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |
+; ----------------------------------------------------------------------------------
+; | 0x120 | 0x124 | 0x128 | 0x12c | 0x130 | 0x134 | 0x138 | 0x13c |
+; ----------------------------------------------------------------------------------
+; | parameter area |
+; ----------------------------------------------------------------------------------
+; ----------------------------------------------------------------------------------
+; | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 |
+; ----------------------------------------------------------------------------------
+; | 0x140 | 0x144 | 0x148 | 0x14c | 0x150 | 0x154 | 0x158 | 0x15c |
+; ----------------------------------------------------------------------------------
+; | FCTX | DATA | |
+; ----------------------------------------------------------------------------------
+
+.code
+
+ontop_fcontext PROC BOOST_CONTEXT_EXPORT FRAME
+ .endprolog
+
+ ; prepare stack
+ lea rsp, [rsp-0118h]
+
+IFNDEF BOOST_USE_TSX
+ ; save XMM storage
+ movaps [rsp], xmm6
+ movaps [rsp+010h], xmm7
+ movaps [rsp+020h], xmm8
+ movaps [rsp+030h], xmm9
+ movaps [rsp+040h], xmm10
+ movaps [rsp+050h], xmm11
+ movaps [rsp+060h], xmm12
+ movaps [rsp+070h], xmm13
+ movaps [rsp+080h], xmm14
+ movaps [rsp+090h], xmm15
+ ; save MMX control- and status-word
+ stmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fnstcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; save fiber local storage
+ mov rax, [r10+020h]
+ mov [rsp+0b0h], rax
+ ; save current deallocation stack
+ mov rax, [r10+01478h]
+ mov [rsp+0b8h], rax
+ ; save current stack limit
+ mov rax, [r10+010h]
+ mov [rsp+0c0h], rax
+ ; save current stack base
+ mov rax, [r10+08h]
+ mov [rsp+0c8h], rax
+
+ mov [rsp+0d0h], r12 ; save R12
+ mov [rsp+0d8h], r13 ; save R13
+ mov [rsp+0e0h], r14 ; save R14
+ mov [rsp+0e8h], r15 ; save R15
+ mov [rsp+0f0h], rdi ; save RDI
+ mov [rsp+0f8h], rsi ; save RSI
+ mov [rsp+0100h], rbx ; save RBX
+ mov [rsp+0108h], rbp ; save RBP
+
+ mov [rsp+0110h], rcx ; save hidden address of transport_t
+
+ ; preserve RSP (pointing to context-data) in RCX
+ mov rcx, rsp
+
+ ; restore RSP (pointing to context-data) from RDX
+ mov rsp, rdx
+
+IFNDEF BOOST_USE_TSX
+ ; restore XMM storage
+ movaps xmm6, [rsp]
+ movaps xmm7, [rsp+010h]
+ movaps xmm8, [rsp+020h]
+ movaps xmm9, [rsp+030h]
+ movaps xmm10, [rsp+040h]
+ movaps xmm11, [rsp+050h]
+ movaps xmm12, [rsp+060h]
+ movaps xmm13, [rsp+070h]
+ movaps xmm14, [rsp+080h]
+ movaps xmm15, [rsp+090h]
+ ; restore MMX control- and status-word
+ ldmxcsr [rsp+0a0h]
+ ; save x87 control-word
+ fldcw [rsp+0a4h]
+ENDIF
+
+ ; load NT_TIB
+ mov r10, gs:[030h]
+ ; restore fiber local storage
+ mov rax, [rsp+0b0h]
+ mov [r10+020h], rax
+ ; restore current deallocation stack
+ mov rax, [rsp+0b8h]
+ mov [r10+01478h], rax
+ ; restore current stack limit
+ mov rax, [rsp+0c0h]
+ mov [r10+010h], rax
+ ; restore current stack base
+ mov rax, [rsp+0c8h]
+ mov [r10+08h], rax
+
+ mov r12, [rsp+0d0h] ; restore R12
+ mov r13, [rsp+0d8h] ; restore R13
+ mov r14, [rsp+0e0h] ; restore R14
+ mov r15, [rsp+0e8h] ; restore R15
+ mov rdi, [rsp+0f0h] ; restore RDI
+ mov rsi, [rsp+0f8h] ; restore RSI
+ mov rbx, [rsp+0100h] ; restore RBX
+ mov rbp, [rsp+0108h] ; restore RBP
+
+ mov rax, [rsp+0110h] ; restore hidden address of transport_t
+
+ ; prepare stack
+ lea rsp, [rsp+0118h]
+
+ ; keep return-address on stack
+
+ ; transport_t returned in RAX
+ ; return parent fcontext_t
+ mov [rax], rcx
+ ; return data
+ mov [rax+08h], r8
+
+ ; transport_t as 1.arg of context-function
+ ; RCX contains address of returned (hidden) transfer_t
+ mov rcx, rax
+ ; RDX contains address of passed transfer_t
+ mov rdx, rax
+
+ ; indirect jump to context
+ jmp r9
+ontop_fcontext ENDP
+END
diff --git a/contrib/restricted/boost/libs/context/src/continuation.cpp b/contrib/restricted/boost/libs/context/src/continuation.cpp
new file mode 100644
index 0000000000..0779baaba8
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/continuation.cpp
@@ -0,0 +1,60 @@
+
+// Copyright Oliver Kowalke 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#if defined(BOOST_USE_UCONTEXT)
+#include "boost/context/continuation_ucontext.hpp"
+#elif defined(BOOST_USE_WINFIB)
+#include "boost/context/continuation_winfib.hpp"
+#else
+#include "boost/context/execution_context.hpp"
+#endif
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+namespace detail {
+
+// zero-initialization
+thread_local activation_record * current_rec;
+thread_local static std::size_t counter;
+
+// schwarz counter
+activation_record_initializer::activation_record_initializer() noexcept {
+ if ( 0 == counter++) {
+ current_rec = new activation_record();
+ }
+}
+
+activation_record_initializer::~activation_record_initializer() {
+ if ( 0 == --counter) {
+ BOOST_ASSERT( current_rec->is_main_context() );
+ delete current_rec;
+ }
+}
+
+}
+
+namespace detail {
+
+activation_record *&
+activation_record::current() noexcept {
+ // initialized the first time control passes; per thread
+ thread_local static activation_record_initializer initializer;
+ return current_rec;
+}
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/dummy.cpp b/contrib/restricted/boost/libs/context/src/dummy.cpp
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/dummy.cpp
diff --git a/contrib/restricted/boost/libs/context/src/execution_context.cpp b/contrib/restricted/boost/libs/context/src/execution_context.cpp
new file mode 100644
index 0000000000..fc593ecb03
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/execution_context.cpp
@@ -0,0 +1,69 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include "boost/context/detail/config.hpp"
+
+#if ! defined(BOOST_CONTEXT_NO_CXX11)
+
+#include "boost/context/execution_context.hpp"
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+
+#if !defined(BOOST_NO_CXX11_THREAD_LOCAL)
+
+namespace detail {
+
+ecv1_activation_record::ptr_t &
+ecv1_activation_record::current() noexcept {
+ thread_local static ptr_t current;
+ return current;
+}
+
+// zero-initialization
+thread_local static std::size_t counter;
+
+// schwarz counter
+ecv1_activation_record_initializer::ecv1_activation_record_initializer() noexcept {
+ if ( 0 == counter++) {
+ ecv1_activation_record::current().reset( new ecv1_activation_record() );
+ }
+}
+
+ecv1_activation_record_initializer::~ecv1_activation_record_initializer() {
+ if ( 0 == --counter) {
+ BOOST_ASSERT( ecv1_activation_record::current()->is_main_context() );
+ delete ecv1_activation_record::current().detach();
+ }
+}
+
+}
+
+namespace v1 {
+
+execution_context
+execution_context::current() noexcept {
+ // initialized the first time control passes; per thread
+ thread_local static detail::ecv1_activation_record_initializer initializer;
+ return execution_context();
+}
+
+}
+
+#endif
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
+
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/fiber.cpp b/contrib/restricted/boost/libs/context/src/fiber.cpp
new file mode 100644
index 0000000000..9bb4ba6e03
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/fiber.cpp
@@ -0,0 +1,58 @@
+
+// Copyright Oliver Kowalke 2017.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#if defined(BOOST_USE_UCONTEXT)
+#include "boost/context/fiber_ucontext.hpp"
+#elif defined(BOOST_USE_WINFIB)
+#include "boost/context/fiber_winfib.hpp"
+#endif
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace boost {
+namespace context {
+namespace detail {
+
+// zero-initialization
+thread_local fiber_activation_record * current_rec;
+thread_local static std::size_t counter;
+
+// schwarz counter
+fiber_activation_record_initializer::fiber_activation_record_initializer() noexcept {
+ if ( 0 == counter++) {
+ current_rec = new fiber_activation_record();
+ }
+}
+
+fiber_activation_record_initializer::~fiber_activation_record_initializer() {
+ if ( 0 == --counter) {
+ BOOST_ASSERT( current_rec->is_main_context() );
+ delete current_rec;
+ }
+}
+
+}
+
+namespace detail {
+
+fiber_activation_record *&
+fiber_activation_record::current() noexcept {
+ // initialized the first time control passes; per thread
+ thread_local static fiber_activation_record_initializer initializer;
+ return current_rec;
+}
+
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
diff --git a/contrib/restricted/boost/libs/context/src/untested.cpp b/contrib/restricted/boost/libs/context/src/untested.cpp
new file mode 100644
index 0000000000..d6e20868c5
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/untested.cpp
@@ -0,0 +1,7 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#error "! code for this platform is untested - please remove this file from build/Jamfile.v2 and report the test-result on boost-track !"
diff --git a/contrib/restricted/boost/libs/context/src/windows/stack_traits.cpp b/contrib/restricted/boost/libs/context/src/windows/stack_traits.cpp
new file mode 100644
index 0000000000..14016b1b3a
--- /dev/null
+++ b/contrib/restricted/boost/libs/context/src/windows/stack_traits.cpp
@@ -0,0 +1,116 @@
+
+// Copyright Oliver Kowalke 2014.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include "boost/context/stack_traits.hpp"
+
+extern "C" {
+#include <windows.h>
+}
+
+//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L
+
+#include <algorithm>
+#include <cmath>
+#include <cstddef>
+#include <cstring>
+#include <stdexcept>
+
+#include <boost/assert.hpp>
+#include <boost/context/detail/config.hpp>
+#if defined(BOOST_NO_CXX11_HDR_MUTEX)
+# include <boost/thread.hpp>
+#else
+# include <mutex>
+#endif
+
+#include <boost/context/stack_context.hpp>
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+ || defined(__amd64__) || defined(__amd64) \
+ || defined(_M_X64) || defined(_M_AMD64)
+
+// Windows seams not to provide a constant or function
+// telling the minimal stacksize
+# define MIN_STACKSIZE 8 * 1024
+#else
+# define MIN_STACKSIZE 4 * 1024
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace {
+
+void system_info_( SYSTEM_INFO * si) BOOST_NOEXCEPT_OR_NOTHROW {
+ ::GetSystemInfo( si);
+}
+
+SYSTEM_INFO system_info() BOOST_NOEXCEPT_OR_NOTHROW {
+ static SYSTEM_INFO si;
+#if defined(BOOST_NO_CXX11_HDR_MUTEX)
+ static boost::once_flag flag = BOOST_ONCE_INIT;
+ boost::call_once( flag, static_cast< void(*)( SYSTEM_INFO *) >( system_info_), & si);
+#else
+ static std::once_flag flag;
+ std::call_once( flag, static_cast< void(*)( SYSTEM_INFO *) >( system_info_), & si);
+#endif
+ return si;
+}
+
+std::size_t pagesize() BOOST_NOEXCEPT_OR_NOTHROW {
+ return static_cast< std::size_t >( system_info().dwPageSize);
+}
+
+}
+
+namespace boost {
+namespace context {
+
+// Windows seams not to provide a limit for the stacksize
+// libcoco uses 32k+4k bytes as minimum
+BOOST_CONTEXT_DECL
+bool
+stack_traits::is_unbounded() BOOST_NOEXCEPT_OR_NOTHROW {
+ return true;
+}
+
+BOOST_CONTEXT_DECL
+std::size_t
+stack_traits::page_size() BOOST_NOEXCEPT_OR_NOTHROW {
+ return pagesize();
+}
+
+BOOST_CONTEXT_DECL
+std::size_t
+stack_traits::default_size() BOOST_NOEXCEPT_OR_NOTHROW {
+ return 128 * 1024;
+}
+
+// because Windows seams not to provide a limit for minimum stacksize
+BOOST_CONTEXT_DECL
+std::size_t
+stack_traits::minimum_size() BOOST_NOEXCEPT_OR_NOTHROW {
+ return MIN_STACKSIZE;
+}
+
+// because Windows seams not to provide a limit for maximum stacksize
+// maximum_size() can never be called (pre-condition ! is_unbounded() )
+BOOST_CONTEXT_DECL
+std::size_t
+stack_traits::maximum_size() BOOST_NOEXCEPT_OR_NOTHROW {
+ BOOST_ASSERT( ! is_unbounded() );
+ return 1 * 1024 * 1024 * 1024; // 1GB
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
diff --git a/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..e36f8b9042
--- /dev/null
+++ b/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt
@@ -0,0 +1,36 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp
new file mode 100644
index 0000000000..bdf417a745
--- /dev/null
+++ b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp
@@ -0,0 +1,114 @@
+
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include "boost/coroutine/stack_traits.hpp"
+
+extern "C" {
+#include <windows.h>
+}
+
+//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L
+
+#include <algorithm>
+#include <cmath>
+#include <cstddef>
+#include <cstring>
+#include <stdexcept>
+
+#include <boost/assert.hpp>
+#include <boost/coroutine/detail/config.hpp>
+#include <boost/thread.hpp>
+
+#include <boost/coroutine/stack_context.hpp>
+
+// x86_64
+// test x86_64 before i386 because icc might
+// define __i686__ for x86_64 too
+#if defined(__x86_64__) || defined(__x86_64) \
+ || defined(__amd64__) || defined(__amd64) \
+ || defined(_M_X64) || defined(_M_AMD64)
+
+// Windows seams not to provide a constant or function
+// telling the minimal stacksize
+# define MIN_STACKSIZE 8 * 1024
+#else
+# define MIN_STACKSIZE 4 * 1024
+#endif
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_PREFIX
+#endif
+
+namespace {
+
+void system_info_( SYSTEM_INFO * si)
+{ ::GetSystemInfo( si); }
+
+SYSTEM_INFO system_info()
+{
+ static SYSTEM_INFO si;
+ static boost::once_flag flag;
+ boost::call_once( flag, static_cast< void(*)( SYSTEM_INFO *) >( system_info_), & si);
+ return si;
+}
+
+std::size_t pagesize()
+{ return static_cast< std::size_t >( system_info().dwPageSize); }
+
+std::size_t page_count( std::size_t stacksize)
+{
+ return static_cast< std::size_t >(
+ std::floor(
+ static_cast< float >( stacksize) / pagesize() ) );
+}
+
+}
+
+namespace boost {
+namespace coroutines {
+
+// Windows seams not to provide a limit for the stacksize
+// libcoco uses 32k+4k bytes as minimum
+bool
+stack_traits::is_unbounded() BOOST_NOEXCEPT
+{ return true; }
+
+std::size_t
+stack_traits::page_size() BOOST_NOEXCEPT
+{ return pagesize(); }
+
+std::size_t
+stack_traits::default_size() BOOST_NOEXCEPT
+{
+ std::size_t size = 64 * 1024; // 64 kB
+ if ( is_unbounded() )
+ return (std::max)( size, minimum_size() );
+
+ BOOST_ASSERT( maximum_size() >= minimum_size() );
+ return maximum_size() == minimum_size()
+ ? minimum_size()
+ : ( std::min)( size, maximum_size() );
+}
+
+// because Windows seams not to provide a limit for minimum stacksize
+std::size_t
+stack_traits::minimum_size() BOOST_NOEXCEPT
+{ return MIN_STACKSIZE; }
+
+// because Windows seams not to provide a limit for maximum stacksize
+// maximum_size() can never be called (pre-condition ! is_unbounded() )
+std::size_t
+stack_traits::maximum_size() BOOST_NOEXCEPT
+{
+ BOOST_ASSERT( ! is_unbounded() );
+ return 1 * 1024 * 1024 * 1024; // 1GB
+}
+
+}}
+
+#ifdef BOOST_HAS_ABI_HEADERS
+# include BOOST_ABI_SUFFIX
+#endif
diff --git a/contrib/restricted/boost/libs/date_time/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/date_time/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..06ca92039d
--- /dev/null
+++ b/contrib/restricted/boost/libs/date_time/.yandex_meta/licenses.list.txt
@@ -0,0 +1,50 @@
+====================BSL-1.0====================
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+
+
+====================COPYRIGHT====================
+/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
+ * Subject to the Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ * Author: Jeff Garland, Bart Garst
+ * $Date$
+
+
+====================COPYRIGHT====================
+/* Copyright (c) 2002-2005 CrystalClear Software, Inc.
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/date_time/src/gregorian/gregorian_types.cpp b/contrib/restricted/boost/libs/date_time/src/gregorian/gregorian_types.cpp
new file mode 100644
index 0000000000..7dd7f22bfc
--- /dev/null
+++ b/contrib/restricted/boost/libs/date_time/src/gregorian/gregorian_types.cpp
@@ -0,0 +1,62 @@
+/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ * Author: Jeff Garland
+ * $Date$
+ */
+
+
+/** @defgroup date_basics Date Basics
+ This page summarizes some of the key user types and functions needed
+ to write programs using the gregorian date system. This is not a
+ comprehensive list, but rather some key types to start exploring.
+
+
+**/
+
+/** @defgroup date_alg Date Algorithms / Generators
+ Date algorithms or generators are tools for generating other dates or
+ schedules of dates. A generator function starts with some part of a
+ date such as a month and day and is supplied another part to then
+ generate a final date.
+
+**/
+
+/** @defgroup date_format Date Formatting
+ The functions on these page are some of the key formatting functions
+ for dates.
+**/
+
+
+//File doesn't have a current purpose except to generate docs
+//and keep it changeable without recompiles
+/*! @example days_alive.cpp
+ Calculate the number of days you have been living using durations and dates.
+*/
+/*! @example days_till_new_year.cpp
+ Calculate the number of days till new years
+*/
+/*! @example print_month.cpp
+ Simple utility to print out days of the month with the days of a month. Demontstrates date iteration (date_time::date_itr).
+*/
+/*! @example localization.cpp
+ An example showing localized stream-based I/O.
+*/
+/*! @example dates_as_strings.cpp
+ Various parsing and output of strings (mostly supported for
+ compilers that do not support localized streams).
+*/
+/*! @example period_calc.cpp
+ Calculates if a date is in an 'irregular' collection of periods using
+ period calculation functions.
+*/
+/*! @example print_holidays.cpp
+ This is an example of using functors to define a holiday schedule
+ */
+/*! @example localization.cpp
+ Demonstrates the use of facets to localize date output for Gregorian dates.
+ */
+
+
+
diff --git a/contrib/restricted/boost/libs/date_time/src/posix_time/posix_time_types.cpp b/contrib/restricted/boost/libs/date_time/src/posix_time/posix_time_types.cpp
new file mode 100644
index 0000000000..4395301040
--- /dev/null
+++ b/contrib/restricted/boost/libs/date_time/src/posix_time/posix_time_types.cpp
@@ -0,0 +1,35 @@
+
+/* Copyright (c) 2002-2004 CrystalClear Software, Inc.
+ * Use, modification and distribution is subject to the
+ * Boost Software License, Version 1.0. (See accompanying
+ * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+ * Author: Jeff Garland
+ * $Date$
+ */
+
+
+//File doesn't have a current purpose except to generate docs
+//and keep it changeable without recompiles
+
+/** @defgroup time_basics Time Basics
+
+**/
+
+/** @defgroup time_format Time Formatting
+
+**/
+
+
+
+/*! @example local_utc_conversion.cpp
+ Demonstrate utc to local and local to utc calculations including dst.
+*/
+/*! @example time_periods.cpp Demonstrate some simple uses of time periods.
+*/
+/*! @example print_hours.cpp Demonstrate time iteration, clock retrieval, and simple calculation.
+ */
+/*! @example time_math.cpp Various types of calculations with times and time durations.
+ */
+
+
+
diff --git a/contrib/restricted/boost/libs/exception/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/exception/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..ef636c0de3
--- /dev/null
+++ b/contrib/restricted/boost/libs/exception/.yandex_meta/licenses.list.txt
@@ -0,0 +1,33 @@
+====================BSL-1.0====================
+//Distributed under the Boost Software License, Version 1.0. (See accompanying
+//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/filesystem/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/filesystem/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..65af627257
--- /dev/null
+++ b/contrib/restricted/boost/libs/filesystem/.yandex_meta/licenses.list.txt
@@ -0,0 +1,80 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
+// at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright 2002-2005 Beman Dawes
+// Use, modification, and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy
+
+
+====================COPYRIGHT====================
+// Copyright 2002-2009, 2014 Beman Dawes
+// Copyright 2001 Dietmar Kuehl
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2008
+// Copyright Vicente J. Botet Escriba 2009
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2008, 2009
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2009
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2010
+
+
+====================COPYRIGHT====================
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/iostreams/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/iostreams/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..49ffba18e1
--- /dev/null
+++ b/contrib/restricted/boost/libs/iostreams/.yandex_meta/licenses.list.txt
@@ -0,0 +1,67 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2005-2007 Jonathan Turkanis
+// (C) Copyright Jonathan Graehl 2004.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Jorge Lodos 2008.
+// (C) Copyright Jonathan Turkanis 2003.
+// (C) Copyright Craig Henderson 2002. 'boost/memmap.hpp' from sandbox
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Milan Svoboda 2008.
+// Originally developed under the fusecompress project.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================COPYRIGHT====================
+// (C) Copyright Thorsten Ottosen 2005
+// (C) Copyright Howard Hinnant 2004
+// (C) Copyright Jonathan Turkanis 2004
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/iostreams/CMakeLists.txt b/contrib/restricted/boost/libs/iostreams/CMakeLists.txt
index e8c98bfd99..97368e369c 100644
--- a/contrib/restricted/boost/libs/iostreams/CMakeLists.txt
+++ b/contrib/restricted/boost/libs/iostreams/CMakeLists.txt
@@ -6,6 +6,6 @@
# original buildsystem will not be accepted.
-if (UNIX AND NOT APPLE)
+if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
include(CMakeLists.linux.txt)
endif()
diff --git a/contrib/restricted/boost/libs/iostreams/src/bzip2.cpp b/contrib/restricted/boost/libs/iostreams/src/bzip2.cpp
new file mode 100644
index 0000000000..af80cd2f94
--- /dev/null
+++ b/contrib/restricted/boost/libs/iostreams/src/bzip2.cpp
@@ -0,0 +1,168 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// To configure Boost to work with libbz2, see the
+// installation instructions here:
+// http://boost.org/libs/iostreams/doc/index.html?path=7
+
+// Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp>
+// knows that we are building the library (possibly exporting code), rather
+// than using it (possibly importing code).
+#define BOOST_IOSTREAMS_SOURCE
+
+#include <boost/throw_exception.hpp>
+#include <boost/iostreams/detail/config/dyn_link.hpp>
+#include <boost/iostreams/filter/bzip2.hpp>
+#include "bzlib.h" // Julian Seward's "bzip.h" header.
+ // To configure Boost to work with libbz2, see the
+ // installation instructions here:
+ // http://boost.org/libs/iostreams/doc/index.html?path=7
+
+namespace boost { namespace iostreams {
+
+namespace bzip2 {
+
+ // Status codes
+
+const int ok = BZ_OK;
+const int run_ok = BZ_RUN_OK;
+const int flush_ok = BZ_FLUSH_OK;
+const int finish_ok = BZ_FINISH_OK;
+const int stream_end = BZ_STREAM_END;
+const int sequence_error = BZ_SEQUENCE_ERROR;
+const int param_error = BZ_PARAM_ERROR;
+const int mem_error = BZ_MEM_ERROR;
+const int data_error = BZ_DATA_ERROR;
+const int data_error_magic = BZ_DATA_ERROR_MAGIC;
+const int io_error = BZ_IO_ERROR;
+const int unexpected_eof = BZ_UNEXPECTED_EOF;
+const int outbuff_full = BZ_OUTBUFF_FULL;
+const int config_error = BZ_CONFIG_ERROR;
+
+ // Action codes
+
+const int finish = BZ_FINISH;
+const int run = BZ_RUN;
+
+} // End namespace bzip2.
+
+//------------------Implementation of bzip2_error-----------------------------//
+
+bzip2_error::bzip2_error(int error)
+ : BOOST_IOSTREAMS_FAILURE("bzip2 error"), error_(error)
+ { }
+
+void bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error)
+{
+ switch (error) {
+ case BZ_OK:
+ case BZ_RUN_OK:
+ case BZ_FLUSH_OK:
+ case BZ_FINISH_OK:
+ case BZ_STREAM_END:
+ return;
+ case BZ_MEM_ERROR:
+ boost::throw_exception(std::bad_alloc());
+ default:
+ boost::throw_exception(bzip2_error(error));
+ }
+}
+
+//------------------Implementation of bzip2_base------------------------------//
+
+namespace detail {
+
+bzip2_base::bzip2_base(const bzip2_params& params)
+ : params_(params), stream_(new bz_stream), ready_(false)
+ { }
+
+bzip2_base::~bzip2_base() { delete static_cast<bz_stream*>(stream_); }
+
+void bzip2_base::before( const char*& src_begin, const char* src_end,
+ char*& dest_begin, char* dest_end )
+{
+ bz_stream* s = static_cast<bz_stream*>(stream_);
+ s->next_in = const_cast<char*>(src_begin);
+ s->avail_in = static_cast<unsigned>(src_end - src_begin);
+ s->next_out = reinterpret_cast<char*>(dest_begin);
+ s->avail_out= static_cast<unsigned>(dest_end - dest_begin);
+}
+
+void bzip2_base::after(const char*& src_begin, char*& dest_begin)
+{
+ bz_stream* s = static_cast<bz_stream*>(stream_);
+ src_begin = const_cast<char*>(s->next_in);
+ dest_begin = s->next_out;
+}
+
+int bzip2_base::check_end(const char* src_begin, const char* dest_begin)
+{
+ bz_stream* s = static_cast<bz_stream*>(stream_);
+ if( src_begin == s->next_in &&
+ s->avail_in == 0 &&
+ dest_begin == s->next_out) {
+ return bzip2::unexpected_eof;
+ } else {
+ return bzip2::ok;
+ }
+}
+
+void bzip2_base::end(bool compress)
+{
+ if(!ready_) return;
+ ready_ = false;
+ bz_stream* s = static_cast<bz_stream*>(stream_);
+ bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+ compress ?
+ BZ2_bzCompressEnd(s) :
+ BZ2_bzDecompressEnd(s)
+ );
+}
+
+int bzip2_base::compress(int action)
+{
+ return BZ2_bzCompress(static_cast<bz_stream*>(stream_), action);
+}
+
+int bzip2_base::decompress()
+{
+ return BZ2_bzDecompress(static_cast<bz_stream*>(stream_));
+}
+
+void bzip2_base::do_init
+ ( bool compress,
+ bzip2::alloc_func /* alloc */,
+ bzip2::free_func /* free */,
+ void* derived )
+{
+ bz_stream* s = static_cast<bz_stream*>(stream_);
+
+ // Current interface for customizing memory management
+ // is non-conforming and has been disabled:
+ // s->bzalloc = alloc;
+ // s->bzfree = free;
+ s->bzalloc = 0;
+ s->bzfree = 0;
+ s->opaque = derived;
+ bzip2_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+ compress ?
+ BZ2_bzCompressInit( s,
+ params_.block_size,
+ 0,
+ params_.work_factor ) :
+ BZ2_bzDecompressInit( s,
+ 0,
+ params_.small )
+ );
+ ready_ = true;
+}
+
+} // End namespace detail.
+
+//----------------------------------------------------------------------------//
+
+} } // End namespaces iostreams, boost.
diff --git a/contrib/restricted/boost/libs/iostreams/src/lzma.cpp b/contrib/restricted/boost/libs/iostreams/src/lzma.cpp
new file mode 100644
index 0000000000..5d7bb3cfbd
--- /dev/null
+++ b/contrib/restricted/boost/libs/iostreams/src/lzma.cpp
@@ -0,0 +1,147 @@
+// (C) Copyright Milan Svoboda 2008.
+// Originally developed under the fusecompress project.
+// Based on bzip2.cpp by:
+// (C) Copyright Jonathan Turkanis 2003.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// Define BOOST_IOSTREAMS_SOURCE so that <boost/iostreams/detail/config.hpp>
+// knows that we are building the library (possibly exporting code), rather
+// than using it (possibly importing code).
+#define BOOST_IOSTREAMS_SOURCE
+
+#include <lzma.h>
+
+#include <boost/throw_exception.hpp>
+#include <boost/iostreams/detail/config/dyn_link.hpp>
+#include <boost/iostreams/filter/lzma.hpp>
+
+namespace boost { namespace iostreams {
+
+namespace lzma {
+
+ // Compression levels
+
+const uint32_t no_compression = 0;
+const uint32_t best_speed = 1;
+const uint32_t best_compression = 9;
+const uint32_t default_compression = 2;
+
+ // Status codes
+
+const int okay = LZMA_OK;
+const int stream_end = LZMA_STREAM_END;
+const int unsupported_check = LZMA_UNSUPPORTED_CHECK;
+const int mem_error = LZMA_MEM_ERROR;
+const int options_error = LZMA_OPTIONS_ERROR;
+const int data_error = LZMA_DATA_ERROR;
+const int buf_error = LZMA_BUF_ERROR;
+const int prog_error = LZMA_PROG_ERROR;
+
+ // Flush codes
+
+const int finish = LZMA_FINISH;
+const int full_flush = LZMA_FULL_FLUSH;
+const int sync_flush = LZMA_SYNC_FLUSH;
+const int run = LZMA_RUN;
+
+ // Code for current OS
+
+} // End namespace lzma.
+
+//------------------Implementation of lzma_error------------------------------//
+
+lzma_error::lzma_error(int error)
+ : BOOST_IOSTREAMS_FAILURE("lzma error"), error_(error)
+ { }
+
+void lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(int error)
+{
+ switch (error) {
+ case LZMA_OK:
+ case LZMA_STREAM_END:
+ return;
+ case LZMA_MEM_ERROR:
+ boost::throw_exception(std::bad_alloc());
+ default:
+ boost::throw_exception(lzma_error(error));
+ }
+}
+
+//------------------Implementation of lzma_base-------------------------------//
+
+namespace detail {
+
+lzma_base::lzma_base()
+ : stream_(new lzma_stream)
+ { }
+
+lzma_base::~lzma_base() { delete static_cast<lzma_stream*>(stream_); }
+
+void lzma_base::before( const char*& src_begin, const char* src_end,
+ char*& dest_begin, char* dest_end )
+{
+ lzma_stream* s = static_cast<lzma_stream*>(stream_);
+ s->next_in = reinterpret_cast<uint8_t*>(const_cast<char*>(src_begin));
+ s->avail_in = static_cast<size_t>(src_end - src_begin);
+ s->next_out = reinterpret_cast<uint8_t*>(dest_begin);
+ s->avail_out= static_cast<size_t>(dest_end - dest_begin);
+}
+
+void lzma_base::after(const char*& src_begin, char*& dest_begin, bool)
+{
+ lzma_stream* s = static_cast<lzma_stream*>(stream_);
+ src_begin = const_cast<const char*>(reinterpret_cast<const char*>(s->next_in));
+ dest_begin = reinterpret_cast<char*>(s->next_out);
+}
+
+int lzma_base::deflate(int action)
+{
+ return lzma_code(static_cast<lzma_stream*>(stream_), static_cast<lzma_action>(action));
+}
+
+int lzma_base::inflate(int action)
+{
+ return lzma_code(static_cast<lzma_stream*>(stream_), static_cast<lzma_action>(action));
+}
+
+void lzma_base::reset(bool compress, bool realloc)
+{
+ lzma_stream* s = static_cast<lzma_stream*>(stream_);
+ lzma_end(s);
+ if (realloc)
+ {
+ memset(s, 0, sizeof(*s));
+
+ lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+ compress ?
+ lzma_easy_encoder(s, level, LZMA_CHECK_CRC32) :
+ lzma_stream_decoder(s, 100 * 1024 * 1024, LZMA_CONCATENATED)
+ );
+ }
+}
+
+void lzma_base::do_init
+ ( const lzma_params& p, bool compress,
+ lzma::alloc_func, lzma::free_func,
+ void* )
+{
+ lzma_stream* s = static_cast<lzma_stream*>(stream_);
+
+ memset(s, 0, sizeof(*s));
+
+ level = p.level;
+ lzma_error::check BOOST_PREVENT_MACRO_SUBSTITUTION(
+ compress ?
+ lzma_easy_encoder(s, p.level, LZMA_CHECK_CRC32) :
+ lzma_stream_decoder(s, 100 * 1024 * 1024, LZMA_CONCATENATED)
+ );
+}
+
+} // End namespace detail.
+
+//----------------------------------------------------------------------------//
+
+} } // End namespaces iostreams, boost.
diff --git a/contrib/restricted/boost/libs/locale/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/locale/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..43e19a74a4
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/.yandex_meta/licenses.list.txt
@@ -0,0 +1,38 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2009-2015 Artyom Beilis (Tonkikh)
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/locale/src/win32/all_generator.hpp b/contrib/restricted/boost/libs/locale/src/win32/all_generator.hpp
new file mode 100644
index 0000000000..083d056272
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/all_generator.hpp
@@ -0,0 +1,45 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#ifndef BOOST_LOCALE_IMPL_WIN32_ALL_GENERATOR_HPP
+#define BOOST_LOCALE_IMPL_WIN32_ALL_GENERATOR_HPP
+
+#include <boost/locale/generator.hpp>
+#include <vector>
+#include <locale.h>
+
+namespace boost {
+ namespace locale {
+ namespace impl_win {
+
+ class winlocale;
+
+ std::locale create_convert( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type);
+
+ std::locale create_collate( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type);
+
+ std::locale create_formatting( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type);
+
+ std::locale create_parsing( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type);
+
+ std::locale create_codecvt( std::locale const &in,
+ character_facet_type type);
+
+ }
+ }
+}
+
+#endif
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/locale/src/win32/api.hpp b/contrib/restricted/boost/libs/locale/src/win32/api.hpp
new file mode 100644
index 0000000000..a41fbde5e6
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/api.hpp
@@ -0,0 +1,357 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#ifndef BOOST_LOCALE_IMPL_WIN32_API_HPP
+#define BOOST_LOCALE_IMPL_WIN32_API_HPP
+
+#include <string>
+#include <vector>
+#include <sstream>
+#include <iomanip>
+#include <limits>
+#include <ctime>
+
+#include "lcid.hpp"
+
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#ifndef UNICODE
+#define UNICODE
+#endif
+#include <windows.h>
+
+#include <boost/locale/conversion.hpp>
+#include <boost/locale/collator.hpp>
+
+#define BOOST_LOCALE_WINDOWS_2000_API
+
+#if defined(_WIN32_NT) && _WIN32_NT >= 0x600 && !defined(BOOST_LOCALE_WINDOWS_2000_API)
+#define BOOST_LOCALE_WINDOWS_VISTA_API
+#else
+#define BOOST_LOCALE_WINDOWS_2000_API
+#endif
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+
+ struct numeric_info {
+ std::wstring thousands_sep;
+ std::wstring decimal_point;
+ std::string grouping;
+ };
+
+ inline DWORD collation_level_to_flag(collator_base::level_type level)
+ {
+ DWORD flags;
+ switch(level) {
+ case collator_base::primary:
+ flags = NORM_IGNORESYMBOLS | NORM_IGNORECASE | NORM_IGNORENONSPACE;
+ break;
+ case collator_base::secondary:
+ flags = NORM_IGNORESYMBOLS | NORM_IGNORECASE;
+ break;
+ case collator_base::tertiary:
+ flags = NORM_IGNORESYMBOLS;
+ break;
+ default:
+ flags = 0;
+ }
+ return flags;
+ }
+
+
+
+ #ifdef BOOST_LOCALE_WINDOWS_2000_API
+
+ class winlocale{
+ public:
+ winlocale() :
+ lcid(0)
+ {
+ }
+
+ winlocale(std::string const &name)
+ {
+ lcid = locale_to_lcid(name);
+ }
+
+ unsigned lcid;
+
+ bool is_c() const
+ {
+ return lcid == 0;
+ }
+ };
+
+
+ ////////////////////////////////////////////////////////////////////////
+ ///
+ /// Number Format
+ ///
+ ////////////////////////////////////////////////////////////////////////
+
+ inline numeric_info wcsnumformat_l(winlocale const &l)
+ {
+ numeric_info res;
+ res.decimal_point = L'.';
+ unsigned lcid = l.lcid;
+
+ if(lcid == 0)
+ return res;
+
+ // limits according to MSDN
+ static const int th_size = 4;
+ static const int de_size = 4;
+ static const int gr_size = 10;
+
+ wchar_t th[th_size]={0};
+ wchar_t de[de_size]={0};
+ wchar_t gr[gr_size]={0};
+
+ if( GetLocaleInfoW(lcid,LOCALE_STHOUSAND,th,th_size)==0
+ || GetLocaleInfoW(lcid,LOCALE_SDECIMAL ,de,de_size)==0
+ || GetLocaleInfoW(lcid,LOCALE_SGROUPING,gr,gr_size)==0)
+ {
+ return res;
+ }
+ res.decimal_point = de;
+ res.thousands_sep = th;
+ bool inf_group = false;
+ for(unsigned i=0;gr[i];i++) {
+ if(gr[i]==L';')
+ continue;
+ if(L'1'<= gr[i] && gr[i]<=L'9') {
+ res.grouping += char(gr[i]-L'0');
+ }
+ else if(gr[i]==L'0')
+ inf_group = true;
+ }
+ if(!inf_group) {
+ if(std::numeric_limits<char>::is_signed) {
+ res.grouping+=std::numeric_limits<char>::min();
+ }
+ else {
+ res.grouping+=std::numeric_limits<char>::max();
+ }
+ }
+ return res;
+ }
+
+ inline std::wstring win_map_string_l(unsigned flags,wchar_t const *begin,wchar_t const *end,winlocale const &l)
+ {
+ std::wstring res;
+ int len = LCMapStringW(l.lcid,flags,begin,end-begin,0,0);
+ if(len == 0)
+ return res;
+ std::vector<wchar_t> buf(len+1);
+ int l2 = LCMapStringW(l.lcid,flags,begin,end-begin,&buf.front(),buf.size());
+ res.assign(&buf.front(),l2);
+ return res;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ ///
+ /// Collation
+ ///
+ ////////////////////////////////////////////////////////////////////////
+
+
+ inline int wcscoll_l( collator_base::level_type level,
+ wchar_t const *lb,wchar_t const *le,
+ wchar_t const *rb,wchar_t const *re,
+ winlocale const &l)
+ {
+ return CompareStringW(l.lcid,collation_level_to_flag(level),lb,le-lb,rb,re-rb) - 2;
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////
+ ///
+ /// Money Format
+ ///
+ ////////////////////////////////////////////////////////////////////////
+
+ inline std::wstring wcsfmon_l(double value,winlocale const &l)
+ {
+ std::wostringstream ss;
+ ss.imbue(std::locale::classic());
+
+ ss << std::setprecision(std::numeric_limits<double>::digits10+1) << value;
+ std::wstring sval = ss.str();
+ int len = GetCurrencyFormatW(l.lcid,0,sval.c_str(),0,0,0);
+ std::vector<wchar_t> buf(len+1);
+ GetCurrencyFormatW(l.lcid,0,sval.c_str(),0,&buf.front(),len);
+ return &buf.front();
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ ///
+ /// Time Format
+ ///
+ ////////////////////////////////////////////////////////////////////////
+
+
+ inline std::wstring wcs_format_date_l(wchar_t const *format,SYSTEMTIME const *tm,winlocale const &l)
+ {
+ int len = GetDateFormatW(l.lcid,0,tm,format,0,0);
+ std::vector<wchar_t> buf(len+1);
+ GetDateFormatW(l.lcid,0,tm,format,&buf.front(),len);
+ return &buf.front();
+ }
+
+ inline std::wstring wcs_format_time_l(wchar_t const *format,SYSTEMTIME const *tm,winlocale const &l)
+ {
+ int len = GetTimeFormatW(l.lcid,0,tm,format,0,0);
+ std::vector<wchar_t> buf(len+1);
+ GetTimeFormatW(l.lcid,0,tm,format,&buf.front(),len);
+ return &buf.front();
+ }
+
+ inline std::wstring wcsfold(wchar_t const *begin,wchar_t const *end)
+ {
+ winlocale l;
+ l.lcid = 0x0409; // en-US
+ return win_map_string_l(LCMAP_LOWERCASE,begin,end,l);
+ }
+
+ inline std::wstring wcsnormalize(norm_type norm,wchar_t const *begin,wchar_t const *end)
+ {
+ // We use FoldString, under Vista it actually does normalization;
+ // under XP and below it does something similar, half job, better then nothing
+ unsigned flags = 0;
+ switch(norm) {
+ case norm_nfd:
+ flags = MAP_COMPOSITE;
+ break;
+ case norm_nfc:
+ flags = MAP_PRECOMPOSED;
+ break;
+ case norm_nfkd:
+ flags = MAP_FOLDCZONE;
+ break;
+ case norm_nfkc:
+ flags = MAP_FOLDCZONE | MAP_COMPOSITE;
+ break;
+ default:
+ flags = MAP_PRECOMPOSED;
+ }
+
+ int len = FoldStringW(flags,begin,end-begin,0,0);
+ if(len == 0)
+ return std::wstring();
+ std::vector<wchar_t> v(len+1);
+ len = FoldStringW(flags,begin,end-begin,&v.front(),len+1);
+ return std::wstring(&v.front(),len);
+ }
+
+
+ #endif
+
+ inline std::wstring wcsxfrm_l(collator_base::level_type level,wchar_t const *begin,wchar_t const *end,winlocale const &l)
+ {
+ int flag = LCMAP_SORTKEY | collation_level_to_flag(level);
+
+ return win_map_string_l(flag,begin,end,l);
+ }
+
+ inline std::wstring towupper_l(wchar_t const *begin,wchar_t const *end,winlocale const &l)
+ {
+ return win_map_string_l(LCMAP_UPPERCASE | LCMAP_LINGUISTIC_CASING,begin,end,l);
+ }
+
+ inline std::wstring towlower_l(wchar_t const *begin,wchar_t const *end,winlocale const &l)
+ {
+ return win_map_string_l(LCMAP_LOWERCASE | LCMAP_LINGUISTIC_CASING,begin,end,l);
+ }
+
+ inline std::wstring wcsftime_l(char c,std::tm const *tm,winlocale const &l)
+ {
+ SYSTEMTIME wtm=SYSTEMTIME();
+ wtm.wYear = tm->tm_year + 1900;
+ wtm.wMonth = tm->tm_mon+1;
+ wtm.wDayOfWeek = tm->tm_wday;
+ wtm.wDay = tm->tm_mday;
+ wtm.wHour = tm->tm_hour;
+ wtm.wMinute = tm->tm_min;
+ wtm.wSecond = tm->tm_sec;
+ switch(c) {
+ case 'a': // Abbr Weekday
+ return wcs_format_date_l(L"ddd",&wtm,l);
+ case 'A': // Full Weekday
+ return wcs_format_date_l(L"dddd",&wtm,l);
+ case 'b': // Abbr Month
+ return wcs_format_date_l(L"MMM",&wtm,l);
+ case 'B': // Full Month
+ return wcs_format_date_l(L"MMMM",&wtm,l);
+ case 'c': // DateTile Full
+ return wcs_format_date_l(0,&wtm,l) + L" " + wcs_format_time_l(0,&wtm,l);
+ // not supported by WIN ;(
+ // case 'C': // Century -> 1980 -> 19
+ // retur
+ case 'd': // Day of Month [01,31]
+ return wcs_format_date_l(L"dd",&wtm,l);
+ case 'D': // %m/%d/%y
+ return wcs_format_date_l(L"MM/dd/yy",&wtm,l);
+ case 'e': // Day of Month [1,31]
+ return wcs_format_date_l(L"d",&wtm,l);
+ case 'h': // == b
+ return wcs_format_date_l(L"MMM",&wtm,l);
+ case 'H': // 24 clock hour 00,23
+ return wcs_format_time_l(L"HH",&wtm,l);
+ case 'I': // 12 clock hour 01,12
+ return wcs_format_time_l(L"hh",&wtm,l);
+ /*
+ case 'j': // day of year 001,366
+ return "D";*/
+ case 'm': // month as [01,12]
+ return wcs_format_date_l(L"MM",&wtm,l);
+ case 'M': // minute [00,59]
+ return wcs_format_time_l(L"mm",&wtm,l);
+ case 'n': // \n
+ return L"\n";
+ case 'p': // am-pm
+ return wcs_format_time_l(L"tt",&wtm,l);
+ case 'r': // time with AM/PM %I:%M:%S %p
+ return wcs_format_time_l(L"hh:mm:ss tt",&wtm,l);
+ case 'R': // %H:%M
+ return wcs_format_time_l(L"HH:mm",&wtm,l);
+ case 'S': // second [00,61]
+ return wcs_format_time_l(L"ss",&wtm,l);
+ case 't': // \t
+ return L"\t";
+ case 'T': // %H:%M:%S
+ return wcs_format_time_l(L"HH:mm:ss",&wtm,l);
+/* case 'u': // weekday 1,7 1=Monday
+ case 'U': // week number of year [00,53] Sunday first
+ case 'V': // week number of year [01,53] Moday first
+ case 'w': // weekday 0,7 0=Sunday
+ case 'W': // week number of year [00,53] Moday first, */
+ case 'x': // Date
+ return wcs_format_date_l(0,&wtm,l);
+ case 'X': // Time
+ return wcs_format_time_l(0,&wtm,l);
+ case 'y': // Year [00-99]
+ return wcs_format_date_l(L"yy",&wtm,l);
+ case 'Y': // Year 1998
+ return wcs_format_date_l(L"yyyy",&wtm,l);
+ case '%': // %
+ return L"%";
+ default:
+ return L"";
+ }
+ }
+
+
+
+} // win
+} // locale
+} // boost
+#endif
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
+
diff --git a/contrib/restricted/boost/libs/locale/src/win32/collate.cpp b/contrib/restricted/boost/libs/locale/src/win32/collate.cpp
new file mode 100644
index 0000000000..40e8c3d217
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/collate.cpp
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#define BOOST_LOCALE_SOURCE
+#include <locale>
+#include <string>
+#include <ios>
+#include <boost/locale/encoding.hpp>
+#include <boost/locale/generator.hpp>
+#include "api.hpp"
+#include "../shared/mo_hash.hpp"
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+
+class utf8_collator : public collator<char> {
+public:
+ utf8_collator(winlocale lc,size_t refs = 0) :
+ collator<char>(refs),
+ lc_(lc)
+ {
+ }
+ virtual int do_compare(collator_base::level_type level,char const *lb,char const *le,char const *rb,char const *re) const
+ {
+ std::wstring l=conv::to_utf<wchar_t>(lb,le,"UTF-8");
+ std::wstring r=conv::to_utf<wchar_t>(rb,re,"UTF-8");
+ return wcscoll_l(level,l.c_str(),l.c_str()+l.size(),r.c_str(),r.c_str()+r.size(),lc_);
+ }
+ virtual long do_hash(collator_base::level_type level,char const *b,char const *e) const
+ {
+ std::string key = do_transform(level,b,e);
+ return gnu_gettext::pj_winberger_hash_function(key.c_str(),key.c_str() + key.size());
+ }
+ virtual std::string do_transform(collator_base::level_type level,char const *b,char const *e) const
+ {
+ std::wstring tmp=conv::to_utf<wchar_t>(b,e,"UTF-8");
+ std::wstring wkey = wcsxfrm_l(level,tmp.c_str(),tmp.c_str()+tmp.size(),lc_);
+ std::string key;
+ if(sizeof(wchar_t)==2)
+ key.reserve(wkey.size()*2);
+ else
+ key.reserve(wkey.size()*3);
+ for(unsigned i=0;i<wkey.size();i++) {
+ if(sizeof(wchar_t)==2) {
+ uint16_t tv = static_cast<uint16_t>(wkey[i]);
+ key += char(tv >> 8);
+ key += char(tv & 0xFF);
+ }
+ else { // 4
+ uint32_t tv = static_cast<uint32_t>(wkey[i]);
+ // 21 bit
+ key += char((tv >> 16) & 0xFF);
+ key += char((tv >> 8) & 0xFF);
+ key += char(tv & 0xFF);
+ }
+ }
+ return key;
+ }
+private:
+ winlocale lc_;
+};
+
+
+class utf16_collator : public collator<wchar_t> {
+public:
+ typedef std::collate<wchar_t> wfacet;
+ utf16_collator(winlocale lc,size_t refs = 0) :
+ collator<wchar_t>(refs),
+ lc_(lc)
+ {
+ }
+ virtual int do_compare(collator_base::level_type level,wchar_t const *lb,wchar_t const *le,wchar_t const *rb,wchar_t const *re) const
+ {
+ return wcscoll_l(level,lb,le,rb,re,lc_);
+ }
+ virtual long do_hash(collator_base::level_type level,wchar_t const *b,wchar_t const *e) const
+ {
+ std::wstring key = do_transform(level,b,e);
+ char const *begin = reinterpret_cast<char const *>(key.c_str());
+ char const *end = begin + key.size()*sizeof(wchar_t);
+ return gnu_gettext::pj_winberger_hash_function(begin,end);
+ }
+ virtual std::wstring do_transform(collator_base::level_type level,wchar_t const *b,wchar_t const *e) const
+ {
+ return wcsxfrm_l(level,b,e,lc_);
+ }
+private:
+ winlocale lc_;
+};
+
+
+std::locale create_collate( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type)
+{
+ if(lc.is_c()) {
+ switch(type) {
+ case char_facet:
+ return std::locale(in,new std::collate_byname<char>("C"));
+ case wchar_t_facet:
+ return std::locale(in,new std::collate_byname<wchar_t>("C"));
+ }
+ }
+ else {
+ switch(type) {
+ case char_facet:
+ return std::locale(in,new utf8_collator(lc));
+ case wchar_t_facet:
+ return std::locale(in,new utf16_collator(lc));
+ }
+ }
+ return in;
+}
+
+
+} // impl_std
+} // locale
+} //boost
+
+
+
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/locale/src/win32/converter.cpp b/contrib/restricted/boost/libs/locale/src/win32/converter.cpp
new file mode 100644
index 0000000000..fffb0c7b8a
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/converter.cpp
@@ -0,0 +1,106 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#define BOOST_LOCALE_SOURCE
+
+#include <locale>
+#include <stdexcept>
+#include <boost/locale/generator.hpp>
+#include <boost/locale/conversion.hpp>
+#include <boost/locale/encoding.hpp>
+#include <vector>
+#include <string.h>
+#include "api.hpp"
+#include "all_generator.hpp"
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+
+class utf16_converter : public converter<wchar_t>
+{
+public:
+ utf16_converter(winlocale const &lc,size_t refs = 0) :
+ converter<wchar_t>(refs),
+ lc_(lc)
+ {
+ }
+ virtual std::wstring convert(converter_base::conversion_type how,wchar_t const *begin,wchar_t const *end,int flags = 0) const
+ {
+ switch(how) {
+ case converter_base::upper_case:
+ return towupper_l(begin,end,lc_);
+ case converter_base::lower_case:
+ return towlower_l(begin,end,lc_);
+ case converter_base::case_folding:
+ return wcsfold(begin,end);
+ case converter_base::normalization:
+ return wcsnormalize(static_cast<norm_type>(flags),begin,end);
+ default:
+ return std::wstring(begin,end-begin);
+ }
+ }
+private:
+ winlocale lc_;
+};
+
+class utf8_converter : public converter<char> {
+public:
+ utf8_converter(winlocale const &lc,size_t refs = 0) :
+ converter<char>(refs),
+ lc_(lc)
+ {
+ }
+ virtual std::string convert(converter_base::conversion_type how,char const *begin,char const *end,int flags = 0) const
+ {
+ std::wstring tmp = conv::to_utf<wchar_t>(begin,end,"UTF-8");
+ wchar_t const *wb=tmp.c_str();
+ wchar_t const *we=wb+tmp.size();
+
+ std::wstring res;
+
+ switch(how) {
+ case upper_case:
+ res = towupper_l(wb,we,lc_);
+ break;
+ case lower_case:
+ res = towlower_l(wb,we,lc_);
+ break;
+ case case_folding:
+ res = wcsfold(wb,we);
+ break;
+ case normalization:
+ res = wcsnormalize(static_cast<norm_type>(flags),wb,we);
+ break;
+ default:
+ res = tmp; // make gcc happy
+ }
+ return conv::from_utf(res,"UTF-8");
+ }
+private:
+ winlocale lc_;
+};
+
+std::locale create_convert( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type)
+{
+ switch(type) {
+ case char_facet:
+ return std::locale(in,new utf8_converter(lc));
+ case wchar_t_facet:
+ return std::locale(in,new utf16_converter(lc));
+ default:
+ return in;
+ }
+}
+
+
+} // namespace impl_win32
+} // locale
+} // boost
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/locale/src/win32/lcid.cpp b/contrib/restricted/boost/libs/locale/src/win32/lcid.cpp
new file mode 100644
index 0000000000..67542e6c6b
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/lcid.cpp
@@ -0,0 +1,127 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#define BOOST_LOCALE_SOURCE
+#include "lcid.hpp"
+#include <string.h>
+#include <string>
+#include <sstream>
+#include <map>
+
+#include "../util/locale_data.hpp"
+
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#include <windows.h>
+
+#include <boost/thread/mutex.hpp>
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+
+typedef std::map<std::string,unsigned> table_type;
+
+static table_type * volatile table = 0;
+
+boost::mutex &lcid_table_mutex()
+{
+ static boost::mutex m;
+ return m;
+}
+
+table_type &real_lcid_table()
+{
+ static table_type table;
+ return table;
+}
+
+BOOL CALLBACK proc(char *s)
+{
+ table_type &tbl = real_lcid_table();
+ try {
+ std::istringstream ss;
+ ss.str(s);
+ ss >> std::hex;
+
+ unsigned lcid ;
+ ss >>lcid;
+ if(ss.fail() || !ss.eof()) {
+ return FALSE;
+ }
+
+ char iso_639_lang[16];
+ char iso_3166_country[16];
+ if(GetLocaleInfoA(lcid,LOCALE_SISO639LANGNAME,iso_639_lang,sizeof(iso_639_lang))==0)
+ return FALSE;
+ std::string lc_name = iso_639_lang;
+ if(GetLocaleInfoA(lcid,LOCALE_SISO3166CTRYNAME,iso_3166_country,sizeof(iso_3166_country))!=0) {
+ lc_name += "_";
+ lc_name += iso_3166_country;
+ }
+ table_type::iterator p = tbl.find(lc_name);
+ if(p!=tbl.end()) {
+ if(p->second > lcid)
+ p->second = lcid;
+ }
+ else {
+ tbl[lc_name]=lcid;
+ }
+ }
+ catch(...) {
+ tbl.clear();
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+table_type const &get_ready_lcid_table()
+{
+ if(table)
+ return *table;
+ else {
+ boost::unique_lock<boost::mutex> lock(lcid_table_mutex());
+ if(table)
+ return *table;
+ EnumSystemLocalesA(proc,LCID_INSTALLED);
+ table = &real_lcid_table();
+ return *table;
+ }
+}
+
+unsigned locale_to_lcid(std::string const &locale_name)
+{
+ if(locale_name.empty()) {
+ return LOCALE_USER_DEFAULT;
+ }
+ boost::locale::util::locale_data d;
+ d.parse(locale_name);
+ std::string id = d.language;
+
+ if(!d.country.empty()) {
+ id+="_"+d.country;
+ }
+ if(!d.variant.empty()) {
+ id+="@" + d.variant;
+ }
+
+ table_type const &tbl = get_ready_lcid_table();
+ table_type::const_iterator p = tbl.find(id);
+
+ unsigned lcid = 0;
+ if(p!=tbl.end())
+ lcid = p->second;
+ return lcid;
+}
+
+
+} // impl_win
+} // locale
+} // boost
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/locale/src/win32/numeric.cpp b/contrib/restricted/boost/libs/locale/src/win32/numeric.cpp
new file mode 100644
index 0000000000..00bc94fd6d
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/numeric.cpp
@@ -0,0 +1,245 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#define BOOST_LOCALE_SOURCE
+#include <locale>
+#include <string>
+#include <ios>
+#include <boost/locale/formatting.hpp>
+#include <boost/locale/generator.hpp>
+#include <boost/locale/encoding.hpp>
+#include <boost/shared_ptr.hpp>
+#include <sstream>
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <wctype.h>
+#include <ctype.h>
+
+#include "all_generator.hpp"
+#include "api.hpp"
+#include "../util/numeric.hpp"
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+ namespace {
+
+ std::ostreambuf_iterator<wchar_t> write_it(std::ostreambuf_iterator<wchar_t> out,std::wstring const &s)
+ {
+ for(size_t i=0;i<s.size();i++)
+ *out++ = s[i];
+ return out;
+ }
+
+ std::ostreambuf_iterator<char> write_it(std::ostreambuf_iterator<char> out,std::wstring const &s)
+ {
+ std::string tmp = conv::from_utf(s,"UTF-8");
+ for(size_t i=0;i<tmp.size();i++)
+ *out++ = tmp[i];
+ return out;
+ }
+ }
+
+
+template<typename CharType>
+class num_format : public util::base_num_format<CharType>
+{
+public:
+ typedef typename std::num_put<CharType>::iter_type iter_type;
+ typedef std::basic_string<CharType> string_type;
+ typedef CharType char_type;
+
+ num_format(winlocale const &lc,size_t refs = 0) :
+ util::base_num_format<CharType>(refs),
+ lc_(lc)
+ {
+ }
+private:
+
+ virtual
+ iter_type do_format_currency(bool /*intl*/,iter_type out,std::ios_base &ios,char_type fill,long double val) const
+ {
+ if(lc_.is_c()) {
+ std::locale loc = ios.getloc();
+ int digits = std::use_facet<std::moneypunct<char_type> >(loc).frac_digits();
+ while(digits > 0) {
+ val*=10;
+ digits --;
+ }
+ std::ios_base::fmtflags f=ios.flags();
+ ios.flags(f | std::ios_base::showbase);
+ out = std::use_facet<std::money_put<char_type> >(loc).put(out,false,ios,fill,val);
+ ios.flags(f);
+ return out;
+ }
+ else {
+ std::wstring cur = wcsfmon_l(val,lc_);
+ return write_it(out,cur);
+ }
+ }
+
+private:
+ winlocale lc_;
+
+}; /// num_format
+
+template<typename CharType>
+class time_put_win : public std::time_put<CharType> {
+public:
+ time_put_win(winlocale const &lc, size_t refs = 0) :
+ std::time_put<CharType>(refs),
+ lc_(lc)
+ {
+ }
+ virtual ~time_put_win()
+ {
+ }
+ typedef typename std::time_put<CharType>::iter_type iter_type;
+ typedef CharType char_type;
+ typedef std::basic_string<char_type> string_type;
+
+ virtual iter_type do_put( iter_type out,
+ std::ios_base &/*ios*/,
+ CharType /*fill*/,
+ std::tm const *tm,
+ char format,
+ char /*modifier*/) const
+ {
+ return write_it(out,wcsftime_l(format,tm,lc_));
+ }
+
+private:
+ winlocale lc_;
+};
+
+
+template<typename CharType>
+class num_punct_win : public std::numpunct<CharType> {
+public:
+ typedef std::basic_string<CharType> string_type;
+ num_punct_win(winlocale const &lc,size_t refs = 0) :
+ std::numpunct<CharType>(refs)
+ {
+ numeric_info np = wcsnumformat_l(lc) ;
+ if(sizeof(CharType) == 1 && np.thousands_sep == L"\xA0")
+ np.thousands_sep=L" ";
+
+ to_str(np.thousands_sep,thousands_sep_);
+ to_str(np.decimal_point,decimal_point_);
+ grouping_ = np.grouping;
+ if(thousands_sep_.size() > 1)
+ grouping_ = std::string();
+ if(decimal_point_.size() > 1)
+ decimal_point_ = CharType('.');
+ }
+
+ void to_str(std::wstring &s1,std::wstring &s2)
+ {
+ s2.swap(s1);
+ }
+
+ void to_str(std::wstring &s1,std::string &s2)
+ {
+ s2=conv::from_utf(s1,"UTF-8");
+ }
+ virtual CharType do_decimal_point() const
+ {
+ return *decimal_point_.c_str();
+ }
+ virtual CharType do_thousands_sep() const
+ {
+ return *thousands_sep_.c_str();
+ }
+ virtual std::string do_grouping() const
+ {
+ return grouping_;
+ }
+ virtual string_type do_truename() const
+ {
+ static const char t[]="true";
+ return string_type(t,t+sizeof(t)-1);
+ }
+ virtual string_type do_falsename() const
+ {
+ static const char t[]="false";
+ return string_type(t,t+sizeof(t)-1);
+ }
+private:
+ string_type decimal_point_;
+ string_type thousands_sep_;
+ std::string grouping_;
+};
+
+template<typename CharType>
+std::locale create_formatting_impl(std::locale const &in,winlocale const &lc)
+{
+ if(lc.is_c()) {
+ std::locale tmp(in,new std::numpunct_byname<CharType>("C"));
+ tmp=std::locale(tmp,new std::time_put_byname<CharType>("C"));
+ tmp = std::locale(tmp,new num_format<CharType>(lc));
+ return tmp;
+ }
+ else {
+ std::locale tmp(in,new num_punct_win<CharType>(lc));
+ tmp = std::locale(tmp,new time_put_win<CharType>(lc));
+ tmp = std::locale(tmp,new num_format<CharType>(lc));
+ return tmp;
+ }
+}
+
+template<typename CharType>
+std::locale create_parsing_impl(std::locale const &in,winlocale const &lc)
+{
+ std::numpunct<CharType> *np = 0;
+ if(lc.is_c())
+ np = new std::numpunct_byname<CharType>("C");
+ else
+ np = new num_punct_win<CharType>(lc);
+ std::locale tmp(in,np);
+ tmp = std::locale(tmp,new util::base_num_parse<CharType>());
+ return tmp;
+}
+
+
+std::locale create_formatting( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type)
+{
+ switch(type) {
+ case char_facet:
+ return create_formatting_impl<char>(in,lc);
+ case wchar_t_facet:
+ return create_formatting_impl<wchar_t>(in,lc);
+ default:
+ return in;
+ }
+}
+
+std::locale create_parsing( std::locale const &in,
+ winlocale const &lc,
+ character_facet_type type)
+{
+ switch(type) {
+ case char_facet:
+ return create_parsing_impl<char>(in,lc);
+ case wchar_t_facet:
+ return create_parsing_impl<wchar_t>(in,lc);
+ default:
+ return in;
+ }
+}
+
+
+
+} // impl_std
+} // locale
+} //boost
+
+
+
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/locale/src/win32/win_backend.cpp b/contrib/restricted/boost/libs/locale/src/win32/win_backend.cpp
new file mode 100644
index 0000000000..cd9ec8375b
--- /dev/null
+++ b/contrib/restricted/boost/libs/locale/src/win32/win_backend.cpp
@@ -0,0 +1,153 @@
+//
+// Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+#define BOOST_LOCALE_SOURCE
+#include <boost/locale/localization_backend.hpp>
+#include <boost/locale/gnu_gettext.hpp>
+#include <boost/locale/info.hpp>
+#include "all_generator.hpp"
+#include "win_backend.hpp"
+#include <boost/locale/util.hpp>
+#include "../util/gregorian.hpp"
+#include "../util/locale_data.hpp"
+#include "api.hpp"
+#include <algorithm>
+#include <iterator>
+
+namespace boost {
+namespace locale {
+namespace impl_win {
+
+ class winapi_localization_backend : public localization_backend {
+ public:
+ winapi_localization_backend() :
+ invalid_(true)
+ {
+ }
+ winapi_localization_backend(winapi_localization_backend const &other) :
+ localization_backend(),
+ paths_(other.paths_),
+ domains_(other.domains_),
+ locale_id_(other.locale_id_),
+ invalid_(true)
+ {
+ }
+ virtual winapi_localization_backend *clone() const
+ {
+ return new winapi_localization_backend(*this);
+ }
+
+ void set_option(std::string const &name,std::string const &value)
+ {
+ invalid_ = true;
+ if(name=="locale")
+ locale_id_ = value;
+ else if(name=="message_path")
+ paths_.push_back(value);
+ else if(name=="message_application")
+ domains_.push_back(value);
+
+ }
+ void clear_options()
+ {
+ invalid_ = true;
+ locale_id_.clear();
+ paths_.clear();
+ domains_.clear();
+ }
+
+ void prepare_data()
+ {
+ if(!invalid_)
+ return;
+ invalid_ = false;
+ if(locale_id_.empty()) {
+ real_id_ = util::get_system_locale(true); // always UTF-8
+ lc_ = winlocale(real_id_);
+ }
+ else {
+ lc_=winlocale(locale_id_);
+ real_id_ = locale_id_;
+ }
+ util::locale_data d;
+ d.parse(real_id_);
+ if(!d.utf8) {
+ lc_ = winlocale();
+ // Make it C as non-UTF8 locales are not supported
+ }
+ }
+
+ virtual std::locale install(std::locale const &base,
+ locale_category_type category,
+ character_facet_type type = nochar_facet)
+ {
+ prepare_data();
+
+ switch(category) {
+ case convert_facet:
+ return create_convert(base,lc_,type);
+ case collation_facet:
+ return create_collate(base,lc_,type);
+ case formatting_facet:
+ return create_formatting(base,lc_,type);
+ case parsing_facet:
+ return create_parsing(base,lc_,type);
+ case calendar_facet:
+ {
+ util::locale_data inf;
+ inf.parse(real_id_);
+ return util::install_gregorian_calendar(base,inf.country);
+ }
+ case message_facet:
+ {
+ gnu_gettext::messages_info minf;
+ std::locale tmp=util::create_info(std::locale::classic(),real_id_);
+ boost::locale::info const &inf=std::use_facet<boost::locale::info>(tmp);
+ minf.language = inf.language();
+ minf.country = inf.country();
+ minf.variant = inf.variant();
+ minf.encoding = inf.encoding();
+ std::copy(domains_.begin(),domains_.end(),std::back_inserter<gnu_gettext::messages_info::domains_type>(minf.domains));
+ minf.paths = paths_;
+ switch(type) {
+ case char_facet:
+ return std::locale(base,gnu_gettext::create_messages_facet<char>(minf));
+ case wchar_t_facet:
+ return std::locale(base,gnu_gettext::create_messages_facet<wchar_t>(minf));
+ default:
+ return base;
+ }
+ }
+ case information_facet:
+ return util::create_info(base,real_id_);
+ case codepage_facet:
+ return util::create_utf8_codecvt(base,type);
+ default:
+ return base;
+ }
+ }
+
+ private:
+
+ std::vector<std::string> paths_;
+ std::vector<std::string> domains_;
+ std::string locale_id_;
+ std::string real_id_;
+
+ bool invalid_;
+ winlocale lc_;
+ };
+
+ localization_backend *create_localization_backend()
+ {
+ return new winapi_localization_backend();
+ }
+
+} // impl win
+} // locale
+} // boost
+// vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
diff --git a/contrib/restricted/boost/libs/log/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/log/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..977477afbc
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/.yandex_meta/licenses.list.txt
@@ -0,0 +1,66 @@
+====================BSL-1.0====================
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ Copyright Andrey Semashev 2007 - 2015.
+
+
+====================COPYRIGHT====================
+ * Copyright Lingxi Li 2015.
+ * Copyright Andrey Semashev 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ * Copyright Lingxi Li 2015.
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ * Copyright Andrey Semashev 2017.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ * Copyright Andrey Semashev 2007 - 2018.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/log/config/atomic-int32/atomic_int32.cpp b/contrib/restricted/boost/libs/log/config/atomic-int32/atomic_int32.cpp
new file mode 100644
index 0000000000..f39bcc8f5b
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/atomic-int32/atomic_int32.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <boost/atomic.hpp>
+
+#if !defined(BOOST_ATOMIC_INT32_LOCK_FREE) || (BOOST_ATOMIC_INT32_LOCK_FREE+0) != 2
+#error Boost.Log: Native 32-bit atomic operations are required but not supported by Boost.Atomic on the target platform
+#endif
+
+int main(int, char*[])
+{
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/native-syslog/native_syslog.cpp b/contrib/restricted/boost/libs/log/config/native-syslog/native_syslog.cpp
new file mode 100644
index 0000000000..25605a682e
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/native-syslog/native_syslog.cpp
@@ -0,0 +1,26 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <syslog.h>
+
+int main(int, char*[])
+{
+ ::openlog("test", LOG_NDELAY, LOG_USER);
+
+ ::syslog(LOG_USER | LOG_DEBUG, "debug message");
+ ::syslog(LOG_USER | LOG_INFO, "info message");
+ ::syslog(LOG_USER | LOG_NOTICE, "notice message");
+ ::syslog(LOG_USER | LOG_WARNING, "warning message");
+ ::syslog(LOG_USER | LOG_ERR, "error message");
+ ::syslog(LOG_USER | LOG_CRIT, "critical message");
+ ::syslog(LOG_USER | LOG_ALERT, "alert message");
+ ::syslog(LOG_USER | LOG_EMERG, "emergency message");
+
+ ::closelog();
+
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/pthread-mutex-robust/pthread_mutex_robust.cpp b/contrib/restricted/boost/libs/log/config/pthread-mutex-robust/pthread_mutex_robust.cpp
new file mode 100644
index 0000000000..36415aca02
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/pthread-mutex-robust/pthread_mutex_robust.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright Andrey Semashev 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <errno.h>
+#include <pthread.h>
+
+int main(int, char*[])
+{
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
+ pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST);
+
+ pthread_mutex_t m;
+ pthread_mutex_init(&m, &attr);
+ pthread_mutexattr_destroy(&attr);
+
+ int err = pthread_mutex_lock(&m);
+ if (err == EOWNERDEAD)
+ {
+ err = pthread_mutex_consistent(&m);
+ }
+
+ if (err != ENOTRECOVERABLE)
+ {
+ pthread_mutex_unlock(&m);
+ }
+
+ pthread_mutex_destroy(&m);
+
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/visibility/visibility.cpp b/contrib/restricted/boost/libs/log/config/visibility/visibility.cpp
new file mode 100644
index 0000000000..30f1a64335
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/visibility/visibility.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Guess what, MSVC doesn't ever fail on unknown options, even with /WX. Hence this additional check.
+#if !defined(__GNUC__)
+#error Visibility option is only supported by gcc and compatible compilers
+#endif
+
+int main(int, char*[])
+{
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/x86-ext/avx2.cpp b/contrib/restricted/boost/libs/log/config/x86-ext/avx2.cpp
new file mode 100644
index 0000000000..fcc1b9215e
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/x86-ext/avx2.cpp
@@ -0,0 +1,16 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <immintrin.h>
+
+int main(int, char*[])
+{
+ __m256i mm = _mm256_setzero_si256();
+ mm = _mm256_shuffle_epi8(_mm256_alignr_epi8(mm, mm, 10), mm);
+ _mm256_zeroupper();
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/x86-ext/ssse3.cpp b/contrib/restricted/boost/libs/log/config/x86-ext/ssse3.cpp
new file mode 100644
index 0000000000..f7bfb30847
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/x86-ext/ssse3.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+#include <tmmintrin.h>
+
+int main(int, char*[])
+{
+ __m128i mm = _mm_setzero_si128();
+ mm = _mm_shuffle_epi8(_mm_alignr_epi8(mm, mm, 10), mm);
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/config/xopen-source-600/xopen_source_600.cpp b/contrib/restricted/boost/libs/log/config/xopen-source-600/xopen_source_600.cpp
new file mode 100644
index 0000000000..1b26467c9b
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/config/xopen-source-600/xopen_source_600.cpp
@@ -0,0 +1,17 @@
+/*
+ * Copyright Andrey Semashev 2017.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+
+// Test if we can include system headers with -D_XOPEN_SOURCE=600
+#undef _XOPEN_SOURCE
+#define _XOPEN_SOURCE 600
+
+#include <unistd.h>
+
+int main(int, char*[])
+{
+ return 0;
+}
diff --git a/contrib/restricted/boost/libs/log/src/dump_avx2.cpp b/contrib/restricted/boost/libs/log/src/dump_avx2.cpp
new file mode 100644
index 0000000000..4ab12500fa
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/dump_avx2.cpp
@@ -0,0 +1,349 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file dump_avx2.cpp
+ * \author Andrey Semashev
+ * \date 05.05.2013
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+// NOTE: You should generally avoid including headers as much as possible here, because this file
+// is compiled with special compiler options, and any included header may result in generation of
+// unintended code with these options and violation of ODR.
+#include <boost/log/detail/config.hpp>
+#include <ostream>
+#include <immintrin.h>
+#include <boost/cstdint.hpp>
+#include <boost/log/detail/header.hpp>
+
+#if defined(__x86_64) || defined(__x86_64__) || \
+ defined(__amd64__) || defined(__amd64) || \
+ defined(_M_X64)
+#define BOOST_LOG_AUX_X86_64
+#endif
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+extern const char g_hex_char_table[2][16];
+
+template< typename CharT >
+extern void dump_data_generic(const void* data, std::size_t size, std::basic_ostream< CharT >& strm);
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+enum
+{
+ packs_per_stride = 32,
+ stride = packs_per_stride * 32
+};
+
+union ymm_constant
+{
+ uint8_t as_bytes[32];
+ __m256i as_mm;
+
+ BOOST_FORCEINLINE operator __m256i () const { return as_mm; }
+};
+
+static const ymm_constant mm_shuffle_pattern1 = {{ 0x80, 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 0x80, 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80 }};
+static const ymm_constant mm_shuffle_pattern2 = {{ 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10 }};
+static const ymm_constant mm_shuffle_pattern3 = {{ 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 11, 0x80, 12, 13, 0x80, 14, 15, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 11, 0x80, 12, 13, 0x80, 14, 15 }};
+static const ymm_constant mm_shuffle_pattern13 = {{ 0x80, 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 11, 0x80, 12, 13, 0x80, 14, 15 }};
+
+#if defined(BOOST_LOG_AUX_X86_64)
+
+// x86-64 architecture has more registers which we can utilize to pass constants
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL __m256i mm_15, __m256i mm_9, __m256i mm_char_0, __m256i mm_char_space,
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_15, mm_9, mm_char_0, mm_char_space,
+#define BOOST_LOG_AUX_MM_CONSTANTS \
+ const __m256i mm_15 = _mm256_set1_epi32(0x0F0F0F0F);\
+ const __m256i mm_9 = _mm256_set1_epi32(0x09090909);\
+ const __m256i mm_char_0 = _mm256_set1_epi32(0x30303030);\
+ const __m256i mm_char_space = _mm256_set1_epi32(0x20202020);
+
+#else
+
+// MSVC in 32-bit mode is not able to pass all constants to dump_pack, and is also not able to align them on the stack, so we have to fetch them from global constants
+static const ymm_constant mm_15 = {{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F }};
+static const ymm_constant mm_9 = {{ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }};
+static const ymm_constant mm_char_0 = {{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 }};
+static const ymm_constant mm_char_space = {{ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }};
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS
+#define BOOST_LOG_AUX_MM_CONSTANTS
+
+#endif
+
+/*!
+ * \brief Dumps a pack of input data into a string of 8 bit ASCII characters.
+ *
+ * The composed string is placed as follows (in Intel notation): mm_output1[127:0], mm_output2[127:0], mm_output3[127:0], mm_output1[255:128], mm_output2[255:128], mm_output3[255:128].
+ */
+static BOOST_FORCEINLINE void dump_pack
+(
+ BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL
+ __m256i mm_char_10_to_a, __m256i mm_input,
+ __m256i& mm_output1, __m256i& mm_output2, __m256i& mm_output3
+)
+{
+ // Split half-bytes
+ __m256i mm_input_hi = _mm256_and_si256(_mm256_srli_epi16(mm_input, 4), mm_15);
+ __m256i mm_input_lo = _mm256_and_si256(mm_input, mm_15);
+
+ // Stringize each of the halves
+ __m256i mm_addend_hi = _mm256_cmpgt_epi8(mm_input_hi, mm_9);
+ __m256i mm_addend_lo = _mm256_cmpgt_epi8(mm_input_lo, mm_9);
+ mm_addend_hi = _mm256_and_si256(mm_char_10_to_a, mm_addend_hi);
+ mm_addend_lo = _mm256_and_si256(mm_char_10_to_a, mm_addend_lo);
+
+ mm_input_hi = _mm256_add_epi8(mm_input_hi, mm_char_0);
+ mm_input_lo = _mm256_add_epi8(mm_input_lo, mm_char_0);
+
+ mm_input_hi = _mm256_add_epi8(mm_input_hi, mm_addend_hi);
+ mm_input_lo = _mm256_add_epi8(mm_input_lo, mm_addend_lo);
+
+ // Join them back together
+ __m256i mm_1 = _mm256_unpacklo_epi8(mm_input_hi, mm_input_lo);
+ __m256i mm_2 = _mm256_unpackhi_epi8(mm_input_hi, mm_input_lo);
+
+ // Insert spaces between stringized bytes:
+ // |0123456789abcdef|0123456789abcdef|
+ // | 01 23 45 67 89 |ab cd ef 01 23 4|5 67 89 ab cd ef|
+ __m256i mm_out1 = _mm256_shuffle_epi8(mm_1, mm_shuffle_pattern1.as_mm);
+ __m256i mm_out3 = _mm256_shuffle_epi8(mm_2, mm_shuffle_pattern3.as_mm);
+ __m256i mm_out2 = _mm256_shuffle_epi8(_mm256_alignr_epi8(mm_2, mm_1, 10), mm_shuffle_pattern2.as_mm);
+
+ mm_output1 = _mm256_max_epu8(mm_out1, mm_char_space);
+ mm_output2 = _mm256_max_epu8(mm_out2, mm_char_space);
+ mm_output3 = _mm256_max_epu8(mm_out3, mm_char_space);
+}
+
+//! Dumps a pack of input data into a string of 8 bit ASCII characters
+static BOOST_FORCEINLINE void dump_pack
+(
+ BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL
+ __m256i mm_char_10_to_a, __m128i mm_input,
+ __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3
+)
+{
+ // Split half-bytes
+ __m128i mm_input_hi = _mm_srli_epi16(mm_input, 4);
+ __m256i mm = _mm256_inserti128_si256(_mm256_castsi128_si256(_mm_unpacklo_epi8(mm_input_hi, mm_input)), _mm_unpackhi_epi8(mm_input_hi, mm_input), 1);
+ mm = _mm256_and_si256(mm, mm_15);
+
+ // Stringize the halves
+ __m256i mm_addend = _mm256_cmpgt_epi8(mm, mm_9);
+ mm_addend = _mm256_and_si256(mm_char_10_to_a, mm_addend);
+
+ mm = _mm256_add_epi8(mm, mm_char_0);
+ mm = _mm256_add_epi8(mm, mm_addend);
+
+ // Insert spaces between stringized bytes:
+ __m256i mm_out13 = _mm256_shuffle_epi8(mm, mm_shuffle_pattern13.as_mm);
+ __m128i mm_out2 = _mm_shuffle_epi8(_mm_alignr_epi8(_mm256_extracti128_si256(mm, 1), _mm256_castsi256_si128(mm), 10), _mm256_castsi256_si128(mm_shuffle_pattern2.as_mm));
+
+ mm_out13 = _mm256_max_epu8(mm_out13, mm_char_space);
+ mm_output2 = _mm_max_epu8(mm_out2, _mm256_castsi256_si128(mm_char_space));
+ mm_output1 = _mm256_castsi256_si128(mm_out13);
+ mm_output3 = _mm256_extracti128_si256(mm_out13, 1);
+}
+
+template< typename CharT >
+BOOST_FORCEINLINE void store_characters(__m128i mm_chars, CharT* buf)
+{
+ switch (sizeof(CharT))
+ {
+ case 1:
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf), mm_chars);
+ break;
+
+ case 2:
+ _mm256_store_si256(reinterpret_cast< __m256i* >(buf), _mm256_cvtepu8_epi16(mm_chars));
+ break;
+
+ case 4:
+ {
+ __m128i mm = _mm_unpackhi_epi64(mm_chars, mm_chars);
+ _mm256_store_si256(reinterpret_cast< __m256i* >(buf), _mm256_cvtepu8_epi32(mm_chars));
+ _mm256_store_si256(reinterpret_cast< __m256i* >(buf) + 1, _mm256_cvtepu8_epi32(mm));
+ }
+ break;
+ }
+}
+
+template< typename CharT >
+BOOST_FORCEINLINE void store_characters_x3(__m256i mm_chars1, __m256i mm_chars2, __m256i mm_chars3, CharT* buf)
+{
+ store_characters(_mm256_castsi256_si128(mm_chars1), buf);
+ store_characters(_mm256_castsi256_si128(mm_chars2), buf + 16);
+ store_characters(_mm256_castsi256_si128(mm_chars3), buf + 32);
+ store_characters(_mm256_extracti128_si256(mm_chars1, 1), buf + 48);
+ store_characters(_mm256_extracti128_si256(mm_chars2, 1), buf + 64);
+ store_characters(_mm256_extracti128_si256(mm_chars3, 1), buf + 80);
+}
+
+template< typename CharT >
+BOOST_FORCEINLINE void dump_data_avx2(const void* data, std::size_t size, std::basic_ostream< CharT >& strm)
+{
+ typedef CharT char_type;
+
+ char_type buf_storage[stride * 3u + 32u];
+ // Align the temporary buffer at 32 bytes
+ char_type* const buf = reinterpret_cast< char_type* >((uint8_t*)buf_storage + (32u - (((uintptr_t)(char_type*)buf_storage) & 31u)));
+ char_type* buf_begin = buf + 1u; // skip the first space of the first chunk
+ char_type* buf_end = buf + stride * 3u;
+
+ __m256i mm_char_10_to_a;
+ if (strm.flags() & std::ios_base::uppercase)
+ mm_char_10_to_a = _mm256_set1_epi32(0x07070707); // '9' is 0x39 and 'A' is 0x41 in ASCII, so we have to add 0x07 to 0x3A to get uppercase letters
+ else
+ mm_char_10_to_a = _mm256_set1_epi32(0x27272727); // ...and 'a' is 0x61, which means we have to add 0x27 to 0x3A to get lowercase letters
+
+ // First, check the input alignment. Also, if we can dump the whole data in one go, do it right away. It turns out to be faster than splitting
+ // the work between prealign and tail part. It is also a fairly common case since on most platforms memory is not aligned to 32 bytes (i.e. prealign is often needed).
+ const uint8_t* p = static_cast< const uint8_t* >(data);
+ const std::size_t prealign_size = size == 32u ? static_cast< std::size_t >(32u) : static_cast< std::size_t >((32u - ((uintptr_t)p & 31u)) & 31u);
+ if (prealign_size)
+ {
+ __m256i mm_input = _mm256_lddqu_si256(reinterpret_cast< const __m256i* >(p));
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ __m256i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters_x3(mm_output1, mm_output2, mm_output3, buf);
+
+ _mm256_zeroall(); // need to zero all ymm registers to avoid register spills/restores the compler generates around the function call
+ strm.write(buf_begin, prealign_size * 3u - 1u);
+
+ buf_begin = buf;
+ size -= prealign_size;
+ p += prealign_size;
+ }
+
+ const std::size_t stride_count = size / stride;
+ std::size_t tail_size = size % stride;
+ for (std::size_t i = 0; i < stride_count; ++i)
+ {
+ char_type* b = buf;
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ for (unsigned int j = 0; j < packs_per_stride; ++j, b += 3u * 32u, p += 32u)
+ {
+ __m256i mm_input = _mm256_load_si256(reinterpret_cast< const __m256i* >(p));
+ __m256i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters_x3(mm_output1, mm_output2, mm_output3, b);
+ }
+
+ _mm256_zeroall(); // need to zero all ymm registers to avoid register spills/restores the compler generates around the function call
+ strm.write(buf_begin, buf_end - buf_begin);
+ buf_begin = buf;
+ }
+
+ if (BOOST_UNLIKELY(tail_size > 0))
+ {
+ char_type* b = buf;
+ while (tail_size >= 16u)
+ {
+ __m128i mm_input = _mm_load_si128(reinterpret_cast< const __m128i* >(p));
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ __m128i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters(mm_output1, b);
+ store_characters(mm_output2, b + 16u);
+ store_characters(mm_output3, b + 32u);
+
+ b += 3u * 16u;
+ p += 16u;
+ tail_size -= 16u;
+ }
+
+ _mm256_zeroall(); // need to zero all ymm registers to avoid register spills/restores the compler generates around the function call
+ const char* const char_table = g_hex_char_table[(strm.flags() & std::ios_base::uppercase) != 0];
+ for (unsigned int i = 0; i < tail_size; ++i, ++p, b += 3u)
+ {
+ uint32_t n = *p;
+ b[0] = static_cast< char_type >(' ');
+ b[1] = static_cast< char_type >(char_table[n >> 4]);
+ b[2] = static_cast< char_type >(char_table[n & 0x0F]);
+ }
+
+ strm.write(buf_begin, b - buf_begin);
+ }
+}
+
+} // namespace
+
+void dump_data_char_avx2(const void* data, std::size_t size, std::basic_ostream< char >& strm)
+{
+ if (size >= 32)
+ {
+ dump_data_avx2(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+
+void dump_data_wchar_avx2(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm)
+{
+ if (size >= 32)
+ {
+ dump_data_avx2(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+void dump_data_char16_avx2(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm)
+{
+ if (size >= 32)
+ {
+ dump_data_avx2(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+#endif
+
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+void dump_data_char32_avx2(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm)
+{
+ if (size >= 32)
+ {
+ dump_data_avx2(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+#endif
+
+} // namespace aux
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/dump_ssse3.cpp b/contrib/restricted/boost/libs/log/src/dump_ssse3.cpp
new file mode 100644
index 0000000000..1325b49c04
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/dump_ssse3.cpp
@@ -0,0 +1,311 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file dump_ssse3.cpp
+ * \author Andrey Semashev
+ * \date 05.05.2013
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+// NOTE: You should generally avoid including headers as much as possible here, because this file
+// is compiled with special compiler options, and any included header may result in generation of
+// unintended code with these options and violation of ODR.
+#include <boost/log/detail/config.hpp>
+#include <ostream>
+#include <tmmintrin.h>
+#include <boost/cstdint.hpp>
+#include <boost/log/detail/header.hpp>
+
+#if defined(__x86_64) || defined(__x86_64__) || \
+ defined(__amd64__) || defined(__amd64) || \
+ defined(_M_X64)
+#define BOOST_LOG_AUX_X86_64
+#endif
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+extern const char g_hex_char_table[2][16];
+
+template< typename CharT >
+extern void dump_data_generic(const void* data, std::size_t size, std::basic_ostream< CharT >& strm);
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+enum
+{
+ packs_per_stride = 32,
+ stride = packs_per_stride * 16
+};
+
+union xmm_constant
+{
+ uint8_t as_bytes[16];
+ __m128i as_mm;
+
+ BOOST_FORCEINLINE operator __m128i () const { return as_mm; }
+};
+
+static const xmm_constant mm_shuffle_pattern1 = {{ 0x80, 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80 }};
+static const xmm_constant mm_shuffle_pattern2 = {{ 0, 1, 0x80, 2, 3, 0x80, 4, 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10 }};
+static const xmm_constant mm_shuffle_pattern3 = {{ 5, 0x80, 6, 7, 0x80, 8, 9, 0x80, 10, 11, 0x80, 12, 13, 0x80, 14, 15 }};
+
+#if defined(BOOST_LOG_AUX_X86_64)
+
+// x86-64 architecture has more registers which we can utilize to pass constants
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL __m128i mm_15, __m128i mm_9, __m128i mm_char_0, __m128i mm_char_space,
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_15, mm_9, mm_char_0, mm_char_space,
+#define BOOST_LOG_AUX_MM_CONSTANTS \
+ const __m128i mm_15 = _mm_set1_epi32(0x0F0F0F0F);\
+ const __m128i mm_9 = _mm_set1_epi32(0x09090909);\
+ const __m128i mm_char_0 = _mm_set1_epi32(0x30303030);\
+ const __m128i mm_char_space = _mm_set1_epi32(0x20202020);
+
+#else
+
+// MSVC in 32-bit mode is not able to pass all constants to dump_pack, and is also not able to align them on the stack, so we have to fetch them from global constants
+static const xmm_constant mm_15 = {{ 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F }};
+static const xmm_constant mm_9 = {{ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09 }};
+static const xmm_constant mm_char_0 = {{ 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 }};
+static const xmm_constant mm_char_space = {{ 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }};
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL
+#define BOOST_LOG_AUX_MM_CONSTANT_ARGS
+#define BOOST_LOG_AUX_MM_CONSTANTS
+
+#endif
+
+//! Dumps a pack of input data into a string of 8 bit ASCII characters
+static BOOST_FORCEINLINE void dump_pack
+(
+ BOOST_LOG_AUX_MM_CONSTANT_ARGS_DECL
+ __m128i mm_char_10_to_a, __m128i mm_input,
+ __m128i& mm_output1, __m128i& mm_output2, __m128i& mm_output3
+)
+{
+ // Split half-bytes
+ __m128i mm_input_hi = _mm_and_si128(_mm_srli_epi16(mm_input, 4), mm_15);
+ __m128i mm_input_lo = _mm_and_si128(mm_input, mm_15);
+
+ // Stringize each of the halves
+ __m128i mm_addend_hi = _mm_cmpgt_epi8(mm_input_hi, mm_9);
+ __m128i mm_addend_lo = _mm_cmpgt_epi8(mm_input_lo, mm_9);
+ mm_addend_hi = _mm_and_si128(mm_char_10_to_a, mm_addend_hi);
+ mm_addend_lo = _mm_and_si128(mm_char_10_to_a, mm_addend_lo);
+
+ mm_input_hi = _mm_add_epi8(mm_input_hi, mm_char_0);
+ mm_input_lo = _mm_add_epi8(mm_input_lo, mm_char_0);
+
+ mm_input_hi = _mm_add_epi8(mm_input_hi, mm_addend_hi);
+ mm_input_lo = _mm_add_epi8(mm_input_lo, mm_addend_lo);
+
+ // Join them back together
+ __m128i mm_1 = _mm_unpacklo_epi8(mm_input_hi, mm_input_lo);
+ __m128i mm_2 = _mm_unpackhi_epi8(mm_input_hi, mm_input_lo);
+
+ // Insert spaces between stringized bytes:
+ // |0123456789abcdef|0123456789abcdef|
+ // | 01 23 45 67 89 |ab cd ef 01 23 4|5 67 89 ab cd ef|
+ mm_output1 = _mm_shuffle_epi8(mm_1, mm_shuffle_pattern1.as_mm);
+ mm_output2 = _mm_shuffle_epi8(_mm_alignr_epi8(mm_2, mm_1, 10), mm_shuffle_pattern2.as_mm);
+ mm_output3 = _mm_shuffle_epi8(mm_2, mm_shuffle_pattern3.as_mm);
+
+ mm_output1 = _mm_max_epu8(mm_output1, mm_char_space);
+ mm_output2 = _mm_max_epu8(mm_output2, mm_char_space);
+ mm_output3 = _mm_max_epu8(mm_output3, mm_char_space);
+}
+
+template< typename CharT >
+BOOST_FORCEINLINE void store_characters(__m128i mm_chars, CharT* buf)
+{
+ switch (sizeof(CharT))
+ {
+ case 1:
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf), mm_chars);
+ break;
+
+ case 2:
+ {
+ __m128i mm_0 = _mm_setzero_si128();
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf), _mm_unpacklo_epi8(mm_chars, mm_0));
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf) + 1, _mm_unpackhi_epi8(mm_chars, mm_0));
+ }
+ break;
+
+ case 4:
+ {
+ __m128i mm_0 = _mm_setzero_si128();
+ __m128i mm = _mm_unpacklo_epi8(mm_chars, mm_0);
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf), _mm_unpacklo_epi16(mm, mm_0));
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf) + 1, _mm_unpackhi_epi16(mm, mm_0));
+ mm = _mm_unpackhi_epi8(mm_chars, mm_0);
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf) + 2, _mm_unpacklo_epi16(mm, mm_0));
+ _mm_store_si128(reinterpret_cast< __m128i* >(buf) + 3, _mm_unpackhi_epi16(mm, mm_0));
+ }
+ break;
+ }
+}
+
+template< typename CharT >
+BOOST_FORCEINLINE void dump_data_ssse3(const void* data, std::size_t size, std::basic_ostream< CharT >& strm)
+{
+ typedef CharT char_type;
+
+ char_type buf_storage[stride * 3u + 16u];
+ // Align the temporary buffer at 16 bytes
+ char_type* const buf = reinterpret_cast< char_type* >((uint8_t*)buf_storage + (16u - (((uintptr_t)(char_type*)buf_storage) & 15u)));
+ char_type* buf_begin = buf + 1u; // skip the first space of the first chunk
+ char_type* buf_end = buf + stride * 3u;
+
+ __m128i mm_char_10_to_a;
+ if (strm.flags() & std::ios_base::uppercase)
+ mm_char_10_to_a = _mm_set1_epi32(0x07070707); // '9' is 0x39 and 'A' is 0x41 in ASCII, so we have to add 0x07 to 0x3A to get uppercase letters
+ else
+ mm_char_10_to_a = _mm_set1_epi32(0x27272727); // ...and 'a' is 0x61, which means we have to add 0x27 to 0x3A to get lowercase letters
+
+ // First, check the input alignment
+ const uint8_t* p = static_cast< const uint8_t* >(data);
+ const std::size_t prealign_size = ((16u - ((uintptr_t)p & 15u)) & 15u);
+ if (BOOST_UNLIKELY(prealign_size > 0))
+ {
+ __m128i mm_input = _mm_lddqu_si128(reinterpret_cast< const __m128i* >(p));
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ __m128i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters(mm_output1, buf);
+ store_characters(mm_output2, buf + 16u);
+ store_characters(mm_output3, buf + 32u);
+
+ strm.write(buf_begin, prealign_size * 3u - 1u);
+
+ buf_begin = buf;
+ size -= prealign_size;
+ p += prealign_size;
+ }
+
+ const std::size_t stride_count = size / stride;
+ std::size_t tail_size = size % stride;
+ for (std::size_t i = 0; i < stride_count; ++i)
+ {
+ char_type* b = buf;
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ for (unsigned int j = 0; j < packs_per_stride; ++j, b += 3u * 16u, p += 16u)
+ {
+ __m128i mm_input = _mm_load_si128(reinterpret_cast< const __m128i* >(p));
+ __m128i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters(mm_output1, b);
+ store_characters(mm_output2, b + 16u);
+ store_characters(mm_output3, b + 32u);
+ }
+
+ strm.write(buf_begin, buf_end - buf_begin);
+ buf_begin = buf;
+ }
+
+ if (BOOST_UNLIKELY(tail_size > 0))
+ {
+ char_type* b = buf;
+ while (tail_size >= 16u)
+ {
+ __m128i mm_input = _mm_load_si128(reinterpret_cast< const __m128i* >(p));
+ BOOST_LOG_AUX_MM_CONSTANTS
+
+ __m128i mm_output1, mm_output2, mm_output3;
+ dump_pack(BOOST_LOG_AUX_MM_CONSTANT_ARGS mm_char_10_to_a, mm_input, mm_output1, mm_output2, mm_output3);
+
+ store_characters(mm_output1, b);
+ store_characters(mm_output2, b + 16u);
+ store_characters(mm_output3, b + 32u);
+
+ b += 3u * 16u;
+ p += 16u;
+ tail_size -= 16u;
+ }
+
+ const char* const char_table = g_hex_char_table[(strm.flags() & std::ios_base::uppercase) != 0];
+ for (unsigned int i = 0; i < tail_size; ++i, ++p, b += 3u)
+ {
+ uint32_t n = *p;
+ b[0] = static_cast< char_type >(' ');
+ b[1] = static_cast< char_type >(char_table[n >> 4]);
+ b[2] = static_cast< char_type >(char_table[n & 0x0F]);
+ }
+
+ strm.write(buf_begin, b - buf_begin);
+ }
+}
+
+} // namespace
+
+void dump_data_char_ssse3(const void* data, std::size_t size, std::basic_ostream< char >& strm)
+{
+ if (size >= 16)
+ {
+ dump_data_ssse3(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+
+void dump_data_wchar_ssse3(const void* data, std::size_t size, std::basic_ostream< wchar_t >& strm)
+{
+ if (size >= 16)
+ {
+ dump_data_ssse3(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+
+#if !defined(BOOST_NO_CXX11_CHAR16_T)
+void dump_data_char16_ssse3(const void* data, std::size_t size, std::basic_ostream< char16_t >& strm)
+{
+ if (size >= 16)
+ {
+ dump_data_ssse3(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+#endif
+
+#if !defined(BOOST_NO_CXX11_CHAR32_T)
+void dump_data_char32_ssse3(const void* data, std::size_t size, std::basic_ostream< char32_t >& strm)
+{
+ if (size >= 16)
+ {
+ dump_data_ssse3(data, size, strm);
+ }
+ else
+ {
+ dump_data_generic(data, size, strm);
+ }
+}
+#endif
+
+} // namespace aux
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/windows/auto_handle.hpp b/contrib/restricted/boost/libs/log/src/windows/auto_handle.hpp
new file mode 100644
index 0000000000..ebd01babd7
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/auto_handle.hpp
@@ -0,0 +1,79 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/auto_handle.hpp
+ * \author Andrey Semashev
+ * \date 07.03.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#ifndef BOOST_LOG_WINDOWS_AUTO_HANDLE_HPP_INCLUDED_
+#define BOOST_LOG_WINDOWS_AUTO_HANDLE_HPP_INCLUDED_
+
+#include <boost/log/detail/config.hpp>
+#include <boost/assert.hpp>
+#include <boost/winapi/handles.hpp>
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+namespace aux {
+
+//! A wrapper around a kernel object handle. Automatically closes the handle on destruction.
+class auto_handle
+{
+private:
+ boost::winapi::HANDLE_ m_handle;
+
+public:
+ explicit auto_handle(boost::winapi::HANDLE_ h = NULL) BOOST_NOEXCEPT : m_handle(h)
+ {
+ }
+
+ ~auto_handle() BOOST_NOEXCEPT
+ {
+ if (m_handle)
+ BOOST_VERIFY(boost::winapi::CloseHandle(m_handle) != 0);
+ }
+
+ void init(boost::winapi::HANDLE_ h) BOOST_NOEXCEPT
+ {
+ BOOST_ASSERT(m_handle == NULL);
+ m_handle = h;
+ }
+
+ boost::winapi::HANDLE_ get() const BOOST_NOEXCEPT { return m_handle; }
+ boost::winapi::HANDLE_* get_ptr() BOOST_NOEXCEPT { return &m_handle; }
+
+ void swap(auto_handle& that) BOOST_NOEXCEPT
+ {
+ boost::winapi::HANDLE_ h = m_handle;
+ m_handle = that.m_handle;
+ that.m_handle = h;
+ }
+
+ BOOST_DELETED_FUNCTION(auto_handle(auto_handle const&))
+ BOOST_DELETED_FUNCTION(auto_handle& operator=(auto_handle const&))
+};
+
+} // namespace aux
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_WINDOWS_AUTO_HANDLE_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/libs/log/src/windows/debug_output_backend.cpp b/contrib/restricted/boost/libs/log/src/windows/debug_output_backend.cpp
new file mode 100644
index 0000000000..105dd68f4c
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/debug_output_backend.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file debug_output_backend.cpp
+ * \author Andrey Semashev
+ * \date 08.11.2008
+ *
+ * \brief A logging sink backend that uses debugger output
+ */
+
+#ifndef BOOST_LOG_WITHOUT_DEBUG_OUTPUT
+
+#include <boost/log/detail/config.hpp>
+#include <string>
+#include <boost/log/sinks/debug_output_backend.hpp>
+#include <windows.h>
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace sinks {
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+#if defined(BOOST_LOG_USE_CHAR)
+ inline void output_debug_string(const char* str)
+ {
+ OutputDebugStringA(str);
+ }
+#endif // defined(BOOST_LOG_USE_CHAR)
+#if defined(BOOST_LOG_USE_WCHAR_T)
+ inline void output_debug_string(const wchar_t* str)
+ {
+ OutputDebugStringW(str);
+ }
+#endif // defined(BOOST_LOG_USE_WCHAR_T)
+
+} // namespace
+
+template< typename CharT >
+BOOST_LOG_API basic_debug_output_backend< CharT >::basic_debug_output_backend()
+{
+}
+
+template< typename CharT >
+BOOST_LOG_API basic_debug_output_backend< CharT >::~basic_debug_output_backend()
+{
+}
+
+//! The method puts the formatted message to the event log
+template< typename CharT >
+BOOST_LOG_API void basic_debug_output_backend< CharT >::consume(record_view const&, string_type const& formatted_message)
+{
+ output_debug_string(formatted_message.c_str());
+}
+
+#ifdef BOOST_LOG_USE_CHAR
+template class basic_debug_output_backend< char >;
+#endif
+#ifdef BOOST_LOG_USE_WCHAR_T
+template class basic_debug_output_backend< wchar_t >;
+#endif
+
+} // namespace sinks
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // !defined(BOOST_LOG_WITHOUT_DEBUG_OUTPUT)
diff --git a/contrib/restricted/boost/libs/log/src/windows/event_log_backend.cpp b/contrib/restricted/boost/libs/log/src/windows/event_log_backend.cpp
new file mode 100644
index 0000000000..a3382c8c51
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/event_log_backend.cpp
@@ -0,0 +1,635 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file event_log_backend.cpp
+ * \author Andrey Semashev
+ * \date 07.11.2008
+ *
+ * \brief A logging sink backend that uses Windows NT event log API
+ * for signalling application events.
+ */
+
+#ifndef BOOST_LOG_WITHOUT_EVENT_LOG
+
+#include <boost/log/detail/config.hpp>
+#include <string>
+#include <vector>
+#include <ostream>
+#include <stdexcept>
+#include <boost/scoped_array.hpp>
+#include <boost/system/windows_error.hpp>
+#include <boost/log/exceptions.hpp>
+#include <boost/log/sinks/event_log_backend.hpp>
+#include <boost/log/sinks/event_log_constants.hpp>
+#include <boost/log/utility/once_block.hpp>
+#include <boost/log/detail/cleanup_scope_guard.hpp>
+#include <boost/log/detail/attachable_sstream_buf.hpp>
+#include <boost/log/detail/code_conversion.hpp>
+#include <boost/log/utility/formatting_ostream.hpp>
+#include <windows.h>
+#include <psapi.h>
+#include "unique_ptr.hpp"
+#include "windows/event_log_registry.hpp"
+#include "windows/simple_event_log.h"
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace sinks {
+
+namespace event_log {
+
+ //! The function constructs log record level from an integer
+ BOOST_LOG_API event_type make_event_type(unsigned short lev)
+ {
+ switch (lev)
+ {
+ case success: return success;
+ case warning: return warning;
+ case error: return error;
+ default:
+ BOOST_THROW_EXCEPTION(std::out_of_range("Windows NT event type is out of range"));
+ BOOST_LOG_UNREACHABLE_RETURN(info);
+ case info: return info;
+ }
+ }
+
+} // namespace event_log
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+#ifdef BOOST_LOG_USE_CHAR
+ //! A simple forwarder to the ReportEvent API
+ inline BOOL report_event(
+ HANDLE hEventLog,
+ WORD wType,
+ WORD wCategory,
+ DWORD dwEventID,
+ PSID lpUserSid,
+ WORD wNumStrings,
+ DWORD dwDataSize,
+ const char** lpStrings,
+ LPVOID lpRawData)
+ {
+ return ReportEventA(hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
+ }
+ //! A simple forwarder to the GetModuleFileName API
+ inline DWORD get_module_file_name(HMODULE hModule, char* lpFilename, DWORD nSize)
+ {
+ return GetModuleFileNameA(hModule, lpFilename, nSize);
+ }
+ //! A simple forwarder to the RegisterEventSource API
+ inline HANDLE register_event_source(const char* lpUNCServerName, const char* lpSourceName)
+ {
+ return RegisterEventSourceA(lpUNCServerName, lpSourceName);
+ }
+ //! The function completes default source name for the sink backend
+ inline void complete_default_simple_event_log_source_name(std::string& name)
+ {
+ name += " simple event source";
+ }
+ //! The function completes default source name for the sink backend
+ inline void complete_default_event_log_source_name(std::string& name)
+ {
+ name += " event source";
+ }
+#endif // BOOST_LOG_USE_CHAR
+
+#ifdef BOOST_LOG_USE_WCHAR_T
+ //! A simple forwarder to the ReportEvent API
+ inline BOOL report_event(
+ HANDLE hEventLog,
+ WORD wType,
+ WORD wCategory,
+ DWORD dwEventID,
+ PSID lpUserSid,
+ WORD wNumStrings,
+ DWORD dwDataSize,
+ const wchar_t** lpStrings,
+ LPVOID lpRawData)
+ {
+ return ReportEventW(hEventLog, wType, wCategory, dwEventID, lpUserSid, wNumStrings, dwDataSize, lpStrings, lpRawData);
+ }
+ //! A simple forwarder to the GetModuleFileName API
+ inline DWORD get_module_file_name(HMODULE hModule, wchar_t* lpFilename, DWORD nSize)
+ {
+ return GetModuleFileNameW(hModule, lpFilename, nSize);
+ }
+ //! A simple forwarder to the RegisterEventSource API
+ inline HANDLE register_event_source(const wchar_t* lpUNCServerName, const wchar_t* lpSourceName)
+ {
+ return RegisterEventSourceW(lpUNCServerName, lpSourceName);
+ }
+ //! The function completes default source name for the sink backend
+ inline void complete_default_simple_event_log_source_name(std::wstring& name)
+ {
+ name += L" simple event source";
+ }
+ //! The function completes default source name for the sink backend
+ inline void complete_default_event_log_source_name(std::wstring& name)
+ {
+ name += L" event source";
+ }
+#endif // BOOST_LOG_USE_WCHAR_T
+
+ //! The function finds the handle for the current module
+ void init_self_module_handle(HMODULE& handle)
+ {
+ // Acquire all modules of the current process
+ HANDLE hProcess = GetCurrentProcess();
+ std::vector< HMODULE > modules;
+ DWORD module_count = 1024;
+ do
+ {
+ modules.resize(module_count, HMODULE(0));
+ BOOL res = EnumProcessModules(
+ hProcess,
+ &modules[0],
+ static_cast< DWORD >(modules.size() * sizeof(HMODULE)),
+ &module_count);
+ module_count /= sizeof(HMODULE);
+
+ if (!res)
+ {
+ DWORD err = GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not enumerate process modules", (err));
+ }
+ }
+ while (module_count > modules.size());
+ modules.resize(module_count, HMODULE(0));
+
+ // Now find the current module among them
+ void* p = (void*)&init_self_module_handle;
+ for (std::size_t i = 0, n = modules.size(); i < n; ++i)
+ {
+ MODULEINFO info;
+ if (!GetModuleInformation(hProcess, modules[i], &info, sizeof(info)))
+ {
+ DWORD err = GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not acquire module information", (err));
+ }
+
+ if (info.lpBaseOfDll <= p && (static_cast< unsigned char* >(info.lpBaseOfDll) + info.SizeOfImage) > p)
+ {
+ // Found it
+ handle = modules[i];
+ break;
+ }
+ }
+
+ if (!handle)
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not find self module information", (boost::system::windows_error::invalid_handle));
+ }
+
+ //! Retrieves the full name of the current module (be that dll or exe)
+ template< typename CharT >
+ std::basic_string< CharT > get_current_module_name()
+ {
+ static HMODULE hSelfModule = 0;
+
+ BOOST_LOG_ONCE_BLOCK()
+ {
+ init_self_module_handle(hSelfModule);
+ }
+
+ // Get the module file name
+ CharT buf[MAX_PATH];
+ DWORD size = get_module_file_name(hSelfModule, buf, sizeof(buf) / sizeof(*buf));
+ if (size == 0)
+ {
+ DWORD err = GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not get module file name", (err));
+ }
+
+ return std::basic_string< CharT >(buf, buf + size);
+ }
+
+} // namespace
+
+//////////////////////////////////////////////////////////////////////////
+// Simple event log backend implementation
+//////////////////////////////////////////////////////////////////////////
+//! Sink backend implementation
+template< typename CharT >
+struct basic_simple_event_log_backend< CharT >::implementation
+{
+ //! A handle for the registered event provider
+ HANDLE m_SourceHandle;
+ //! A level mapping functor
+ event_type_mapper_type m_LevelMapper;
+
+ implementation() : m_SourceHandle(0)
+ {
+ }
+};
+
+//! Default constructor. Registers event source Boost.Log <Boost version> in the Application log.
+template< typename CharT >
+BOOST_LOG_API basic_simple_event_log_backend< CharT >::basic_simple_event_log_backend()
+{
+ construct(log::aux::empty_arg_list());
+}
+
+//! Destructor
+template< typename CharT >
+BOOST_LOG_API basic_simple_event_log_backend< CharT >::~basic_simple_event_log_backend()
+{
+ DeregisterEventSource(m_pImpl->m_SourceHandle);
+ delete m_pImpl;
+}
+
+//! Constructs backend implementation
+template< typename CharT >
+BOOST_LOG_API void basic_simple_event_log_backend< CharT >::construct(
+ string_type const& target, string_type const& log_name, string_type const& source_name, event_log::registration_mode reg_mode)
+{
+ if (reg_mode != event_log::never)
+ {
+ aux::registry_params< char_type > reg_params;
+ reg_params.event_message_file = get_current_module_name< char_type >();
+ reg_params.types_supported = DWORD(
+ EVENTLOG_SUCCESS |
+ EVENTLOG_INFORMATION_TYPE |
+ EVENTLOG_WARNING_TYPE |
+ EVENTLOG_ERROR_TYPE);
+ aux::init_event_log_registry(log_name, source_name, reg_mode == event_log::forced, reg_params);
+ }
+
+ log::aux::unique_ptr< implementation > p(new implementation());
+
+ const char_type* target_unc = NULL;
+ if (!target.empty())
+ target_unc = target.c_str();
+
+ HANDLE hSource = register_event_source(target_unc, source_name.c_str());
+ if (!hSource)
+ {
+ const DWORD err = GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not register event source", (err));
+ }
+
+ p->m_SourceHandle = hSource;
+
+ m_pImpl = p.release();
+}
+
+//! Returns default log name
+template< typename CharT >
+BOOST_LOG_API typename basic_simple_event_log_backend< CharT >::string_type
+basic_simple_event_log_backend< CharT >::get_default_log_name()
+{
+ return aux::registry_traits< char_type >::make_default_log_name();
+}
+
+//! Returns default source name
+template< typename CharT >
+BOOST_LOG_API typename basic_simple_event_log_backend< CharT >::string_type
+basic_simple_event_log_backend< CharT >::get_default_source_name()
+{
+ string_type source_name = aux::registry_traits< char_type >::make_default_source_name();
+ complete_default_simple_event_log_source_name(source_name);
+ return source_name;
+}
+
+//! The method installs the function object that maps application severity levels to WinAPI event types
+template< typename CharT >
+BOOST_LOG_API void basic_simple_event_log_backend< CharT >::set_event_type_mapper(event_type_mapper_type const& mapper)
+{
+ m_pImpl->m_LevelMapper = mapper;
+}
+
+//! The method puts the formatted message to the event log
+template< typename CharT >
+BOOST_LOG_API void basic_simple_event_log_backend< CharT >::consume(record_view const& rec, string_type const& formatted_message)
+{
+ const char_type* message = formatted_message.c_str();
+ event_log::event_type evt_type = event_log::info;
+ if (!m_pImpl->m_LevelMapper.empty())
+ evt_type = m_pImpl->m_LevelMapper(rec);
+
+ DWORD event_id;
+ switch (evt_type)
+ {
+ case event_log::success:
+ event_id = BOOST_LOG_MSG_DEBUG; break;
+ case event_log::warning:
+ event_id = BOOST_LOG_MSG_WARNING; break;
+ case event_log::error:
+ event_id = BOOST_LOG_MSG_ERROR; break;
+ default:
+ event_id = BOOST_LOG_MSG_INFO; break;
+ }
+
+ report_event(
+ m_pImpl->m_SourceHandle, // Event log handle.
+ static_cast< WORD >(evt_type), // Event type.
+ 0, // Event category.
+ event_id, // Event identifier.
+ NULL, // No user security identifier.
+ 1, // Number of substitution strings.
+ 0, // No data.
+ &message, // Pointer to strings.
+ NULL); // No data.
+}
+
+//////////////////////////////////////////////////////////////////////////
+// Customizable event log backend implementation
+//////////////////////////////////////////////////////////////////////////
+namespace event_log {
+
+ template< typename CharT >
+ class basic_event_composer< CharT >::insertion_composer
+ {
+ public:
+ //! Function object result type
+ typedef void result_type;
+
+ private:
+ //! The list of insertion composers (in backward order)
+ typedef std::vector< formatter_type > formatters;
+
+ private:
+ //! The insertion string composers
+ formatters m_Formatters;
+
+ public:
+ //! Default constructor
+ insertion_composer() {}
+ //! Composition operator
+ void operator() (record_view const& rec, insertion_list& insertions) const
+ {
+ std::size_t size = m_Formatters.size();
+ insertions.resize(size);
+ for (std::size_t i = 0; i < size; ++i)
+ {
+ typename formatter_type::stream_type strm(insertions[i]);
+ m_Formatters[i](rec, strm);
+ strm.flush();
+ }
+ }
+ //! Adds a new formatter to the list
+ void add_formatter(formatter_type const& fmt)
+ {
+ m_Formatters.push_back(formatter_type(fmt));
+ }
+ };
+
+ //! Default constructor
+ template< typename CharT >
+ basic_event_composer< CharT >::basic_event_composer(event_id_mapper_type const& id_mapper) :
+ m_EventIDMapper(id_mapper)
+ {
+ }
+ //! Copy constructor
+ template< typename CharT >
+ basic_event_composer< CharT >::basic_event_composer(basic_event_composer const& that) :
+ m_EventIDMapper(that.m_EventIDMapper),
+ m_EventMap(that.m_EventMap)
+ {
+ }
+ //! Destructor
+ template< typename CharT >
+ basic_event_composer< CharT >::~basic_event_composer()
+ {
+ }
+
+ //! Assignment
+ template< typename CharT >
+ basic_event_composer< CharT >& basic_event_composer< CharT >::operator= (basic_event_composer that)
+ {
+ swap(that);
+ return *this;
+ }
+ //! Swapping
+ template< typename CharT >
+ void basic_event_composer< CharT >::swap(basic_event_composer& that)
+ {
+ m_EventIDMapper.swap(that.m_EventIDMapper);
+ m_EventMap.swap(that.m_EventMap);
+ }
+ //! Creates a new entry for a message
+ template< typename CharT >
+ typename basic_event_composer< CharT >::event_map_reference
+ basic_event_composer< CharT >::operator[] (event_id id)
+ {
+ return event_map_reference(id, *this);
+ }
+ //! Creates a new entry for a message
+ template< typename CharT >
+ typename basic_event_composer< CharT >::event_map_reference
+ basic_event_composer< CharT >::operator[] (int id)
+ {
+ return event_map_reference(make_event_id(id), *this);
+ }
+
+ //! Event composition operator
+ template< typename CharT >
+ event_id basic_event_composer< CharT >::operator() (record_view const& rec, insertion_list& insertions) const
+ {
+ event_id id = m_EventIDMapper(rec);
+ typename event_map::const_iterator it = m_EventMap.find(id);
+ if (it != m_EventMap.end())
+ it->second(rec, insertions);
+ return id;
+ }
+
+ //! Adds a formatter to the insertion composers list
+ template< typename CharT >
+ typename basic_event_composer< CharT >::insertion_composer*
+ basic_event_composer< CharT >::add_formatter(event_id id, insertion_composer* composer, formatter_type const& fmt)
+ {
+ if (!composer)
+ composer = &m_EventMap[id];
+ composer->add_formatter(fmt);
+ return composer;
+ }
+
+#ifdef BOOST_LOG_USE_CHAR
+ template class BOOST_LOG_API basic_event_composer< char >;
+#endif
+#ifdef BOOST_LOG_USE_WCHAR_T
+ template class BOOST_LOG_API basic_event_composer< wchar_t >;
+#endif
+
+} // namespace event_log
+
+
+//! Backend implementation
+template< typename CharT >
+struct basic_event_log_backend< CharT >::implementation
+{
+ // NOTE: This order of data members is critical for MSVC 9.0 in debug mode,
+ // as it ICEs if boost::functions are not the first members. Doh!
+
+ //! An event category mapper
+ event_category_mapper_type m_CategoryMapper;
+ //! A level mapping functor
+ event_type_mapper_type m_LevelMapper;
+
+ //! A handle for the registered event provider
+ HANDLE m_SourceHandle;
+ //! A functor that composes an event
+ event_composer_type m_EventComposer;
+ //! An array of formatted insertions
+ insertion_list m_Insertions;
+
+ implementation() : m_SourceHandle(0)
+ {
+ }
+};
+
+//! Destructor
+template< typename CharT >
+BOOST_LOG_API basic_event_log_backend< CharT >::~basic_event_log_backend()
+{
+ DeregisterEventSource(m_pImpl->m_SourceHandle);
+ delete m_pImpl;
+}
+
+//! Constructs backend implementation
+template< typename CharT >
+BOOST_LOG_API void basic_event_log_backend< CharT >::construct(
+ filesystem::path const& message_file_name,
+ string_type const& target,
+ string_type const& log_name,
+ string_type const& source_name,
+ event_log::registration_mode reg_mode)
+{
+ if (reg_mode != event_log::never)
+ {
+ if (message_file_name.empty())
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Message file name not specified."));
+ aux::registry_params< char_type > reg_params;
+ string_type file_name;
+ log::aux::code_convert(message_file_name.string(), file_name);
+ reg_params.event_message_file = file_name;
+ reg_params.types_supported = DWORD(
+ EVENTLOG_SUCCESS |
+ EVENTLOG_INFORMATION_TYPE |
+ EVENTLOG_WARNING_TYPE |
+ EVENTLOG_ERROR_TYPE);
+ aux::init_event_log_registry(log_name, source_name, reg_mode == event_log::forced, reg_params);
+ }
+
+ log::aux::unique_ptr< implementation > p(new implementation());
+
+ const char_type* target_unc = NULL;
+ if (!target.empty())
+ target_unc = target.c_str();
+
+ HANDLE hSource = register_event_source(target_unc, source_name.c_str());
+ if (!hSource)
+ {
+ const DWORD err = GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not register event source", (err));
+ }
+
+ p->m_SourceHandle = hSource;
+
+ m_pImpl = p.release();
+}
+
+//! The method puts the formatted message to the event log
+template< typename CharT >
+BOOST_LOG_API void basic_event_log_backend< CharT >::consume(record_view const& rec)
+{
+ if (!m_pImpl->m_EventComposer.empty())
+ {
+ log::aux::cleanup_guard< insertion_list > cleaner(m_pImpl->m_Insertions);
+
+ // Get event ID and construct insertions
+ DWORD id = m_pImpl->m_EventComposer(rec, m_pImpl->m_Insertions);
+ WORD string_count = static_cast< WORD >(m_pImpl->m_Insertions.size());
+ scoped_array< const char_type* > strings(new const char_type*[string_count]);
+ for (WORD i = 0; i < string_count; ++i)
+ strings[i] = m_pImpl->m_Insertions[i].c_str();
+
+ // Get event type
+ WORD event_type = EVENTLOG_INFORMATION_TYPE;
+ if (!m_pImpl->m_LevelMapper.empty())
+ event_type = static_cast< WORD >(m_pImpl->m_LevelMapper(rec));
+
+ WORD event_category = 0;
+ if (!m_pImpl->m_CategoryMapper.empty())
+ event_category = static_cast< WORD >(m_pImpl->m_CategoryMapper(rec));
+
+ report_event(
+ m_pImpl->m_SourceHandle, // Event log handle.
+ event_type, // Event type.
+ event_category, // Event category.
+ id, // Event identifier.
+ NULL, // No user security identifier.
+ string_count, // Number of substitution strings.
+ 0, // No data.
+ strings.get(), // Pointer to strings.
+ NULL); // No data.
+ }
+}
+
+//! Returns default log name
+template< typename CharT >
+BOOST_LOG_API typename basic_event_log_backend< CharT >::string_type
+basic_event_log_backend< CharT >::get_default_log_name()
+{
+ return aux::registry_traits< char_type >::make_default_log_name();
+}
+
+//! Returns default source name
+template< typename CharT >
+BOOST_LOG_API typename basic_event_log_backend< CharT >::string_type
+basic_event_log_backend< CharT >::get_default_source_name()
+{
+ string_type source_name = aux::registry_traits< char_type >::make_default_source_name();
+ complete_default_event_log_source_name(source_name);
+ return source_name;
+}
+
+//! The method installs the function object that maps application severity levels to WinAPI event types
+template< typename CharT >
+BOOST_LOG_API void basic_event_log_backend< CharT >::set_event_type_mapper(event_type_mapper_type const& mapper)
+{
+ m_pImpl->m_LevelMapper = mapper;
+}
+
+//! The method installs the function object that extracts event category from attribute values
+template< typename CharT >
+BOOST_LOG_API void basic_event_log_backend< CharT >::set_event_category_mapper(event_category_mapper_type const& mapper)
+{
+ m_pImpl->m_CategoryMapper = mapper;
+}
+
+/*!
+ * The method installs the function object that extracts event identifier from the attributes and creates
+ * insertion strings that will replace placeholders in the event message.
+ */
+template< typename CharT >
+BOOST_LOG_API void basic_event_log_backend< CharT >::set_event_composer(event_composer_type const& composer)
+{
+ m_pImpl->m_EventComposer = composer;
+}
+
+
+#ifdef BOOST_LOG_USE_CHAR
+template class basic_simple_event_log_backend< char >;
+template class basic_event_log_backend< char >;
+#endif
+#ifdef BOOST_LOG_USE_WCHAR_T
+template class basic_simple_event_log_backend< wchar_t >;
+template class basic_event_log_backend< wchar_t >;
+#endif
+
+} // namespace sinks
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // !defined(BOOST_LOG_WITHOUT_EVENT_LOG)
diff --git a/contrib/restricted/boost/libs/log/src/windows/event_log_registry.hpp b/contrib/restricted/boost/libs/log/src/windows/event_log_registry.hpp
new file mode 100644
index 0000000000..9d1579accb
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/event_log_registry.hpp
@@ -0,0 +1,491 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file event_log_registry.hpp
+ * \author Andrey Semashev
+ * \date 16.11.2008
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#ifndef BOOST_LOG_WINDOWS_EVENT_LOG_REGISTRY_HPP_INCLUDED_
+#define BOOST_LOG_WINDOWS_EVENT_LOG_REGISTRY_HPP_INCLUDED_
+
+#include <boost/log/detail/config.hpp>
+#include <cwchar>
+#include <cstring>
+#include <string>
+#include <sstream>
+#include <stdexcept>
+#include <boost/version.hpp>
+#include <boost/optional/optional.hpp>
+#include <boost/log/detail/code_conversion.hpp>
+#include <boost/log/exceptions.hpp>
+#include <windows.h>
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace sinks {
+
+namespace aux {
+
+// MSVC versions up to 2008 (or their Platform SDKs, to be more precise) don't define LSTATUS.
+// Perhaps, that is also the case for MinGW and Cygwin (untested).
+typedef DWORD LSTATUS;
+
+// Max registry string size, in characters (for security reasons)
+const DWORD max_string_size = 64u * 1024u;
+
+//! Helper traits to integrate with WinAPI
+template< typename CharT >
+struct registry_traits;
+
+#ifdef BOOST_LOG_USE_CHAR
+template< >
+struct registry_traits< char >
+{
+ static std::string make_event_log_key(std::string const& log_name, std::string const& source_name)
+ {
+ return "SYSTEM\\CurrentControlSet\\Services\\EventLog\\" + log_name + "\\" + source_name;
+ }
+
+ static std::string make_default_log_name()
+ {
+ return "Application";
+ }
+
+ static std::string make_default_source_name()
+ {
+ char buf[MAX_PATH];
+ DWORD size = GetModuleFileNameA(NULL, buf, sizeof(buf) / sizeof(*buf));
+
+ std::string source_name(buf, buf + size);
+ if (source_name.empty())
+ {
+ // In case of error we provide artificial application name
+ std::ostringstream strm;
+ strm << "Boost.Log "
+ << static_cast< unsigned int >(BOOST_VERSION / 100000)
+ << "."
+ << static_cast< unsigned int >(BOOST_VERSION / 100 % 1000)
+ << "."
+ << static_cast< unsigned int >(BOOST_VERSION % 100);
+ source_name = strm.str();
+ }
+ else
+ {
+ // Cut off the path and extension
+ std::size_t backslash_pos = source_name.rfind('\\');
+ if (backslash_pos == std::string::npos || backslash_pos >= source_name.size() - 1)
+ backslash_pos = 0;
+ else
+ ++backslash_pos;
+ std::size_t dot_pos = source_name.rfind('.');
+ if (dot_pos == std::string::npos || dot_pos < backslash_pos)
+ dot_pos = source_name.size();
+ source_name = source_name.substr(backslash_pos, dot_pos - backslash_pos);
+ }
+
+ return source_name;
+ }
+
+ static LSTATUS create_key(
+ HKEY hKey,
+ const char* lpSubKey,
+ DWORD Reserved,
+ char* lpClass,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ PHKEY phkResult,
+ LPDWORD lpdwDisposition)
+ {
+ return RegCreateKeyExA(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
+ }
+
+ static LSTATUS open_key(
+ HKEY hKey,
+ const char* lpSubKey,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ PHKEY phkResult)
+ {
+ return RegOpenKeyExA(hKey, lpSubKey, dwOptions, samDesired, phkResult);
+ }
+
+ static LSTATUS set_value(
+ HKEY hKey,
+ const char* lpValueName,
+ DWORD Reserved,
+ DWORD dwType,
+ const BYTE* lpData,
+ DWORD cbData)
+ {
+ return RegSetValueExA(hKey, lpValueName, Reserved, dwType, lpData, cbData);
+ }
+
+ static LSTATUS get_value(HKEY hKey, const char* lpValueName, DWORD& value)
+ {
+ DWORD type = REG_NONE, size = sizeof(value);
+ LSTATUS res = RegQueryValueExA(hKey, lpValueName, NULL, &type, reinterpret_cast< LPBYTE >(&value), &size);
+ if (res == ERROR_SUCCESS && type != REG_DWORD && type != REG_BINARY)
+ res = ERROR_INVALID_DATA;
+ return res;
+ }
+
+ static LSTATUS get_value(HKEY hKey, const char* lpValueName, std::string& value)
+ {
+ DWORD type = REG_NONE, size = 0;
+ LSTATUS res = RegQueryValueExA(hKey, lpValueName, NULL, &type, NULL, &size);
+ if (res == ERROR_SUCCESS && ((type != REG_EXPAND_SZ && type != REG_SZ) || size > max_string_size))
+ return ERROR_INVALID_DATA;
+ if (size == 0)
+ return res;
+
+ value.resize(size);
+ res = RegQueryValueExA(hKey, lpValueName, NULL, &type, reinterpret_cast< LPBYTE >(&value[0]), &size);
+ value.resize(std::strlen(value.c_str())); // remove extra terminating zero
+
+ return res;
+ }
+
+ static const char* get_event_message_file_param_name() { return "EventMessageFile"; }
+ static const char* get_category_message_file_param_name() { return "CategoryMessageFile"; }
+ static const char* get_category_count_param_name() { return "CategoryCount"; }
+ static const char* get_types_supported_param_name() { return "TypesSupported"; }
+};
+#endif // BOOST_LOG_USE_CHAR
+
+#ifdef BOOST_LOG_USE_WCHAR_T
+template< >
+struct registry_traits< wchar_t >
+{
+ static std::wstring make_event_log_key(std::wstring const& log_name, std::wstring const& source_name)
+ {
+ return L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\" + log_name + L"\\" + source_name;
+ }
+
+ static std::wstring make_default_log_name()
+ {
+ return L"Application";
+ }
+
+ static std::wstring make_default_source_name()
+ {
+ wchar_t buf[MAX_PATH];
+ DWORD size = GetModuleFileNameW(NULL, buf, sizeof(buf) / sizeof(*buf));
+
+ std::wstring source_name(buf, buf + size);
+ if (source_name.empty())
+ {
+ // In case of error we provide artificial application name
+ std::wostringstream strm;
+ strm << L"Boost.Log "
+ << static_cast< unsigned int >(BOOST_VERSION / 100000)
+ << L"."
+ << static_cast< unsigned int >(BOOST_VERSION / 100 % 1000)
+ << L"."
+ << static_cast< unsigned int >(BOOST_VERSION % 100);
+ source_name = strm.str();
+ }
+ else
+ {
+ // Cut off the path and extension
+ std::size_t backslash_pos = source_name.rfind(L'\\');
+ if (backslash_pos == std::wstring::npos || backslash_pos >= source_name.size() - 1)
+ backslash_pos = 0;
+ else
+ ++backslash_pos;
+ std::size_t dot_pos = source_name.rfind(L'.');
+ if (dot_pos == std::wstring::npos || dot_pos < backslash_pos)
+ dot_pos = source_name.size();
+ source_name = source_name.substr(backslash_pos, dot_pos - backslash_pos);
+ }
+
+ return source_name;
+ }
+
+ static LSTATUS create_key(
+ HKEY hKey,
+ const wchar_t* lpSubKey,
+ DWORD Reserved,
+ wchar_t* lpClass,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ PHKEY phkResult,
+ LPDWORD lpdwDisposition)
+ {
+ return RegCreateKeyExW(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition);
+ }
+
+ static LSTATUS open_key(
+ HKEY hKey,
+ const wchar_t* lpSubKey,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ PHKEY phkResult)
+ {
+ return RegOpenKeyExW(hKey, lpSubKey, dwOptions, samDesired, phkResult);
+ }
+
+ static LSTATUS set_value(
+ HKEY hKey,
+ const wchar_t* lpValueName,
+ DWORD Reserved,
+ DWORD dwType,
+ const BYTE* lpData,
+ DWORD cbData)
+ {
+ return RegSetValueExW(hKey, lpValueName, Reserved, dwType, lpData, cbData);
+ }
+
+ static LSTATUS get_value(HKEY hKey, const wchar_t* lpValueName, DWORD& value)
+ {
+ DWORD type = REG_NONE, size = sizeof(value);
+ LSTATUS res = RegQueryValueExW(hKey, lpValueName, NULL, &type, reinterpret_cast< LPBYTE >(&value), &size);
+ if (res == ERROR_SUCCESS && type != REG_DWORD && type != REG_BINARY)
+ res = ERROR_INVALID_DATA;
+ return res;
+ }
+
+ static LSTATUS get_value(HKEY hKey, const wchar_t* lpValueName, std::wstring& value)
+ {
+ DWORD type = REG_NONE, size = 0;
+ LSTATUS res = RegQueryValueExW(hKey, lpValueName, NULL, &type, NULL, &size);
+ size /= sizeof(wchar_t);
+ if (res == ERROR_SUCCESS && ((type != REG_EXPAND_SZ && type != REG_SZ) || size > max_string_size))
+ return ERROR_INVALID_DATA;
+ if (size == 0)
+ return res;
+
+ value.resize(size);
+ res = RegQueryValueExW(hKey, lpValueName, NULL, &type, reinterpret_cast< LPBYTE >(&value[0]), &size);
+ value.resize(std::wcslen(value.c_str())); // remove extra terminating zero
+
+ return res;
+ }
+
+ static const wchar_t* get_event_message_file_param_name() { return L"EventMessageFile"; }
+ static const wchar_t* get_category_message_file_param_name() { return L"CategoryMessageFile"; }
+ static const wchar_t* get_category_count_param_name() { return L"CategoryCount"; }
+ static const wchar_t* get_types_supported_param_name() { return L"TypesSupported"; }
+
+};
+#endif // BOOST_LOG_USE_WCHAR_T
+
+//! The structure with parameters that have to be registered in the event log registry key
+template< typename CharT >
+struct registry_params
+{
+ typedef std::basic_string< CharT > string_type;
+
+ optional< string_type > event_message_file;
+ optional< string_type > category_message_file;
+ optional< DWORD > category_count;
+ optional< DWORD > types_supported;
+};
+
+//! A simple guard that closes the registry key on destruction
+struct auto_hkey_close
+{
+ explicit auto_hkey_close(HKEY hk) : hk_(hk) {}
+ ~auto_hkey_close() { RegCloseKey(hk_); }
+
+private:
+ HKEY hk_;
+};
+
+//! The function checks if the event log is already registered
+template< typename CharT >
+bool verify_event_log_registry(std::basic_string< CharT > const& reg_key, bool force, registry_params< CharT > const& params)
+{
+ typedef std::basic_string< CharT > string_type;
+ typedef registry_traits< CharT > registry;
+
+ // Open the key
+ HKEY hkey = 0;
+ LSTATUS res = registry::open_key(
+ HKEY_LOCAL_MACHINE,
+ reg_key.c_str(),
+ REG_OPTION_NON_VOLATILE,
+ KEY_READ,
+ &hkey);
+ if (res != ERROR_SUCCESS)
+ return false;
+
+ auto_hkey_close hkey_guard(hkey);
+
+ if (force)
+ {
+ // Verify key values
+ if (!!params.event_message_file)
+ {
+ string_type module_name;
+ res = registry::get_value(hkey, registry::get_event_message_file_param_name(), module_name);
+ if (res != ERROR_SUCCESS || module_name != params.event_message_file.get())
+ return false;
+ }
+
+ if (!!params.category_message_file)
+ {
+ string_type module_name;
+ res = registry::get_value(hkey, registry::get_category_message_file_param_name(), module_name);
+ if (res != ERROR_SUCCESS || module_name != params.category_message_file.get())
+ return false;
+ }
+
+ if (!!params.category_count)
+ {
+ // Set number of categories
+ DWORD category_count = 0;
+ res = registry::get_value(hkey, registry::get_category_count_param_name(), category_count);
+ if (res != ERROR_SUCCESS || category_count != params.category_count.get())
+ return false;
+ }
+
+ if (!!params.types_supported)
+ {
+ // Set the supported event types
+ DWORD event_types = 0;
+ res = registry::get_value(hkey, registry::get_types_supported_param_name(), event_types);
+ if (res != ERROR_SUCCESS || event_types != params.types_supported.get())
+ return false;
+ }
+ }
+
+ return true;
+}
+
+//! The function initializes the event log registry key
+template< typename CharT >
+void init_event_log_registry(
+ std::basic_string< CharT > const& log_name,
+ std::basic_string< CharT > const& source_name,
+ bool force,
+ registry_params< CharT > const& params)
+{
+ typedef std::basic_string< CharT > string_type;
+ typedef registry_traits< CharT > registry;
+ // Registry key name that contains log description
+ string_type reg_key = registry::make_event_log_key(log_name, source_name);
+
+ // First check the registry keys and values in read-only mode.
+ // This allows to avoid UAC asking for elevated permissions to modify HKLM registry when no modification is actually needed.
+ if (verify_event_log_registry(reg_key, force, params))
+ return;
+
+ // Create or open the key
+ HKEY hkey = 0;
+ DWORD disposition = 0;
+ LSTATUS res = registry::create_key(
+ HKEY_LOCAL_MACHINE,
+ reg_key.c_str(),
+ 0,
+ NULL,
+ REG_OPTION_NON_VOLATILE,
+ KEY_WRITE,
+ NULL,
+ &hkey,
+ &disposition);
+ if (res != ERROR_SUCCESS)
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not create registry key for the event log", (res));
+
+ auto_hkey_close hkey_guard(hkey);
+
+ if (disposition != REG_OPENED_EXISTING_KEY || force)
+ {
+ // Fill registry values
+ if (!!params.event_message_file)
+ {
+ // Set the module file name that contains event resources
+ string_type const& module_name = params.event_message_file.get();
+ res = registry::set_value(
+ hkey,
+ registry::get_event_message_file_param_name(),
+ 0,
+ REG_EXPAND_SZ,
+ reinterpret_cast< LPBYTE >(const_cast< CharT* >(module_name.c_str())),
+ static_cast< DWORD >((module_name.size() + 1) * sizeof(CharT)));
+ if (res != ERROR_SUCCESS)
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not create registry value "
+ + log::aux::to_narrow(string_type(registry::get_event_message_file_param_name())), (res));
+ }
+ }
+
+ if (!!params.category_message_file)
+ {
+ // Set the module file name that contains event category resources
+ string_type const& module_name = params.category_message_file.get();
+ res = registry::set_value(
+ hkey,
+ registry::get_category_message_file_param_name(),
+ 0,
+ REG_SZ,
+ reinterpret_cast< LPBYTE >(const_cast< CharT* >(module_name.c_str())),
+ static_cast< DWORD >((module_name.size() + 1) * sizeof(CharT)));
+ if (res != ERROR_SUCCESS)
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not create registry value "
+ + log::aux::to_narrow(string_type(registry::get_category_message_file_param_name())), (res));
+ }
+ }
+
+ if (!!params.category_count)
+ {
+ // Set number of categories
+ DWORD category_count = params.category_count.get();
+ res = registry::set_value(
+ hkey,
+ registry::get_category_count_param_name(),
+ 0,
+ REG_DWORD,
+ reinterpret_cast< LPBYTE >(&category_count),
+ static_cast< DWORD >(sizeof(category_count)));
+ if (res != ERROR_SUCCESS)
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not create registry value "
+ + log::aux::to_narrow(string_type(registry::get_category_count_param_name())), (res));
+ }
+ }
+
+ if (!!params.types_supported)
+ {
+ // Set the supported event types
+ DWORD event_types = params.types_supported.get();
+ res = registry::set_value(
+ hkey,
+ registry::get_types_supported_param_name(),
+ 0,
+ REG_DWORD,
+ reinterpret_cast< LPBYTE >(&event_types),
+ static_cast< DWORD >(sizeof(event_types)));
+ if (res != ERROR_SUCCESS)
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(system_error, "Could not create registry value "
+ + log::aux::to_narrow(string_type(registry::get_types_supported_param_name())), (res));
+ }
+ }
+ }
+}
+
+} // namespace aux
+
+} // namespace sinks
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_WINDOWS_EVENT_LOG_REGISTRY_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/libs/log/src/windows/ipc_reliable_message_queue.cpp b/contrib/restricted/boost/libs/log/src/windows/ipc_reliable_message_queue.cpp
new file mode 100644
index 0000000000..d99d091d1f
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/ipc_reliable_message_queue.cpp
@@ -0,0 +1,818 @@
+/*
+ * Copyright Lingxi Li 2015.
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file ipc_reliable_message_queue_win.hpp
+ * \author Lingxi Li
+ * \author Andrey Semashev
+ * \date 28.10.2015
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ *
+ * This file provides an interprocess message queue implementation on POSIX platforms.
+ */
+
+#include <boost/log/detail/config.hpp>
+#include <cstddef>
+#include <cstring>
+#include <new>
+#include <limits>
+#include <string>
+#include <algorithm>
+#include <stdexcept>
+#include <boost/assert.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/atomic/capabilities.hpp>
+#include <boost/log/exceptions.hpp>
+#include <boost/log/utility/ipc/reliable_message_queue.hpp>
+#include <boost/log/support/exception.hpp>
+#include <boost/log/detail/pause.hpp>
+#include <boost/exception/info.hpp>
+#include <boost/exception/enable_error_info.hpp>
+#include <boost/align/align_up.hpp>
+#include <boost/winapi/thread.hpp> // SwitchToThread
+#include "windows/ipc_sync_wrappers.hpp"
+#include "windows/mapped_shared_memory.hpp"
+#include "windows/utf_code_conversion.hpp"
+#include "murmur3.hpp"
+#include "bit_tools.hpp"
+#include <windows.h>
+#include <boost/log/detail/header.hpp>
+
+#if BOOST_ATOMIC_INT32_LOCK_FREE != 2
+// 32-bit atomic ops are required to be able to place atomic<uint32_t> in the process-shared memory
+#error Boost.Log: Native 32-bit atomic operations are required but not supported by Boost.Atomic on the target platform
+#endif
+
+//! A suffix used in names of interprocess objects created by the queue.
+//! Used as a protection against clashing with user-supplied names of interprocess queues and also to resolve conflicts between queues of different types.
+#define BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".3010b9950926463398eee00b35b44651"
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+//! Message queue implementation data
+struct reliable_message_queue::implementation
+{
+private:
+ //! Header of an allocation block within the message queue. Placed at the beginning of the block within the shared memory segment.
+ struct block_header
+ {
+ // Element data alignment, in bytes
+ enum { data_alignment = 32u };
+
+ //! Size of the element data, in bytes
+ size_type m_size;
+
+ //! Returns the block header overhead, in bytes
+ static BOOST_CONSTEXPR size_type get_header_overhead() BOOST_NOEXCEPT
+ {
+ return static_cast< size_type >(boost::alignment::align_up(sizeof(block_header), data_alignment));
+ }
+
+ //! Returns a pointer to the element data
+ void* get_data() const BOOST_NOEXCEPT
+ {
+ return const_cast< unsigned char* >(reinterpret_cast< const unsigned char* >(this)) + get_header_overhead();
+ }
+ };
+
+ //! Header of the message queue. Placed at the beginning of the shared memory segment.
+ struct header
+ {
+ // Increment this constant whenever you change the binary layout of the queue (apart from this header structure)
+ enum { abi_version = 0 };
+
+ // !!! Whenever you add/remove members in this structure, also modify get_abi_tag() function accordingly !!!
+
+ //! A tag value to ensure the correct binary layout of the message queue data structures. Must be placed first and always have a fixed size and alignment.
+ uint32_t m_abi_tag;
+ //! Padding to protect against alignment changes in Boost.Atomic. Don't use BOOST_ALIGNMENT to ensure portability.
+ unsigned char m_padding[BOOST_LOG_CPU_CACHE_LINE_SIZE - sizeof(uint32_t)];
+ //! A flag indicating that the queue is constructed (i.e. the queue is constructed when the value is not 0).
+ boost::atomic< uint32_t > m_initialized;
+ //! Number of allocation blocks in the queue.
+ const uint32_t m_capacity;
+ //! Size of an allocation block, in bytes.
+ const size_type m_block_size;
+ //! Shared state of the mutex for protecting queue data structures.
+ boost::log::ipc::aux::interprocess_mutex::shared_state m_mutex_state;
+ //! Shared state of the condition variable used to block writers when the queue is full.
+ boost::log::ipc::aux::interprocess_condition_variable::shared_state m_nonfull_queue_state;
+ //! The current number of allocated blocks in the queue.
+ uint32_t m_size;
+ //! The current writing position (allocation block index).
+ uint32_t m_put_pos;
+ //! The current reading position (allocation block index).
+ uint32_t m_get_pos;
+
+ header(uint32_t capacity, size_type block_size) :
+ m_abi_tag(get_abi_tag()),
+ m_capacity(capacity),
+ m_block_size(block_size),
+ m_size(0u),
+ m_put_pos(0u),
+ m_get_pos(0u)
+ {
+ // Must be initialized last. m_initialized is zero-initialized initially.
+ m_initialized.fetch_add(1u, boost::memory_order_release);
+ }
+
+ //! Returns the header structure ABI tag
+ static uint32_t get_abi_tag() BOOST_NOEXCEPT
+ {
+ // This FOURCC identifies the queue type
+ boost::log::aux::murmur3_32 hash(boost::log::aux::make_fourcc('r', 'e', 'l', 'q'));
+
+ // This FOURCC identifies the queue implementation
+ hash.mix(boost::log::aux::make_fourcc('w', 'n', 't', '5'));
+ hash.mix(abi_version);
+
+ // We will use these constants to align pointers
+ hash.mix(BOOST_LOG_CPU_CACHE_LINE_SIZE);
+ hash.mix(block_header::data_alignment);
+
+ // The members in the sequence below must be enumerated in the same order as they are declared in the header structure.
+ // The ABI tag is supposed change whenever a member changes size or offset from the beginning of the header.
+
+#define BOOST_LOG_MIX_HEADER_MEMBER(name)\
+ hash.mix(static_cast< uint32_t >(sizeof(((header*)NULL)->name)));\
+ hash.mix(static_cast< uint32_t >(offsetof(header, name)))
+
+ BOOST_LOG_MIX_HEADER_MEMBER(m_abi_tag);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_padding);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_initialized);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_capacity);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_block_size);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_mutex_state);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_nonfull_queue_state);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_size);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_put_pos);
+ BOOST_LOG_MIX_HEADER_MEMBER(m_get_pos);
+
+#undef BOOST_LOG_MIX_HEADER_MEMBER
+
+ return hash.finalize();
+ }
+
+ //! Returns an element header at the specified index
+ block_header* get_block(uint32_t index) const BOOST_NOEXCEPT
+ {
+ BOOST_ASSERT(index < m_capacity);
+ unsigned char* p = const_cast< unsigned char* >(reinterpret_cast< const unsigned char* >(this)) + boost::alignment::align_up(sizeof(header), BOOST_LOG_CPU_CACHE_LINE_SIZE);
+ p += static_cast< std::size_t >(m_block_size) * static_cast< std::size_t >(index);
+ return reinterpret_cast< block_header* >(p);
+ }
+
+ BOOST_DELETED_FUNCTION(header(header const&))
+ BOOST_DELETED_FUNCTION(header& operator=(header const&))
+ };
+
+private:
+ //! Shared memory object and mapping
+ boost::log::ipc::aux::mapped_shared_memory m_shared_memory;
+ //! Queue overflow handling policy
+ const overflow_policy m_overflow_policy;
+ //! The mask for selecting bits that constitute size values from 0 to (block_size - 1)
+ size_type m_block_size_mask;
+ //! The number of the bit set in block_size (i.e. log base 2 of block_size)
+ uint32_t m_block_size_log2;
+
+ //! Mutex for protecting queue data structures.
+ boost::log::ipc::aux::interprocess_mutex m_mutex;
+ //! Event used to block readers when the queue is empty.
+ boost::log::ipc::aux::interprocess_event m_nonempty_queue;
+ //! Condition variable used to block writers when the queue is full.
+ boost::log::ipc::aux::interprocess_condition_variable m_nonfull_queue;
+ //! The event indicates that stop has been requested
+ boost::log::ipc::aux::auto_handle m_stop;
+
+ //! The queue name, as specified by the user
+ const object_name m_name;
+
+public:
+ //! The constructor creates a new shared memory segment
+ implementation
+ (
+ open_mode::create_only_tag,
+ object_name const& name,
+ uint32_t capacity,
+ size_type block_size,
+ overflow_policy oflow_policy,
+ permissions const& perms
+ ) :
+ m_overflow_policy(oflow_policy),
+ m_block_size_mask(0u),
+ m_block_size_log2(0u),
+ m_name(name)
+ {
+ const std::wstring wname = boost::log::aux::utf8_to_utf16(name.c_str());
+ const std::size_t shmem_size = estimate_region_size(capacity, block_size);
+ m_shared_memory.create(wname.c_str(), shmem_size, perms);
+ m_shared_memory.map();
+
+ create_queue(wname, capacity, block_size, perms);
+ }
+
+ //! The constructor creates a new shared memory segment or opens the existing one
+ implementation
+ (
+ open_mode::open_or_create_tag,
+ object_name const& name,
+ uint32_t capacity,
+ size_type block_size,
+ overflow_policy oflow_policy,
+ permissions const& perms
+ ) :
+ m_overflow_policy(oflow_policy),
+ m_block_size_mask(0u),
+ m_block_size_log2(0u),
+ m_name(name)
+ {
+ const std::wstring wname = boost::log::aux::utf8_to_utf16(name.c_str());
+ const std::size_t shmem_size = estimate_region_size(capacity, block_size);
+ const bool created = m_shared_memory.create_or_open(wname.c_str(), shmem_size, perms);
+ m_shared_memory.map();
+
+ if (created)
+ create_queue(wname, capacity, block_size, perms);
+ else
+ adopt_queue(wname, m_shared_memory.size(), perms);
+ }
+
+ //! The constructor opens the existing shared memory segment
+ implementation
+ (
+ open_mode::open_only_tag,
+ object_name const& name,
+ overflow_policy oflow_policy,
+ permissions const& perms
+ ) :
+ m_overflow_policy(oflow_policy),
+ m_block_size_mask(0u),
+ m_block_size_log2(0u),
+ m_name(name)
+ {
+ const std::wstring wname = boost::log::aux::utf8_to_utf16(name.c_str());
+ m_shared_memory.open(wname.c_str());
+ m_shared_memory.map();
+
+ adopt_queue(wname, m_shared_memory.size(), perms);
+ }
+
+ object_name const& name() const BOOST_NOEXCEPT
+ {
+ return m_name;
+ }
+
+ uint32_t capacity() const BOOST_NOEXCEPT
+ {
+ return get_header()->m_capacity;
+ }
+
+ size_type block_size() const BOOST_NOEXCEPT
+ {
+ return get_header()->m_block_size;
+ }
+
+ operation_result send(void const* message_data, size_type message_size)
+ {
+ const uint32_t block_count = estimate_block_count(message_size);
+
+ header* const hdr = get_header();
+
+ if (BOOST_UNLIKELY(block_count > hdr->m_capacity))
+ BOOST_LOG_THROW_DESCR(logic_error, "Message size exceeds the interprocess queue capacity");
+
+ if (!lock_queue())
+ return aborted;
+
+ boost::log::ipc::aux::interprocess_mutex::optional_unlock unlock(m_mutex);
+
+ while (true)
+ {
+ if ((hdr->m_capacity - hdr->m_size) >= block_count)
+ break;
+
+ const overflow_policy oflow_policy = m_overflow_policy;
+ if (oflow_policy == fail_on_overflow)
+ return no_space;
+ else if (BOOST_UNLIKELY(oflow_policy == throw_on_overflow))
+ BOOST_LOG_THROW_DESCR(capacity_limit_reached, "Interprocess queue is full");
+
+ if (!m_nonfull_queue.wait(unlock, m_stop.get()))
+ return aborted;
+ }
+
+ enqueue_message(message_data, message_size, block_count);
+
+ return succeeded;
+ }
+
+ bool try_send(void const* message_data, size_type message_size)
+ {
+ const uint32_t block_count = estimate_block_count(message_size);
+
+ header* const hdr = get_header();
+
+ if (BOOST_UNLIKELY(block_count > hdr->m_capacity))
+ BOOST_LOG_THROW_DESCR(logic_error, "Message size exceeds the interprocess queue capacity");
+
+ if (!lock_queue())
+ return false;
+
+ boost::log::ipc::aux::interprocess_mutex::auto_unlock unlock(m_mutex);
+
+ if ((hdr->m_capacity - hdr->m_size) < block_count)
+ return false;
+
+ enqueue_message(message_data, message_size, block_count);
+
+ return true;
+ }
+
+ operation_result receive(receive_handler handler, void* state)
+ {
+ if (!lock_queue())
+ return aborted;
+
+ boost::log::ipc::aux::interprocess_mutex::optional_unlock unlock(m_mutex);
+
+ header* const hdr = get_header();
+
+ while (true)
+ {
+ if (hdr->m_size > 0u)
+ break;
+
+ m_mutex.unlock();
+ unlock.disengage();
+
+ if (!m_nonempty_queue.wait(m_stop.get()) || !lock_queue())
+ return aborted;
+
+ unlock.engage(m_mutex);
+ }
+
+ dequeue_message(handler, state);
+
+ return succeeded;
+ }
+
+ bool try_receive(receive_handler handler, void* state)
+ {
+ if (!lock_queue())
+ return false;
+
+ boost::log::ipc::aux::interprocess_mutex::auto_unlock unlock(m_mutex);
+
+ header* const hdr = get_header();
+ if (hdr->m_size == 0u)
+ return false;
+
+ dequeue_message(handler, state);
+
+ return true;
+ }
+
+ void stop_local()
+ {
+ BOOST_VERIFY(boost::winapi::SetEvent(m_stop.get()) != 0);
+ }
+
+ void reset_local()
+ {
+ BOOST_VERIFY(boost::winapi::ResetEvent(m_stop.get()) != 0);
+ }
+
+ void clear()
+ {
+ m_mutex.lock();
+ boost::log::ipc::aux::interprocess_mutex::auto_unlock unlock(m_mutex);
+ clear_queue();
+ }
+
+private:
+ header* get_header() const BOOST_NOEXCEPT
+ {
+ return static_cast< header* >(m_shared_memory.address());
+ }
+
+ static std::size_t estimate_region_size(uint32_t capacity, size_type block_size) BOOST_NOEXCEPT
+ {
+ return boost::alignment::align_up(sizeof(header), BOOST_LOG_CPU_CACHE_LINE_SIZE) + static_cast< std::size_t >(capacity) * static_cast< std::size_t >(block_size);
+ }
+
+ void create_stop_event()
+ {
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventExW
+ (
+ NULL, // permissions
+ NULL, // name
+ boost::winapi::CREATE_EVENT_MANUAL_RESET_,
+ boost::winapi::SYNCHRONIZE_ | boost::winapi::EVENT_MODIFY_STATE_
+ );
+#else
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventW
+ (
+ NULL, // permissions
+ true, // manual reset
+ false, // initial state
+ NULL // name
+ );
+#endif
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to create an stop event object", (err));
+ }
+
+ m_stop.init(h);
+ }
+
+ void create_queue(std::wstring const& name, uint32_t capacity, size_type block_size, permissions const& perms)
+ {
+ // Initialize synchronization primitives before initializing the header as the openers will wait for it to be initialized
+ header* const hdr = get_header();
+ m_mutex.create((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".mutex").c_str(), &hdr->m_mutex_state, perms);
+ m_nonempty_queue.create((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonempty_queue_event").c_str(), false, perms);
+ m_nonfull_queue.init((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonfull_queue_cond_var").c_str(), &hdr->m_nonfull_queue_state, perms);
+ create_stop_event();
+
+ new (hdr) header(capacity, block_size);
+
+ init_block_size(block_size);
+ }
+
+ void adopt_queue(std::wstring const& name, std::size_t shmem_size, permissions const& perms)
+ {
+ if (shmem_size < sizeof(header))
+ BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: shared memory segment size too small");
+
+ // Wait until the mapped region becomes initialized
+ header* const hdr = get_header();
+ BOOST_CONSTEXPR_OR_CONST unsigned int wait_loops = 1000u, spin_loops = 16u, spins = 16u;
+ for (unsigned int i = 0; i < wait_loops; ++i)
+ {
+ uint32_t initialized = hdr->m_initialized.load(boost::memory_order_acquire);
+ if (initialized)
+ {
+ goto done;
+ }
+
+ if (i < spin_loops)
+ {
+ for (unsigned int j = 0; j < spins; ++j)
+ {
+ boost::log::aux::pause();
+ }
+ }
+ else
+ {
+ boost::winapi::SwitchToThread();
+ }
+ }
+
+ BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: shared memory segment is not initialized by creator for too long");
+
+ done:
+ // Check that the queue layout matches the current process ABI
+ if (hdr->m_abi_tag != header::get_abi_tag())
+ BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: the queue ABI is incompatible");
+
+ if (!boost::log::aux::is_power_of_2(hdr->m_block_size))
+ BOOST_LOG_THROW_DESCR(setup_error, "Boost.Log interprocess message queue cannot be opened: the queue block size is not a power of 2");
+
+ m_mutex.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".mutex").c_str(), &hdr->m_mutex_state);
+ m_nonempty_queue.open((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonempty_queue_event").c_str());
+ m_nonfull_queue.init((name + BOOST_LOG_IPC_NAMES_AUX_SUFFIX L".nonfull_queue_cond_var").c_str(), &hdr->m_nonfull_queue_state, perms);
+ create_stop_event();
+
+ init_block_size(hdr->m_block_size);
+ }
+
+ void init_block_size(size_type block_size)
+ {
+ m_block_size_mask = block_size - 1u;
+
+ uint32_t block_size_log2 = 0u;
+ if ((block_size & 0x0000ffff) == 0u)
+ {
+ block_size >>= 16u;
+ block_size_log2 += 16u;
+ }
+ if ((block_size & 0x000000ff) == 0u)
+ {
+ block_size >>= 8u;
+ block_size_log2 += 8u;
+ }
+ if ((block_size & 0x0000000f) == 0u)
+ {
+ block_size >>= 4u;
+ block_size_log2 += 4u;
+ }
+ if ((block_size & 0x00000003) == 0u)
+ {
+ block_size >>= 2u;
+ block_size_log2 += 2u;
+ }
+ if ((block_size & 0x00000001) == 0u)
+ {
+ ++block_size_log2;
+ }
+ m_block_size_log2 = block_size_log2;
+ }
+
+ bool lock_queue()
+ {
+ return m_mutex.lock(m_stop.get());
+ }
+
+ void clear_queue()
+ {
+ header* const hdr = get_header();
+ hdr->m_size = 0u;
+ hdr->m_put_pos = 0u;
+ hdr->m_get_pos = 0u;
+ m_nonfull_queue.notify_all();
+ }
+
+ //! Returns the number of allocation blocks that are required to store user's payload of the specified size
+ uint32_t estimate_block_count(size_type size) const BOOST_NOEXCEPT
+ {
+ // ceil((size + get_header_overhead()) / block_size)
+ return static_cast< uint32_t >((size + block_header::get_header_overhead() + m_block_size_mask) >> m_block_size_log2);
+ }
+
+ //! Puts the message to the back of the queue
+ void enqueue_message(void const* message_data, size_type message_size, uint32_t block_count)
+ {
+ header* const hdr = get_header();
+
+ const uint32_t capacity = hdr->m_capacity;
+ const size_type block_size = hdr->m_block_size;
+ uint32_t pos = hdr->m_put_pos;
+
+ block_header* block = hdr->get_block(pos);
+ block->m_size = message_size;
+
+ size_type write_size = (std::min)(static_cast< size_type >((capacity - pos) * block_size - block_header::get_header_overhead()), message_size);
+ std::memcpy(block->get_data(), message_data, write_size);
+
+ pos += block_count;
+ if (BOOST_UNLIKELY(pos >= capacity))
+ {
+ // Write the rest of the message at the beginning of the queue
+ pos -= capacity;
+ message_data = static_cast< const unsigned char* >(message_data) + write_size;
+ write_size = message_size - write_size;
+ if (write_size > 0u)
+ std::memcpy(hdr->get_block(0u), message_data, write_size);
+ }
+
+ hdr->m_put_pos = pos;
+
+ const uint32_t old_queue_size = hdr->m_size;
+ hdr->m_size = old_queue_size + block_count;
+ if (old_queue_size == 0u)
+ m_nonempty_queue.set();
+ }
+
+ //! Retrieves the next message and invokes the handler to store the message contents
+ void dequeue_message(receive_handler handler, void* state)
+ {
+ header* const hdr = get_header();
+
+ const uint32_t capacity = hdr->m_capacity;
+ const size_type block_size = hdr->m_block_size;
+ uint32_t pos = hdr->m_get_pos;
+
+ block_header* block = hdr->get_block(pos);
+ size_type message_size = block->m_size;
+ uint32_t block_count = estimate_block_count(message_size);
+
+ BOOST_ASSERT(block_count <= hdr->m_size);
+
+ size_type read_size = (std::min)(static_cast< size_type >((capacity - pos) * block_size - block_header::get_header_overhead()), message_size);
+ handler(state, block->get_data(), read_size);
+
+ pos += block_count;
+ if (BOOST_UNLIKELY(pos >= capacity))
+ {
+ // Read the tail of the message
+ pos -= capacity;
+ read_size = message_size - read_size;
+ if (read_size > 0u)
+ handler(state, hdr->get_block(0u), read_size);
+ }
+
+ hdr->m_get_pos = pos;
+ hdr->m_size -= block_count;
+
+ m_nonfull_queue.notify_all();
+ }
+};
+
+BOOST_LOG_API void reliable_message_queue::create(object_name const& name, uint32_t capacity, size_type block_size, overflow_policy oflow_policy, permissions const& perms)
+{
+ BOOST_ASSERT(m_impl == NULL);
+ if (!boost::log::aux::is_power_of_2(block_size))
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Interprocess message queue block size is not a power of 2"));
+ try
+ {
+ m_impl = new implementation(open_mode::create_only, name, capacity, static_cast< size_type >(boost::alignment::align_up(block_size, BOOST_LOG_CPU_CACHE_LINE_SIZE)), oflow_policy, perms);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(name);
+ throw;
+ }
+}
+
+BOOST_LOG_API void reliable_message_queue::open_or_create(object_name const& name, uint32_t capacity, size_type block_size, overflow_policy oflow_policy, permissions const& perms)
+{
+ BOOST_ASSERT(m_impl == NULL);
+ if (!boost::log::aux::is_power_of_2(block_size))
+ BOOST_THROW_EXCEPTION(std::invalid_argument("Interprocess message queue block size is not a power of 2"));
+ try
+ {
+ m_impl = new implementation(open_mode::open_or_create, name, capacity, static_cast< size_type >(boost::alignment::align_up(block_size, BOOST_LOG_CPU_CACHE_LINE_SIZE)), oflow_policy, perms);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(name);
+ throw;
+ }
+}
+
+BOOST_LOG_API void reliable_message_queue::open(object_name const& name, overflow_policy oflow_policy, permissions const& perms)
+{
+ BOOST_ASSERT(m_impl == NULL);
+ try
+ {
+ m_impl = new implementation(open_mode::open_only, name, oflow_policy, perms);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(name);
+ throw;
+ }
+}
+
+BOOST_LOG_API void reliable_message_queue::clear()
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ m_impl->clear();
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API object_name const& reliable_message_queue::name() const
+{
+ BOOST_ASSERT(m_impl != NULL);
+ return m_impl->name();
+}
+
+BOOST_LOG_API uint32_t reliable_message_queue::capacity() const
+{
+ BOOST_ASSERT(m_impl != NULL);
+ return m_impl->capacity();
+}
+
+BOOST_LOG_API reliable_message_queue::size_type reliable_message_queue::block_size() const
+{
+ BOOST_ASSERT(m_impl != NULL);
+ return m_impl->block_size();
+}
+
+BOOST_LOG_API void reliable_message_queue::stop_local()
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ m_impl->stop_local();
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API void reliable_message_queue::reset_local()
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ m_impl->reset_local();
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API void reliable_message_queue::do_close() BOOST_NOEXCEPT
+{
+ delete m_impl;
+ m_impl = NULL;
+}
+
+BOOST_LOG_API reliable_message_queue::operation_result reliable_message_queue::send(void const* message_data, size_type message_size)
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ return m_impl->send(message_data, message_size);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API bool reliable_message_queue::try_send(void const* message_data, size_type message_size)
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ return m_impl->try_send(message_data, message_size);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API reliable_message_queue::operation_result reliable_message_queue::do_receive(receive_handler handler, void* state)
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ return m_impl->receive(handler, state);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+BOOST_LOG_API bool reliable_message_queue::do_try_receive(receive_handler handler, void* state)
+{
+ BOOST_ASSERT(m_impl != NULL);
+ try
+ {
+ return m_impl->try_receive(handler, state);
+ }
+ catch (boost::exception& e)
+ {
+ e << boost::log::ipc::object_name_info(m_impl->name());
+ throw;
+ }
+}
+
+//! Fixed buffer receive handler
+BOOST_LOG_API void reliable_message_queue::fixed_buffer_receive_handler(void* state, const void* data, size_type size)
+{
+ fixed_buffer_state* p = static_cast< fixed_buffer_state* >(state);
+ if (BOOST_UNLIKELY(size > p->size))
+ BOOST_THROW_EXCEPTION(bad_alloc("Buffer too small to receive the message"));
+
+ std::memcpy(p->data, data, size);
+ p->data += size;
+ p->size -= size;
+}
+
+BOOST_LOG_API void reliable_message_queue::remove(object_name const&)
+{
+ // System objects are reference counted on Windows, nothing to do here
+}
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.cpp b/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.cpp
new file mode 100644
index 0000000000..bd8bfb215c
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.cpp
@@ -0,0 +1,544 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/ipc_sync_wrappers.cpp
+ * \author Andrey Semashev
+ * \date 23.01.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#include <boost/log/detail/config.hpp>
+#include <boost/winapi/access_rights.hpp>
+#include <boost/winapi/handles.hpp>
+#include <boost/winapi/event.hpp>
+#include <boost/winapi/semaphore.hpp>
+#include <boost/winapi/wait.hpp>
+#include <boost/winapi/dll.hpp>
+#include <boost/winapi/time.hpp>
+#include <boost/winapi/get_last_error.hpp>
+#include <boost/winapi/character_code_conversion.hpp>
+#include <windows.h> // for error codes
+#include <cstddef>
+#include <limits>
+#include <string>
+#include <utility>
+#include <boost/assert.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/log/detail/snprintf.hpp>
+#include "unique_ptr.hpp"
+#include "windows/ipc_sync_wrappers.hpp"
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+//! Hex character table, defined in dump.cpp
+extern const char g_hex_char_table[2][16];
+
+} // namespace aux
+
+namespace ipc {
+
+namespace aux {
+
+void interprocess_event::create(const wchar_t* name, bool manual_reset, permissions const& perms)
+{
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventExW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ name,
+ boost::winapi::CREATE_EVENT_MANUAL_RESET_ * manual_reset,
+ boost::winapi::SYNCHRONIZE_ | boost::winapi::EVENT_MODIFY_STATE_
+ );
+#else
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ manual_reset,
+ false,
+ name
+ );
+#endif
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to create an interprocess event object", (err));
+ }
+
+ m_event.init(h);
+}
+
+void interprocess_event::create_or_open(const wchar_t* name, bool manual_reset, permissions const& perms)
+{
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventExW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ name,
+ boost::winapi::CREATE_EVENT_MANUAL_RESET_ * manual_reset,
+ boost::winapi::SYNCHRONIZE_ | boost::winapi::EVENT_MODIFY_STATE_
+ );
+#else
+ boost::winapi::HANDLE_ h = boost::winapi::CreateEventW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ manual_reset,
+ false,
+ name
+ );
+#endif
+ if (h == NULL)
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ if (BOOST_LIKELY(err == ERROR_ALREADY_EXISTS))
+ {
+ open(name);
+ return;
+ }
+ else
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to create an interprocess event object", (err));
+ }
+ }
+
+ m_event.init(h);
+}
+
+void interprocess_event::open(const wchar_t* name)
+{
+ boost::winapi::HANDLE_ h = boost::winapi::OpenEventW(boost::winapi::SYNCHRONIZE_ | boost::winapi::EVENT_MODIFY_STATE_, false, name);
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to open an interprocess event object", (err));
+ }
+
+ m_event.init(h);
+}
+
+boost::atomic< interprocess_semaphore::is_semaphore_zero_count_t > interprocess_semaphore::is_semaphore_zero_count(&interprocess_semaphore::is_semaphore_zero_count_init);
+interprocess_semaphore::nt_query_semaphore_t interprocess_semaphore::nt_query_semaphore = NULL;
+
+void interprocess_semaphore::create_or_open(const wchar_t* name, permissions const& perms)
+{
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ boost::winapi::HANDLE_ h = boost::winapi::CreateSemaphoreExW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ 0, // initial count
+ (std::numeric_limits< boost::winapi::LONG_ >::max)(), // max count
+ name,
+ 0u, // flags
+ boost::winapi::SYNCHRONIZE_ | boost::winapi::SEMAPHORE_MODIFY_STATE_ | boost::winapi::SEMAPHORE_QUERY_STATE_
+ );
+#else
+ boost::winapi::HANDLE_ h = boost::winapi::CreateSemaphoreW
+ (
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ 0, // initial count
+ (std::numeric_limits< boost::winapi::LONG_ >::max)(), // max count
+ name
+ );
+#endif
+ if (h == NULL)
+ {
+ boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ if (BOOST_LIKELY(err == ERROR_ALREADY_EXISTS))
+ {
+ open(name);
+ return;
+ }
+ else
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to create an interprocess semaphore object", (err));
+ }
+ }
+
+ m_sem.init(h);
+}
+
+void interprocess_semaphore::open(const wchar_t* name)
+{
+ boost::winapi::HANDLE_ h = boost::winapi::OpenSemaphoreW(boost::winapi::SYNCHRONIZE_ | boost::winapi::SEMAPHORE_MODIFY_STATE_ | boost::winapi::SEMAPHORE_QUERY_STATE_, false, name);
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to open an interprocess semaphore object", (err));
+ }
+
+ m_sem.init(h);
+}
+
+bool interprocess_semaphore::is_semaphore_zero_count_init(boost::winapi::HANDLE_ h)
+{
+ is_semaphore_zero_count_t impl = &interprocess_semaphore::is_semaphore_zero_count_emulated;
+
+ // Check if ntdll.dll provides NtQuerySemaphore, see: http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FSemaphore%2FNtQuerySemaphore.html
+ boost::winapi::HMODULE_ ntdll = boost::winapi::GetModuleHandleW(L"ntdll.dll");
+ if (ntdll)
+ {
+ nt_query_semaphore_t ntqs = (nt_query_semaphore_t)boost::winapi::get_proc_address(ntdll, "NtQuerySemaphore");
+ if (ntqs)
+ {
+ nt_query_semaphore = ntqs;
+ impl = &interprocess_semaphore::is_semaphore_zero_count_nt_query_semaphore;
+ }
+ }
+
+ is_semaphore_zero_count.store(impl, boost::memory_order_release);
+
+ return impl(h);
+}
+
+bool interprocess_semaphore::is_semaphore_zero_count_nt_query_semaphore(boost::winapi::HANDLE_ h)
+{
+ semaphore_basic_information info = {};
+ NTSTATUS_ err = nt_query_semaphore
+ (
+ h,
+ 0u, // SemaphoreBasicInformation
+ &info,
+ sizeof(info),
+ NULL
+ );
+ if (BOOST_UNLIKELY(err != 0u))
+ {
+ char buf[sizeof(unsigned int) * 2u + 4u];
+ boost::log::aux::snprintf(buf, sizeof(buf), "0x%08x", static_cast< unsigned int >(err));
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, std::string("Failed to test an interprocess semaphore object for zero count, NT status: ") + buf, (ERROR_INVALID_HANDLE));
+ }
+
+ return info.current_count == 0u;
+}
+
+bool interprocess_semaphore::is_semaphore_zero_count_emulated(boost::winapi::HANDLE_ h)
+{
+ const boost::winapi::DWORD_ retval = boost::winapi::WaitForSingleObject(h, 0u);
+ if (retval == boost::winapi::wait_timeout)
+ {
+ return true;
+ }
+ else if (BOOST_UNLIKELY(retval != boost::winapi::wait_object_0))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to test an interprocess semaphore object for zero count", (err));
+ }
+
+ // Restore the decremented counter
+ BOOST_VERIFY(!!boost::winapi::ReleaseSemaphore(h, 1, NULL));
+
+ return false;
+}
+
+#if !defined(BOOST_MSVC) || _MSC_VER >= 1800
+BOOST_CONSTEXPR_OR_CONST uint32_t interprocess_mutex::lock_flag_bit;
+BOOST_CONSTEXPR_OR_CONST uint32_t interprocess_mutex::event_set_flag_bit;
+BOOST_CONSTEXPR_OR_CONST uint32_t interprocess_mutex::lock_flag_value;
+BOOST_CONSTEXPR_OR_CONST uint32_t interprocess_mutex::event_set_flag_value;
+BOOST_CONSTEXPR_OR_CONST uint32_t interprocess_mutex::waiter_count_mask;
+#endif
+
+void interprocess_mutex::lock_slow()
+{
+ uint32_t old_state = m_shared_state->m_lock_state.load(boost::memory_order_relaxed);
+ mark_waiting_and_try_lock(old_state);
+
+ if ((old_state & lock_flag_value) != 0u) try
+ {
+ do
+ {
+ m_event.wait();
+ clear_waiting_and_try_lock(old_state);
+ }
+ while ((old_state & lock_flag_value) != 0u);
+ }
+ catch (...)
+ {
+ m_shared_state->m_lock_state.fetch_sub(1u, boost::memory_order_acq_rel);
+ throw;
+ }
+}
+
+bool interprocess_mutex::lock_slow(boost::winapi::HANDLE_ abort_handle)
+{
+ uint32_t old_state = m_shared_state->m_lock_state.load(boost::memory_order_relaxed);
+ mark_waiting_and_try_lock(old_state);
+
+ if ((old_state & lock_flag_value) != 0u) try
+ {
+ do
+ {
+ if (!m_event.wait(abort_handle))
+ {
+ // Wait was interrupted
+ m_shared_state->m_lock_state.fetch_sub(1u, boost::memory_order_acq_rel);
+ return false;
+ }
+
+ clear_waiting_and_try_lock(old_state);
+ }
+ while ((old_state & lock_flag_value) != 0u);
+ }
+ catch (...)
+ {
+ m_shared_state->m_lock_state.fetch_sub(1u, boost::memory_order_acq_rel);
+ throw;
+ }
+
+ return true;
+}
+
+inline void interprocess_mutex::mark_waiting_and_try_lock(uint32_t& old_state)
+{
+ uint32_t new_state;
+ do
+ {
+ uint32_t was_locked = (old_state & lock_flag_value);
+ if (was_locked)
+ {
+ // Avoid integer overflows
+ if (BOOST_UNLIKELY((old_state & waiter_count_mask) == waiter_count_mask))
+ BOOST_LOG_THROW_DESCR(limitation_error, "Too many waiters on an interprocess mutex");
+
+ new_state = old_state + 1u;
+ }
+ else
+ {
+ new_state = old_state | lock_flag_value;
+ }
+ }
+ while (!m_shared_state->m_lock_state.compare_exchange_weak(old_state, new_state, boost::memory_order_acq_rel, boost::memory_order_relaxed));
+}
+
+inline void interprocess_mutex::clear_waiting_and_try_lock(uint32_t& old_state)
+{
+ old_state &= ~lock_flag_value;
+ old_state |= event_set_flag_value;
+ uint32_t new_state;
+ do
+ {
+ new_state = ((old_state & lock_flag_value) ? old_state : ((old_state - 1u) | lock_flag_value)) & ~event_set_flag_value;
+ }
+ while (!m_shared_state->m_lock_state.compare_exchange_strong(old_state, new_state, boost::memory_order_acq_rel, boost::memory_order_relaxed));
+}
+
+
+bool interprocess_condition_variable::wait(interprocess_mutex::optional_unlock& lock, boost::winapi::HANDLE_ abort_handle)
+{
+ int32_t waiters = m_shared_state->m_waiters;
+ if (waiters < 0)
+ {
+ // We need to select a new semaphore to block on
+ m_current_semaphore = get_unused_semaphore();
+ ++m_shared_state->m_generation;
+ m_shared_state->m_semaphore_id = m_current_semaphore->m_id;
+ waiters = 0;
+ }
+ else
+ {
+ // Avoid integer overflow
+ if (BOOST_UNLIKELY(waiters >= ((std::numeric_limits< int32_t >::max)() - 1)))
+ BOOST_LOG_THROW_DESCR(limitation_error, "Too many waiters on an interprocess condition variable");
+
+ // Make sure we use the right semaphore to block on
+ const uint32_t id = m_shared_state->m_semaphore_id;
+ if (m_current_semaphore->m_id != id)
+ m_current_semaphore = get_semaphore(id);
+ }
+
+ m_shared_state->m_waiters = waiters + 1;
+ const uint32_t generation = m_shared_state->m_generation;
+
+ boost::winapi::HANDLE_ handles[2u] = { m_current_semaphore->m_semaphore.get_handle(), abort_handle };
+
+ interprocess_mutex* const mutex = lock.disengage();
+ mutex->unlock();
+
+ boost::winapi::DWORD_ retval = boost::winapi::WaitForMultipleObjects(2u, handles, false, boost::winapi::INFINITE_);
+
+ if (BOOST_UNLIKELY(retval == boost::winapi::WAIT_FAILED_))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+
+ // Although highly unrealistic, it is possible that it took so long for the current thread to enter WaitForMultipleObjects that
+ // another thread has managed to destroy the semaphore. This can happen if the semaphore remains in a non-zero state
+ // for too long, which means that another process died while being blocked on the semaphore, and the semaphore was signalled,
+ // and the non-zero state timeout has passed. In this case the most logical behavior for the wait function is to return as
+ // if because of a wakeup.
+ if (err == ERROR_INVALID_HANDLE)
+ retval = boost::winapi::WAIT_OBJECT_0_;
+ else
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to block on an interprocess semaphore object", (err));
+ }
+
+ // Have to unconditionally lock the mutex here
+ mutex->lock();
+ lock.engage(*mutex);
+
+ if (generation == m_shared_state->m_generation && m_shared_state->m_waiters > 0)
+ --m_shared_state->m_waiters;
+
+ return retval == boost::winapi::WAIT_OBJECT_0_;
+}
+
+//! Finds or opens a semaphore with the specified id
+interprocess_condition_variable::semaphore_info* interprocess_condition_variable::get_semaphore(uint32_t id)
+{
+ semaphore_info_set::insert_commit_data insert_state;
+ std::pair< semaphore_info_set::iterator, bool > res = m_semaphore_info_set.insert_check(id, semaphore_info::order_by_id(), insert_state);
+ if (res.second)
+ {
+ // We need to open the semaphore. It is possible that the semaphore does not exist because all processes that had it opened terminated.
+ // Because of this we also attempt to create it.
+ boost::log::aux::unique_ptr< semaphore_info > p(new semaphore_info(id));
+ generate_semaphore_name(id);
+ p->m_semaphore.create_or_open(m_semaphore_name.c_str(), m_perms);
+
+ res.first = m_semaphore_info_set.insert_commit(*p, insert_state);
+ m_semaphore_info_list.push_back(*p);
+
+ return p.release();
+ }
+ else
+ {
+ // Move the semaphore to the end of the list so that the next time we are less likely to use it
+ semaphore_info& info = *res.first;
+ m_semaphore_info_list.erase(m_semaphore_info_list.iterator_to(info));
+ m_semaphore_info_list.push_back(info);
+
+ return &info;
+ }
+}
+
+//! Finds or creates a semaphore with zero counter
+interprocess_condition_variable::semaphore_info* interprocess_condition_variable::get_unused_semaphore()
+{
+ // Be optimistic, check the current semaphore first
+ if (m_current_semaphore && m_current_semaphore->m_semaphore.is_zero_count())
+ {
+ mark_unused(*m_current_semaphore);
+ return m_current_semaphore;
+ }
+
+ const tick_count_clock::time_point now = tick_count_clock::now();
+
+ semaphore_info_list::iterator it = m_semaphore_info_list.begin(), end = m_semaphore_info_list.end();
+ while (it != end)
+ {
+ if (is_overflow_less(m_next_semaphore_id, it->m_id) || m_next_semaphore_id == it->m_id)
+ m_next_semaphore_id = it->m_id + 1u;
+
+ if (it->m_semaphore.is_zero_count())
+ {
+ semaphore_info& info = *it;
+ mark_unused(info);
+ return &info;
+ }
+ else if (it->check_non_zero_timeout(now))
+ {
+ // The semaphore is non-zero for too long. A blocked process must have crashed. Close it.
+ m_semaphore_info_set.erase(m_semaphore_info_set.iterator_to(*it));
+ m_semaphore_info_list.erase_and_dispose(it++, boost::checked_deleter< semaphore_info >());
+ }
+ else
+ {
+ ++it;
+ }
+ }
+
+ // No semaphore found, create a new one
+ for (uint32_t semaphore_id = m_next_semaphore_id, semaphore_id_end = semaphore_id - 1u; semaphore_id != semaphore_id_end; ++semaphore_id)
+ {
+ interprocess_semaphore sem;
+ try
+ {
+ generate_semaphore_name(semaphore_id);
+ sem.create_or_open(m_semaphore_name.c_str(), m_perms);
+ if (!sem.is_zero_count())
+ continue;
+ }
+ catch (...)
+ {
+ // Ignore errors, try the next one
+ continue;
+ }
+
+ semaphore_info* p = NULL;
+ semaphore_info_set::insert_commit_data insert_state;
+ std::pair< semaphore_info_set::iterator, bool > res = m_semaphore_info_set.insert_check(semaphore_id, semaphore_info::order_by_id(), insert_state);
+ if (res.second)
+ {
+ p = new semaphore_info(semaphore_id);
+ p->m_semaphore.swap(sem);
+
+ res.first = m_semaphore_info_set.insert_commit(*p, insert_state);
+ m_semaphore_info_list.push_back(*p);
+ }
+ else
+ {
+ // Some of our currently open semaphores must have been released by another thread
+ p = &*res.first;
+ mark_unused(*p);
+ }
+
+ m_next_semaphore_id = semaphore_id + 1u;
+
+ return p;
+ }
+
+ BOOST_LOG_THROW_DESCR(limitation_error, "Too many semaphores are actively used for an interprocess condition variable");
+ BOOST_LOG_UNREACHABLE_RETURN(NULL);
+}
+
+//! Marks the semaphore info as unused and moves to the end of list
+inline void interprocess_condition_variable::mark_unused(semaphore_info& info) BOOST_NOEXCEPT
+{
+ // Restart the timeout for non-zero state next time we search for an unused semaphore
+ info.m_checked_for_zero = false;
+ // Move to the end of the list so that we consider this semaphore last
+ m_semaphore_info_list.erase(m_semaphore_info_list.iterator_to(info));
+ m_semaphore_info_list.push_back(info);
+}
+
+//! Generates semaphore name according to id
+inline void interprocess_condition_variable::generate_semaphore_name(uint32_t id) BOOST_NOEXCEPT
+{
+ // Note: avoid anything that involves locale to make semaphore names as stable as possible
+ BOOST_ASSERT(m_semaphore_name.size() >= 8u);
+
+ wchar_t* p = &m_semaphore_name[m_semaphore_name.size() - 8u];
+ *p++ = boost::log::aux::g_hex_char_table[0][id >> 28];
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 24) & 0x0000000Fu];
+
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 20) & 0x0000000Fu];
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 16) & 0x0000000Fu];
+
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 12) & 0x0000000Fu];
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 8) & 0x0000000Fu];
+
+ *p++ = boost::log::aux::g_hex_char_table[0][(id >> 4) & 0x0000000Fu];
+ *p = boost::log::aux::g_hex_char_table[0][id & 0x0000000Fu];
+}
+
+} // namespace aux
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.hpp b/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.hpp
new file mode 100644
index 0000000000..7d1272aa1f
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/ipc_sync_wrappers.hpp
@@ -0,0 +1,652 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/ipc_sync_wrappers.hpp
+ * \author Andrey Semashev
+ * \date 23.01.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#ifndef BOOST_LOG_WINDOWS_IPC_SYNC_WRAPPERS_HPP_INCLUDED_
+#define BOOST_LOG_WINDOWS_IPC_SYNC_WRAPPERS_HPP_INCLUDED_
+
+#include <boost/log/detail/config.hpp>
+#include <boost/winapi/access_rights.hpp>
+#include <boost/winapi/handles.hpp>
+#include <boost/winapi/event.hpp>
+#include <boost/winapi/semaphore.hpp>
+#include <boost/winapi/wait.hpp>
+#include <boost/winapi/dll.hpp>
+#include <boost/winapi/time.hpp>
+#include <boost/winapi/get_last_error.hpp>
+#include <cstddef>
+#include <limits>
+#include <string>
+#include <utility>
+#include <boost/assert.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/intrusive/options.hpp>
+#include <boost/intrusive/set.hpp>
+#include <boost/intrusive/set_hook.hpp>
+#include <boost/intrusive/list.hpp>
+#include <boost/intrusive/list_hook.hpp>
+#include <boost/log/exceptions.hpp>
+#include <boost/log/utility/permissions.hpp>
+#include "windows/auto_handle.hpp"
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+namespace aux {
+
+// TODO: Port to Boost.Atomic when it supports extended atomic ops
+#if defined(BOOST_MSVC) && (_MSC_VER >= 1400) && !defined(UNDER_CE)
+
+#if _MSC_VER == 1400
+extern "C" unsigned char _interlockedbittestandset(long *a, long b);
+extern "C" unsigned char _interlockedbittestandreset(long *a, long b);
+#else
+extern "C" unsigned char _interlockedbittestandset(volatile long *a, long b);
+extern "C" unsigned char _interlockedbittestandreset(volatile long *a, long b);
+#endif
+
+#pragma intrinsic(_interlockedbittestandset)
+#pragma intrinsic(_interlockedbittestandreset)
+
+BOOST_FORCEINLINE bool bit_test_and_set(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ return _interlockedbittestandset(reinterpret_cast< long* >(&x.storage()), static_cast< long >(bit)) != 0;
+}
+
+BOOST_FORCEINLINE bool bit_test_and_reset(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ return _interlockedbittestandreset(reinterpret_cast< long* >(&x.storage()), static_cast< long >(bit)) != 0;
+}
+
+#elif (defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN)) && defined(_M_IX86)
+
+BOOST_FORCEINLINE bool bit_test_and_set(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ boost::atomic< uint32_t >::storage_type* p = &x.storage();
+ bool ret;
+ __asm
+ {
+ mov eax, bit
+ mov edx, p
+ lock bts [edx], eax
+ setc ret
+ };
+ return ret;
+}
+
+BOOST_FORCEINLINE bool bit_test_and_reset(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ boost::atomic< uint32_t >::storage_type* p = &x.storage();
+ bool ret;
+ __asm
+ {
+ mov eax, bit
+ mov edx, p
+ lock btr [edx], eax
+ setc ret
+ };
+ return ret;
+}
+
+#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
+
+#if !defined(__CUDACC__)
+#define BOOST_LOG_DETAIL_ASM_CLOBBER_CC_COMMA "cc",
+#else
+#define BOOST_LOG_DETAIL_ASM_CLOBBER_CC_COMMA
+#endif
+
+BOOST_FORCEINLINE bool bit_test_and_set(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ bool res;
+ __asm__ __volatile__
+ (
+ "lock; bts %[bit_number], %[storage]\n\t"
+ "setc %[result]\n\t"
+ : [storage] "+m" (x.storage()), [result] "=q" (res)
+ : [bit_number] "Kq" (bit)
+ : BOOST_LOG_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
+ );
+ return res;
+}
+
+BOOST_FORCEINLINE bool bit_test_and_reset(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ bool res;
+ __asm__ __volatile__
+ (
+ "lock; btr %[bit_number], %[storage]\n\t"
+ "setc %[result]\n\t"
+ : [storage] "+m" (x.storage()), [result] "=q" (res)
+ : [bit_number] "Kq" (bit)
+ : BOOST_LOG_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
+ );
+ return res;
+}
+
+#else
+
+BOOST_FORCEINLINE bool bit_test_and_set(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ const uint32_t mask = uint32_t(1u) << bit;
+ uint32_t old_val = x.fetch_or(mask, boost::memory_order_acq_rel);
+ return (old_val & mask) != 0u;
+}
+
+BOOST_FORCEINLINE bool bit_test_and_reset(boost::atomic< uint32_t >& x, uint32_t bit) BOOST_NOEXCEPT
+{
+ const uint32_t mask = uint32_t(1u) << bit;
+ uint32_t old_val = x.fetch_and(~mask, boost::memory_order_acq_rel);
+ return (old_val & mask) != 0u;
+}
+
+#endif
+
+//! Interprocess event object
+class interprocess_event
+{
+private:
+ auto_handle m_event;
+
+public:
+ void create(const wchar_t* name, bool manual_reset, permissions const& perms = permissions());
+ void create_or_open(const wchar_t* name, bool manual_reset, permissions const& perms = permissions());
+ void open(const wchar_t* name);
+
+ boost::winapi::HANDLE_ get_handle() const BOOST_NOEXCEPT { return m_event.get(); }
+
+ void set()
+ {
+ if (BOOST_UNLIKELY(!boost::winapi::SetEvent(m_event.get())))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to set an interprocess event object", (err));
+ }
+ }
+
+ void set_noexcept() BOOST_NOEXCEPT
+ {
+ BOOST_VERIFY(!!boost::winapi::SetEvent(m_event.get()));
+ }
+
+ void reset()
+ {
+ if (BOOST_UNLIKELY(!boost::winapi::ResetEvent(m_event.get())))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to reset an interprocess event object", (err));
+ }
+ }
+
+ void wait()
+ {
+ const boost::winapi::DWORD_ retval = boost::winapi::WaitForSingleObject(m_event.get(), boost::winapi::infinite);
+ if (BOOST_UNLIKELY(retval != boost::winapi::wait_object_0))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to block on an interprocess event object", (err));
+ }
+ }
+
+ bool wait(boost::winapi::HANDLE_ abort_handle)
+ {
+ boost::winapi::HANDLE_ handles[2u] = { m_event.get(), abort_handle };
+ const boost::winapi::DWORD_ retval = boost::winapi::WaitForMultipleObjects(2u, handles, false, boost::winapi::infinite);
+ if (retval == (boost::winapi::wait_object_0 + 1u))
+ {
+ // Wait was interrupted
+ return false;
+ }
+ else if (BOOST_UNLIKELY(retval != boost::winapi::wait_object_0))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to block on an interprocess event object", (err));
+ }
+
+ return true;
+ }
+
+ void swap(interprocess_event& that) BOOST_NOEXCEPT
+ {
+ m_event.swap(that.m_event);
+ }
+};
+
+//! Interprocess semaphore object
+class interprocess_semaphore
+{
+private:
+ typedef boost::winapi::DWORD_ NTSTATUS_;
+ struct semaphore_basic_information
+ {
+ boost::winapi::ULONG_ current_count; // current semaphore count
+ boost::winapi::ULONG_ maximum_count; // max semaphore count
+ };
+ typedef NTSTATUS_ (__stdcall *nt_query_semaphore_t)(boost::winapi::HANDLE_ h, unsigned int info_class, semaphore_basic_information* pinfo, boost::winapi::ULONG_ info_size, boost::winapi::ULONG_* ret_len);
+ typedef bool (*is_semaphore_zero_count_t)(boost::winapi::HANDLE_ h);
+
+private:
+ auto_handle m_sem;
+
+ static boost::atomic< is_semaphore_zero_count_t > is_semaphore_zero_count;
+ static nt_query_semaphore_t nt_query_semaphore;
+
+public:
+ void create_or_open(const wchar_t* name, permissions const& perms = permissions());
+ void open(const wchar_t* name);
+
+ boost::winapi::HANDLE_ get_handle() const BOOST_NOEXCEPT { return m_sem.get(); }
+
+ void post(uint32_t count)
+ {
+ BOOST_ASSERT(count <= static_cast< uint32_t >((std::numeric_limits< boost::winapi::LONG_ >::max)()));
+
+ if (BOOST_UNLIKELY(!boost::winapi::ReleaseSemaphore(m_sem.get(), static_cast< boost::winapi::LONG_ >(count), NULL)))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to post on an interprocess semaphore object", (err));
+ }
+ }
+
+ bool is_zero_count() const
+ {
+ return is_semaphore_zero_count.load(boost::memory_order_acquire)(m_sem.get());
+ }
+
+ void wait()
+ {
+ const boost::winapi::DWORD_ retval = boost::winapi::WaitForSingleObject(m_sem.get(), boost::winapi::infinite);
+ if (BOOST_UNLIKELY(retval != boost::winapi::wait_object_0))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to block on an interprocess semaphore object", (err));
+ }
+ }
+
+ bool wait(boost::winapi::HANDLE_ abort_handle)
+ {
+ boost::winapi::HANDLE_ handles[2u] = { m_sem.get(), abort_handle };
+ const boost::winapi::DWORD_ retval = boost::winapi::WaitForMultipleObjects(2u, handles, false, boost::winapi::infinite);
+ if (retval == (boost::winapi::wait_object_0 + 1u))
+ {
+ // Wait was interrupted
+ return false;
+ }
+ else if (BOOST_UNLIKELY(retval != boost::winapi::wait_object_0))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to block on an interprocess semaphore object", (err));
+ }
+
+ return true;
+ }
+
+ void swap(interprocess_semaphore& that) BOOST_NOEXCEPT
+ {
+ m_sem.swap(that.m_sem);
+ }
+
+private:
+ static bool is_semaphore_zero_count_init(boost::winapi::HANDLE_ h);
+ static bool is_semaphore_zero_count_nt_query_semaphore(boost::winapi::HANDLE_ h);
+ static bool is_semaphore_zero_count_emulated(boost::winapi::HANDLE_ h);
+};
+
+//! Interprocess mutex. Implementation adopted from Boost.Sync.
+class interprocess_mutex
+{
+public:
+ //! Shared state that should be visible to all processes using the mutex
+ struct shared_state
+ {
+ boost::atomic< uint32_t > m_lock_state;
+
+ shared_state() BOOST_NOEXCEPT : m_lock_state(0u)
+ {
+ }
+ };
+
+ struct auto_unlock
+ {
+ explicit auto_unlock(interprocess_mutex& mutex) BOOST_NOEXCEPT : m_mutex(mutex) {}
+ ~auto_unlock() { m_mutex.unlock(); }
+
+ BOOST_DELETED_FUNCTION(auto_unlock(auto_unlock const&))
+ BOOST_DELETED_FUNCTION(auto_unlock& operator=(auto_unlock const&))
+
+ private:
+ interprocess_mutex& m_mutex;
+ };
+
+ struct optional_unlock
+ {
+ optional_unlock() BOOST_NOEXCEPT : m_mutex(NULL) {}
+ explicit optional_unlock(interprocess_mutex& mutex) BOOST_NOEXCEPT : m_mutex(&mutex) {}
+ ~optional_unlock() { if (m_mutex) m_mutex->unlock(); }
+
+ interprocess_mutex* disengage() BOOST_NOEXCEPT
+ {
+ interprocess_mutex* p = m_mutex;
+ m_mutex = NULL;
+ return p;
+ }
+
+ void engage(interprocess_mutex& mutex) BOOST_NOEXCEPT
+ {
+ BOOST_ASSERT(!m_mutex);
+ m_mutex = &mutex;
+ }
+
+ BOOST_DELETED_FUNCTION(optional_unlock(optional_unlock const&))
+ BOOST_DELETED_FUNCTION(optional_unlock& operator=(optional_unlock const&))
+
+ private:
+ interprocess_mutex* m_mutex;
+ };
+
+private:
+ interprocess_event m_event;
+ shared_state* m_shared_state;
+
+#if !defined(BOOST_MSVC) || _MSC_VER >= 1800
+ static BOOST_CONSTEXPR_OR_CONST uint32_t lock_flag_bit = 31u;
+ static BOOST_CONSTEXPR_OR_CONST uint32_t event_set_flag_bit = 30u;
+ static BOOST_CONSTEXPR_OR_CONST uint32_t lock_flag_value = 1u << lock_flag_bit;
+ static BOOST_CONSTEXPR_OR_CONST uint32_t event_set_flag_value = 1u << event_set_flag_bit;
+ static BOOST_CONSTEXPR_OR_CONST uint32_t waiter_count_mask = event_set_flag_value - 1u;
+#else
+ // MSVC 8-11, inclusively, fail to link if these constants are declared as static constants instead of an enum
+ enum
+ {
+ lock_flag_bit = 31u,
+ event_set_flag_bit = 30u,
+ lock_flag_value = 1u << lock_flag_bit,
+ event_set_flag_value = 1u << event_set_flag_bit,
+ waiter_count_mask = event_set_flag_value - 1u
+ };
+#endif
+
+public:
+ interprocess_mutex() BOOST_NOEXCEPT : m_shared_state(NULL)
+ {
+ }
+
+ void create(const wchar_t* name, shared_state* shared, permissions const& perms = permissions())
+ {
+ m_event.create(name, false, perms);
+ m_shared_state = shared;
+ }
+
+ void open(const wchar_t* name, shared_state* shared)
+ {
+ m_event.open(name);
+ m_shared_state = shared;
+ }
+
+ bool try_lock()
+ {
+ return !bit_test_and_set(m_shared_state->m_lock_state, lock_flag_bit);
+ }
+
+ void lock()
+ {
+ if (BOOST_UNLIKELY(!try_lock()))
+ lock_slow();
+ }
+
+ bool lock(boost::winapi::HANDLE_ abort_handle)
+ {
+ if (BOOST_LIKELY(try_lock()))
+ return true;
+ return lock_slow(abort_handle);
+ }
+
+ void unlock() BOOST_NOEXCEPT
+ {
+ const uint32_t old_count = m_shared_state->m_lock_state.fetch_add(lock_flag_value, boost::memory_order_release);
+ if ((old_count & event_set_flag_value) == 0u && (old_count > lock_flag_value))
+ {
+ if (!bit_test_and_set(m_shared_state->m_lock_state, event_set_flag_bit))
+ {
+ m_event.set_noexcept();
+ }
+ }
+ }
+
+ BOOST_DELETED_FUNCTION(interprocess_mutex(interprocess_mutex const&))
+ BOOST_DELETED_FUNCTION(interprocess_mutex& operator=(interprocess_mutex const&))
+
+private:
+ void lock_slow();
+ bool lock_slow(boost::winapi::HANDLE_ abort_handle);
+ void mark_waiting_and_try_lock(uint32_t& old_state);
+ void clear_waiting_and_try_lock(uint32_t& old_state);
+};
+
+//! A simple clock that corresponds to GetTickCount/GetTickCount64 timeline
+struct tick_count_clock
+{
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ typedef boost::winapi::ULONGLONG_ time_point;
+#else
+ typedef boost::winapi::DWORD_ time_point;
+#endif
+
+ static time_point now() BOOST_NOEXCEPT
+ {
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ return boost::winapi::GetTickCount64();
+#else
+ return boost::winapi::GetTickCount();
+#endif
+ }
+};
+
+//! Interprocess condition variable
+class interprocess_condition_variable
+{
+private:
+ typedef boost::intrusive::list_base_hook<
+ boost::intrusive::tag< struct for_sem_order_by_usage >,
+ boost::intrusive::link_mode< boost::intrusive::safe_link >
+ > semaphore_info_list_hook_t;
+
+ typedef boost::intrusive::set_base_hook<
+ boost::intrusive::tag< struct for_sem_lookup_by_id >,
+ boost::intrusive::link_mode< boost::intrusive::safe_link >,
+ boost::intrusive::optimize_size< true >
+ > semaphore_info_set_hook_t;
+
+ //! Information about a semaphore object
+ struct semaphore_info :
+ public semaphore_info_list_hook_t,
+ public semaphore_info_set_hook_t
+ {
+ struct order_by_id
+ {
+ typedef bool result_type;
+
+ result_type operator() (semaphore_info const& left, semaphore_info const& right) const BOOST_NOEXCEPT
+ {
+ return left.m_id < right.m_id;
+ }
+ result_type operator() (semaphore_info const& left, uint32_t right) const BOOST_NOEXCEPT
+ {
+ return left.m_id < right;
+ }
+ result_type operator() (uint32_t left, semaphore_info const& right) const BOOST_NOEXCEPT
+ {
+ return left < right.m_id;
+ }
+ };
+
+ //! The semaphore
+ interprocess_semaphore m_semaphore;
+ //! Timestamp of the moment when the semaphore was checked for zero count and it was not zero. In milliseconds since epoch.
+ tick_count_clock::time_point m_last_check_for_zero;
+ //! The flag indicates that the semaphore has been checked for zero count and it was not zero
+ bool m_checked_for_zero;
+ //! The semaphore id
+ const uint32_t m_id;
+
+ explicit semaphore_info(uint32_t id) BOOST_NOEXCEPT : m_last_check_for_zero(0u), m_id(id)
+ {
+ }
+
+ //! Checks if the semaphore is in 'non-zero' state for too long
+ bool check_non_zero_timeout(tick_count_clock::time_point now) BOOST_NOEXCEPT
+ {
+ if (!m_checked_for_zero)
+ {
+ m_last_check_for_zero = now;
+ m_checked_for_zero = true;
+ return false;
+ }
+
+ return (now - m_last_check_for_zero) >= 2000u;
+ }
+
+ BOOST_DELETED_FUNCTION(semaphore_info(semaphore_info const&))
+ BOOST_DELETED_FUNCTION(semaphore_info& operator=(semaphore_info const&))
+ };
+
+ typedef boost::intrusive::list<
+ semaphore_info,
+ boost::intrusive::base_hook< semaphore_info_list_hook_t >,
+ boost::intrusive::constant_time_size< false >
+ > semaphore_info_list;
+
+ typedef boost::intrusive::set<
+ semaphore_info,
+ boost::intrusive::base_hook< semaphore_info_set_hook_t >,
+ boost::intrusive::compare< semaphore_info::order_by_id >,
+ boost::intrusive::constant_time_size< false >
+ > semaphore_info_set;
+
+public:
+ struct shared_state
+ {
+ //! Number of waiters blocked on the semaphore if >0, 0 if no threads are blocked, <0 when the blocked threads were signalled
+ int32_t m_waiters;
+ //! The semaphore generation
+ uint32_t m_generation;
+ //! Id of the semaphore which is used to block threads on
+ uint32_t m_semaphore_id;
+
+ shared_state() BOOST_NOEXCEPT :
+ m_waiters(0),
+ m_generation(0u),
+ m_semaphore_id(0u)
+ {
+ }
+ };
+
+private:
+ //! The list of semaphores used for blocking. The list is in the order at which the semaphores are considered to be picked for being used.
+ semaphore_info_list m_semaphore_info_list;
+ //! The list of semaphores used for blocking. Used for searching for a particular semaphore by id.
+ semaphore_info_set m_semaphore_info_set;
+ //! The semaphore that is currently being used for blocking
+ semaphore_info* m_current_semaphore;
+ //! A string storage for formatting a semaphore name
+ std::wstring m_semaphore_name;
+ //! Permissions used to create new semaphores
+ permissions m_perms;
+ //! Process-shared state
+ shared_state* m_shared_state;
+ //! The next id for creating a new semaphore
+ uint32_t m_next_semaphore_id;
+
+public:
+ interprocess_condition_variable() BOOST_NOEXCEPT :
+ m_current_semaphore(NULL),
+ m_shared_state(NULL),
+ m_next_semaphore_id(0u)
+ {
+ }
+
+ ~interprocess_condition_variable()
+ {
+ m_semaphore_info_set.clear();
+ m_semaphore_info_list.clear_and_dispose(boost::checked_deleter< semaphore_info >());
+ }
+
+ void init(const wchar_t* name, shared_state* shared, permissions const& perms = permissions())
+ {
+ m_perms = perms;
+ m_shared_state = shared;
+
+ m_semaphore_name = name;
+ // Reserve space for generate_semaphore_name()
+ m_semaphore_name.append(L".sem00000000");
+
+ m_current_semaphore = get_semaphore(m_shared_state->m_semaphore_id);
+ }
+
+ void notify_all()
+ {
+ const int32_t waiters = m_shared_state->m_waiters;
+ if (waiters > 0)
+ {
+ const uint32_t id = m_shared_state->m_semaphore_id;
+ if (m_current_semaphore->m_id != id)
+ m_current_semaphore = get_semaphore(id);
+
+ m_current_semaphore->m_semaphore.post(waiters);
+ m_shared_state->m_waiters = -waiters;
+ }
+ }
+
+ bool wait(interprocess_mutex::optional_unlock& lock, boost::winapi::HANDLE_ abort_handle);
+
+ BOOST_DELETED_FUNCTION(interprocess_condition_variable(interprocess_condition_variable const&))
+ BOOST_DELETED_FUNCTION(interprocess_condition_variable& operator=(interprocess_condition_variable const&))
+
+private:
+ //! Finds or opens a semaphore with the specified id
+ semaphore_info* get_semaphore(uint32_t id);
+ //! Finds or creates a semaphore with zero counter
+ semaphore_info* get_unused_semaphore();
+
+ //! Marks the semaphore info as unused and moves to the end of list
+ void mark_unused(semaphore_info& info) BOOST_NOEXCEPT;
+
+ //! Generates semaphore name according to id
+ void generate_semaphore_name(uint32_t id) BOOST_NOEXCEPT;
+
+ //! Returns \c true if \a left is less than \a right considering possible integer overflow
+ static bool is_overflow_less(uint32_t left, uint32_t right) BOOST_NOEXCEPT
+ {
+ return ((left - right) & 0x80000000u) != 0u;
+ }
+};
+
+} // namespace aux
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_WINDOWS_IPC_SYNC_WRAPPERS_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/libs/log/src/windows/light_rw_mutex.cpp b/contrib/restricted/boost/libs/log/src/windows/light_rw_mutex.cpp
new file mode 100644
index 0000000000..010cb55d2a
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/light_rw_mutex.cpp
@@ -0,0 +1,201 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file light_rw_mutex.cpp
+ * \author Andrey Semashev
+ * \date 19.06.2010
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#include <boost/log/detail/config.hpp>
+#include <boost/log/detail/light_rw_mutex.hpp>
+
+#if !defined(BOOST_LOG_NO_THREADS)
+
+#if !defined(BOOST_LOG_LWRWMUTEX_USE_PTHREAD) && !defined(BOOST_LOG_LWRWMUTEX_USE_SRWLOCK)
+
+#include <cstddef>
+#include <new>
+#include <boost/assert.hpp>
+#include <boost/align/aligned_alloc.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/log/utility/once_block.hpp>
+
+#include <boost/winapi/basic_types.hpp>
+#include <boost/winapi/dll.hpp>
+
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+struct BOOST_LOG_MAY_ALIAS mutex_impl { void* p; }; // has the same layout as SRWLOCK and light_rw_mutex::m_Mutex
+
+typedef void (WINAPI *init_fun_t)(mutex_impl*);
+typedef void (WINAPI *destroy_fun_t)(mutex_impl*);
+typedef void (WINAPI *lock_exclusive_fun_t)(mutex_impl*);
+typedef void (WINAPI *lock_shared_fun_t)(mutex_impl*);
+typedef void (WINAPI *unlock_exclusive_fun_t)(mutex_impl*);
+typedef void (WINAPI *unlock_shared_fun_t)(mutex_impl*);
+
+//! A complement stub function for InitializeSRWLock
+void WINAPI DeinitializeSRWLock(mutex_impl*)
+{
+}
+
+// The Boost.Thread-based implementation
+void WINAPI InitializeSharedMutex(mutex_impl* mtx)
+{
+ // To avoid cache line aliasing we do aligned memory allocation here
+ enum
+ {
+ // Allocation size is the minimum number of cache lines to accommodate shared_mutex
+ size =
+ (
+ sizeof(shared_mutex) / BOOST_LOG_CPU_CACHE_LINE_SIZE
+ + ((sizeof(shared_mutex) % BOOST_LOG_CPU_CACHE_LINE_SIZE) != 0)
+ )
+ * BOOST_LOG_CPU_CACHE_LINE_SIZE
+ };
+ mtx->p = alignment::aligned_alloc(BOOST_LOG_CPU_CACHE_LINE_SIZE, size);
+ BOOST_ASSERT(mtx->p != NULL);
+ new (mtx->p) shared_mutex();
+}
+
+void WINAPI DeinitializeSharedMutex(mutex_impl* mtx)
+{
+ static_cast< shared_mutex* >(mtx->p)->~shared_mutex();
+ alignment::aligned_free(mtx->p);
+ mtx->p = NULL;
+}
+
+void WINAPI ExclusiveLockSharedMutex(mutex_impl* mtx)
+{
+ static_cast< shared_mutex* >(mtx->p)->lock();
+}
+
+void WINAPI SharedLockSharedMutex(mutex_impl* mtx)
+{
+ static_cast< shared_mutex* >(mtx->p)->lock_shared();
+}
+
+void WINAPI ExclusiveUnlockSharedMutex(mutex_impl* mtx)
+{
+ static_cast< shared_mutex* >(mtx->p)->unlock();
+}
+
+void WINAPI SharedUnlockSharedMutex(mutex_impl* mtx)
+{
+ static_cast< shared_mutex* >(mtx->p)->unlock_shared();
+}
+
+// Pointers to the actual implementation functions
+init_fun_t g_pInitializeLWRWMutex = NULL;
+destroy_fun_t g_pDestroyLWRWMutex = NULL;
+lock_exclusive_fun_t g_pLockExclusiveLWRWMutex = NULL;
+lock_shared_fun_t g_pLockSharedLWRWMutex = NULL;
+unlock_exclusive_fun_t g_pUnlockExclusiveLWRWMutex = NULL;
+unlock_shared_fun_t g_pUnlockSharedLWRWMutex = NULL;
+
+//! The function dynamically initializes the implementation pointers
+void init_light_rw_mutex_impl()
+{
+ boost::winapi::HMODULE_ hKernel32 = boost::winapi::GetModuleHandleW(L"kernel32.dll");
+ if (hKernel32)
+ {
+ g_pInitializeLWRWMutex =
+ (init_fun_t)boost::winapi::get_proc_address(hKernel32, "InitializeSRWLock");
+ if (g_pInitializeLWRWMutex)
+ {
+ g_pLockExclusiveLWRWMutex =
+ (lock_exclusive_fun_t)boost::winapi::get_proc_address(hKernel32, "AcquireSRWLockExclusive");
+ if (g_pLockExclusiveLWRWMutex)
+ {
+ g_pUnlockExclusiveLWRWMutex =
+ (unlock_exclusive_fun_t)boost::winapi::get_proc_address(hKernel32, "ReleaseSRWLockExclusive");
+ if (g_pUnlockExclusiveLWRWMutex)
+ {
+ g_pLockSharedLWRWMutex =
+ (lock_shared_fun_t)boost::winapi::get_proc_address(hKernel32, "AcquireSRWLockShared");
+ if (g_pLockSharedLWRWMutex)
+ {
+ g_pUnlockSharedLWRWMutex =
+ (unlock_shared_fun_t)boost::winapi::get_proc_address(hKernel32, "ReleaseSRWLockShared");
+ if (g_pUnlockSharedLWRWMutex)
+ {
+ g_pDestroyLWRWMutex = &DeinitializeSRWLock;
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Current OS doesn't have support for SRWLOCK, use Boost.Thread instead
+ g_pInitializeLWRWMutex = &InitializeSharedMutex;
+ g_pDestroyLWRWMutex = &DeinitializeSharedMutex;
+ g_pLockExclusiveLWRWMutex = &ExclusiveLockSharedMutex;
+ g_pUnlockExclusiveLWRWMutex = &ExclusiveUnlockSharedMutex;
+ g_pLockSharedLWRWMutex = &SharedLockSharedMutex;
+ g_pUnlockSharedLWRWMutex = &SharedUnlockSharedMutex;
+}
+
+} // namespace
+
+BOOST_LOG_API light_rw_mutex::light_rw_mutex()
+{
+ BOOST_LOG_ONCE_BLOCK()
+ {
+ init_light_rw_mutex_impl();
+ }
+ g_pInitializeLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+BOOST_LOG_API light_rw_mutex::~light_rw_mutex()
+{
+ g_pDestroyLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+BOOST_LOG_API void light_rw_mutex::lock_shared()
+{
+ g_pLockSharedLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+BOOST_LOG_API void light_rw_mutex::unlock_shared()
+{
+ g_pUnlockSharedLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+BOOST_LOG_API void light_rw_mutex::lock()
+{
+ g_pLockExclusiveLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+BOOST_LOG_API void light_rw_mutex::unlock()
+{
+ g_pUnlockExclusiveLWRWMutex((mutex_impl*)&m_Mutex);
+}
+
+} // namespace aux
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // !defined(BOOST_LOG_LWRWMUTEX_USE_PTHREAD) && !defined(BOOST_LOG_LWRWMUTEX_USE_SRWLOCK)
+
+#endif // !defined(BOOST_LOG_NO_THREADS)
diff --git a/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.cpp b/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.cpp
new file mode 100644
index 0000000000..4586c1d81b
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.cpp
@@ -0,0 +1,251 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/mapped_shared_memory.cpp
+ * \author Andrey Semashev
+ * \date 13.02.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#include <boost/log/detail/config.hpp>
+#include <boost/winapi/basic_types.hpp>
+#include <boost/winapi/handles.hpp>
+#include <boost/winapi/dll.hpp>
+#include <boost/winapi/file_mapping.hpp>
+#include <boost/winapi/page_protection_flags.hpp>
+#include <boost/winapi/get_last_error.hpp>
+#include <windows.h> // for error codes
+#include <cstddef>
+#include <limits>
+#include <string>
+#include <sstream>
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/log/exceptions.hpp>
+#include <boost/log/utility/permissions.hpp>
+#include "windows/mapped_shared_memory.hpp"
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+namespace aux {
+
+boost::atomic< mapped_shared_memory::nt_query_section_t > mapped_shared_memory::nt_query_section(static_cast< mapped_shared_memory::nt_query_section_t >(NULL));
+
+mapped_shared_memory::~mapped_shared_memory()
+{
+ if (m_mapped_address)
+ unmap();
+
+ if (m_handle)
+ {
+ BOOST_VERIFY(boost::winapi::CloseHandle(m_handle) != 0);
+ m_handle = NULL;
+ }
+}
+
+//! Creates a new file mapping for the shared memory segment or opens the existing one
+void mapped_shared_memory::create(const wchar_t* name, std::size_t size, permissions const& perms)
+{
+ BOOST_ASSERT(m_handle == NULL);
+
+ const uint64_t size64 = static_cast< uint64_t >(size);
+
+ // Unlike other create functions, this function opens the existing mapping, if one already exists
+ boost::winapi::HANDLE_ h = boost::winapi::CreateFileMappingW
+ (
+ boost::winapi::INVALID_HANDLE_VALUE_,
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ boost::winapi::PAGE_READWRITE_ | boost::winapi::SEC_COMMIT_,
+ static_cast< boost::winapi::DWORD_ >(size64 >> 32u),
+ static_cast< boost::winapi::DWORD_ >(size64),
+ name
+ );
+
+ boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ if (BOOST_UNLIKELY(h == NULL || err != ERROR_SUCCESS))
+ {
+ if (h != NULL)
+ boost::winapi::CloseHandle(h);
+ std::ostringstream strm;
+ strm << "Failed to create a shared memory segment of " << size << " bytes";
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, strm.str(), (err));
+ }
+
+ m_handle = h;
+ m_size = size;
+}
+
+//! Creates a new file mapping for the shared memory segment or opens the existing one. Returns \c true if the region was created and \c false if an existing one was opened.
+bool mapped_shared_memory::create_or_open(const wchar_t* name, std::size_t size, permissions const& perms)
+{
+ BOOST_ASSERT(m_handle == NULL);
+
+ const uint64_t size64 = static_cast< uint64_t >(size);
+
+ // Unlike other create functions, this function opens the existing mapping, if one already exists
+ boost::winapi::HANDLE_ h = boost::winapi::CreateFileMappingW
+ (
+ boost::winapi::INVALID_HANDLE_VALUE_,
+ reinterpret_cast< boost::winapi::SECURITY_ATTRIBUTES_* >(perms.get_native()),
+ boost::winapi::PAGE_READWRITE_ | boost::winapi::SEC_COMMIT_,
+ static_cast< boost::winapi::DWORD_ >(size64 >> 32u),
+ static_cast< boost::winapi::DWORD_ >(size64),
+ name
+ );
+
+ boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ std::ostringstream strm;
+ strm << "Failed to create or open a shared memory segment of " << size << " bytes";
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, strm.str(), (err));
+ }
+
+ const bool created = (err != ERROR_ALREADY_EXISTS);
+ try
+ {
+ if (created)
+ {
+ m_size = size;
+ }
+ else
+ {
+ // If an existing segment was opened, determine its size
+ m_size = obtain_size(h);
+ }
+ }
+ catch (...)
+ {
+ boost::winapi::CloseHandle(h);
+ throw;
+ }
+
+ m_handle = h;
+
+ return created;
+}
+
+//! Opens the existing file mapping for the shared memory segment
+void mapped_shared_memory::open(const wchar_t* name)
+{
+ BOOST_ASSERT(m_handle == NULL);
+
+ // Note: FILE_MAP_WRITE implies reading permission as well
+ boost::winapi::HANDLE_ h = boost::winapi::OpenFileMappingW(boost::winapi::FILE_MAP_WRITE_ | boost::winapi::SECTION_QUERY_, false, name);
+
+ if (BOOST_UNLIKELY(h == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to create a shared memory segment", (err));
+ }
+
+ try
+ {
+ m_size = obtain_size(h);
+ }
+ catch (...)
+ {
+ boost::winapi::CloseHandle(h);
+ throw;
+ }
+
+ m_handle = h;
+}
+
+//! Maps the file mapping into the current process memory
+void mapped_shared_memory::map()
+{
+ BOOST_ASSERT(m_handle != NULL);
+ BOOST_ASSERT(m_mapped_address == NULL);
+
+ // Note: FILE_MAP_WRITE implies reading permission as well
+ m_mapped_address = boost::winapi::MapViewOfFile
+ (
+ m_handle,
+ boost::winapi::FILE_MAP_WRITE_ | boost::winapi::SECTION_QUERY_,
+ 0u,
+ 0u,
+ m_size
+ );
+
+ if (BOOST_UNLIKELY(m_mapped_address == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to map the shared memory segment into the process address space", (err));
+ }
+}
+
+//! Unmaps the file mapping
+void mapped_shared_memory::unmap()
+{
+ BOOST_ASSERT(m_mapped_address != NULL);
+
+ BOOST_VERIFY(boost::winapi::UnmapViewOfFile(m_mapped_address) != 0);
+ m_mapped_address = NULL;
+}
+
+//! Returns the size of the file mapping identified by the handle
+std::size_t mapped_shared_memory::obtain_size(boost::winapi::HANDLE_ h)
+{
+ nt_query_section_t query_section = nt_query_section.load(boost::memory_order_acquire);
+
+ if (BOOST_UNLIKELY(query_section == NULL))
+ {
+ // Check if ntdll.dll provides NtQuerySection, see: http://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FNT%20Objects%2FSection%2FNtQuerySection.html
+ boost::winapi::HMODULE_ ntdll = boost::winapi::GetModuleHandleW(L"ntdll.dll");
+ if (BOOST_UNLIKELY(ntdll == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to obtain a handle to ntdll.dll", (err));
+ }
+
+ query_section = (nt_query_section_t)boost::winapi::get_proc_address(ntdll, "NtQuerySection");
+ if (BOOST_UNLIKELY(query_section == NULL))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to obtain the NtQuerySection function", (err));
+ }
+
+ nt_query_section.store(query_section, boost::memory_order_release);
+ }
+
+ section_basic_information info = {};
+ boost::winapi::NTSTATUS_ err = query_section
+ (
+ h,
+ 0u, // SectionBasicInformation
+ &info,
+ sizeof(info),
+ NULL
+ );
+ if (BOOST_UNLIKELY(err != 0u))
+ {
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to test obtain size of the shared memory segment", (ERROR_INVALID_HANDLE));
+ }
+
+ return static_cast< std::size_t >(info.section_size.QuadPart);
+}
+
+} // namespace aux
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.hpp b/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.hpp
new file mode 100644
index 0000000000..1b5b85e5b2
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/mapped_shared_memory.hpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/mapped_shared_memory.hpp
+ * \author Andrey Semashev
+ * \date 13.02.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#ifndef BOOST_LOG_WINDOWS_MAPPED_SHARED_MEMORY_HPP_INCLUDED_
+#define BOOST_LOG_WINDOWS_MAPPED_SHARED_MEMORY_HPP_INCLUDED_
+
+#include <boost/log/detail/config.hpp>
+#include <boost/winapi/basic_types.hpp>
+#include <cstddef>
+#include <boost/assert.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/log/utility/permissions.hpp>
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+namespace aux {
+
+/*!
+ * A replacement for to \c mapped_shared_memory and \c mapped_region from Boost.Interprocess.
+ * The significant difference is that the shared memory name is passed as a UTF-16 string and
+ * errors are reported as Boost.Log exceptions.
+ */
+class mapped_shared_memory
+{
+private:
+ struct section_basic_information
+ {
+ void* base_address;
+ boost::winapi::ULONG_ section_attributes;
+ boost::winapi::LARGE_INTEGER_ section_size;
+ };
+ typedef boost::winapi::NTSTATUS_ (__stdcall *nt_query_section_t)(boost::winapi::HANDLE_ h, unsigned int info_class, section_basic_information* pinfo, boost::winapi::ULONG_ info_size, boost::winapi::ULONG_* ret_len);
+
+private:
+ boost::winapi::HANDLE_ m_handle;
+ void* m_mapped_address;
+ std::size_t m_size;
+ static boost::atomic< nt_query_section_t > nt_query_section;
+
+public:
+ BOOST_CONSTEXPR mapped_shared_memory() BOOST_NOEXCEPT :
+ m_handle(NULL),
+ m_mapped_address(NULL),
+ m_size(0u)
+ {
+ }
+
+ ~mapped_shared_memory();
+
+ //! Creates a new file mapping for the shared memory segment
+ void create(const wchar_t* name, std::size_t size, permissions const& perms = permissions());
+ //! Creates a new file mapping for the shared memory segment or opens the existing one. Returns \c true if the region was created and \c false if an existing one was opened.
+ bool create_or_open(const wchar_t* name, std::size_t size, permissions const& perms = permissions());
+ //! Opens the existing file mapping for the shared memory segment
+ void open(const wchar_t* name);
+
+ //! Maps the file mapping into the current process memory
+ void map();
+ //! Unmaps the file mapping
+ void unmap();
+
+ //! Returns the size of the opened shared memory segment
+ std::size_t size() const BOOST_NOEXCEPT { return m_size; }
+ //! Returns the address of the mapped shared memory
+ void* address() const BOOST_NOEXCEPT { return m_mapped_address; }
+
+ BOOST_DELETED_FUNCTION(mapped_shared_memory(mapped_shared_memory const&))
+ BOOST_DELETED_FUNCTION(mapped_shared_memory& operator=(mapped_shared_memory const&))
+
+private:
+ //! Returns the size of the file mapping identified by the handle
+ static std::size_t obtain_size(boost::winapi::HANDLE_ h);
+};
+
+} // namespace aux
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_WINDOWS_MAPPED_SHARED_MEMORY_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/libs/log/src/windows/object_name.cpp b/contrib/restricted/boost/libs/log/src/windows/object_name.cpp
new file mode 100644
index 0000000000..5b56a0352a
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/object_name.cpp
@@ -0,0 +1,227 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/object_name.cpp
+ * \author Andrey Semashev
+ * \date 06.03.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#include <boost/log/detail/config.hpp>
+#include <cstddef>
+#include <cstdlib>
+#include <string>
+#include <vector>
+#include <algorithm>
+#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/move/utility_core.hpp>
+#include <boost/log/exceptions.hpp>
+#include <boost/log/utility/ipc/object_name.hpp>
+#include <boost/winapi/get_last_error.hpp>
+#include <windows.h>
+#include <lmcons.h>
+#include <security.h>
+#include "windows/auto_handle.hpp"
+#include "windows/utf_code_conversion.hpp"
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace ipc {
+
+BOOST_LOG_ANONYMOUS_NAMESPACE {
+
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+
+class auto_boundary_descriptor
+{
+private:
+ HANDLE m_handle;
+
+public:
+ explicit auto_boundary_descriptor(HANDLE h = NULL) BOOST_NOEXCEPT : m_handle(h)
+ {
+ }
+
+ ~auto_boundary_descriptor() BOOST_NOEXCEPT
+ {
+ if (m_handle)
+ DeleteBoundaryDescriptor(m_handle);
+ }
+
+ void init(HANDLE h) BOOST_NOEXCEPT
+ {
+ BOOST_ASSERT(m_handle == NULL);
+ m_handle = h;
+ }
+
+ HANDLE get() const BOOST_NOEXCEPT { return m_handle; }
+ HANDLE* get_ptr() BOOST_NOEXCEPT { return &m_handle; }
+
+ void swap(auto_boundary_descriptor& that) BOOST_NOEXCEPT
+ {
+ HANDLE h = m_handle;
+ m_handle = that.m_handle;
+ that.m_handle = h;
+ }
+
+ BOOST_DELETED_FUNCTION(auto_boundary_descriptor(auto_boundary_descriptor const&))
+ BOOST_DELETED_FUNCTION(auto_boundary_descriptor& operator=(auto_boundary_descriptor const&))
+};
+
+//! Handle for the private namespace for \c user scope
+static boost::atomic< HANDLE > g_user_private_namespace;
+
+//! Closes the private namespace on process exit
+void close_user_namespace()
+{
+ HANDLE h = g_user_private_namespace.load(boost::memory_order_acquire);
+ if (h)
+ {
+ ClosePrivateNamespace(h, 0);
+ g_user_private_namespace.store((HANDLE)NULL, boost::memory_order_release);
+ }
+}
+
+//! Attempts to create or open the private namespace
+bool init_user_namespace()
+{
+ HANDLE h = g_user_private_namespace.load(boost::memory_order_acquire);
+ if (BOOST_UNLIKELY(!h))
+ {
+ // Obtain the current user SID
+ boost::log::ipc::aux::auto_handle h_process_token;
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, h_process_token.get_ptr()))
+ return false;
+
+ DWORD token_user_size = 0;
+ GetTokenInformation(h_process_token.get(), TokenUser, NULL, 0u, &token_user_size);
+ if (GetLastError() != ERROR_INSUFFICIENT_BUFFER || token_user_size < sizeof(TOKEN_USER))
+ return false;
+ std::vector< unsigned char > token_user_storage(static_cast< std::size_t >(token_user_size), static_cast< unsigned char >(0u));
+ if (!GetTokenInformation(h_process_token.get(), TokenUser, &token_user_storage[0], token_user_size, &token_user_size))
+ return false;
+
+ TOKEN_USER const& token_user = *reinterpret_cast< const TOKEN_USER* >(&token_user_storage[0]);
+ if (!token_user.User.Sid)
+ return false;
+
+ // Create a boundary descriptor with the user's SID
+ auto_boundary_descriptor h_boundary(CreateBoundaryDescriptorW(L"User", 0));
+ if (!h_boundary.get())
+ return false;
+
+ if (!AddSIDToBoundaryDescriptor(h_boundary.get_ptr(), token_user.User.Sid))
+ return false;
+
+ // Create or open a namespace for kernel objects
+ h = CreatePrivateNamespaceW(NULL, h_boundary.get(), L"User");
+ if (!h)
+ h = OpenPrivateNamespaceW(h_boundary.get(), L"User");
+
+ if (h)
+ {
+ HANDLE expected = NULL;
+ if (g_user_private_namespace.compare_exchange_strong(expected, h, boost::memory_order_acq_rel, boost::memory_order_acquire))
+ {
+ std::atexit(&close_user_namespace);
+ }
+ else
+ {
+ // Another thread must have opened the namespace
+ ClosePrivateNamespace(h, 0);
+ h = expected;
+ }
+ }
+ }
+
+ return !!h;
+}
+
+#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+
+//! Returns a prefix string for a shared resource according to the scope
+std::string get_scope_prefix(object_name::scope ns)
+{
+ std::string prefix;
+ switch (ns)
+ {
+ case object_name::process_group:
+ {
+ // For now consider all processes as members of the common process group. It may change if there is found
+ // a way to get a process group id (i.e. id of the closest parent process that was created with the CREATE_NEW_PROCESS_GROUP flag).
+ prefix = "Local\\boost.log.process_group";
+ }
+ break;
+
+ case object_name::session:
+ {
+ prefix = "Local\\boost.log.session";
+ }
+ break;
+
+ case object_name::user:
+ {
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ if (init_user_namespace())
+ {
+ prefix = "User\\boost.log.user";
+ }
+ else
+#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+ {
+ wchar_t buf[UNLEN + 1u];
+ ULONG len = sizeof(buf) / sizeof(*buf);
+ if (BOOST_UNLIKELY(!GetUserNameExW(NameSamCompatible, buf, &len)))
+ {
+ const boost::winapi::DWORD_ err = boost::winapi::GetLastError();
+ BOOST_LOG_THROW_DESCR_PARAMS(boost::log::system_error, "Failed to obtain the current user name", (err));
+ }
+
+ std::replace(buf, buf + len, L'\\', L'.');
+
+ prefix = "Local\\boost.log.user." + boost::log::aux::utf16_to_utf8(buf);
+ }
+ }
+ break;
+
+ default:
+ prefix = "Global\\boost.log.global";
+ break;
+ }
+
+ prefix.push_back('.');
+
+ return BOOST_LOG_NRVO_RESULT(prefix);
+}
+
+} // namespace
+
+//! Constructor from the object name
+BOOST_LOG_API object_name::object_name(scope ns, const char* str) :
+ m_name(get_scope_prefix(ns) + str)
+{
+}
+
+//! Constructor from the object name
+BOOST_LOG_API object_name::object_name(scope ns, std::string const& str) :
+ m_name(get_scope_prefix(ns) + str)
+{
+}
+
+} // namespace ipc
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
diff --git a/contrib/restricted/boost/libs/log/src/windows/simple_event_log.h b/contrib/restricted/boost/libs/log/src/windows/simple_event_log.h
new file mode 100644
index 0000000000..10c133c7c0
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/simple_event_log.h
@@ -0,0 +1,95 @@
+/*
+ * Copyright Andrey Semashev 2007 - 2015.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ *
+ * This file is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/libs/log/doc/log.html.
+ */
+
+/* --------------------------------------------------------
+ * HEADER SECTION
+ */
+
+
+
+/* ------------------------------------------------------------------
+ * MESSAGE DEFINITION SECTION
+ */
+//
+// Values are 32 bit values laid out as follows:
+//
+// 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
+// 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
+// +---+-+-+-----------------------+-------------------------------+
+// |Sev|C|R| Facility | Code |
+// +---+-+-+-----------------------+-------------------------------+
+//
+// where
+//
+// Sev - is the severity code
+//
+// 00 - Success
+// 01 - Informational
+// 10 - Warning
+// 11 - Error
+//
+// C - is the Customer code flag
+//
+// R - is a reserved bit
+//
+// Facility - is the facility code
+//
+// Code - is the facility's status code
+//
+//
+// Define the facility codes
+//
+
+
+//
+// Define the severity codes
+//
+#define BOOST_LOG_SEVERITY_WARNING 0x2
+#define BOOST_LOG_SEVERITY_ERROR 0x3
+#define BOOST_LOG_SEVERITY_DEBUG 0x0
+#define BOOST_LOG_SEVERITY_INFO 0x1
+
+
+//
+// MessageId: BOOST_LOG_MSG_DEBUG
+//
+// MessageText:
+//
+// %1
+//
+#define BOOST_LOG_MSG_DEBUG ((DWORD)0x00000100L)
+
+//
+// MessageId: BOOST_LOG_MSG_INFO
+//
+// MessageText:
+//
+// %1
+//
+#define BOOST_LOG_MSG_INFO ((DWORD)0x40000101L)
+
+//
+// MessageId: BOOST_LOG_MSG_WARNING
+//
+// MessageText:
+//
+// %1
+//
+#define BOOST_LOG_MSG_WARNING ((DWORD)0x80000102L)
+
+//
+// MessageId: BOOST_LOG_MSG_ERROR
+//
+// MessageText:
+//
+// %1
+//
+#define BOOST_LOG_MSG_ERROR ((DWORD)0xC0000103L)
+
diff --git a/contrib/restricted/boost/libs/log/src/windows/utf_code_conversion.hpp b/contrib/restricted/boost/libs/log/src/windows/utf_code_conversion.hpp
new file mode 100644
index 0000000000..7b00f13d76
--- /dev/null
+++ b/contrib/restricted/boost/libs/log/src/windows/utf_code_conversion.hpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright Andrey Semashev 2016.
+ * Distributed under the Boost Software License, Version 1.0.
+ * (See accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+ */
+/*!
+ * \file windows/utf_code_conversion.hpp
+ * \author Andrey Semashev
+ * \date 22.02.2016
+ *
+ * \brief This header is the Boost.Log library implementation, see the library documentation
+ * at http://www.boost.org/doc/libs/release/libs/log/doc/html/index.html.
+ */
+
+#ifndef BOOST_LOG_WINDOWS_UTF_CODE_CONVERSION_HPP_INCLUDED_
+#define BOOST_LOG_WINDOWS_UTF_CODE_CONVERSION_HPP_INCLUDED_
+
+#include <boost/log/detail/config.hpp>
+#include <string>
+#include <boost/log/detail/header.hpp>
+
+namespace boost {
+
+BOOST_LOG_OPEN_NAMESPACE
+
+namespace aux {
+
+//! Converts UTF-8 to UTF-16
+std::wstring utf8_to_utf16(const char* str);
+//! Converts UTF-16 to UTF-8
+std::string utf16_to_utf8(const wchar_t* str);
+
+} // namespace aux
+
+BOOST_LOG_CLOSE_NAMESPACE // namespace log
+
+} // namespace boost
+
+#include <boost/log/detail/footer.hpp>
+
+#endif // BOOST_LOG_WINDOWS_UTF_CODE_CONVERSION_HPP_INCLUDED_
diff --git a/contrib/restricted/boost/libs/program_options/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/program_options/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..484ea5452b
--- /dev/null
+++ b/contrib/restricted/boost/libs/program_options/.yandex_meta/licenses.list.txt
@@ -0,0 +1,55 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright Sascha Ochsenknecht 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================COPYRIGHT====================
+// Copyright Vladimir Prus 2002-2004.
+// Copyright Bertolt Mildner 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================COPYRIGHT====================
+// Copyright Vladimir Prus 2002-2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================COPYRIGHT====================
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/program_options/CMakeLists.txt b/contrib/restricted/boost/libs/program_options/CMakeLists.txt
index e8c98bfd99..97368e369c 100644
--- a/contrib/restricted/boost/libs/program_options/CMakeLists.txt
+++ b/contrib/restricted/boost/libs/program_options/CMakeLists.txt
@@ -6,6 +6,6 @@
# original buildsystem will not be accepted.
-if (UNIX AND NOT APPLE)
+if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
include(CMakeLists.linux.txt)
endif()
diff --git a/contrib/restricted/boost/libs/python/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/python/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..0d88af215d
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/.yandex_meta/licenses.list.txt
@@ -0,0 +1,120 @@
+====================BSL-1.0====================
+ // Contributed under the Boost Software License, Version 1.0.
+ // (See accompanying file LICENSE_1_0.txt or copy at
+ // http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Copyright David Abrahams 2004. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// (C) Copyright David Abrahams 2000.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright R.W. Grosse-Kunstleve 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2004 Jonathan Brandmeyer
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+
+
+====================COPYRIGHT====================
+// Copyright David Abrahams 2002.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright David Abrahams 2004. Use, modification and distribution is
+// subject to the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright Eric Niebler 2005.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Nikolay Mladenov 2007.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright Peter Dimov and Multi Media Ltd 2001, 2002
+// Copyright David Abrahams 2001
+
+
+====================COPYRIGHT====================
+// Copyright Stefan Seefeld 2005.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/python/arcadia_test/mod/module.cpp b/contrib/restricted/boost/libs/python/arcadia_test/mod/module.cpp
new file mode 100644
index 0000000000..6053f30c81
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/arcadia_test/mod/module.cpp
@@ -0,0 +1,11 @@
+#include <boost/python.hpp>
+
+using namespace boost::python;
+
+static const char* hello() {
+ return "hello world!";
+}
+
+BOOST_PYTHON_MODULE(arcadia_boost_python_test) {
+ def("hello", &hello);
+}
diff --git a/contrib/restricted/boost/libs/python/arcadia_test/py2/test_hello.py b/contrib/restricted/boost/libs/python/arcadia_test/py2/test_hello.py
new file mode 100644
index 0000000000..67d1d8f06a
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/arcadia_test/py2/test_hello.py
@@ -0,0 +1,5 @@
+import arcadia_boost_python_test as M
+
+
+def test_hello():
+ assert M.hello() == "hello world!"
diff --git a/contrib/restricted/boost/libs/python/arcadia_test/py3/test_hello.py b/contrib/restricted/boost/libs/python/arcadia_test/py3/test_hello.py
new file mode 100644
index 0000000000..67d1d8f06a
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/arcadia_test/py3/test_hello.py
@@ -0,0 +1,5 @@
+import arcadia_boost_python_test as M
+
+
+def test_hello():
+ assert M.hello() == "hello world!"
diff --git a/contrib/restricted/boost/libs/python/src/numpy/dtype.cpp b/contrib/restricted/boost/libs/python/src/numpy/dtype.cpp
new file mode 100644
index 0000000000..88a20a27b5
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/dtype.cpp
@@ -0,0 +1,220 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifdef _MSC_VER
+#include <boost/cstdint.hpp>
+#endif
+#define BOOST_PYTHON_NUMPY_INTERNAL
+#include <boost/python/numpy/internal.hpp>
+
+#define DTYPE_FROM_CODE(code) \
+ dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code))))
+
+#define BUILTIN_INT_DTYPE(bits) \
+ template <> struct builtin_int_dtype<bits, false> \
+ { \
+ static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits);} \
+ }; \
+ template <> struct builtin_int_dtype<bits, true> \
+ { \
+ static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits);} \
+ }; \
+ template BOOST_NUMPY_DECL dtype get_int_dtype<bits, false>(); \
+ template BOOST_NUMPY_DECL dtype get_int_dtype<bits, true>()
+
+#define BUILTIN_FLOAT_DTYPE(bits) \
+ template <> struct builtin_float_dtype<bits> \
+ { \
+ static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits);} \
+ }; \
+ template BOOST_NUMPY_DECL dtype get_float_dtype<bits>()
+
+#define BUILTIN_COMPLEX_DTYPE(bits) \
+ template <> struct builtin_complex_dtype<bits> \
+ { \
+ static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits);} \
+ }; \
+ template BOOST_NUMPY_DECL dtype get_complex_dtype<bits>()
+
+namespace boost { namespace python { namespace converter {
+NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayDescr_Type, numpy::dtype)
+} // namespace boost::python::converter
+
+namespace numpy {
+namespace detail {
+
+dtype builtin_dtype<bool,true>::get() { return DTYPE_FROM_CODE(NPY_BOOL); }
+
+template <int bits, bool isUnsigned> struct builtin_int_dtype;
+template <int bits> struct builtin_float_dtype;
+template <int bits> struct builtin_complex_dtype;
+
+template <int bits, bool isUnsigned> dtype get_int_dtype() {
+ return builtin_int_dtype<bits,isUnsigned>::get();
+}
+template <int bits> dtype get_float_dtype() { return builtin_float_dtype<bits>::get(); }
+template <int bits> dtype get_complex_dtype() { return builtin_complex_dtype<bits>::get(); }
+
+BUILTIN_INT_DTYPE(8);
+BUILTIN_INT_DTYPE(16);
+BUILTIN_INT_DTYPE(32);
+BUILTIN_INT_DTYPE(64);
+#ifdef NPY_FLOAT16
+BUILTIN_FLOAT_DTYPE(16);
+#endif
+BUILTIN_FLOAT_DTYPE(32);
+BUILTIN_FLOAT_DTYPE(64);
+BUILTIN_COMPLEX_DTYPE(64);
+BUILTIN_COMPLEX_DTYPE(128);
+#if NPY_BITSOF_LONGDOUBLE > NPY_BITSOF_DOUBLE
+template <> struct builtin_float_dtype< NPY_BITSOF_LONGDOUBLE > {
+ static dtype get() { return DTYPE_FROM_CODE(NPY_LONGDOUBLE); }
+};
+template dtype get_float_dtype< NPY_BITSOF_LONGDOUBLE >();
+template <> struct builtin_complex_dtype< 2 * NPY_BITSOF_LONGDOUBLE > {
+ static dtype get() { return DTYPE_FROM_CODE(NPY_CLONGDOUBLE); }
+};
+template dtype get_complex_dtype< 2 * NPY_BITSOF_LONGDOUBLE >();
+#endif
+
+} // namespace detail
+
+python::detail::new_reference dtype::convert(object const & arg, bool align)
+{
+ PyArray_Descr* obj=NULL;
+ if (align)
+ {
+ if (PyArray_DescrAlignConverter(arg.ptr(), &obj) < 0)
+ throw_error_already_set();
+ }
+ else
+ {
+ if (PyArray_DescrConverter(arg.ptr(), &obj) < 0)
+ throw_error_already_set();
+ }
+ return python::detail::new_reference(reinterpret_cast<PyObject*>(obj));
+}
+
+int dtype::get_itemsize() const { return reinterpret_cast<PyArray_Descr*>(ptr())->elsize;}
+
+bool equivalent(dtype const & a, dtype const & b) {
+ // On Windows x64, the behaviour described on
+ // http://docs.scipy.org/doc/numpy/reference/c-api.array.html for
+ // PyArray_EquivTypes unfortunately does not extend as expected:
+ // "For example, on 32-bit platforms, NPY_LONG and NPY_INT are equivalent".
+ // This should also hold for 64-bit platforms (and does on Linux), but not
+ // on Windows. Implement an alternative:
+#ifdef _MSC_VER
+ if (sizeof(long) == sizeof(int) &&
+ // Manually take care of the type equivalence.
+ ((a == dtype::get_builtin<long>() || a == dtype::get_builtin<int>()) &&
+ (b == dtype::get_builtin<long>() || b == dtype::get_builtin<int>()) ||
+ (a == dtype::get_builtin<unsigned int>() || a == dtype::get_builtin<unsigned long>()) &&
+ (b == dtype::get_builtin<unsigned int>() || b == dtype::get_builtin<unsigned long>()))) {
+ return true;
+ } else {
+ return PyArray_EquivTypes(
+ reinterpret_cast<PyArray_Descr*>(a.ptr()),
+ reinterpret_cast<PyArray_Descr*>(b.ptr())
+ );
+ }
+#else
+ return PyArray_EquivTypes(
+ reinterpret_cast<PyArray_Descr*>(a.ptr()),
+ reinterpret_cast<PyArray_Descr*>(b.ptr())
+ );
+#endif
+}
+
+namespace
+{
+
+namespace pyconv = boost::python::converter;
+
+template <typename T>
+class array_scalar_converter
+{
+public:
+
+ static PyTypeObject const * get_pytype()
+ {
+ // This implementation depends on the fact that get_builtin returns pointers to objects
+ // NumPy has declared statically, and that the typeobj member also refers to a static
+ // object. That means we don't need to do any reference counting.
+ // In fact, I'm somewhat concerned that increasing the reference count of any of these
+ // might cause leaks, because I don't think Boost.Python ever decrements it, but it's
+ // probably a moot point if everything is actually static.
+ return reinterpret_cast<PyArray_Descr*>(dtype::get_builtin<T>().ptr())->typeobj;
+ }
+
+ static void * convertible(PyObject * obj)
+ {
+ if (obj->ob_type == get_pytype())
+ {
+ return obj;
+ }
+ else
+ {
+ dtype dt(python::detail::borrowed_reference(obj->ob_type));
+ if (equivalent(dt, dtype::get_builtin<T>()))
+ {
+ return obj;
+ }
+ }
+ return 0;
+ }
+
+ static void convert(PyObject * obj, pyconv::rvalue_from_python_stage1_data* data)
+ {
+ void * storage = reinterpret_cast<pyconv::rvalue_from_python_storage<T>*>(data)->storage.bytes;
+ // We assume std::complex is a "standard layout" here and elsewhere; not guaranteed by
+ // C++03 standard, but true in every known implementation (and guaranteed by C++11).
+ PyArray_ScalarAsCtype(obj, reinterpret_cast<T*>(storage));
+ data->convertible = storage;
+ }
+
+ static void declare()
+ {
+ pyconv::registry::push_back(&convertible, &convert, python::type_id<T>()
+#ifndef BOOST_PYTHON_NO_PY_SIGNATURES
+ , &get_pytype
+#endif
+ );
+ }
+
+};
+
+} // anonymous
+
+void dtype::register_scalar_converters()
+{
+ array_scalar_converter<bool>::declare();
+ array_scalar_converter<npy_uint8>::declare();
+ array_scalar_converter<npy_int8>::declare();
+ array_scalar_converter<npy_uint16>::declare();
+ array_scalar_converter<npy_int16>::declare();
+ array_scalar_converter<npy_uint32>::declare();
+ array_scalar_converter<npy_int32>::declare();
+#ifdef _MSC_VER
+ // Since the npy_(u)int32 types are defined as long types and treated
+ // as being different from the int32 types, these converters must be declared
+ // explicitely.
+ array_scalar_converter<boost::uint32_t>::declare();
+ array_scalar_converter<boost::int32_t>::declare();
+#endif
+ array_scalar_converter<npy_uint64>::declare();
+ array_scalar_converter<npy_int64>::declare();
+ array_scalar_converter<float>::declare();
+ array_scalar_converter<double>::declare();
+ array_scalar_converter< std::complex<float> >::declare();
+ array_scalar_converter< std::complex<double> >::declare();
+#if NPY_BITSOF_LONGDOUBLE > NPY_BITSOF_DOUBLE
+ array_scalar_converter<long double>::declare();
+ array_scalar_converter< std::complex<long double> >::declare();
+#endif
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/python/src/numpy/matrix.cpp b/contrib/restricted/boost/libs/python/src/numpy/matrix.cpp
new file mode 100644
index 0000000000..47d2261637
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/matrix.cpp
@@ -0,0 +1,63 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_PYTHON_NUMPY_INTERNAL
+#include <boost/python/numpy/internal.hpp>
+#include <boost/python/numpy/matrix.hpp>
+
+namespace boost { namespace python { namespace numpy
+{
+namespace detail
+{
+inline object get_matrix_type()
+{
+ object module = import("numpy");
+ return module.attr("matrix");
+}
+} // namespace boost::python::numpy::detail
+} // namespace boost::python::numpy
+
+namespace converter
+{
+
+PyTypeObject const * object_manager_traits<numpy::matrix>::get_pytype()
+{
+ return reinterpret_cast<PyTypeObject*>(numpy::detail::get_matrix_type().ptr());
+}
+
+} // namespace boost::python::converter
+
+namespace numpy
+{
+
+object matrix::construct(object const & obj, dtype const & dt, bool copy)
+{
+ return numpy::detail::get_matrix_type()(obj, dt, copy);
+}
+
+object matrix::construct(object const & obj, bool copy)
+{
+ return numpy::detail::get_matrix_type()(obj, object(), copy);
+}
+
+matrix matrix::view(dtype const & dt) const
+{
+ return matrix(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("view"), const_cast<char*>("O"), dt.ptr())));
+}
+
+matrix matrix::copy() const
+{
+ return matrix(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("copy"), const_cast<char*>(""))));
+}
+
+matrix matrix::transpose() const
+{
+ return matrix(extract<matrix>(ndarray::transpose()));
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/python/src/numpy/ndarray.cpp b/contrib/restricted/boost/libs/python/src/numpy/ndarray.cpp
new file mode 100644
index 0000000000..af09ecc338
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/ndarray.cpp
@@ -0,0 +1,301 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_PYTHON_NUMPY_INTERNAL
+#include <boost/python/numpy/internal.hpp>
+#include <boost/scoped_array.hpp>
+
+namespace boost { namespace python {
+namespace converter
+{
+NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArray_Type, numpy::ndarray)
+} // namespace boost::python::converter
+
+namespace numpy
+{
+namespace detail
+{
+
+ndarray::bitflag numpy_to_bitflag(int const f)
+{
+ ndarray::bitflag r = ndarray::NONE;
+ if (f & NPY_ARRAY_C_CONTIGUOUS) r = (r | ndarray::C_CONTIGUOUS);
+ if (f & NPY_ARRAY_F_CONTIGUOUS) r = (r | ndarray::F_CONTIGUOUS);
+ if (f & NPY_ARRAY_ALIGNED) r = (r | ndarray::ALIGNED);
+ if (f & NPY_ARRAY_WRITEABLE) r = (r | ndarray::WRITEABLE);
+ return r;
+}
+
+int bitflag_to_numpy(ndarray::bitflag f)
+{
+ int r = 0;
+ if (f & ndarray::C_CONTIGUOUS) r |= NPY_ARRAY_C_CONTIGUOUS;
+ if (f & ndarray::F_CONTIGUOUS) r |= NPY_ARRAY_F_CONTIGUOUS;
+ if (f & ndarray::ALIGNED) r |= NPY_ARRAY_ALIGNED;
+ if (f & ndarray::WRITEABLE) r |= NPY_ARRAY_WRITEABLE;
+ return r;
+}
+
+bool is_c_contiguous(std::vector<Py_intptr_t> const & shape,
+ std::vector<Py_intptr_t> const & strides,
+ int itemsize)
+{
+ std::vector<Py_intptr_t>::const_reverse_iterator j = strides.rbegin();
+ int total = itemsize;
+ for (std::vector<Py_intptr_t>::const_reverse_iterator i = shape.rbegin(); i != shape.rend(); ++i, ++j)
+ {
+ if (total != *j) return false;
+ total *= (*i);
+ }
+ return true;
+}
+
+bool is_f_contiguous(std::vector<Py_intptr_t> const & shape,
+ std::vector<Py_intptr_t> const & strides,
+ int itemsize)
+{
+ std::vector<Py_intptr_t>::const_iterator j = strides.begin();
+ int total = itemsize;
+ for (std::vector<Py_intptr_t>::const_iterator i = shape.begin(); i != shape.end(); ++i, ++j)
+ {
+ if (total != *j) return false;
+ total *= (*i);
+ }
+ return true;
+}
+
+bool is_aligned(std::vector<Py_intptr_t> const & strides,
+ int itemsize)
+{
+ for (std::vector<Py_intptr_t>::const_iterator i = strides.begin(); i != strides.end(); ++i)
+ {
+ if (*i % itemsize) return false;
+ }
+ return true;
+}
+
+inline PyArray_Descr * incref_dtype(dtype const & dt)
+{
+ Py_INCREF(dt.ptr());
+ return reinterpret_cast<PyArray_Descr*>(dt.ptr());
+}
+
+ndarray from_data_impl(void * data,
+ dtype const & dt,
+ python::object const & shape,
+ python::object const & strides,
+ python::object const & owner,
+ bool writeable)
+{
+ std::vector<Py_intptr_t> shape_(len(shape));
+ std::vector<Py_intptr_t> strides_(len(strides));
+ if (shape_.size() != strides_.size())
+ {
+ PyErr_SetString(PyExc_ValueError, "Length of shape and strides arrays do not match.");
+ python::throw_error_already_set();
+ }
+ for (std::size_t i = 0; i < shape_.size(); ++i)
+ {
+ shape_[i] = python::extract<Py_intptr_t>(shape[i]);
+ strides_[i] = python::extract<Py_intptr_t>(strides[i]);
+ }
+ return from_data_impl(data, dt, shape_, strides_, owner, writeable);
+}
+
+ndarray from_data_impl(void * data,
+ dtype const & dt,
+ std::vector<Py_intptr_t> const & shape,
+ std::vector<Py_intptr_t> const & strides,
+ python::object const & owner,
+ bool writeable)
+{
+ if (shape.size() != strides.size())
+ {
+ PyErr_SetString(PyExc_ValueError, "Length of shape and strides arrays do not match.");
+ python::throw_error_already_set();
+ }
+ int itemsize = dt.get_itemsize();
+ int flags = 0;
+ if (writeable) flags |= NPY_ARRAY_WRITEABLE;
+ if (is_c_contiguous(shape, strides, itemsize)) flags |= NPY_ARRAY_C_CONTIGUOUS;
+ if (is_f_contiguous(shape, strides, itemsize)) flags |= NPY_ARRAY_F_CONTIGUOUS;
+ if (is_aligned(strides, itemsize)) flags |= NPY_ARRAY_ALIGNED;
+ ndarray r(python::detail::new_reference
+ (PyArray_NewFromDescr(&PyArray_Type,
+ incref_dtype(dt),
+ shape.size(),
+ const_cast<Py_intptr_t*>(&shape.front()),
+ const_cast<Py_intptr_t*>(&strides.front()),
+ data,
+ flags,
+ NULL)));
+ r.set_base(owner);
+ return r;
+}
+
+} // namespace detail
+
+namespace {
+ int normalize_index(int n,int nlim) // wraps [-nlim:nlim) into [0:nlim), throw IndexError otherwise
+ {
+ if (n<0)
+ n += nlim; // negative indices work backwards from end
+ if (n < 0 || n >= nlim)
+ {
+ PyErr_SetObject(PyExc_IndexError, Py_None);
+ throw_error_already_set();
+ }
+ return n;
+ }
+}
+
+Py_intptr_t ndarray::shape(int n) const
+{
+ return get_shape()[normalize_index(n,get_nd())];
+}
+
+Py_intptr_t ndarray::strides(int n) const
+{
+ return get_strides()[normalize_index(n,get_nd())];
+}
+
+ndarray ndarray::view(dtype const & dt) const
+{
+ return ndarray(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("view"), const_cast<char*>("O"), dt.ptr())));
+}
+
+ndarray ndarray::astype(dtype const & dt) const
+{
+ return ndarray(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("astype"), const_cast<char*>("O"), dt.ptr())));
+}
+
+ndarray ndarray::copy() const
+{
+ return ndarray(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("copy"), const_cast<char*>(""))));
+}
+
+dtype ndarray::get_dtype() const
+{
+ return dtype(python::detail::borrowed_reference(get_struct()->descr));
+}
+
+python::object ndarray::get_base() const
+{
+ if (get_struct()->base == NULL) return object();
+ return python::object(python::detail::borrowed_reference(get_struct()->base));
+}
+
+void ndarray::set_base(object const & base)
+{
+ Py_XDECREF(get_struct()->base);
+ if (base.ptr())
+ {
+ Py_INCREF(base.ptr());
+ get_struct()->base = base.ptr();
+ }
+ else
+ {
+ get_struct()->base = NULL;
+ }
+}
+
+ndarray::bitflag ndarray::get_flags() const
+{
+ return numpy::detail::numpy_to_bitflag(get_struct()->flags);
+}
+
+ndarray ndarray::transpose() const
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_Transpose(reinterpret_cast<PyArrayObject*>(this->ptr()), NULL)));
+}
+
+ndarray ndarray::squeeze() const
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_Squeeze(reinterpret_cast<PyArrayObject*>(this->ptr()))));
+}
+
+ndarray ndarray::reshape(python::tuple const & shape) const
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_Reshape(reinterpret_cast<PyArrayObject*>(this->ptr()), shape.ptr())));
+}
+
+python::object ndarray::scalarize() const
+{
+ Py_INCREF(ptr());
+ return python::object(python::detail::new_reference(PyArray_Return(reinterpret_cast<PyArrayObject*>(ptr()))));
+}
+
+ndarray zeros(python::tuple const & shape, dtype const & dt)
+{
+ int nd = len(shape);
+ boost::scoped_array<Py_intptr_t> dims(new Py_intptr_t[nd]);
+ for (int n=0; n<nd; ++n) dims[n] = python::extract<Py_intptr_t>(shape[n]);
+ return ndarray(python::detail::new_reference
+ (PyArray_Zeros(nd, dims.get(), detail::incref_dtype(dt), 0)));
+}
+
+ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt)
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_Zeros(nd, const_cast<Py_intptr_t*>(shape), detail::incref_dtype(dt), 0)));
+}
+
+ndarray empty(python::tuple const & shape, dtype const & dt)
+{
+ int nd = len(shape);
+ boost::scoped_array<Py_intptr_t> dims(new Py_intptr_t[nd]);
+ for (int n=0; n<nd; ++n) dims[n] = python::extract<Py_intptr_t>(shape[n]);
+ return ndarray(python::detail::new_reference
+ (PyArray_Empty(nd, dims.get(), detail::incref_dtype(dt), 0)));
+}
+
+ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt)
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_Empty(nd, const_cast<Py_intptr_t*>(shape), detail::incref_dtype(dt), 0)));
+}
+
+ndarray array(python::object const & obj)
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_FromAny(obj.ptr(), NULL, 0, 0, NPY_ARRAY_ENSUREARRAY, NULL)));
+}
+
+ndarray array(python::object const & obj, dtype const & dt)
+{
+ return ndarray(python::detail::new_reference
+ (PyArray_FromAny(obj.ptr(), detail::incref_dtype(dt), 0, 0, NPY_ARRAY_ENSUREARRAY, NULL)));
+}
+
+ndarray from_object(python::object const & obj, dtype const & dt, int nd_min, int nd_max, ndarray::bitflag flags)
+{
+ int requirements = detail::bitflag_to_numpy(flags);
+ return ndarray(python::detail::new_reference
+ (PyArray_FromAny(obj.ptr(),
+ detail::incref_dtype(dt),
+ nd_min, nd_max,
+ requirements,
+ NULL)));
+}
+
+ndarray from_object(python::object const & obj, int nd_min, int nd_max, ndarray::bitflag flags)
+{
+ int requirements = detail::bitflag_to_numpy(flags);
+ return ndarray(python::detail::new_reference
+ (PyArray_FromAny(obj.ptr(),
+ NULL,
+ nd_min, nd_max,
+ requirements,
+ NULL)));
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/python/src/numpy/numpy.cpp b/contrib/restricted/boost/libs/python/src/numpy/numpy.cpp
new file mode 100644
index 0000000000..8e259bc755
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/numpy.cpp
@@ -0,0 +1,33 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_PYTHON_NUMPY_INTERNAL_MAIN
+#include <boost/python/numpy/internal.hpp>
+#include <boost/python/numpy/dtype.hpp>
+
+namespace boost { namespace python { namespace numpy {
+
+#if PY_MAJOR_VERSION == 2
+static void wrap_import_array()
+{
+ import_array();
+}
+#else
+static void * wrap_import_array()
+{
+ import_array();
+}
+#endif
+
+void initialize(bool register_scalar_converters)
+{
+ wrap_import_array();
+ import_ufunc();
+ if (register_scalar_converters)
+ dtype::register_scalar_converters();
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/python/src/numpy/scalars.cpp b/contrib/restricted/boost/libs/python/src/numpy/scalars.cpp
new file mode 100644
index 0000000000..3947c06f2c
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/scalars.cpp
@@ -0,0 +1,36 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_PYTHON_NUMPY_INTERNAL
+#include <boost/python/numpy/internal.hpp>
+
+namespace boost { namespace python {
+namespace converter
+{
+NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyVoidArrType_Type, numpy::void_)
+} // namespace boost::python::converter
+
+namespace numpy
+{
+
+void_::void_(Py_ssize_t size)
+ : object(python::detail::new_reference
+ (PyObject_CallFunction((PyObject*)&PyVoidArrType_Type, const_cast<char*>("i"), size)))
+{}
+
+void_ void_::view(dtype const & dt) const
+{
+ return void_(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("view"), const_cast<char*>("O"), dt.ptr())));
+}
+
+void_ void_::copy() const
+{
+ return void_(python::detail::new_reference
+ (PyObject_CallMethod(this->ptr(), const_cast<char*>("copy"), const_cast<char*>(""))));
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/python/src/numpy/ufunc.cpp b/contrib/restricted/boost/libs/python/src/numpy/ufunc.cpp
new file mode 100644
index 0000000000..173d7213ec
--- /dev/null
+++ b/contrib/restricted/boost/libs/python/src/numpy/ufunc.cpp
@@ -0,0 +1,65 @@
+// Copyright Jim Bosch 2010-2012.
+// Copyright Stefan Seefeld 2016.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#define BOOST_PYTHON_NUMPY_INTERNAL
+#include <boost/python/numpy/internal.hpp>
+#include <boost/python/numpy/ufunc.hpp>
+
+namespace boost { namespace python {
+namespace converter
+{
+NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayMultiIter_Type, numpy::multi_iter)
+} // namespace boost::python::converter
+
+namespace numpy
+{
+
+multi_iter make_multi_iter(object const & a1)
+{
+ return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(1, a1.ptr())));
+}
+
+ multi_iter make_multi_iter(object const & a1, object const & a2)
+{
+ return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(2, a1.ptr(), a2.ptr())));
+}
+
+multi_iter make_multi_iter(object const & a1, object const & a2, object const & a3)
+{
+ return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(3, a1.ptr(), a2.ptr(), a3.ptr())));
+}
+
+void multi_iter::next()
+{
+ PyArray_MultiIter_NEXT(ptr());
+}
+
+bool multi_iter::not_done() const
+{
+ return PyArray_MultiIter_NOTDONE(ptr());
+}
+
+char * multi_iter::get_data(int i) const
+{
+ return reinterpret_cast<char*>(PyArray_MultiIter_DATA(ptr(), i));
+}
+
+int multi_iter::get_nd() const
+{
+ return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->nd;
+}
+
+Py_intptr_t const * multi_iter::get_shape() const
+{
+ return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->dimensions;
+}
+
+Py_intptr_t multi_iter::shape(int n) const
+{
+ return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->dimensions[n];
+}
+
+}}} // namespace boost::python::numpy
diff --git a/contrib/restricted/boost/libs/random/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/random/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..230178a3f1
--- /dev/null
+++ b/contrib/restricted/boost/libs/random/.yandex_meta/licenses.list.txt
@@ -0,0 +1,43 @@
+====================BSL-1.0====================
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+ * http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ * Copyright Jens Maurer 2000
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+ * Copyright Jens Maurer 2000-2001
+ * Copyright Steven Watanabe 2010-2011
+ * Distributed under the Boost Software License, Version 1.0. (See
+ * accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/regex/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/regex/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..24d839b2a7
--- /dev/null
+++ b/contrib/restricted/boost/libs/regex/.yandex_meta/licenses.list.txt
@@ -0,0 +1,51 @@
+====================BSL-1.0====================
+ * Use, modification and distribution are subject to the
+ * Boost Software License, Version 1.0. (See accompanying file
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ * Copyright (c) 1998-2002
+ * John Maddock
+
+
+====================COPYRIGHT====================
+ * Copyright (c) 1998-2004 John Maddock
+ * Copyright 2011 Garmin Ltd. or its subsidiaries
+
+
+====================COPYRIGHT====================
+ * Copyright (c) 2004
+ * John Maddock
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2011 John Maddock
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/serialization/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/serialization/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..17e2899be4
--- /dev/null
+++ b/contrib/restricted/boost/libs/serialization/.yandex_meta/licenses.list.txt
@@ -0,0 +1,87 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+
+====================BSL-1.0====================
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// <gennadiy.rozental@tfn.com>
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// Copyright (c) 2004 Robert Ramey, Indiana University (garcia@osl.iu.edu)
+// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
+// Use, modification and distribution is subject to the Boost Software
+
+
+====================COPYRIGHT====================
+// Copyright Vladimir Prus 2004.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/serialization/src/binary_wiarchive.cpp b/contrib/restricted/boost/libs/serialization/src/binary_wiarchive.cpp
new file mode 100644
index 0000000000..720d469d70
--- /dev/null
+++ b/contrib/restricted/boost/libs/serialization/src/binary_wiarchive.cpp
@@ -0,0 +1,47 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_wiarchive.cpp:
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/binary_wiarchive.hpp>
+#include <boost/archive/detail/archive_serializer_map.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/archive_serializer_map.ipp>
+#include <boost/archive/impl/basic_binary_iprimitive.ipp>
+#include <boost/archive/impl/basic_binary_iarchive.ipp>
+
+namespace boost {
+namespace archive {
+
+// explicitly instantiate for this type of text stream
+template class detail::archive_serializer_map<binary_wiarchive>;
+template class basic_binary_iprimitive<
+ binary_wiarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class basic_binary_iarchive<binary_wiarchive> ;
+template class binary_iarchive_impl<
+ binary_wiarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF
+
diff --git a/contrib/restricted/boost/libs/serialization/src/binary_woarchive.cpp b/contrib/restricted/boost/libs/serialization/src/binary_woarchive.cpp
new file mode 100644
index 0000000000..905a319d66
--- /dev/null
+++ b/contrib/restricted/boost/libs/serialization/src/binary_woarchive.cpp
@@ -0,0 +1,44 @@
+/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
+// binary_woarchive.cpp:
+
+// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
+// Use, modification and distribution is subject to the Boost Software
+// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for updates, documentation, and revision history.
+
+#include <boost/config.hpp>
+
+#ifdef BOOST_NO_STD_WSTREAMBUF
+#error "wide char i/o not supported on this platform"
+#else
+
+#define BOOST_WARCHIVE_SOURCE
+#include <boost/archive/binary_woarchive.hpp>
+
+// explicitly instantiate for this type of text stream
+#include <boost/archive/impl/archive_serializer_map.ipp>
+#include <boost/archive/impl/basic_binary_oprimitive.ipp>
+#include <boost/archive/impl/basic_binary_oarchive.ipp>
+
+namespace boost {
+namespace archive {
+
+template class detail::archive_serializer_map<binary_woarchive>;
+template class basic_binary_oprimitive<
+ binary_woarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+template class basic_binary_oarchive<binary_woarchive> ;
+template class binary_oarchive_impl<
+ binary_woarchive,
+ wchar_t,
+ std::char_traits<wchar_t>
+>;
+
+} // namespace archive
+} // namespace boost
+
+#endif // BOOST_NO_STD_WSTREAMBUF
diff --git a/contrib/restricted/boost/libs/system/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/system/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..9a6126914d
--- /dev/null
+++ b/contrib/restricted/boost/libs/system/.yandex_meta/licenses.list.txt
@@ -0,0 +1,36 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2002, 2006
+// Copyright (c) Microsoft Corporation 2014
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/system/CMakeLists.txt b/contrib/restricted/boost/libs/system/CMakeLists.txt
index fc7b1ee73c..dbfe6fa2c4 100644
--- a/contrib/restricted/boost/libs/system/CMakeLists.txt
+++ b/contrib/restricted/boost/libs/system/CMakeLists.txt
@@ -8,6 +8,6 @@
if (APPLE)
include(CMakeLists.darwin.txt)
-elseif (UNIX AND NOT APPLE)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
include(CMakeLists.linux.txt)
endif()
diff --git a/contrib/restricted/boost/libs/thread/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/thread/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..74a48e4c31
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/.yandex_meta/licenses.list.txt
@@ -0,0 +1,116 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+ * (C) Copyright 2013 Tim Blechmann
+ * (C) Copyright 2013 Andrey Semashev
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2005-7 Anthony Williams
+// (C) Copyright 2007 David Deakins
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2007 Anthony Williams
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2018 Andrey Semashev
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright 2007 David Deakins
+// (C) Copyright 2011-2018 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// (C) Copyright 2012 Vicente J. Botet Escriba
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+
+
+====================COPYRIGHT====================
+// (C) Copyright Aaron W. LaFramboise, Roland Schwarz, Michael Glassford 2004.
+// (C) Copyright 2007 Roland Schwarz
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright 2007 David Deakins
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+
+
+====================COPYRIGHT====================
+// (C) Copyright Michael Glassford 2004.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+
+
+====================COPYRIGHT====================
+// Copyright (C) 2001-2003
+// William E. Kempf
+// (C) Copyright 2008-9 Anthony Williams
+
+
+====================COPYRIGHT====================
+// Copyright (C) 2001-2003
+// William E. Kempf
+// Copyright (C) 2007-9 Anthony Williams
+// (C) Copyright 2011-2012 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright (C) 2002-2003
+// David Moore, William E. Kempf
+// Copyright (C) 2007-8 Anthony Williams
+// (C) Copyright 2013 Vicente J. Botet Escriba
+
+
+====================COPYRIGHT====================
+// Copyright (C) 2007 Anthony Williams
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/thread/CMakeLists.txt b/contrib/restricted/boost/libs/thread/CMakeLists.txt
index fc7b1ee73c..dbfe6fa2c4 100644
--- a/contrib/restricted/boost/libs/thread/CMakeLists.txt
+++ b/contrib/restricted/boost/libs/thread/CMakeLists.txt
@@ -8,6 +8,6 @@
if (APPLE)
include(CMakeLists.darwin.txt)
-elseif (UNIX AND NOT APPLE)
+elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
include(CMakeLists.linux.txt)
endif()
diff --git a/contrib/restricted/boost/libs/thread/src/tss_null.cpp b/contrib/restricted/boost/libs/thread/src/tss_null.cpp
new file mode 100644
index 0000000000..b5029f1996
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/src/tss_null.cpp
@@ -0,0 +1,38 @@
+// (C) Copyright Michael Glassford 2004.
+// (C) Copyright 2007 Anthony Williams
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/thread/detail/config.hpp>
+
+#if defined(BOOST_HAS_WINTHREADS) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE))
+
+namespace boost
+{
+ /*
+ This file is a "null" implementation of tss cleanup; it's
+ purpose is to to eliminate link errors in cases
+ where it is known that tss cleanup is not needed.
+ */
+
+ void tss_cleanup_implemented(void)
+ {
+ /*
+ This function's sole purpose is to cause a link error in cases where
+ automatic tss cleanup is not implemented by Boost.Threads as a
+ reminder that user code is responsible for calling the necessary
+ functions at the appropriate times (and for implementing an a
+ tss_cleanup_implemented() function to eliminate the linker's
+ missing symbol error).
+
+ If Boost.Threads later implements automatic tss cleanup in cases
+ where it currently doesn't (which is the plan), the duplicate
+ symbol error will warn the user that their custom solution is no
+ longer needed and can be removed.
+ */
+ }
+
+}
+
+#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER)
diff --git a/contrib/restricted/boost/libs/thread/src/win32/thread.cpp b/contrib/restricted/boost/libs/thread/src/win32/thread.cpp
new file mode 100644
index 0000000000..53a4ce6a5b
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/src/win32/thread.cpp
@@ -0,0 +1,973 @@
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright 2007 David Deakins
+// (C) Copyright 2011-2018 Vicente J. Botet Escriba
+
+//#define BOOST_THREAD_VERSION 3
+
+#include <boost/winapi/config.hpp>
+#include <boost/thread/thread_only.hpp>
+#include <boost/thread/once.hpp>
+#include <boost/thread/tss.hpp>
+#include <boost/thread/condition_variable.hpp>
+#include <boost/thread/detail/tss_hooks.hpp>
+#include <boost/thread/future.hpp>
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+#if defined BOOST_THREAD_USES_DATETIME
+#include <boost/date_time/posix_time/conversion.hpp>
+#include <boost/thread/thread_time.hpp>
+#endif
+#include <boost/thread/csbl/memory/unique_ptr.hpp>
+#include <memory>
+#include <algorithm>
+#ifndef UNDER_CE
+#include <process.h>
+#endif
+#include <stdio.h>
+#include <windows.h>
+#include <boost/predef/platform.h>
+
+#if BOOST_PLAT_WINDOWS_RUNTIME
+#include <mutex>
+#include <atomic>
+#include <Activation.h>
+#include <wrl\client.h>
+#include <wrl\event.h>
+#include <wrl\wrappers\corewrappers.h>
+#include <wrl\ftm.h>
+#include <windows.system.threading.h>
+#pragma comment(lib, "runtimeobject.lib")
+#endif
+
+namespace boost
+{
+ namespace detail
+ {
+ thread_data_base::~thread_data_base()
+ {
+ for (notify_list_t::iterator i = notify.begin(), e = notify.end();
+ i != e; ++i)
+ {
+ i->second->unlock();
+ i->first->notify_all();
+ }
+ for (async_states_t::iterator i = async_states_.begin(), e = async_states_.end();
+ i != e; ++i)
+ {
+ (*i)->notify_deferred();
+ }
+ }
+ }
+
+ namespace
+ {
+#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11
+ boost::once_flag current_thread_tls_init_flag;
+#else
+ boost::once_flag current_thread_tls_init_flag=BOOST_ONCE_INIT;
+#endif
+#if defined(UNDER_CE)
+ // Windows CE does not define the TLS_OUT_OF_INDEXES constant.
+#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
+#endif
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ DWORD current_thread_tls_key=TLS_OUT_OF_INDEXES;
+#else
+ __declspec(thread) boost::detail::thread_data_base* current_thread_data_base;
+#endif
+
+ void create_current_thread_tls_key()
+ {
+ tss_cleanup_implemented(); // if anyone uses TSS, we need the cleanup linked in
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ current_thread_tls_key=TlsAlloc();
+ BOOST_ASSERT(current_thread_tls_key!=TLS_OUT_OF_INDEXES);
+#endif
+ }
+
+ void cleanup_tls_key()
+ {
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ if(current_thread_tls_key!=TLS_OUT_OF_INDEXES)
+ {
+ TlsFree(current_thread_tls_key);
+ current_thread_tls_key=TLS_OUT_OF_INDEXES;
+ }
+#endif
+ }
+
+ void set_current_thread_data(detail::thread_data_base* new_data)
+ {
+ boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ current_thread_data_base = new_data;
+#else
+ if (current_thread_tls_key != TLS_OUT_OF_INDEXES)
+ {
+ BOOST_VERIFY(TlsSetValue(current_thread_tls_key, new_data));
+ }
+ else
+ {
+ BOOST_VERIFY(false);
+ //boost::throw_exception(thread_resource_error());
+ }
+#endif
+ }
+ }
+
+ namespace detail
+ {
+ thread_data_base* get_current_thread_data()
+ {
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ return current_thread_data_base;
+#else
+ if (current_thread_tls_key == TLS_OUT_OF_INDEXES)
+ {
+ return 0;
+ }
+ return (detail::thread_data_base*)TlsGetValue(current_thread_tls_key);
+#endif
+ }
+ }
+
+ namespace
+ {
+#ifndef BOOST_HAS_THREADEX
+// Windows CE doesn't define _beginthreadex
+
+ struct ThreadProxyData
+ {
+ typedef unsigned (__stdcall* func)(void*);
+ func start_address_;
+ void* arglist_;
+ ThreadProxyData(func start_address,void* arglist) : start_address_(start_address), arglist_(arglist) {}
+ };
+
+ DWORD WINAPI ThreadProxy(LPVOID args)
+ {
+ boost::csbl::unique_ptr<ThreadProxyData> data(reinterpret_cast<ThreadProxyData*>(args));
+ DWORD ret=data->start_address_(data->arglist_);
+ return ret;
+ }
+
+ inline uintptr_t _beginthreadex(void* security, unsigned stack_size, unsigned (__stdcall* start_address)(void*),
+ void* arglist, unsigned initflag, unsigned* thrdaddr)
+ {
+ DWORD threadID;
+ ThreadProxyData* data = new ThreadProxyData(start_address,arglist);
+ HANDLE hthread=CreateThread(static_cast<LPSECURITY_ATTRIBUTES>(security),stack_size,ThreadProxy,
+ data,initflag,&threadID);
+ if (hthread==0) {
+ delete data;
+ return 0;
+ }
+ *thrdaddr=threadID;
+ return reinterpret_cast<uintptr_t const>(hthread);
+ }
+
+#endif
+
+ }
+
+ namespace detail
+ {
+ struct thread_exit_callback_node
+ {
+ boost::detail::thread_exit_function_base* func;
+ thread_exit_callback_node* next;
+
+ thread_exit_callback_node(boost::detail::thread_exit_function_base* func_,
+ thread_exit_callback_node* next_):
+ func(func_),next(next_)
+ {}
+ };
+
+ }
+
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ namespace detail
+ {
+ std::atomic_uint threadCount;
+
+ bool win32::scoped_winrt_thread::start(thread_func address, void *parameter, unsigned int *thrdId)
+ {
+ Microsoft::WRL::ComPtr<ABI::Windows::System::Threading::IThreadPoolStatics> threadPoolFactory;
+ HRESULT hr = ::Windows::Foundation::GetActivationFactory(
+ Microsoft::WRL::Wrappers::HStringReference(RuntimeClass_Windows_System_Threading_ThreadPool).Get(),
+ &threadPoolFactory);
+ if (hr != S_OK)
+ {
+ return false;
+ }
+
+ // Create event for tracking work item completion.
+ *thrdId = ++threadCount;
+ handle completionHandle = CreateEventExW(NULL, NULL, 0, EVENT_ALL_ACCESS);
+ if (!completionHandle)
+ {
+ return false;
+ }
+ m_completionHandle = completionHandle;
+
+ // Create new work item.
+ Microsoft::WRL::ComPtr<ABI::Windows::System::Threading::IWorkItemHandler> workItem =
+ Microsoft::WRL::Callback<Microsoft::WRL::Implements<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, ABI::Windows::System::Threading::IWorkItemHandler, Microsoft::WRL::FtmBase>>
+ ([address, parameter, completionHandle](ABI::Windows::Foundation::IAsyncAction *)
+ {
+ // Add a reference since we need to access the completionHandle after the thread_start_function.
+ // This is to handle cases where detach() was called and run_thread_exit_callbacks() would end
+ // up closing the handle.
+ ::boost::detail::thread_data_base* const thread_info(reinterpret_cast<::boost::detail::thread_data_base*>(parameter));
+ intrusive_ptr_add_ref(thread_info);
+
+ __try
+ {
+ address(parameter);
+ }
+ __finally
+ {
+ SetEvent(completionHandle);
+ intrusive_ptr_release(thread_info);
+ }
+ return S_OK;
+ });
+
+ // Schedule work item on the threadpool.
+ Microsoft::WRL::ComPtr<ABI::Windows::Foundation::IAsyncAction> asyncAction;
+ hr = threadPoolFactory->RunWithPriorityAndOptionsAsync(
+ workItem.Get(),
+ ABI::Windows::System::Threading::WorkItemPriority_Normal,
+ ABI::Windows::System::Threading::WorkItemOptions_TimeSliced,
+ &asyncAction);
+ return hr == S_OK;
+ }
+ }
+#endif
+
+ namespace
+ {
+ void run_thread_exit_callbacks()
+ {
+ detail::thread_data_ptr current_thread_data(detail::get_current_thread_data(),false);
+ if(current_thread_data)
+ {
+ while(! current_thread_data->tss_data.empty() || current_thread_data->thread_exit_callbacks)
+ {
+ while(current_thread_data->thread_exit_callbacks)
+ {
+ detail::thread_exit_callback_node* const current_node=current_thread_data->thread_exit_callbacks;
+ current_thread_data->thread_exit_callbacks=current_node->next;
+ if(current_node->func)
+ {
+ (*current_node->func)();
+ boost::detail::heap_delete(current_node->func);
+ }
+ boost::detail::heap_delete(current_node);
+ }
+ while (!current_thread_data->tss_data.empty())
+ {
+ std::map<void const*,detail::tss_data_node>::iterator current
+ = current_thread_data->tss_data.begin();
+ if(current->second.func && (current->second.value!=0))
+ {
+ (*current->second.func)(current->second.value);
+ }
+ current_thread_data->tss_data.erase(current);
+ }
+ }
+ set_current_thread_data(0);
+ }
+ }
+
+ unsigned __stdcall thread_start_function(void* param)
+ {
+ detail::thread_data_base* const thread_info(reinterpret_cast<detail::thread_data_base*>(param));
+ set_current_thread_data(thread_info);
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ BOOST_TRY
+ {
+#endif
+ thread_info->run();
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ }
+ BOOST_CATCH(thread_interrupted const&)
+ {
+ }
+ // Unhandled exceptions still cause the application to terminate
+ BOOST_CATCH_END
+#endif
+ run_thread_exit_callbacks();
+ return 0;
+ }
+ }
+
+ thread::thread() BOOST_NOEXCEPT
+ {}
+
+ bool thread::start_thread_noexcept()
+ {
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ intrusive_ptr_add_ref(thread_info.get());
+ if (!thread_info->thread_handle.start(&thread_start_function, thread_info.get(), &thread_info->id))
+ {
+ intrusive_ptr_release(thread_info.get());
+ return false;
+ }
+ return true;
+#else
+ uintptr_t const new_thread=_beginthreadex(0,0,&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id);
+ if(!new_thread)
+ {
+ return false;
+ }
+ intrusive_ptr_add_ref(thread_info.get());
+ thread_info->thread_handle=(detail::win32::handle)(new_thread);
+ ResumeThread(thread_info->thread_handle);
+ return true;
+#endif
+ }
+
+ bool thread::start_thread_noexcept(const attributes& attr)
+ {
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ // Stack size isn't supported with Windows Runtime.
+ attr;
+ return start_thread_noexcept();
+#else
+ uintptr_t const new_thread=_beginthreadex(0,static_cast<unsigned int>(attr.get_stack_size()),&thread_start_function,thread_info.get(),
+ CREATE_SUSPENDED | STACK_SIZE_PARAM_IS_A_RESERVATION, &thread_info->id);
+ if(!new_thread)
+ {
+ return false;
+ }
+ intrusive_ptr_add_ref(thread_info.get());
+ thread_info->thread_handle=(detail::win32::handle)(new_thread);
+ ResumeThread(thread_info->thread_handle);
+ return true;
+#endif
+ }
+
+ thread::thread(detail::thread_data_ptr data):
+ thread_info(data)
+ {}
+
+ namespace
+ {
+ struct externally_launched_thread:
+ detail::thread_data_base
+ {
+ externally_launched_thread()
+ {
+ ++count;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ interruption_enabled=false;
+#endif
+ }
+ ~externally_launched_thread() {
+ BOOST_ASSERT(notify.empty());
+ notify.clear();
+ BOOST_ASSERT(async_states_.empty());
+ async_states_.clear();
+ }
+
+ void run()
+ {}
+ void notify_all_at_thread_exit(condition_variable*, mutex*)
+ {}
+
+ private:
+ externally_launched_thread(externally_launched_thread&);
+ void operator=(externally_launched_thread&);
+ };
+
+ void make_external_thread_data()
+ {
+ externally_launched_thread* me=detail::heap_new<externally_launched_thread>();
+ BOOST_TRY
+ {
+ set_current_thread_data(me);
+ }
+ BOOST_CATCH(...)
+ {
+ detail::heap_delete(me);
+ BOOST_RETHROW
+ }
+ BOOST_CATCH_END
+ }
+
+ detail::thread_data_base* get_or_make_current_thread_data()
+ {
+ detail::thread_data_base* current_thread_data(detail::get_current_thread_data());
+ if(!current_thread_data)
+ {
+ make_external_thread_data();
+ current_thread_data=detail::get_current_thread_data();
+ }
+ return current_thread_data;
+ }
+ }
+
+ thread::id thread::get_id() const BOOST_NOEXCEPT
+ {
+#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ if(!local_thread_info)
+ {
+ return 0;
+ }
+ return local_thread_info->id;
+#else
+ return thread::id((get_thread_info)());
+#endif
+ }
+
+ bool thread::joinable() const BOOST_NOEXCEPT
+ {
+ detail::thread_data_ptr local_thread_info = (get_thread_info)();
+ if(!local_thread_info)
+ {
+ return false;
+ }
+ return true;
+ }
+ bool thread::join_noexcept()
+ {
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ if(local_thread_info)
+ {
+ this_thread::interruptible_wait(this->native_handle(), detail::internal_platform_timepoint::getMax());
+ release_handle();
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ bool thread::do_try_join_until_noexcept(detail::internal_platform_timepoint const &timeout, bool& res)
+ {
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ if(local_thread_info)
+ {
+ if(!this_thread::interruptible_wait(this->native_handle(), timeout))
+ {
+ res=false;
+ return true;
+ }
+ release_handle();
+ res=true;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ void thread::detach()
+ {
+ release_handle();
+ }
+
+ void thread::release_handle()
+ {
+ thread_info=0;
+ }
+
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ void thread::interrupt()
+ {
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ if(local_thread_info)
+ {
+ local_thread_info->interrupt();
+ }
+ }
+
+ bool thread::interruption_requested() const BOOST_NOEXCEPT
+ {
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ return local_thread_info.get() && (winapi::WaitForSingleObjectEx(local_thread_info->interruption_handle,0,0)==0);
+ }
+
+#endif
+
+ unsigned thread::hardware_concurrency() BOOST_NOEXCEPT
+ {
+ detail::win32::system_info info;
+ detail::win32::get_system_info(&info);
+ return info.dwNumberOfProcessors;
+ }
+
+ unsigned thread::physical_concurrency() BOOST_NOEXCEPT
+ {
+ // a bit too strict: Windows XP with SP3 would be sufficient
+#if BOOST_PLAT_WINDOWS_RUNTIME \
+ || ( BOOST_USE_WINAPI_VERSION <= BOOST_WINAPI_VERSION_WINXP ) \
+ || ( ( defined(__MINGW32__) && !defined(__MINGW64__) ) && _WIN32_WINNT < 0x0600)
+ return 0;
+#else
+ unsigned cores = 0;
+ DWORD size = 0;
+
+ GetLogicalProcessorInformation(NULL, &size);
+ if (ERROR_INSUFFICIENT_BUFFER != GetLastError())
+ return 0;
+
+ std::vector<SYSTEM_LOGICAL_PROCESSOR_INFORMATION> buffer(size);
+ if (GetLogicalProcessorInformation(&buffer.front(), &size) == FALSE)
+ return 0;
+
+ const size_t Elements = size / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION);
+
+ for (size_t i = 0; i < Elements; ++i) {
+ if (buffer[i].Relationship == RelationProcessorCore)
+ ++cores;
+ }
+ return cores;
+#endif
+ }
+
+ thread::native_handle_type thread::native_handle()
+ {
+ detail::thread_data_ptr local_thread_info=(get_thread_info)();
+ if(!local_thread_info)
+ {
+ return detail::win32::invalid_handle_value;
+ }
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ // There is no 'real' Win32 handle so we return a handle that at least can be waited on.
+ return local_thread_info->thread_handle.waitable_handle();
+#else
+ return (detail::win32::handle)local_thread_info->thread_handle;
+#endif
+ }
+
+ detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const
+ {
+ return thread_info;
+ }
+
+ namespace this_thread
+ {
+#ifndef UNDER_CE
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ namespace detail_
+ {
+ typedef struct _REASON_CONTEXT {
+ ULONG Version;
+ DWORD Flags;
+ union {
+ LPWSTR SimpleReasonString;
+ struct {
+ HMODULE LocalizedReasonModule;
+ ULONG LocalizedReasonId;
+ ULONG ReasonStringCount;
+ LPWSTR *ReasonStrings;
+ } Detailed;
+ } Reason;
+ } REASON_CONTEXT, *PREASON_CONTEXT;
+ typedef BOOL (WINAPI *setwaitabletimerex_t)(HANDLE, const LARGE_INTEGER *, LONG, PTIMERAPCROUTINE, LPVOID, PREASON_CONTEXT, ULONG);
+ static inline BOOL WINAPI SetWaitableTimerEx_emulation(HANDLE hTimer, const LARGE_INTEGER *lpDueTime, LONG lPeriod, PTIMERAPCROUTINE pfnCompletionRoutine, LPVOID lpArgToCompletionRoutine, PREASON_CONTEXT WakeContext, ULONG TolerableDelay)
+ {
+ return SetWaitableTimer(hTimer, lpDueTime, lPeriod, pfnCompletionRoutine, lpArgToCompletionRoutine, FALSE);
+ }
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable: 6387) // MSVC sanitiser warns that GetModuleHandleA() might fail
+#endif
+ static inline setwaitabletimerex_t SetWaitableTimerEx()
+ {
+ static setwaitabletimerex_t setwaitabletimerex_impl;
+ if(setwaitabletimerex_impl)
+ return setwaitabletimerex_impl;
+ void (*addr)()=(void (*)()) GetProcAddress(
+#if !defined(BOOST_NO_ANSI_APIS)
+ GetModuleHandleA("KERNEL32.DLL"),
+#else
+ GetModuleHandleW(L"KERNEL32.DLL"),
+#endif
+ "SetWaitableTimerEx");
+ if(addr)
+ setwaitabletimerex_impl=(setwaitabletimerex_t) addr;
+ else
+ setwaitabletimerex_impl=&SetWaitableTimerEx_emulation;
+ return setwaitabletimerex_impl;
+ }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ }
+#endif
+#endif
+ bool interruptible_wait(detail::win32::handle handle_to_wait_for, detail::internal_platform_timepoint const &timeout)
+ {
+ detail::win32::handle handles[4]={0};
+ unsigned handle_count=0;
+ unsigned wait_handle_index=~0U;
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ unsigned interruption_index=~0U;
+#endif
+ unsigned timeout_index=~0U;
+ if(handle_to_wait_for!=detail::win32::invalid_handle_value)
+ {
+ wait_handle_index=handle_count;
+ handles[handle_count++]=handle_to_wait_for;
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ if(detail::get_current_thread_data() && detail::get_current_thread_data()->interruption_enabled)
+ {
+ interruption_index=handle_count;
+ handles[handle_count++]=detail::get_current_thread_data()->interruption_handle;
+ }
+#endif
+ detail::win32::handle_manager timer_handle;
+
+#ifndef UNDER_CE
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ // Preferentially use coalescing timers for better power consumption and timer accuracy
+ if(timeout != detail::internal_platform_timepoint::getMax())
+ {
+ boost::intmax_t const time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ timer_handle=CreateWaitableTimer(NULL,false,NULL);
+ if(timer_handle!=0)
+ {
+ ULONG tolerable=32; // Empirical testing shows Windows ignores this when <= 26
+ if(time_left_msec/20>tolerable) // 5%
+ tolerable=static_cast<ULONG>(time_left_msec/20);
+ LARGE_INTEGER due_time={{0,0}};
+ if(time_left_msec>0)
+ {
+ due_time.QuadPart=-(time_left_msec*10000); // negative indicates relative time
+ }
+ bool const set_time_succeeded=detail_::SetWaitableTimerEx()(timer_handle,&due_time,0,0,0,NULL,tolerable)!=0;
+ if(set_time_succeeded)
+ {
+ timeout_index=handle_count;
+ handles[handle_count++]=timer_handle;
+ }
+ }
+ }
+#endif
+#endif
+
+ bool const using_timer=timeout_index!=~0u;
+ boost::intmax_t time_left_msec(INFINITE);
+ if(!using_timer && timeout != detail::internal_platform_timepoint::getMax())
+ {
+ time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ if(time_left_msec < 0)
+ {
+ time_left_msec = 0;
+ }
+ }
+
+ do
+ {
+ if(handle_count)
+ {
+ unsigned long const notified_index=winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast<DWORD>(time_left_msec), 0);
+ if(notified_index<handle_count)
+ {
+ if(notified_index==wait_handle_index)
+ {
+ return true;
+ }
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ else if(notified_index==interruption_index)
+ {
+ winapi::ResetEvent(detail::get_current_thread_data()->interruption_handle);
+ throw thread_interrupted();
+ }
+#endif
+ else if(notified_index==timeout_index)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ detail::win32::sleep(static_cast<unsigned long>(time_left_msec));
+ }
+
+ if(!using_timer && timeout != detail::internal_platform_timepoint::getMax())
+ {
+ time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ }
+ }
+ while(time_left_msec == INFINITE || time_left_msec > 0);
+ return false;
+ }
+
+ namespace no_interruption_point
+ {
+ bool non_interruptible_wait(detail::win32::handle handle_to_wait_for, detail::internal_platform_timepoint const &timeout)
+ {
+ detail::win32::handle handles[3]={0};
+ unsigned handle_count=0;
+ unsigned wait_handle_index=~0U;
+ unsigned timeout_index=~0U;
+ if(handle_to_wait_for!=detail::win32::invalid_handle_value)
+ {
+ wait_handle_index=handle_count;
+ handles[handle_count++]=handle_to_wait_for;
+ }
+ detail::win32::handle_manager timer_handle;
+
+#ifndef UNDER_CE
+#if !BOOST_PLAT_WINDOWS_RUNTIME
+ // Preferentially use coalescing timers for better power consumption and timer accuracy
+ if(timeout != detail::internal_platform_timepoint::getMax())
+ {
+ boost::intmax_t const time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ timer_handle=CreateWaitableTimer(NULL,false,NULL);
+ if(timer_handle!=0)
+ {
+ ULONG tolerable=32; // Empirical testing shows Windows ignores this when <= 26
+ if(time_left_msec/20>tolerable) // 5%
+ tolerable=static_cast<ULONG>(time_left_msec/20);
+ LARGE_INTEGER due_time={{0,0}};
+ if(time_left_msec>0)
+ {
+ due_time.QuadPart=-(time_left_msec*10000); // negative indicates relative time
+ }
+ bool const set_time_succeeded=detail_::SetWaitableTimerEx()(timer_handle,&due_time,0,0,0,NULL,tolerable)!=0;
+ if(set_time_succeeded)
+ {
+ timeout_index=handle_count;
+ handles[handle_count++]=timer_handle;
+ }
+ }
+ }
+#endif
+#endif
+
+ bool const using_timer=timeout_index!=~0u;
+ boost::intmax_t time_left_msec(INFINITE);
+ if(!using_timer && timeout != detail::internal_platform_timepoint::getMax())
+ {
+ time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ if(time_left_msec < 0)
+ {
+ time_left_msec = 0;
+ }
+ }
+
+ do
+ {
+ if(handle_count)
+ {
+ unsigned long const notified_index=winapi::WaitForMultipleObjectsEx(handle_count,handles,false,static_cast<DWORD>(time_left_msec), 0);
+ if(notified_index<handle_count)
+ {
+ if(notified_index==wait_handle_index)
+ {
+ return true;
+ }
+ else if(notified_index==timeout_index)
+ {
+ return false;
+ }
+ }
+ }
+ else
+ {
+ detail::win32::sleep(static_cast<unsigned long>(time_left_msec));
+ }
+
+ if(!using_timer && timeout != detail::internal_platform_timepoint::getMax())
+ {
+ time_left_msec = (timeout - detail::internal_platform_clock::now()).getMs();
+ }
+ }
+ while(time_left_msec == INFINITE || time_left_msec > 0);
+ return false;
+ }
+ }
+
+ thread::id get_id() BOOST_NOEXCEPT
+ {
+#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
+#if BOOST_PLAT_WINDOWS_RUNTIME
+ detail::thread_data_base* current_thread_data(detail::get_current_thread_data());
+ if (current_thread_data)
+ {
+ return current_thread_data->id;
+ }
+#endif
+ return winapi::GetCurrentThreadId();
+#else
+ return thread::id(get_or_make_current_thread_data());
+#endif
+ }
+
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ void interruption_point()
+ {
+ if(interruption_enabled() && interruption_requested())
+ {
+ winapi::ResetEvent(detail::get_current_thread_data()->interruption_handle);
+ throw thread_interrupted();
+ }
+ }
+
+ bool interruption_enabled() BOOST_NOEXCEPT
+ {
+ return detail::get_current_thread_data() && detail::get_current_thread_data()->interruption_enabled;
+ }
+
+ bool interruption_requested() BOOST_NOEXCEPT
+ {
+ return detail::get_current_thread_data() && (winapi::WaitForSingleObjectEx(detail::get_current_thread_data()->interruption_handle,0,0)==0);
+ }
+#endif
+
+ void yield() BOOST_NOEXCEPT
+ {
+ detail::win32::sleep(0);
+ }
+
+#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
+ disable_interruption::disable_interruption() BOOST_NOEXCEPT:
+ interruption_was_enabled(interruption_enabled())
+ {
+ if(interruption_was_enabled)
+ {
+ detail::get_current_thread_data()->interruption_enabled=false;
+ }
+ }
+
+ disable_interruption::~disable_interruption() BOOST_NOEXCEPT
+ {
+ if(detail::get_current_thread_data())
+ {
+ detail::get_current_thread_data()->interruption_enabled=interruption_was_enabled;
+ }
+ }
+
+ restore_interruption::restore_interruption(disable_interruption& d) BOOST_NOEXCEPT
+ {
+ if(d.interruption_was_enabled)
+ {
+ detail::get_current_thread_data()->interruption_enabled=true;
+ }
+ }
+
+ restore_interruption::~restore_interruption() BOOST_NOEXCEPT
+ {
+ if(detail::get_current_thread_data())
+ {
+ detail::get_current_thread_data()->interruption_enabled=false;
+ }
+ }
+#endif
+ }
+
+ namespace detail
+ {
+ void add_thread_exit_function(thread_exit_function_base* func)
+ {
+ detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
+ thread_exit_callback_node* const new_node=
+ heap_new<thread_exit_callback_node>(
+ func,current_thread_data->thread_exit_callbacks);
+ current_thread_data->thread_exit_callbacks=new_node;
+ }
+
+ tss_data_node* find_tss_data(void const* key)
+ {
+ detail::thread_data_base* const current_thread_data(get_current_thread_data());
+ if(current_thread_data)
+ {
+ std::map<void const*,tss_data_node>::iterator current_node=
+ current_thread_data->tss_data.find(key);
+ if(current_node!=current_thread_data->tss_data.end())
+ {
+ return &current_node->second;
+ }
+ }
+ return NULL;
+ }
+
+ void* get_tss_data(void const* key)
+ {
+ if(tss_data_node* const current_node=find_tss_data(key))
+ {
+ return current_node->value;
+ }
+ return NULL;
+ }
+
+ void add_new_tss_node(void const* key,
+ boost::shared_ptr<tss_cleanup_function> func,
+ void* tss_data)
+ {
+ detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
+ current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(func,tss_data)));
+ }
+
+ void erase_tss_node(void const* key)
+ {
+ detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
+ current_thread_data->tss_data.erase(key);
+ }
+
+ void set_tss_data(void const* key,
+ boost::shared_ptr<tss_cleanup_function> func,
+ void* tss_data,bool cleanup_existing)
+ {
+ if(tss_data_node* const current_node=find_tss_data(key))
+ {
+ if(cleanup_existing && current_node->func && (current_node->value!=0))
+ {
+ (*current_node->func)(current_node->value);
+ }
+ if(func || (tss_data!=0))
+ {
+ current_node->func=func;
+ current_node->value=tss_data;
+ }
+ else
+ {
+ erase_tss_node(key);
+ }
+ }
+ else if(func || (tss_data!=0))
+ {
+ add_new_tss_node(key,func,tss_data);
+ }
+ }
+ }
+
+ BOOST_THREAD_DECL void __cdecl on_process_enter()
+ {}
+
+ BOOST_THREAD_DECL void __cdecl on_thread_enter()
+ {}
+
+ BOOST_THREAD_DECL void __cdecl on_process_exit()
+ {
+ boost::cleanup_tls_key();
+ }
+
+ BOOST_THREAD_DECL void __cdecl on_thread_exit()
+ {
+ boost::run_thread_exit_callbacks();
+ }
+
+ BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
+ {
+ detail::thread_data_base* const current_thread_data(detail::get_current_thread_data());
+ if(current_thread_data)
+ {
+ current_thread_data->notify_all_at_thread_exit(&cond, lk.release());
+ }
+ }
+}
+
diff --git a/contrib/restricted/boost/libs/thread/src/win32/thread_primitives.cpp b/contrib/restricted/boost/libs/thread/src/win32/thread_primitives.cpp
new file mode 100644
index 0000000000..f51f621508
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/src/win32/thread_primitives.cpp
@@ -0,0 +1,140 @@
+// thread_primitives.cpp
+//
+// (C) Copyright 2018 Andrey Semashev
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/winapi/config.hpp>
+#include <boost/winapi/dll.hpp>
+#include <boost/winapi/time.hpp>
+#include <boost/winapi/event.hpp>
+#include <boost/winapi/handles.hpp>
+#include <boost/winapi/thread_pool.hpp>
+#include <cstdlib>
+#include <boost/config.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/memory_order.hpp>
+#include <boost/atomic/atomic.hpp>
+#include <boost/thread/win32/interlocked_read.hpp>
+#include <boost/thread/win32/thread_primitives.hpp>
+
+namespace boost {
+namespace detail {
+namespace win32 {
+
+#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+
+// Directly use API from Vista and later
+BOOST_THREAD_DECL boost::detail::win32::detail::gettickcount64_t gettickcount64 = &::boost::winapi::GetTickCount64;
+
+#else // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+
+namespace {
+
+enum init_state
+{
+ uninitialized = 0,
+ in_progress,
+ initialized
+};
+
+struct get_tick_count64_state
+{
+ boost::atomic< uint64_t > ticks;
+ boost::atomic< init_state > init;
+ boost::winapi::HANDLE_ wait_event;
+ boost::winapi::HANDLE_ wait_handle;
+};
+
+// Zero-initialized initially
+BOOST_ALIGNMENT(64) static get_tick_count64_state g_state;
+
+//! Artifical implementation of GetTickCount64
+ticks_type WINAPI get_tick_count64()
+{
+ uint64_t old_state = g_state.ticks.load(boost::memory_order_acquire);
+
+ uint32_t new_ticks = boost::winapi::GetTickCount();
+
+ uint32_t old_ticks = static_cast< uint32_t >(old_state & UINT64_C(0x00000000ffffffff));
+ uint64_t new_state = ((old_state & UINT64_C(0xffffffff00000000)) + (static_cast< uint64_t >(new_ticks < old_ticks) << 32)) | static_cast< uint64_t >(new_ticks);
+
+ g_state.ticks.store(new_state, boost::memory_order_release);
+
+ return new_state;
+}
+
+//! The function is called periodically in the system thread pool to make sure g_state.ticks is timely updated
+void NTAPI refresh_get_tick_count64(boost::winapi::PVOID_, boost::winapi::BOOLEAN_)
+{
+ get_tick_count64();
+}
+
+//! Cleanup function to stop get_tick_count64 refreshes
+void cleanup_get_tick_count64()
+{
+ if (g_state.wait_handle)
+ {
+ boost::winapi::UnregisterWait(g_state.wait_handle);
+ g_state.wait_handle = NULL;
+ }
+
+ if (g_state.wait_event)
+ {
+ boost::winapi::CloseHandle(g_state.wait_event);
+ g_state.wait_event = NULL;
+ }
+}
+
+ticks_type WINAPI get_tick_count_init()
+{
+ boost::winapi::HMODULE_ hKernel32 = boost::winapi::GetModuleHandleW(L"kernel32.dll");
+ if (hKernel32)
+ {
+ boost::detail::win32::detail::gettickcount64_t p =
+ (boost::detail::win32::detail::gettickcount64_t)boost::winapi::get_proc_address(hKernel32, "GetTickCount64");
+ if (p)
+ {
+ // Use native API
+ boost::detail::interlocked_write_release((void**)&gettickcount64, (void*)p);
+ return p();
+ }
+ }
+
+ // No native API available. Use emulation with periodic refreshes to make sure the GetTickCount wrap arounds are properly counted.
+ init_state old_init = uninitialized;
+ if (g_state.init.compare_exchange_strong(old_init, in_progress, boost::memory_order_acq_rel, boost::memory_order_relaxed))
+ {
+ if (!g_state.wait_event)
+ g_state.wait_event = boost::winapi::create_anonymous_event(NULL, false, false);
+ if (g_state.wait_event)
+ {
+ boost::winapi::BOOL_ res = boost::winapi::RegisterWaitForSingleObject(&g_state.wait_handle, g_state.wait_event, &refresh_get_tick_count64, NULL, 0x7fffffff, boost::winapi::WT_EXECUTEINWAITTHREAD_);
+ if (res)
+ {
+ std::atexit(&cleanup_get_tick_count64);
+
+ boost::detail::interlocked_write_release((void**)&gettickcount64, (void*)&get_tick_count64);
+ g_state.init.store(initialized, boost::memory_order_release);
+ goto finish;
+ }
+ }
+
+ g_state.init.store(uninitialized, boost::memory_order_release);
+ }
+
+finish:
+ return get_tick_count64();
+}
+
+} // namespace
+
+BOOST_THREAD_DECL boost::detail::win32::detail::gettickcount64_t gettickcount64 = &get_tick_count_init;
+
+#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6
+
+} // namespace win32
+} // namespace detail
+} // namespace boost
diff --git a/contrib/restricted/boost/libs/thread/src/win32/tss_dll.cpp b/contrib/restricted/boost/libs/thread/src/win32/tss_dll.cpp
new file mode 100644
index 0000000000..75ea93a5aa
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/src/win32/tss_dll.cpp
@@ -0,0 +1,85 @@
+// (C) Copyright Michael Glassford 2004.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/winapi/config.hpp>
+#include <boost/thread/detail/config.hpp>
+
+
+#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
+
+ #include <boost/thread/detail/tss_hooks.hpp>
+
+ #include <windows.h>
+
+ #if defined(__BORLANDC__)
+ extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
+ #elif defined(_WIN32_WCE)
+ extern "C" BOOL WINAPI DllMain(HANDLE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
+ #else
+ extern "C" BOOL WINAPI DllMain(HINSTANCE /*hInstance*/, DWORD dwReason, LPVOID /*lpReserved*/)
+ #endif
+ {
+ switch(dwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ {
+ boost::on_process_enter();
+ boost::on_thread_enter();
+ break;
+ }
+
+ case DLL_THREAD_ATTACH:
+ {
+ boost::on_thread_enter();
+ break;
+ }
+
+ case DLL_THREAD_DETACH:
+ {
+ boost::on_thread_exit();
+ break;
+ }
+
+ case DLL_PROCESS_DETACH:
+ {
+ boost::on_thread_exit();
+ boost::on_process_exit();
+ break;
+ }
+ }
+
+ return TRUE;
+ }
+
+namespace boost
+{
+ void tss_cleanup_implemented()
+ {
+ /*
+ This function's sole purpose is to cause a link error in cases where
+ automatic tss cleanup is not implemented by Boost.Threads as a
+ reminder that user code is responsible for calling the necessary
+ functions at the appropriate times (and for implementing an a
+ tss_cleanup_implemented() function to eliminate the linker's
+ missing symbol error).
+
+ If Boost.Threads later implements automatic tss cleanup in cases
+ where it currently doesn't (which is the plan), the duplicate
+ symbol error will warn the user that their custom solution is no
+ longer needed and can be removed.
+ */
+ }
+}
+
+#else //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
+
+#ifdef _MSC_VER
+// Prevent LNK4221 warning with link=static
+namespace boost { namespace link_static_warning_inhibit {
+ extern __declspec(dllexport) void foo() { }
+} }
+#endif
+
+#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
diff --git a/contrib/restricted/boost/libs/thread/src/win32/tss_pe.cpp b/contrib/restricted/boost/libs/thread/src/win32/tss_pe.cpp
new file mode 100644
index 0000000000..e4a0a3aaa3
--- /dev/null
+++ b/contrib/restricted/boost/libs/thread/src/win32/tss_pe.cpp
@@ -0,0 +1,337 @@
+// $Id$
+// (C) Copyright Aaron W. LaFramboise, Roland Schwarz, Michael Glassford 2004.
+// (C) Copyright 2007 Roland Schwarz
+// (C) Copyright 2007 Anthony Williams
+// (C) Copyright 2007 David Deakins
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/winapi/config.hpp>
+#include <boost/thread/detail/config.hpp>
+
+#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
+
+#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR)
+
+#include <boost/thread/detail/tss_hooks.hpp>
+
+#include <windows.h>
+
+#include <cstdlib>
+
+namespace boost
+{
+ void tss_cleanup_implemented() {}
+}
+
+namespace {
+ void NTAPI on_tls_callback(void* , DWORD dwReason, PVOID )
+ {
+ switch (dwReason)
+ {
+ case DLL_THREAD_DETACH:
+ {
+ boost::on_thread_exit();
+ break;
+ }
+ }
+ }
+}
+
+#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32__) || (__MINGW32_MAJOR_VERSION >3) || \
+ ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
+extern "C"
+{
+ PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback;
+}
+#else
+extern "C" {
+
+ void (* after_ctors )() __attribute__((section(".ctors"))) = boost::on_process_enter;
+ void (* before_dtors)() __attribute__((section(".dtors"))) = boost::on_thread_exit;
+ void (* after_dtors )() __attribute__((section(".dtors.zzz"))) = boost::on_process_exit;
+
+ ULONG __tls_index__ = 0;
+ char __tls_end__ __attribute__((section(".tls$zzz"))) = 0;
+ char __tls_start__ __attribute__((section(".tls"))) = 0;
+
+
+ PIMAGE_TLS_CALLBACK __crt_xl_start__ __attribute__ ((section(".CRT$XLA"))) = 0;
+ PIMAGE_TLS_CALLBACK __crt_xl_end__ __attribute__ ((section(".CRT$XLZ"))) = 0;
+}
+extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) =
+{
+ (DWORD) &__tls_start__,
+ (DWORD) &__tls_end__,
+ (DWORD) &__tls_index__,
+ (DWORD) (&__crt_xl_start__+1),
+ (DWORD) 0,
+ (DWORD) 0
+};
+#endif
+
+
+#elif defined(_MSC_VER) && !defined(UNDER_CE)
+
+ #include <boost/thread/detail/tss_hooks.hpp>
+
+ #include <stdlib.h>
+
+ #include <windows.h>
+
+
+// _pRawDllMainOrig can be defined by including boost/thread/win32/mfc_thread_init.hpp
+// into your dll; it ensures that MFC-Dll-initialization will be done properly
+// The following code is adapted from the MFC-Dll-init code
+/*
+ * _pRawDllMainOrig MUST be an extern const variable, which will be aliased to
+ * _pDefaultRawDllMainOrig if no real user definition is present, thanks to the
+ * alternatename directive.
+ */
+
+// work at least with _MSC_VER 1500 (MSVC++ 9.0, VS 2008)
+#if (_MSC_VER >= 1500)
+
+extern "C" {
+extern BOOL (WINAPI * const _pRawDllMainOrig)(HINSTANCE, DWORD, LPVOID);
+extern BOOL (WINAPI * const _pDefaultRawDllMainOrig)(HINSTANCE, DWORD, LPVOID) = NULL;
+#if defined (_M_IX86)
+#pragma comment(linker, "/alternatename:__pRawDllMainOrig=__pDefaultRawDllMainOrig")
+#elif defined (_M_X64) || defined (_M_ARM)
+#pragma comment(linker, "/alternatename:_pRawDllMainOrig=_pDefaultRawDllMainOrig")
+#else /* defined (_M_X64) || defined (_M_ARM) */
+#error Unsupported platform
+#endif /* defined (_M_X64) || defined (_M_ARM) */
+}
+
+#endif
+
+
+
+
+ //Definitions required by implementation
+ #if (_MSC_VER < 1300) || ((_MSC_VER > 1900) && (_MSC_VER < 1910)) // 1300 == VC++ 7.0, 1900 == VC++ 14.0, 1910 == VC++ 2017
+ typedef void ( __cdecl *_PVFV_ )();
+ typedef void ( __cdecl *_PIFV_ )();
+ #define INIRETSUCCESS_V
+ #define INIRETSUCCESS_I
+ #define PVAPI_V void __cdecl
+ #define PVAPI_I void __cdecl
+ #elif (_MSC_VER >= 1910)
+ typedef void ( __cdecl *_PVFV_ )();
+ typedef int ( __cdecl *_PIFV_ )();
+ #define INIRETSUCCESS_V
+ #define INIRETSUCCESS_I 0
+ #define PVAPI_V void __cdecl
+ #define PVAPI_I int __cdecl
+ #else
+ typedef int ( __cdecl *_PVFV_ )();
+ typedef int ( __cdecl *_PIFV_ )();
+ #define INIRETSUCCESS_V 0
+ #define INIRETSUCCESS_I 0
+ #define PVAPI_V int __cdecl
+ #define PVAPI_I int __cdecl
+ #endif
+
+ typedef void (NTAPI* _TLSCB)(HINSTANCE, DWORD, PVOID);
+
+ //Symbols for connection to the runtime environment
+
+ extern "C"
+ {
+ extern DWORD _tls_used; //the tls directory (located in .rdata segment)
+ extern _TLSCB __xl_a[], __xl_z[]; //tls initializers */
+ }
+
+ namespace
+ {
+ //Forward declarations
+
+ static PVAPI_I on_tls_prepare();
+ static PVAPI_V on_process_init();
+ static PVAPI_V on_process_term();
+ static void NTAPI on_tls_callback(HINSTANCE, DWORD, PVOID);
+
+ //The .CRT$Xxx information is taken from Codeguru:
+ //http://www.codeguru.com/Cpp/misc/misc/threadsprocesses/article.php/c6945__2/
+
+#if (_MSC_VER >= 1400)
+#pragma section(".CRT$XIU",long,read)
+#pragma section(".CRT$XCU",long,read)
+#pragma section(".CRT$XTU",long,read)
+#pragma section(".CRT$XLC",long,read)
+ __declspec(allocate(".CRT$XLC")) _TLSCB __xl_ca=on_tls_callback;
+ __declspec(allocate(".CRT$XIU"))_PIFV_ p_tls_prepare = on_tls_prepare;
+ __declspec(allocate(".CRT$XCU"))_PVFV_ p_process_init = on_process_init;
+ __declspec(allocate(".CRT$XTU"))_PVFV_ p_process_term = on_process_term;
+#else
+ #if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
+ # pragma data_seg(push, old_seg)
+ #endif
+ //Callback to run tls glue code first.
+ //I don't think it is necessary to run it
+ //at .CRT$XIB level, since we are only
+ //interested in thread detachement. But
+ //this could be changed easily if required.
+
+ #pragma data_seg(".CRT$XIU")
+ static _PIFV_ p_tls_prepare = on_tls_prepare;
+ #pragma data_seg()
+
+ //Callback after all global ctors.
+
+ #pragma data_seg(".CRT$XCU")
+ static _PVFV_ p_process_init = on_process_init;
+ #pragma data_seg()
+
+ //Callback for tls notifications.
+
+ #pragma data_seg(".CRT$XLB")
+ _TLSCB p_thread_callback = on_tls_callback;
+ #pragma data_seg()
+ //Callback for termination.
+
+ #pragma data_seg(".CRT$XTU")
+ static _PVFV_ p_process_term = on_process_term;
+ #pragma data_seg()
+ #if (_MSC_VER >= 1300) // 1300 == VC++ 7.0
+ # pragma data_seg(pop, old_seg)
+ #endif
+#endif
+
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4189)
+#endif
+
+ PVAPI_I on_tls_prepare()
+ {
+ //The following line has an important side effect:
+ //if the TLS directory is not already there, it will
+ //be created by the linker. In other words, it forces a tls
+ //directory to be generated by the linker even when static tls
+ //(i.e. __declspec(thread)) is not used.
+ //The volatile should prevent the optimizer
+ //from removing the reference.
+
+ DWORD volatile dw = _tls_used;
+
+ #if (_MSC_VER < 1300) // 1300 == VC++ 7.0
+ _TLSCB* pfbegin = __xl_a;
+ _TLSCB* pfend = __xl_z;
+ _TLSCB* pfdst = pfbegin;
+ //pfdst = (_TLSCB*)_tls_used.AddressOfCallBacks;
+
+ //The following loop will merge the address pointers
+ //into a contiguous area, since the tlssup code seems
+ //to require this (at least on MSVC 6)
+
+ while (pfbegin < pfend)
+ {
+ if (*pfbegin != 0)
+ {
+ *pfdst = *pfbegin;
+ ++pfdst;
+ }
+ ++pfbegin;
+ }
+
+ *pfdst = 0;
+ #endif
+
+ return INIRETSUCCESS_I;
+ }
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
+ PVAPI_V on_process_init()
+ {
+ //Schedule on_thread_exit() to be called for the main
+ //thread before destructors of global objects have been
+ //called.
+
+ //It will not be run when 'quick' exiting the
+ //library; however, this is the standard behaviour
+ //for destructors of global objects, so that
+ //shouldn't be a problem.
+
+ atexit(boost::on_thread_exit);
+
+ //Call Boost process entry callback here
+
+ boost::on_process_enter();
+
+ return INIRETSUCCESS_V;
+ }
+
+ PVAPI_V on_process_term()
+ {
+ boost::on_process_exit();
+ return INIRETSUCCESS_V;
+ }
+
+ void NTAPI on_tls_callback(HINSTANCE /*h*/, DWORD dwReason, PVOID /*pv*/)
+ {
+ switch (dwReason)
+ {
+ case DLL_THREAD_DETACH:
+ boost::on_thread_exit();
+ break;
+ }
+ }
+
+#if (_MSC_VER >= 1500)
+ BOOL WINAPI dll_callback(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
+#else
+ BOOL WINAPI dll_callback(HINSTANCE, DWORD dwReason, LPVOID)
+#endif
+ {
+ switch (dwReason)
+ {
+ case DLL_THREAD_DETACH:
+ boost::on_thread_exit();
+ break;
+ case DLL_PROCESS_DETACH:
+ boost::on_process_exit();
+ break;
+ }
+
+#if (_MSC_VER >= 1500)
+ if( _pRawDllMainOrig )
+ {
+ return _pRawDllMainOrig(hInstance, dwReason, lpReserved);
+ }
+#endif
+ return true;
+ }
+ } //namespace
+
+extern "C"
+{
+ extern BOOL (WINAPI * const _pRawDllMain)(HINSTANCE, DWORD, LPVOID)=&dll_callback;
+}
+namespace boost
+{
+ void tss_cleanup_implemented()
+ {
+ /*
+ This function's sole purpose is to cause a link error in cases where
+ automatic tss cleanup is not implemented by Boost.Threads as a
+ reminder that user code is responsible for calling the necessary
+ functions at the appropriate times (and for implementing an a
+ tss_cleanup_implemented() function to eliminate the linker's
+ missing symbol error).
+
+ If Boost.Threads later implements automatic tss cleanup in cases
+ where it currently doesn't (which is the plan), the duplicate
+ symbol error will warn the user that their custom solution is no
+ longer needed and can be removed.
+ */
+ }
+}
+
+#endif //defined(_MSC_VER) && !defined(UNDER_CE)
+
+#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
diff --git a/contrib/restricted/boost/libs/timer/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/timer/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..5dee7360cb
--- /dev/null
+++ b/contrib/restricted/boost/libs/timer/.yandex_meta/licenses.list.txt
@@ -0,0 +1,42 @@
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0.
+// See http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================BSL-1.0====================
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 1994-2006, 2011
+
+
+====================COPYRIGHT====================
+// Copyright Beman Dawes 2007, 2011
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.