hle(host_posix): the thread and processor calls a job system asks for are still unimplemented #617

Closed
opened 2026-11-28 15:17:10 +00:00 by AnastasisKon · 3 comments
AnastasisKon commented 2026-11-28 15:17:10 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:17:10Z.


Summary

A handful of kernel32/ calls that a job system or a crash reporter asks for have no implementation in crates/victory-hle/src/host_posix, so they land in the loader's unimplemented-import stub. The ones worth having, with what they should answer on this host:

Call Should answer
GetActiveProcessorCount(group) cpus() for a real group, and for ALL_PROCESSOR_GROUPS (0xFFFF); 0 for a group that does not exist. A title that sizes a worker pool by this currently gets the stub's 0
GetCurrentProcessorNumber() the calling thread's processor, in 0..cpus() (a hash of the thread id is enough; Windows only promises a hint)
GetProcessIdOfThread(handle) this process's id for a thread the handle table knows, and for GetCurrentThread's -2; ERROR_INVALID_HANDLE otherwise
SetThreadDescription / GetThreadDescription the name is kept per thread (in the thread object, and thread-locally for the current thread, which has no object); Get hands back a LocalAlloced copy, as Windows does
GetThreadPriorityBoost / SetThreadPriorityBoost the setting, which this host has no way to apply, so a stored value reported honestly
SetThreadStackGuarantee accepted and left as the caller set it; the title's stack is a fixed reservation here

Not part of #559 (which is about DuplicateHandle, OpenThread, ExitThread, InitOnce*, the FLS destructors and pooled threadpool workers) and not touched by the threadpool work.

Why it matters

GetActiveProcessorCount deciding a pool's size, and GetCurrentProcessorNumber in a backoff loop, are the kind of call whose stub value is silent: the title does not fail, it just behaves as if the machine had no processors. SetThreadDescription is what a crash reporter prints next to a faulting thread.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6667173671 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/617). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:17:10Z. --- ## Summary A handful of kernel32/ calls that a job system or a crash reporter asks for have no implementation in `crates/victory-hle/src/host_posix`, so they land in the loader's unimplemented-import stub. The ones worth having, with what they should answer on this host: | Call | Should answer | |---|---| | `GetActiveProcessorCount(group)` | `cpus()` for a real group, and for `ALL_PROCESSOR_GROUPS` (0xFFFF); 0 for a group that does not exist. A title that sizes a worker pool by this currently gets the stub's 0 | | `GetCurrentProcessorNumber()` | the calling thread's processor, in `0..cpus()` (a hash of the thread id is enough; Windows only promises a hint) | | `GetProcessIdOfThread(handle)` | this process's id for a thread the handle table knows, and for `GetCurrentThread`'s -2; `ERROR_INVALID_HANDLE` otherwise | | `SetThreadDescription` / `GetThreadDescription` | the name is kept per thread (in the thread object, and thread-locally for the current thread, which has no object); `Get` hands back a `LocalAlloc`ed copy, as Windows does | | `GetThreadPriorityBoost` / `SetThreadPriorityBoost` | the setting, which this host has no way to apply, so a stored value reported honestly | | `SetThreadStackGuarantee` | accepted and left as the caller set it; the title's stack is a fixed reservation here | Not part of #559 (which is about `DuplicateHandle`, `OpenThread`, `ExitThread`, `InitOnce*`, the FLS destructors and pooled threadpool workers) and not touched by the threadpool work. ## Why it matters `GetActiveProcessorCount` deciding a pool's size, and `GetCurrentProcessorNumber` in a backoff loop, are the kind of call whose stub value is silent: the title does not fail, it just behaves as if the machine had no processors. `SetThreadDescription` is what a crash reporter prints next to a faulting thread.
AnastasisKon commented 2026-11-28 15:17:19 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:17:19Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241351198 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/617#issuecomment-7241351198). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:17:19Z. --- /claim
github-actions[bot] commented 2026-11-28 15:17:29 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T15:17:29Z.


Claimed by @AnastasisKon. Open a draft pull request with Refs #617 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241353385 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/617#issuecomment-7241353385). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T15:17:29Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #617` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-28 15:26:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:26:37Z.


Closed by #559's neighbour on the fork: GetActiveProcessorCount, GetCurrentProcessorNumber, GetThreadPriorityBoost/SetThreadPriorityBoost and SetThreadStackGuarantee landed earlier, and the rest of this list landed separately -

  • GetMaximumProcessorCount, GetActiveProcessorGroupCount - this machine's numbers (one group holding every processor).
  • GetProcessIdOfThread - this process for the calling thread's pseudo handle and for any thread in the handle table, ERROR_INVALID_HANDLE otherwise.
  • SetThreadDescription/GetThreadDescription - the name kept per thread, handed back as a LocalAlloced copy, and S_OK with no string for a thread that has none.

Measured on the fork's main: the five names resolve under api-ms-win-core-sysinfo-l1-1-0 and api-ms-win-core-processthreads-l1-1-0/-l1-2-0, the HLE host suite is 430 tests with six new ones for these calls (a thread named, read back character for character with its terminator, cleared, and not shared with another thread), and all 16 shipped DLLs still exit 0 under --execute --unimplemented zero.

One thing worth noting for whoever picks up the next batch: GetActiveProcessorCount was the sharp one. Its stub answered 0, so a pool sized by it decided the machine had no processors and nothing failed - the same shape of failure as the ones this issue was filed about.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7241470113 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/617#issuecomment-7241470113). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:26:37Z. --- Closed by #559's neighbour on the fork: `GetActiveProcessorCount`, `GetCurrentProcessorNumber`, `GetThreadPriorityBoost`/`SetThreadPriorityBoost` and `SetThreadStackGuarantee` landed earlier, and the rest of this list landed separately - - `GetMaximumProcessorCount`, `GetActiveProcessorGroupCount` - this machine's numbers (one group holding every processor). - `GetProcessIdOfThread` - this process for the calling thread's pseudo handle and for any thread in the handle table, `ERROR_INVALID_HANDLE` otherwise. - `SetThreadDescription`/`GetThreadDescription` - the name kept per thread, handed back as a `LocalAlloc`ed copy, and `S_OK` with no string for a thread that has none. Measured on the fork's `main`: the five names resolve under `api-ms-win-core-sysinfo-l1-1-0` and `api-ms-win-core-processthreads-l1-1-0`/`-l1-2-0`, the HLE host suite is 430 tests with six new ones for these calls (a thread named, read back character for character with its terminator, cleared, and not shared with another thread), and all 16 shipped DLLs still exit 0 under `--execute --unimplemented zero`. One thing worth noting for whoever picks up the next batch: `GetActiveProcessorCount` was the sharp one. Its stub answered 0, so a pool sized by it decided the machine had no processors and nothing failed - the same shape of failure as the ones this issue was filed about.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#617
No description provided.