Skip to content

Commit ef140e0

Browse files
authored
Merge pull request #46 from ntoskrnl7/feature/ldk-0.7.7-driver-stl-coverage
Expand driver-tested STL coverage with LDK 0.7.7
2 parents fd0fbf7 + 8d9067c commit ef140e0

41 files changed

Lines changed: 2749 additions & 376 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ build*/
55
.vs/
66
artifacts/
77
lib/
8+
.cpm-cache/

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ else()
6161
set(LDK_USE_RAISE_EXCEPTION OFF)
6262
set(LDK_USE_RTL_RAISE_EXCEPTION OFF)
6363
endif()
64-
CPMAddPackage("gh:ntoskrnl7/Ldk@0.7.5")
64+
if (NOT CRTSYS_ENABLE_DIAGNOSTIC_BREAKPOINTS)
65+
set(LDK_ENABLE_DIAGNOSTIC_BREAKPOINTS OFF CACHE BOOL "Set to OFF to suppress LDK diagnostic KdBreakPoint calls")
66+
endif()
67+
CPMAddPackage("gh:ntoskrnl7/Ldk@0.7.7")
6568

6669
CPMAddPackage("gh:ntoskrnl7/FindWDK#master")
6770
list(APPEND CMAKE_MODULE_PATH "${FindWDK_SOURCE_DIR}/cmake")
@@ -96,10 +99,13 @@ if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32")
9699
src/custom/crt/math/*.c
97100
)
98101
list(APPEND SOURCE_FILES ${MATH_SOURCE_FILES})
102+
list(APPEND SOURCE_FILES src/custom/crt/tls_x86.asm)
99103
else()
100104
file(GLOB MATH_SOURCE_FILES
101105
src/custom/crt/math/nextafter.c
102106
src/custom/crt/math/fpclassify.c
107+
src/custom/crt/math/fma.c
108+
src/custom/crt/math/real_helpers.c
103109
)
104110
list(APPEND SOURCE_FILES ${MATH_SOURCE_FILES})
105111
endif()

cmake/CrtSys.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,15 @@ endfunction()
182182

183183
function(crtsys_add_driver _target)
184184
cmake_parse_arguments(WDK "" "WINVER" "" ${ARGN})
185+
186+
set(_CRTSYS_ORIGINAL_GENERATOR_PLATFORM "${CMAKE_GENERATOR_PLATFORM}")
187+
if(_CRTSYS_ORIGINAL_GENERATOR_PLATFORM MATCHES "^([^,]+),")
188+
set(CMAKE_GENERATOR_PLATFORM "${CMAKE_MATCH_1}")
189+
endif()
190+
185191
wdk_add_driver(${_target} ${WDK_UNPARSED_ARGUMENTS} CUSTOM_ENTRY_POINT CrtSysDriverEntry EXTENDED_CPP_FEATURES)
192+
193+
set(CMAKE_GENERATOR_PLATFORM "${_CRTSYS_ORIGINAL_GENERATOR_PLATFORM}")
186194
crtsys_scope_compile_options_to_c_cxx(${_target})
187195

188196
crtsys_apply_driver_settings(${_target} "${_CRTSYS_ROOT}")

docs/cppreference-attribution.md

Lines changed: 102 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,26 @@ test harness, typically by moving the sample `main()` body into a namespaced
2626
- `std::shared_ptr`: <https://en.cppreference.com/w/cpp/memory/shared_ptr>
2727
- `std::atomic`: <https://en.cppreference.com/w/cpp/atomic/atomic>
2828
- `std::atomic_flag`: <https://en.cppreference.com/w/cpp/atomic/atomic_flag>
29+
- `std::latch`: <https://en.cppreference.com/w/cpp/thread/latch>
30+
- `std::barrier`: <https://en.cppreference.com/w/cpp/thread/barrier>
31+
- `std::counting_semaphore` / `std::binary_semaphore`: <https://en.cppreference.com/w/cpp/thread/counting_semaphore>
2932
- `std::weak_ptr`: <https://en.cppreference.com/w/cpp/memory/weak_ptr>
3033
- `std::array`: <https://en.cppreference.com/w/cpp/container/array>
3134
- `std::vector`: <https://en.cppreference.com/w/cpp/container/vector>
3235
- `std::deque`: <https://en.cppreference.com/w/cpp/container/deque>
3336
- `std::list`: <https://en.cppreference.com/w/cpp/container/list>
3437
- `std::forward_list::insert_after`: <https://en.cppreference.com/w/cpp/container/forward_list/insert_after>
38+
- `std::locale`: <https://en.cppreference.com/w/cpp/locale/locale>
39+
- `std::locale` constructors: <https://en.cppreference.com/w/cpp/locale/locale/locale>
40+
- `std::has_facet`: <https://en.cppreference.com/w/cpp/locale/has_facet>
41+
- `std::use_facet`: <https://en.cppreference.com/w/cpp/locale/use_facet>
42+
- `std::numpunct`: <https://en.cppreference.com/w/cpp/locale/numpunct>
43+
- `std::ctype<char>`: <https://en.cppreference.com/w/cpp/locale/ctype_char>
44+
- `std::messages::open`: <https://en.cppreference.com/w/cpp/locale/messages/open>
45+
- `std::get_money`: <https://en.cppreference.com/w/cpp/io/manip/get_money>
46+
- `std::put_money`: <https://en.cppreference.com/w/cpp/io/manip/put_money>
47+
- `std::get_time`: <https://en.cppreference.com/w/cpp/io/manip/get_time>
48+
- `std::put_time`: <https://en.cppreference.com/w/cpp/io/manip/put_time>
3549
- `std::map`: <https://en.cppreference.com/w/cpp/container/map>
3650
- `std::set`: <https://en.cppreference.com/w/cpp/container/set>
3751
- `std::multiset::erase`: <https://en.cppreference.com/w/cpp/container/multiset/erase>
@@ -55,6 +69,11 @@ test harness, typically by moving the sample `main()` body into a namespaced
5569
- `std::binary_search`: <https://en.cppreference.com/w/cpp/algorithm/binary_search>
5670
- `std::ranges` filter/transform views: <https://en.cppreference.com/w/cpp/ranges>
5771
- `std::ranges::sort`: <https://en.cppreference.com/w/cpp/algorithm/ranges/sort>
72+
- `std::ranges::zip_view`: <https://en.cppreference.com/w/cpp/ranges/zip_view>
73+
- `std::ranges::chunk_view`: <https://en.cppreference.com/w/cpp/ranges/chunk_view>
74+
- `std::ranges::slide_view`: <https://en.cppreference.com/w/cpp/ranges/slide_view>
75+
- `std::ranges::stride_view`: <https://en.cppreference.com/w/cpp/ranges/stride_view>
76+
- `std::ranges::repeat_view`: <https://en.cppreference.com/w/cpp/ranges/repeat_view>
5877
- `std::merge`: <https://en.cppreference.com/w/cpp/algorithm/merge>
5978
- `std::make_heap`: <https://en.cppreference.com/w/cpp/algorithm/make_heap>
6079
- `std::next_permutation`: <https://en.cppreference.com/w/cpp/algorithm/next_permutation>
@@ -85,73 +104,110 @@ test harness, typically by moving the sample `main()` body into a namespaced
85104
- `std::derived_from` / `std::same_as`: <https://en.cppreference.com/w/cpp/concepts>
86105
- `std::strong_ordering`: <https://en.cppreference.com/w/cpp/utility/compare/strong_ordering>
87106
- `std::numbers`: <https://en.cppreference.com/w/cpp/numeric/constants>
107+
- `std::format`: <https://en.cppreference.com/w/cpp/utility/format/format>
108+
- `std::regex`: <https://en.cppreference.com/w/cpp/regex>
88109
- `std::distance`: <https://en.cppreference.com/w/cpp/iterator/distance>
89110
- `std::advance`: <https://en.cppreference.com/w/cpp/iterator/advance>
90111
- `std::next`: <https://en.cppreference.com/w/cpp/iterator/next>
91112
- `std::back_inserter`: <https://en.cppreference.com/w/cpp/iterator/back_inserter>
92113
- `std::complex`: <https://en.cppreference.com/w/cpp/numeric/complex>
114+
- `std::complex std::exp`: <https://en.cppreference.com/w/cpp/numeric/complex/exp>
115+
- `std::complex std::pow`: <https://en.cppreference.com/w/cpp/numeric/complex/pow>
93116
- `std::valarray::slice`: <https://en.cppreference.com/w/cpp/numeric/valarray/slice>
117+
- `std::random_device`: <https://en.cppreference.com/w/cpp/numeric/random/random_device>
94118
- `std::uniform_int_distribution`: <https://en.cppreference.com/w/cpp/numeric/random/uniform_int_distribution>
119+
- `std::chrono::current_zone`: <https://en.cppreference.com/w/cpp/chrono/current_zone>
120+
- `std::chrono::locate_zone`: <https://en.cppreference.com/w/cpp/chrono/locate_zone>
121+
- `std::chrono::zoned_time`: <https://en.cppreference.com/w/cpp/chrono/zoned_time>
122+
- `std::chrono::time_zone::get_info`: <https://en.cppreference.com/w/cpp/chrono/time_zone/get_info>
95123
- `std::unique_ptr`: <https://en.cppreference.com/w/cpp/memory/unique_ptr>
96124
- `std::pmr::monotonic_buffer_resource`: <https://en.cppreference.com/w/cpp/memory/monotonic_buffer_resource>
125+
- `std::filesystem::path` lexical operations: <https://en.cppreference.com/w/cpp/filesystem/path/lexically_normal>
126+
- `std::filesystem::directory_iterator`: <https://en.cppreference.com/w/cpp/filesystem/directory_iterator>
127+
- `std::filesystem::recursive_directory_iterator`: <https://en.cppreference.com/w/cpp/filesystem/recursive_directory_iterator>
128+
- `std::filesystem::copy`: <https://en.cppreference.com/w/cpp/filesystem/copy>
129+
- `std::filesystem::copy_file`: <https://en.cppreference.com/w/cpp/filesystem/copy_file>
130+
- `std::filesystem::create_directory`: <https://en.cppreference.com/w/cpp/filesystem/create_directory>
131+
- `std::filesystem::create_hard_link`: <https://en.cppreference.com/w/cpp/filesystem/create_hard_link>
132+
- `std::filesystem::create_symlink` / `std::filesystem::create_directory_symlink`: <https://en.cppreference.com/w/cpp/filesystem/create_symlink>
133+
- `std::filesystem::read_symlink`: <https://en.cppreference.com/w/cpp/filesystem/read_symlink>
134+
- `std::filesystem::copy_symlink`: <https://en.cppreference.com/w/cpp/filesystem/copy_symlink>
135+
- `std::filesystem::directory_entry`: <https://en.cppreference.com/w/cpp/filesystem/directory_entry>
136+
- `std::filesystem::equivalent`: <https://en.cppreference.com/w/cpp/filesystem/equivalent>
137+
- `std::filesystem::file_size`: <https://en.cppreference.com/w/cpp/filesystem/file_size>
138+
- `std::filesystem::hard_link_count`: <https://en.cppreference.com/w/cpp/filesystem/hard_link_count>
139+
- `std::filesystem::status` / `std::filesystem::symlink_status`: <https://en.cppreference.com/w/cpp/filesystem/status>
140+
- `std::filesystem::exists`: <https://en.cppreference.com/w/cpp/filesystem/exists>
141+
- `std::filesystem::is_directory`: <https://en.cppreference.com/w/cpp/filesystem/is_directory>
142+
- `std::filesystem::is_regular_file`: <https://en.cppreference.com/w/cpp/filesystem/is_regular_file>
143+
- `std::filesystem::is_empty`: <https://en.cppreference.com/w/cpp/filesystem/is_empty>
144+
- `std::filesystem::permissions`: <https://en.cppreference.com/w/cpp/filesystem/permissions>
145+
- `std::filesystem::resize_file`: <https://en.cppreference.com/w/cpp/filesystem/resize_file>
146+
- `std::filesystem::remove_all`: <https://en.cppreference.com/w/cpp/filesystem/remove>
147+
- `std::filesystem::space`: <https://en.cppreference.com/w/cpp/filesystem/space>
148+
- `std::filesystem::rename`: <https://en.cppreference.com/w/cpp/filesystem/rename>
149+
- `std::filesystem::temp_directory_path`: <https://en.cppreference.com/w/cpp/filesystem/temp_directory_path>
150+
- `std::filesystem::last_write_time`: <https://en.cppreference.com/w/cpp/filesystem/last_write_time>
151+
- `std::filesystem::canonical` / `std::filesystem::weakly_canonical`: <https://en.cppreference.com/w/cpp/filesystem/canonical>
97152
- `std::function`: <https://en.cppreference.com/w/cpp/utility/functional/function>
98153
- `std::bind`: <https://en.cppreference.com/w/cpp/utility/functional/bind>
99154

100-
The `std::atomic` example keeps the cppreference worker logic, but the default
101-
kernel-driver build uses `std::thread` with explicit joins instead of
102-
`std::jthread`. The exact `std::jthread` form is available behind
103-
`CRTSYS_ENABLE_EXACT_CPPREFERENCE_JTHREAD_ATOMIC_EXAMPLE`; it currently requires
104-
MSVC STL atomic wait/notify ABI helpers that crtsys does not implement yet.
155+
The `std::atomic` example keeps the cppreference worker logic and uses the
156+
exact `std::jthread` form when C++20 atomic wait/notify support is available.
105157

106-
The `std::atomic_flag` example keeps the cppreference spinlock logic, but the
107-
default kernel-driver build disables the optional C++20 wait/notify path for
108-
the same ABI-helper reason.
158+
The `std::atomic_flag` example keeps the cppreference spinlock logic and uses
159+
the optional C++20 wait/notify path when the feature-test macro is available.
160+
161+
The `std::latch`, `std::barrier`, and semaphore examples keep the cppreference
162+
synchronization flow. The barrier example uses `std::osyncstream`, and the
163+
semaphore example keeps the original worker delay.
109164

110165
The `std::unique_ptr` example keeps the ownership, polymorphism, custom deleter,
111-
array, and linked-list portions. The default kernel-driver build skips the
112-
hosted file I/O demo and uses a smaller linked-list size; the exact linked-list
113-
stress size is available behind
114-
`CRTSYS_ENABLE_EXACT_CPPREFERENCE_UNIQUE_PTR_STRESS_TEST`.
166+
array, and linked-list portions, including the hosted file I/O custom deleter,
167+
the locale-imbued output, and the cppreference linked-list stress size.
168+
169+
The locale harness ports the linked cppreference locale, facet, money, and time
170+
examples. The messages example does not claim hosted message-catalog support.
115171

116-
The `std::any` example keeps the `any_cast`, bad-cast, reset, and pointer-access
117-
behavior. The default kernel-driver build prints known sample type names instead
118-
of calling `any::type().name()`, because that path requires MSVC `type_info`
119-
name/cleanup ABI helpers that crtsys does not implement yet.
172+
The `std::any` example keeps the `any_cast`, bad-cast, reset, pointer-access,
173+
and `any::type().name()` behavior.
120174

121-
The `std::iota` example keeps the list/iterator/shuffle structure. The default
122-
kernel-driver build uses a fixed `std::mt19937` seed instead of
123-
`std::random_device`, because the latter can depend on hosted entropy APIs.
175+
The `std::iota` example keeps the cppreference list/iterator/shuffle structure.
124176

125-
The `std::reference_wrapper` example uses the same fixed-seed approach for its
126-
shuffle step, for the same reason.
177+
The `std::reference_wrapper` example keeps the cppreference shuffle structure.
127178

128-
The `std::merge` and `std::uniform_int_distribution` examples also use fixed
129-
`std::mt19937` seeds instead of `std::random_device`.
179+
The chrono timezone tests keep the cppreference `current_zone` / `zoned_time`
180+
flow and add explicit `locate_zone` / `time_zone::get_info` offset checks for
181+
selected zones.
130182

131183
The `std::stack::push` example keeps the cppreference BrainHack interpreter
132184
shape. The x64 driver-test harness invokes it through `ntl::expand_stack`
133185
because the example embeds a 32 KiB tape buffer in the interpreter object.
134186

135-
The `std::to_chars` and `std::from_chars` tests currently cover the integer
136-
paths. Floating-point conversion examples are intentionally left out of the
137-
default kernel-driver run until their MSVC STL dependency surface is reviewed.
138-
139-
The `std::expected` example is present as a conditional harness. The current
140-
MSVC 14.32 toolset used by the driver build does not provide `<expected>`, so
141-
the default run reports that the feature is unavailable.
142-
143-
The `std::complex` test keeps only the arithmetic portion of the cppreference
144-
example by default. The transcendental portions using functions such as
145-
`std::pow` and `std::exp` require MSVC math helper symbols that crtsys does not
146-
provide yet.
147-
148-
The `std::lerp` example is available behind
149-
`CRTSYS_ENABLE_UNSUPPORTED_LERP_TEST`. The default kernel-driver build disables
150-
it because MSVC's `std::lerp(float)` implementation can reference the `fmaf`
151-
helper in driver builds, which crtsys does not provide yet.
152-
153-
The `std::pmr::monotonic_buffer_resource` example is available behind
154-
`CRTSYS_ENABLE_UNSUPPORTED_PMR_TEST` with smaller default iteration and node
155-
counts. The default kernel-driver build does not enable it because MSVC's PMR
156-
implementation requires resource ABI helpers such as
157-
`_Aligned_get_default_resource` that crtsys does not provide yet.
187+
The listed C++23 `std::views` examples are compiled into the driver test when
188+
the matching feature-test macro is available.
189+
190+
The `std::to_chars` test follows the cppreference example, including the
191+
floating-point overload calls. The `std::from_chars` test follows the
192+
cppreference integer example and adds floating-point overload checks for the
193+
same page.
194+
195+
The `std::expected` example is compiled into the driver test when the
196+
`__cpp_lib_expected` feature-test macro is available.
197+
198+
The `std::format` example runs in the default driver build.
199+
200+
The `std::regex` example keeps the cppreference `regex_search`, iterator, and
201+
`regex_replace` flow.
202+
203+
The filesystem examples listed above are ported into the driver harness.
204+
The `copy_symlink` page currently has no cppreference example, so the harness
205+
uses a small direct check for that function.
206+
207+
The `std::complex` test keeps the arithmetic portion of the cppreference
208+
example and also includes the `std::exp` and `std::pow` examples.
209+
210+
The `std::lerp` example is enabled in the default kernel-driver build.
211+
212+
The `std::pmr::monotonic_buffer_resource` example is compiled into the default
213+
driver run with the cppreference iteration and node counts.

0 commit comments

Comments
 (0)