upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 15:16:46 -0500
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 15:16:46 -0500
commitae59e91bf5e6bdc1b1bbcd2e618140ab56e57d3e (patch)
treeeea67ea8a08c64e2835970a8a3194eee150929ed /runtime
parentd01a491883e347fb6d6ed8deef18bdd98d421cc5 (diff)
parent2428954112549a24fcc2b93206a30620184b044d (diff)
Merge pull request #3295 from Roberto0953
Diffstat (limited to 'runtime')
-rw-r--r--runtime/shims/xgameruntime.cpp13
-rw-r--r--runtime/test/xgameruntime_test.cpp14
2 files changed, 26 insertions, 1 deletions
diff --git a/runtime/shims/xgameruntime.cpp b/runtime/shims/xgameruntime.cpp
index 7f3599558..045f7e903 100644
--- a/runtime/shims/xgameruntime.cpp
+++ b/runtime/shims/xgameruntime.cpp
@@ -154,6 +154,17 @@ template <int Slot> uint64_t STDMETHODCALLTYPE private_slot(void*) {
154 return 0; 154 return 0;
155} 155}
156 156
157// Slot 8, XAsyncBeginAlloc: private (no public page) and never called by the package's DLLs, so its signature here
158// is not measured. Refuse it: answering S_OK would tell the caller its async call has begun while no provider ever
159// receives XAsyncOp::Begin, so its completion never arrives.
160HRESULT STDMETHODCALLTYPE begin_alloc_not_provided(void*) {
161 static std::atomic<bool> s_logged{false};
162 if (!s_logged.exchange(true))
163 std::fprintf(stderr, "[rt] xgameruntime: XThreadingImpl slot 8 (XAsyncBeginAlloc) called; not provided, "
164 "returning E_NOTIMPL\n");
165 return E_NOTIMPL;
166}
167
157// XThreadSetTimeSensitive / XThreadIsTimeSensitive / XThreadAssertNotTimeSensitive. The flag is per thread, as in 168// XThreadSetTimeSensitive / XThreadIsTimeSensitive / XThreadAssertNotTimeSensitive. The flag is per thread, as in
158// the GDK; nothing is enforced offline (a time-sensitive thread may still block). 169// the GDK; nothing is enforced offline (a time-sensitive thread may still block).
159thread_local bool t_time_sensitive = false; 170thread_local bool t_time_sensitive = false;
@@ -173,7 +184,7 @@ const void* const kThreadingVtable[] = {
173 XM(XAsyncCancel), // 5 184 XM(XAsyncCancel), // 5
174 XM(XAsyncRun), // 6 185 XM(XAsyncRun), // 6
175 XM(XAsyncBegin), // 7 186 XM(XAsyncBegin), // 7
176 reinterpret_cast<const void*>(&private_slot<8>), // 8 XAsyncBeginAlloc (private, not called by the package) 187 reinterpret_cast<const void*>(&begin_alloc_not_provided), // 8 XAsyncBeginAlloc (private, not called by the package)
177 XM(XAsyncSchedule), // 9 188 XM(XAsyncSchedule), // 9
178 XM(XAsyncComplete), // 10 189 XM(XAsyncComplete), // 10
179 XM(XAsyncGetResult), // 11 190 XM(XAsyncGetResult), // 11
diff --git a/runtime/test/xgameruntime_test.cpp b/runtime/test/xgameruntime_test.cpp
index c5a0e988e..062840c80 100644
--- a/runtime/test/xgameruntime_test.cpp
+++ b/runtime/test/xgameruntime_test.cpp
@@ -279,6 +279,20 @@ void check_run_time_load() {
279 reinterpret_cast<SetSensitive>(slot(t, 27))(t, false) == S_OK && 279 reinterpret_cast<SetSensitive>(slot(t, 27))(t, false) == S_OK &&
280 !reinterpret_cast<IsSensitive>(slot(t, 30))(t), 280 !reinterpret_cast<IsSensitive>(slot(t, 30))(t),
281 "slots 27 and 30 set and read this thread's time-sensitive flag"); 281 "slots 27 and 30 set and read this thread's time-sensitive flag");
282 // Slot 8 (XAsyncBeginAlloc, private, signature not measured) must not report a begun call whose provider
283 // never received XAsyncOp::Begin: either it refuses, or the provider saw Begin exactly once.
284 static std::atomic<int> s_begins{0};
285 XAsyncProvider* provider = [](XAsyncOp op, const XAsyncProviderData*) -> HRESULT {
286 if (op == XAsyncOp::Begin) s_begins.fetch_add(1);
287 return S_OK;
288 };
289 XAsyncBlock alloc_block{};
290 using BeginAlloc = HRESULT(STDMETHODCALLTYPE*)(void*, XAsyncBlock*, const void*, const char*, XAsyncProvider*,
291 size_t, size_t, void*);
292 const HRESULT alloc_hr =
293 reinterpret_cast<BeginAlloc>(slot(t, 8))(t, &alloc_block, nullptr, "test", provider, 16, 0, nullptr);
294 check(FAILED(alloc_hr) || s_begins.load() == 1,
295 "slot 8 (XAsyncBeginAlloc) never reports success for a call whose provider did not begin");
282 void* unk = nullptr; 296 void* unk = nullptr;
283 const GUID iunknown = {0, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; 297 const GUID iunknown = {0, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
284 using QI = HRESULT(STDMETHODCALLTYPE*)(void*, REFIID, void**); 298 using QI = HRESULT(STDMETHODCALLTYPE*)(void*, REFIID, void**);