mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-27 21:00:28 +00:00
Compare commits
63
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e5856bbcf | ||
|
|
566272082a | ||
|
|
64ba56079f | ||
|
|
e266670e87 | ||
|
|
54b06fea3e | ||
|
|
8eb25fb9fe | ||
|
|
40ffea2789 | ||
|
|
80eacf9ac2 | ||
|
|
d9816e4cb5 | ||
|
|
39b628d60d | ||
|
|
1d70633958 | ||
|
|
a9f55b51f7 | ||
|
|
722388a46d | ||
|
|
e7ff293eba | ||
|
|
dfaaa07df4 | ||
|
|
962b83c731 | ||
|
|
7fff77c801 | ||
|
|
c3684a1ae8 | ||
|
|
d561595599 | ||
|
|
8cab0b1de8 | ||
|
|
d2367dca30 | ||
|
|
60ad6c779e | ||
|
|
ffc7056d26 | ||
|
|
9923e59114 | ||
|
|
feba95fe39 | ||
|
|
a275de6e2e | ||
|
|
25986845da | ||
|
|
df9652740b | ||
|
|
1ca491d8d0 | ||
|
|
964a8296f2 | ||
|
|
d8a8c96408 | ||
|
|
50321b3f14 | ||
|
|
1fe07f45ee | ||
|
|
d486d21813 | ||
|
|
4c92c88b29 | ||
|
|
478e9218ac | ||
|
|
8d2662dcd7 | ||
|
|
fe1bf568c8 | ||
|
|
873652d685 | ||
|
|
84f561b12b | ||
|
|
2b113a2e5e | ||
|
|
9a26e1ee36 | ||
|
|
c84b80b24f | ||
|
|
ae804f0530 | ||
|
|
64e7b16983 | ||
|
|
1ea898b4bf | ||
|
|
7946968cc4 | ||
|
|
67b8cff9df | ||
|
|
51c23a2f38 | ||
|
|
7d97e67448 | ||
|
|
d9261db887 | ||
|
|
5c0c82b3f9 | ||
|
|
b71db3c25a | ||
|
|
566f803111 | ||
|
|
857c16fcf7 | ||
|
|
4f5c6913f5 | ||
|
|
e4ddb05a1a | ||
|
|
d33a7c6941 | ||
|
|
4e838207fe | ||
|
|
b40bbae1da | ||
|
|
b04b41f26a | ||
|
|
3dd3ef06e2 | ||
|
|
fee956293d |
No files matched your search
@@ -7,8 +7,9 @@ body:
|
||||
id: area
|
||||
attributes:
|
||||
label: Area
|
||||
description: "cpu: translation, DBT, PE loading, guest startup, guest memory. gpu: RDNA2, shaders, Metal. runtime: Win32, CRT, C++ runtime, import generation, OS services, platform abstractions. shared: cross-subsystem interfaces. qa: verification, regression, security review."
|
||||
description: "hybrid: CrossOver integration, configuration, diagnostics, benchmarks (active). The areas below are preserved native research unless hybrid work requires them. cpu: translation, DBT, PE loading, guest startup, guest memory. gpu: RDNA2, shaders, Metal. runtime: Win32, CRT, C++ runtime, import generation, OS services, platform abstractions. shared: cross-subsystem interfaces. qa: verification, regression, security review."
|
||||
options:
|
||||
- hybrid
|
||||
- cpu
|
||||
- gpu
|
||||
- runtime
|
||||
@@ -43,7 +44,7 @@ body:
|
||||
id: files
|
||||
attributes:
|
||||
label: Files
|
||||
description: Paths the task may edit, one per line: exact paths, directories ending in "/", or globs with * and **. Two claimed tasks never overlap.
|
||||
description: 'Paths the task may edit, one per line: exact paths, directories ending in "/", or globs with * and **. Two claimed tasks never overlap.'
|
||||
render: text
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -1,42 +1,57 @@
|
||||
name: Bug report
|
||||
description: Report a reproducible defect in Xenora or XenoMetal.
|
||||
description: A reproducible defect.
|
||||
title: "bug: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Use synthetic or authorized inputs only. For vulnerabilities, follow SECURITY.md. Remove personal paths, credentials and private data from logs.
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue. For vulnerabilities follow SECURITY.md.'
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: Description
|
||||
description: What went wrong? Identify the affected subsystem and expected behavior.
|
||||
description: 'What went wrong and what you expected.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: Reproduction steps
|
||||
description: Include exact commands and a minimal, legally distributable input if applicable.
|
||||
description: 'Exact commands and a minimal, legally distributable input.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Environment
|
||||
description: Commit, macOS, Apple GPU, RAM, Rust, Xcode and relevant tool versions. Include sanitized doctor output if available.
|
||||
description: 'Commit, macOS, chip, memory, CrossOver and Rosetta 2 versions, graphics backend. Remove personal paths and credentials.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: output
|
||||
id: scope
|
||||
attributes:
|
||||
label: Actual output and diagnostics
|
||||
description: Include expected versus actual results, validation-layer messages and relevant logs.
|
||||
- type: checkboxes
|
||||
id: confirmation
|
||||
label: Scope and dependencies
|
||||
description: 'Affected area; related issues.'
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Confirmation
|
||||
options:
|
||||
- label: I searched for existing reports and have not included sensitive or unauthorized material.
|
||||
required: true
|
||||
label: Acceptance criteria
|
||||
description: 'When is this fixed?'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How to confirm the fix independently.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: 'Only if third-party code or a dependency is involved.'
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Documentation
|
||||
description: Fix, add or restructure documentation.
|
||||
title: "docs: "
|
||||
labels: [documentation]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is unclear, wrong or missing.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Pages and sources involved.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'Files to change; update docs/README.md if pages are added or moved.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'None if none.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Claims are scoped to their evidence; links work.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'scripts/audit/docs_hygiene.py and claims audit pass.'
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Feature proposal
|
||||
description: Propose a compiler, graphics, tooling or other project enhancement.
|
||||
title: "feat: "
|
||||
labels: [enhancement]
|
||||
body:
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem or gap
|
||||
description: Which limitation does this feature address?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: proposal
|
||||
attributes:
|
||||
label: Proposed approach
|
||||
description: Explain the intended behavior and affected components. Link relevant public specifications when available.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: criteria
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: What observable results and tests would demonstrate completion?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: Alternatives and trade-offs
|
||||
description: Include limitations, dependency costs or impacts on native ARM64 and Metal if relevant.
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Hardware verification report
|
||||
description: Submit real hardware test results for Xenora.
|
||||
title: "hardware: "
|
||||
labels: [needs-verification]
|
||||
body:
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: Test environment
|
||||
description: Commit, Apple chip/GPU, RAM, macOS, Xcode/Metal version, Rust version, validation settings. Do not include serial numbers or registry IDs.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: commands
|
||||
attributes:
|
||||
label: Commands and inputs
|
||||
description: Include exact commands and synthetic or authorized fixture identifiers.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: results
|
||||
attributes:
|
||||
label: Results
|
||||
description: Report actual output, pass/fail/skip counts, and limitations. Compilation alone does not prove execution.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: performance
|
||||
attributes:
|
||||
label: Performance data (optional)
|
||||
description: Include repetitions, warm-up, timing method, validation state and variability if reporting measurements.
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Hybrid engineering task
|
||||
description: Integration, configuration, diagnostics or tooling around CrossOver.
|
||||
title: "task: "
|
||||
labels: [track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is missing or wrong, and why it matters for the hybrid architecture.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Versions (macOS, chip, CrossOver, Rosetta 2, graphics backend), related issues, upstream references.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'What is in and out. Avoid duplicating what CrossOver already provides.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: "Blocking issues or decisions; write 'none' if none."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Observable, checkable results.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How an independent contributor verifies it; commands, workloads, evidence class.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Performance investigation
|
||||
description: Measure or improve performance with evidence.
|
||||
title: "perf: "
|
||||
labels: [performance,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue. Do not promise gains before measuring.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem and metric
|
||||
description: 'Which metric (average FPS, 1% low, frame-time percentiles, CPU or GPU use, memory, startup, shader compile latency) and why.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Workload, hardware (reference: M4, 24 GB), software versions, settings.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'Measurement only, or change as well.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'Measurement protocol (#353) and baseline (#355).'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Measured before-and-after under equivalent conditions, with variance.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'Correctness and rendering equivalence verified before the result counts.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,42 +1,57 @@
|
||||
name: Technical research
|
||||
description: Record an ISA, Metal or publicly documented graphics research finding.
|
||||
name: Upstream research or dependency evaluation
|
||||
description: Assess a project, component or license from public sources.
|
||||
title: "research: "
|
||||
labels: [research]
|
||||
labels: [research,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: Use only public, authorized sources. Do not link to leaked SDKs, private documentation or unauthorized game content.
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: question
|
||||
id: problem
|
||||
attributes:
|
||||
label: Research question or finding
|
||||
label: Question
|
||||
description: 'The decision this research informs.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: sources
|
||||
id: context
|
||||
attributes:
|
||||
label: Sources and applicability
|
||||
description: URLs, specification sections or revision, exact architecture and license/provenance if relevant.
|
||||
label: Technical context
|
||||
description: 'What is already known; link docs/research/upstream-registry.md entries.'
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: evidence
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Evidence class (highest applicable)
|
||||
options:
|
||||
- A - Measured on named hardware
|
||||
- B - Normative source for exact target
|
||||
- C - Normative source for related target
|
||||
- D - Non-normative official material
|
||||
- E - Independent software behavior
|
||||
- F - Uncorroborated community claim
|
||||
- U - Unknown or assumption
|
||||
label: Scope
|
||||
description: 'Which versions or components; desk research or execution.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: 'Other issues or decisions; execution may need a maintainer-approved environment.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Each claim cites vendor or upstream documentation, or a recorded observation of a stated version; unknowns stay marked unknown.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation, limitations and proposed next steps
|
||||
description: Distinguish Apple or desktop RDNA observations from Xbox behavior.
|
||||
label: Validation requirements
|
||||
description: 'Independent re-derivation and evidence class (A to U).'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,57 @@
|
||||
name: Testing and validation
|
||||
description: Add or run a validation for a workload or behaviour.
|
||||
title: "validate: "
|
||||
labels: [needs-verification,track: hybrid]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: 'Active work is the CrossOver-based hybrid architecture (docs/roadmap.md). Use independently authored or authorized workloads only; never link leaked builds, confidential SDKs or private documentation. Claim by replying on the issue.'
|
||||
- type: textarea
|
||||
id: problem
|
||||
attributes:
|
||||
label: Problem
|
||||
description: 'What is missing or wrong, and why it matters for the hybrid architecture.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: context
|
||||
attributes:
|
||||
label: Technical context
|
||||
description: 'Versions (macOS, chip, CrossOver, Rosetta 2, graphics backend), related issues, upstream references.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scope
|
||||
attributes:
|
||||
label: Scope
|
||||
description: 'What is in and out. Avoid duplicating what CrossOver already provides.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: Dependencies
|
||||
description: "Blocking issues or decisions; write 'none' if none."
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: acceptance
|
||||
attributes:
|
||||
label: Acceptance criteria
|
||||
description: 'Observable, checkable results.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation requirements
|
||||
description: 'How an independent contributor verifies it; commands, workloads, evidence class.'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: licensing
|
||||
attributes:
|
||||
label: Licensing and provenance
|
||||
description: "Licenses of any component involved, source and version, and whether anything would be bundled or copied. Write 'not applicable' if none."
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,40 +0,0 @@
|
||||
## Summary
|
||||
|
||||
<!-- What changes, and why? -->
|
||||
|
||||
Closes #<!-- the issue you claimed -->
|
||||
|
||||
## Implementation and evidence
|
||||
|
||||
<!-- Describe affected subsystems, architecture assumptions, specification sections and upstream provenance where applicable. -->
|
||||
|
||||
## Verification
|
||||
|
||||
<!-- List actual commands and outcomes. Include hardware, validation-layer state and pass/fail/skip counts for GPU tests. Mark unrun checks explicitly. -->
|
||||
|
||||
| Check | Result / evidence |
|
||||
| --- | --- |
|
||||
| Formatting and lint | |
|
||||
| Unit / integration tests | |
|
||||
| GPU / differential tests | |
|
||||
| Fuzzing / mutation / benchmarks, if relevant | |
|
||||
|
||||
## Compatibility and limitations
|
||||
|
||||
<!-- Note unsupported behavior, regressions, interface changes, performance effects and remaining uncertainty. -->
|
||||
|
||||
## Checklist
|
||||
|
||||
- [ ] I claimed the linked issue with a reply before starting, and nobody else held a live claim on it.
|
||||
- [ ] I reviewed the changes and disclosed material AI assistance below, if applicable.
|
||||
- [ ] The change preserves native ARM64 and Metal-first requirements.
|
||||
- [ ] I added relevant tests or explained why they are not applicable.
|
||||
- [ ] I did not report skipped or unrun tests as passing.
|
||||
- [ ] I updated applicable documentation, claims and status records.
|
||||
- [ ] Third-party code and fixtures have verified licenses and provenance, or none were added.
|
||||
- [ ] No restricted materials, credentials or private data are included.
|
||||
- [ ] My commits are signed off under the DCO.
|
||||
|
||||
## AI assistance
|
||||
|
||||
<!-- Describe material assistance and the checks you personally performed, or state none. -->
|
||||
@@ -0,0 +1,29 @@
|
||||
## Related issue
|
||||
|
||||
Closes #
|
||||
|
||||
## Summary
|
||||
|
||||
## Technical changes
|
||||
|
||||
## Tests performed
|
||||
|
||||
Commands, versions, pass/fail/skip counts and hardware. A skipped test is not a pass.
|
||||
|
||||
## Performance impact
|
||||
|
||||
Measured before and after under equivalent conditions, or "none expected" with reason.
|
||||
|
||||
## Compatibility impact
|
||||
|
||||
Workloads, macOS or CrossOver versions and hardware affected. Do not claim support that was not tested.
|
||||
|
||||
## Known limitations
|
||||
|
||||
## Third-party code attribution
|
||||
|
||||
Source repository, exact commit, license, modifications. "None" if none.
|
||||
|
||||
## Dependency and licensing considerations
|
||||
|
||||
New or changed dependencies, license compatibility with GPL-3.0-or-later, redistribution limits (proprietary components are never bundled). DCO: commits are signed off.
|
||||
@@ -63,8 +63,6 @@ jobs:
|
||||
run: |
|
||||
PYTHONPATH=scripts python3 -m unittest discover -s tests/agent_queue
|
||||
sh -n scripts/agent-queue.sh scripts/agent-sync.sh
|
||||
- name: Test pull request template check
|
||||
run: PYTHONPATH=scripts python3 -m unittest discover -s tests/pr_template
|
||||
- name: Test native audit JSON decoding
|
||||
run: python3 -m unittest discover -s tests/audit
|
||||
- name: Test semantic registry generator and coverage report
|
||||
@@ -90,3 +88,33 @@ jobs:
|
||||
file "$binary"
|
||||
test "$(lipo -archs "$binary")" = arm64
|
||||
otool -L "$binary"
|
||||
|
||||
native-app:
|
||||
name: Native app build and smoke
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 20
|
||||
env:
|
||||
CARGO_BUILD_JOBS: 3
|
||||
RUSTUP_TOOLCHAIN: 1.100.0-aarch64-apple-darwin
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Verify runner architecture
|
||||
run: |
|
||||
uname -m
|
||||
test "$(uname -m)" = arm64
|
||||
test "$(sysctl -n sysctl.proc_translated)" = 0
|
||||
- name: Install native Rust
|
||||
run: |
|
||||
rustup toolchain install "$RUSTUP_TOOLCHAIN" --profile minimal
|
||||
rustc -vV
|
||||
- name: Show Swift and Xcode
|
||||
run: |
|
||||
xcodebuild -version
|
||||
swift --version
|
||||
# Builds the locked C ABI library and the Swift app together, checks the
|
||||
# executable is arm64-only and links only system libraries, and runs
|
||||
# `--smoke`. This is an app build and smoke result, not GPU verification.
|
||||
- name: Build BetterXen.app and run its smoke check
|
||||
run: scripts/build-app.sh
|
||||
@@ -0,0 +1,43 @@
|
||||
name: Repository hygiene
|
||||
|
||||
# Fast checks on tracked files that need no Rust toolchain and no network:
|
||||
# merge-conflict markers, broken relative Markdown links and invalid workflow
|
||||
# YAML (scripts/audit/docs_hygiene.py). A second, advisory step warns when
|
||||
# source or script changes arrive without a CHANGELOG.md update; it never fails.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: hygiene-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
hygiene:
|
||||
name: Repository hygiene
|
||||
runs-on: ubuntu-24.04-arm
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
- name: Install PyYAML
|
||||
run: python3 -c 'import yaml' 2>/dev/null || python3 -m pip install --user --break-system-packages pyyaml
|
||||
- name: Check documentation and workflow files
|
||||
run: python3 scripts/audit/docs_hygiene.py --require-yaml
|
||||
- name: Remind about the changelog (advisory)
|
||||
if: github.event_name == 'pull_request'
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
run: |
|
||||
changed="$(git diff --name-only "$BASE_SHA"...HEAD || true)"
|
||||
if printf '%s\n' "$changed" | grep -Eq '^(crates|scripts|shaders|fixtures)/' \
|
||||
&& ! printf '%s\n' "$changed" | grep -qx 'CHANGELOG.md'; then
|
||||
echo "::warning title=Changelog::Source or script files changed without a CHANGELOG.md update."
|
||||
fi
|
||||
@@ -1,38 +0,0 @@
|
||||
name: PR template
|
||||
|
||||
# Fails when a pull request description does not follow
|
||||
# .github/PULL_REQUEST_TEMPLATE.md: every section present and filled in, a
|
||||
# linked issue ("Closes #N" or "No linked issue: <reason>"), and the
|
||||
# claimed-first and DCO checkboxes ticked. Runs again whenever the description
|
||||
# is edited; comments never start it. Runs on the base branch: pull request
|
||||
# code is never checked out or executed, and the description is read as data.
|
||||
#
|
||||
# To make it blocking, mark the "PR template / description" check as required
|
||||
# in the branch protection rule for main.
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
description:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Check the description against the template
|
||||
run: |
|
||||
set -u
|
||||
status=0
|
||||
python3 scripts/pr_template_check.py --event "$GITHUB_EVENT_PATH" > "$RUNNER_TEMP/result.txt" || status=$?
|
||||
cat "$RUNNER_TEMP/result.txt"
|
||||
{ echo '## PR template'; cat "$RUNNER_TEMP/result.txt"; } >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$status" -ne 0 ]; then
|
||||
echo "::error title=PR description does not follow the template::$(tail -n +2 "$RUNNER_TEMP/result.txt" | head -n -1 | tr '\n' ' ')"
|
||||
fi
|
||||
exit "$status"
|
||||
+2
-2
@@ -36,8 +36,8 @@
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/diagnostics/probe/
|
||||
/diagnostics/gta6-candidate-*/
|
||||
/diagnostics/gta6-check/
|
||||
/diagnostics/title-candidate-*/
|
||||
/diagnostics/title-check/
|
||||
|
||||
# Native application build output
|
||||
/app/.build/
|
||||
@@ -1,40 +1,60 @@
|
||||
# BetterXen engineering rules
|
||||
|
||||
### Native Apple Silicon
|
||||
These rules apply to every contributor and coding agent. They were rewritten on the `planning/hybrid-first-transition` branch when BetterXen moved from native-first to CrossOver-based hybrid development. `CLAUDE.md` is a symlink to this file. The decision is recorded in `docs/adr/0005-crossover-hybrid-direction.md`; the plan is `docs/roadmap.md`.
|
||||
|
||||
Never introduce Rosetta 2, x86-64 host executables, MoltenVK, Vulkan runtime dependencies, Wine, CrossOver, Windows compatibility layers, OpenGL fallback rendering, or unnecessary graphics abstraction layers.
|
||||
### Direction
|
||||
|
||||
- SPIR-V is permitted as a compiler intermediate representation. It does not justify a Vulkan runtime.
|
||||
- All host executables and native dependencies must support ARM64. Verify with file, lipo -archs and otool -L.
|
||||
- Never run Intel binaries through Rosetta, even temporarily. Never add a dependency that requires Rosetta to build or run. If a dependency cannot run natively, find an alternative or document the limitation.
|
||||
- The guest architecture being decoded may be x86-64, but BetterXen itself runs natively on ARM64.
|
||||
- BetterXen is hybrid-first Apple Silicon compatibility research. **CrossOver is the primary compatibility foundation and hybrid is the only active development direction.** CrossOver is an externally installed dependency unless its license explicitly permits another distribution model.
|
||||
- BetterXen's own work is the layer around it: integration, configuration, environment management, diagnostics, reproducible testing, benchmarking and measured optimization. Reuse established infrastructure before writing an independent replacement; write one only for a demonstrated limitation.
|
||||
- The independent native implementation (x86-64 decoder, ARM64 translator, runtime, gfx1030 shader compiler, Metal backend) is **preserved and paused**. Do not delete it, expand its roadmap, create speculative native issues or assign contributors to it by default. Native work is allowed only when hybrid development directly requires it, or after an explicit maintainer decision to resume (`docs/research/native-roadmap.md`). Keep its tests passing.
|
||||
- This is the intended architecture, not a verified Xbox compatibility stack. Do not assume CrossOver, Rosetta 2 or D3DMetal provide Xbox runtime compatibility; verify the actual capabilities and integration boundaries of the installed versions.
|
||||
|
||||
### Planning
|
||||
|
||||
- Planning is progressive. Only the current phase has a milestone and open issues; the roadmap outlines later phases provisionally and `Parked ideas` holds future items. Do not create speculative issues, trackers or milestones for distant phases; promote an idea when its prerequisites are met.
|
||||
- Every new issue states a specific problem, the evidence it is needed, a deliverable, upstream references, a reuse assessment, dependencies, acceptance criteria and a validation method. Do not create administrative issues to manage planning.
|
||||
- Do not open native-only issues. If hybrid work needs a native component, file a focused hybrid issue.
|
||||
|
||||
### Dependencies and reuse
|
||||
|
||||
- Wine-based compatibility infrastructure, CrossOver, Rosetta 2 where supported and technically appropriate, and D3DMetal (subject to its license terms) are permitted. DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX and similar projects may be evaluated and used where appropriate. Legitimate external dependencies and open-source implementations are encouraged.
|
||||
- Before integrating or copying anything: verify the exact license of the component (the file for copied source, not just the repository), check compatibility with GPL-3.0-or-later and with every other selected component, preserve copyright notices, record the source repository and exact commit or version, document modifications, and add the entry to `docs/research/upstream-registry.md` and `docs/research/component-reuse-matrix.md`. If licensing is uncertain, do not use it until resolved. Never remove upstream notices.
|
||||
- Do not bundle, modify or redistribute proprietary components (CrossOver binaries, D3DMetal, Rosetta 2, Apple tools) unless their license explicitly allows it. Do not assume a proprietary component can be incorporated into GPL-licensed source. Distinguish open-source parts from proprietary parts in every assessment.
|
||||
- Do not bypass licensing or activation requirements of any dependency.
|
||||
- Provenance first: exclude anything derived from leaked proprietary material or unauthorized software. A project's license being GPL does not clear material it was built from or for. Projects whose stated purpose depends on leaked or unauthorized builds, including VIctory, its forks and similar efforts, are discovery references at documentation level; adopt nothing from them without a per-file provenance and license review recorded in the registry. Game-specific, asset-specific and decryption-related code is never adopted.
|
||||
|
||||
### Native Apple Silicon host
|
||||
|
||||
- BetterXen's own host executables, libraries and tools must support ARM64 natively; verify with file, lipo -archs and otool -L. Do not add x86-64 host executables that BetterXen itself builds or ships.
|
||||
- Rosetta 2 may be used where Apple supports it and CrossOver or another selected component relies on it for x86-64 guest code. Record versions and its support status; do not depend on it for BetterXen's own code.
|
||||
- Support M1 through M5 and future generations through runtime capability detection. Do not assume all Apple GPUs share capabilities.
|
||||
- Use aarch64-apple-darwin as the Rust target.
|
||||
- Use aarch64-apple-darwin as the Rust target. Metal is the host graphics API. Do not add graphics abstraction layers beyond what a selected component or a measured need justifies.
|
||||
- SPIR-V remains permitted as a compiler intermediate representation.
|
||||
|
||||
### Honesty and evidence
|
||||
|
||||
- Never report a test as passed unless it ran and passed. Never count a skipped test as GPU verification.
|
||||
- Never invent benchmark results, hardware compatibility, API names, instruction encodings, hardware capabilities or implementation status.
|
||||
- Never invent benchmark results, hardware compatibility, API names, instruction encodings, hardware capabilities, interface details, product capabilities or implementation status. Never promise a performance improvement before measuring it.
|
||||
- Never claim a clean build unless the commands actually succeeded.
|
||||
- Never present planned features as working. State clearly that game execution is not supported unless demonstrated.
|
||||
- Never replace GPU tests with mocks and then claim GPU support.
|
||||
- Unknown information is classified as unknown and becomes a documented research task.
|
||||
- Every hardware claim carries an evidence class (section 9). Never present a lower-class claim as if it were a higher-class one.
|
||||
- Unknown information is classified as unknown and becomes a documented research task. Facts about CrossOver, Rosetta 2, D3DMetal and other upstreams must cite vendor or upstream documentation, or a recorded observation of a stated version.
|
||||
- Every hardware claim carries an evidence class (see docs/claims.toml). Never present a lower-class claim as if it were a higher-class one.
|
||||
- Never claim "verified on Xbox hardware". BetterXen has no Xbox hardware access. Agreement with a spec-derived reference is not agreement with Xbox hardware, and docs must say so.
|
||||
- Do not hide errors behind fallbacks. Do not translate unsupported instructions into silent no-ops. Do not weaken or delete tests to make them pass. Do not change mutation counting, tolerances or gate definitions to improve a score.
|
||||
- A phase is complete only with the evidence its exit conditions name. Do not derive progress from commits, lines of code, closed issues or isolated passing fixtures.
|
||||
|
||||
### Independence of verification
|
||||
|
||||
- The agent that writes a component does not certify it. The two independent reviewers (section 5) re-derive expectations from primary sources and are not told the implementers' conclusions as ground truth.
|
||||
- The agent that writes a component does not certify it. Independent reviewers re-derive expectations from primary sources and are not told the implementers' conclusions as ground truth.
|
||||
- The same faulty code must never produce both the expected and the actual values in a test.
|
||||
|
||||
### Legal and clean-room
|
||||
|
||||
- Use only publicly accessible documentation and authorized materials. Never obtain or use leaked SDKs, confidential Xbox documentation, restricted console tools, firmware, encryption keys, or proprietary game binaries and shader collections. Do not attempt to bypass documentation access restrictions.
|
||||
- Use only publicly accessible documentation, publicly licensed software and authorized materials. All validation uses independently authored or authorized workloads. Never obtain or use leaked executables or SDKs, confidential Xbox documentation, restricted console tools, firmware, encryption keys, unauthorized assets or source code, or proprietary game builds and shader collections. Do not attempt to bypass documentation access restrictions.
|
||||
- Contributors who have seen leaked or confidential Xbox materials must not contribute. State this in CONTRIBUTING.md and require a DCO sign-off (Signed-off-by) on contributions.
|
||||
- Include a plain statement in docs/legal.md: BetterXen does not circumvent console security or DRM, does not load encrypted or protected content, and is a research project built from public documentation. Add a note that this is not legal advice and that contributors should know their local laws, including anti-circumvention provisions such as DMCA section 1201.
|
||||
- Before copying or adapting any upstream code: verify the exact license of that file (not just the repo), check GPL-3.0-or-later compatibility, preserve copyright notices, record source repository and exact commit, document modifications, include required attribution. Never remove upstream copyright notices. If licensing is uncertain, stop using that code until resolved.
|
||||
- Keep BetterXen's emulator implementation original. Never copy, port, translate or adapt emulator source from Leonida, KyTx, AnyPS5 or similar projects.
|
||||
- docs/legal.md states: BetterXen does not circumvent console security or DRM, does not load encrypted or protected content, and is a research project built from public documentation. This is not legal advice; contributors should know their local laws, including anti-circumvention provisions such as DMCA section 1201.
|
||||
- Keep BetterXen's own implementation original where it is original. Never copy, port, translate or adapt source from emulator projects built for leaked or unauthorized material (for example PE-Vulkan, KyTx, AnyPS5 and similar).
|
||||
- Validate the technical compatibility and safety of user-provided files. Do not ask for ownership receipts, accounts or acquisition provenance as part of file loading. Contributor provenance and licensing obligations still apply.
|
||||
- Never place restricted material in the repository or its Git history.
|
||||
- Do not push, publish, or change remote visibility without explicit user authorization. Prepare locally and report readiness.
|
||||
@@ -43,7 +63,7 @@ Never introduce Rosetta 2, x86-64 host executables, MoltenVK, Vulkan runtime dep
|
||||
|
||||
No AI slop (section 29).
|
||||
|
||||
Read docs/interfaces.md and docs/progress.md before implementation.
|
||||
Read docs/roadmap.md, docs/interfaces.md and docs/progress.md before implementation.
|
||||
|
||||
## Claiming work before you start
|
||||
|
||||
@@ -84,7 +104,7 @@ A coding agent claims in the name of the person it works for and follows the sam
|
||||
- Lint: `cargo clippy --workspace --all-targets -- -D warnings`
|
||||
- Test: `cargo test --workspace`
|
||||
- Verify the synthetic fixtures: `scripts/assemble-fixture.sh --check`
|
||||
- Run native GPU correctness: `scripts/test-gpu.sh`
|
||||
- Run native GPU correctness (preserved native research): `scripts/test-gpu.sh`
|
||||
- Run the three RDNA-to-Metal fixtures: `scripts/demo.sh`
|
||||
- Run independent CPU validation: `cargo test --locked -p xenora-semantic-review`
|
||||
- Run the correctness-gated benchmark suite: `scripts/benchmark.sh` (idle machine, release, validation off)
|
||||
@@ -101,4 +121,4 @@ Preserve the configured Git author and committer identity.
|
||||
|
||||
## Ownership
|
||||
|
||||
Xbox and claims owns public console research. ISA owns the decoder and oracle fixtures. Compiler owns the parser, IR and MSL. Metal owns the native GPU backend. Testing owns the independent reference and fixture validation. Infrastructure owns shared Cargo configuration, policies and the CPU boundary. R1 independently audits claims and release evidence. R2 independently validates semantic expectations and mutation results.
|
||||
These are responsibility areas, not personal assignments; do not assign people without their agreement. Hybrid integration owns the CrossOver assessment, integration boundary, configuration, diagnostics and benchmarks. Xbox and claims owns public console research. ISA owns the decoder and oracle fixtures. Compiler owns the parser, IR and MSL. Metal owns the native GPU backend. Testing owns the independent reference and fixture validation. Infrastructure owns shared Cargo configuration, policies and the CPU boundary. R1 independently audits claims and release evidence. R2 independently validates semantic expectations and mutation results.
|
||||
@@ -9,7 +9,33 @@ exact revision and known limitations.
|
||||
Guest execution uses original, purpose-built test programs. Commercial Xbox game execution
|
||||
remains unsupported.
|
||||
|
||||
### Added
|
||||
- Added `--stall-timeout` and a memory-settle wait to `betterxen-hybrid run`/`bench` (#385): a run that prints nothing for the given time is stopped and classified `stalled`, and after any stop the supervisor waits (up to `--settle-bound`, default 60 s) until free memory is back above the start threshold and records whether it recovered. Based on supervision lessons from skakwy's victory-mac (reimplemented, not copied). Also fixes a defect found by the first real stall run: stopping a bottle used `CX_BOTTLE`, which does not select the bottle, so a stopped Windows process kept running; it now sets `WINEPREFIX`. Verified with 4 new unit tests (stub launcher) and a real CrossOver 26.3 run on the M4: a silent workload was stopped as `stalled` after 4.7 s of a 120 s timeout, nothing was left running, and the next run passed. The low-memory recovery path is only tested with an injected memory reader. Not independently reviewed.
|
||||
- Added `betterxen-hybrid run` and `bench`: launch a Windows program through an installed CrossOver (`bin/wine --bottle`, an interface CodeWeavers does not document for macOS), with timeout, the memory guard, failure classification (passed, failed exit, timed out, stopped on low memory, cannot execute, no graphics device), sampled CrossOver process memory and CPU, thermal notes, recognised host-noise diagnostics and frame statistics, and write a JSON record; `bench` repeats a workload across graphics backends. Locally verified with 24 unit tests (stub launcher) and with real runs on CrossOver 26.3 on the Apple M4.
|
||||
- Executed the original Windows workloads under CrossOver 26.3 for the first time (`docs/research/crossover-baseline-2026-11-25.md`). x86-64 C, Rust, Direct3D 11 clear and triangle/frame-loop programs passed; all four ARM64 builds were rejected by CrossOver (`cannot execute`). Five-repeat, 2000-frame comparison of default, D3DMetal, DXMT, DXVK and wined3d on a trivial offscreen workload: D3DMetal's median submit-and-wait was about 1.8 times the others; this is not rendering performance. Observed on one machine, not independently reproduced, using an undocumented backend variable.
|
||||
- Added `workloads/d3d11-frameloop` (indexed triangle, shaders, event-query frame loop) and negative controls for both Direct3D programs; made workload builds byte-reproducible on one machine with `--no-insert-timestamp`.
|
||||
- Added `betterxen-hybrid guard`, a memory-pressure supervisor: it refuses to start a command when system-wide free memory is below a threshold and stops it (SIGTERM, then SIGKILL) when memory drops below a limit, reporting why. It is adapted from the memory guard in contributor skakwy's `victory-mac` `mac/run-victory.sh` (GPL-3.0, used with his permission) and reimplemented in Rust. Locally verified with 6 unit tests and three end-to-end runs (refuse, pass-through, stop) on macOS 27.0; the `memory_pressure -Q` output format is not a documented interface; not independently reviewed.
|
||||
- Added original Windows workloads and a build script (#364, #365): a C and a Rust self-checking console program and a Direct3D 11 clear-and-readback program (`workloads/`), built for x86-64 and ARM64 with a checksum-verified llvm-mingw 20261117 by `scripts/hybrid/build-windows-workloads.sh` (`docs/research/hybrid-toolchain.md`). All six outputs were confirmed as the right PE architecture with `file`. **The x86-64 outputs were later run under CrossOver (see below).**
|
||||
- Extended `docs/research/upstream-integration-audit.md` with a component-level review of skakwy's `victory-mac`: the reported ~1 FPS is, in his own notes, 1 to 1.9 s per frame of a leaked console-game dump measured by his runtime, so it is not reproducible or adoptable here. His Windows cross-link wrapper failed with Homebrew `llvm@17` and was not integrated; his Metal swizzle and D3DMetal-internals fixes are rejected; game-specific loader patches are rejected.
|
||||
- Added the `betterxen-hybrid` crate (`crates/hybrid`, no third-party dependencies, native arm64) with `host`, `crossover`, `toolchain`, `frames` and `receipt` commands that print JSON: a host receipt (macOS, chip, memory, core split, whether an x86_64 binary runs under Rosetta, GPU and Metal family), CrossOver discovery limited to `Info.plist` metadata, `lipo -archs` and the documented `BottleDir` and `ManagedBottleDirs` preferences, a Windows cross-compiler probe, and frame-time statistics (nearest-rank percentiles, 1 % and 0.1 % lows, stutter count). Locally verified: 13 unit tests, clippy with warnings denied, and a run on the Apple M4 reference machine, where CrossOver is **not installed** (the report says so) and only Homebrew mingw-w64 x86_64 and i686 compilers were found. CrossOver discovery has been tested on a synthetic bundle only and has never inspected a real CrossOver; nothing launches a program or measures a game. Not independently reviewed (#353, #350, #364, #145).
|
||||
- Added `docs/research/upstream-integration-audit.md` and registry and reuse-matrix rows for skakwy/victory-mac, MacBox, ScarlettMac, ossover, Whisky and rum (source read through the GitHub API, nothing executed, no code copied). Findings: MacBox and ScarlettMac are GPL-2.0 and game-specific, so they are rejected; the Game Porting Toolkit licence text (a third-party copy of version 4.0) limits use to developing, testing or evaluating games and distribution to non-commercial; contributor-reported frame results (about 1 FPS, then two rendered frames) are recorded as unverified.
|
||||
- Added the upstream research registry and component reuse matrix (`docs/research/`), a public-documentation review (evidence class D, nothing executed) of CrossOver, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX, VIctory, VIctory-macOS and PortWatch. VIctory-family projects are excluded from reuse on provenance grounds. The GitHub project board is not yet configured because the token lacks the `project` scope (#346).
|
||||
- Added hybrid research records: `docs/research/hybrid-backlog-research-2026-11-25.md` (findings and registry candidates, from search summaries) and `docs/research/primary-source-verification-2026-11-25.md` (re-check against CodeWeavers, Apple, DXMT and Wine primary pages). It confirms CrossOver's backend list, finds no public documentation of `CX_GRAPHICS_BACKEND`, and records that two Apple notices on Rosetta's end disagree; D3DMetal's license text and CrossOver's Rosetta and ARM64 plans remain unverified. Eleven issues created from the research were reviewed the same day: #364 and #365 stay in Phase 1, the others are parked and recorded under "Parked ideas" in the roadmap. Rust 1.100.0 (already installed) is the required toolchain; the default `stable` was 1.94.1. Planning only; nothing was installed or run.
|
||||
- Added File > Open Executable… with Command-O to the app (#252). It opens the focused window's read-only file importer, the same one as that window's button, and is disabled when no window can present it; each window keeps its own importer, so with several windows only the focused one shows the picker. The chosen file goes through the same inspection path as the button, drag and drop and Finder Open With; nothing is executed. A file-importer failure is now shown in red with the system's description instead of being ignored, a cancelled picker shows nothing, and the message clears on the next selection. `BetterXen --smoke-import-result`, run by `scripts/build-app.sh`, checks cancellation, a shown failure and its clearing; it fails on the previous importer handling. Checked locally on Apple Silicon in the running app (Command-O and the menu item open the picker, cancel shows no error, a second Command-O opens it again, with two windows only the focused one presents it, and with every window closed the menu item is disabled); not yet independently reviewed.
|
||||
- Added `docs/research/texture-formats.md`, an inventory of the texture formats and layouts BetterXen handles (#260). For BC1–BC7, RGBA8 and Depth32Float it separates container recognition, CPU decoding, layout conversion, native Metal upload and readback, translated sampling, the host-side D3D12-shaped API (called from Rust, not wired to guest imports) and guest reachability through imported services, and links each cell's implementing files and tests and each format's exact public specification sections, including the packed BC footprints from #241. It cross-references #208 and #209 instead of opening duplicate tasks, lists console layouts, console descriptors and asset or audio containers as unknowns, and ranks three proposed follow-ups with fixture recipes and owners. Research only; no implementation changed.
|
||||
- Rewrote the README around the six development phases and the first-launchable-application target (#311), with colour-coded Mermaid diagrams (system flow, milestone roadmap, CPU, runtime-service and shader-form charts built from the generated registries), badges, a repository overview, a contributing section and corrected texture-sampling wording. The older X1–X25 capability map is kept in a collapsible section. The diagrams were not render-tested locally.
|
||||
- Added a fast "Repository hygiene" check (`.github/workflows/hygiene.yml`, `scripts/audit/docs_hygiene.py`). It runs on Ubuntu without a Rust toolchain or network access and fails only on merge-conflict markers, broken relative Markdown links and invalid workflow YAML in tracked files. A separate advisory step warns, without failing, when source or script changes have no changelog entry. A local run over the 626 tracked files found no problems, and planted failures of each kind were caught; it has not yet run on GitHub.
|
||||
- Documented the proposed guest AVX/AVX2 state and decoding contract and specified an original integer fixture with known results and fault controls (#299).
|
||||
|
||||
### Removed
|
||||
- Removed the "PR template" check (`.github/workflows/pr-template.yml`, `scripts/pr_template_check.py` and its tests) and its CI test step. Also removed `.github/PULL_REQUEST_TEMPLATE.md`. Pull request descriptions are no longer validated or pre-filled; CONTRIBUTING.md still asks for the same information and the claim-first rule still applies.
|
||||
|
||||
### Changed
|
||||
- Replaced the native-first development plan with a CrossOver-based hybrid roadmap (`docs/roadmap.md`: five provisional phases, only Phase 1 active; the earlier H0 to H7 breakdown is archived) and an accepted-direction ADR 0005. No hybrid component exists yet and no Xbox title is shown to run; this is planning and research scheduling only, and no phase is verified complete.
|
||||
- Rewrote the engineering rules in `AGENTS.md` (`CLAUDE.md` is a symlink to it) to permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal subject to licensing, while keeping the honesty, independent-verification, provenance and clean-room rules and adding dependency and reuse rules. Resolves #345.
|
||||
- Native work is preserved and paused: tag `native-first-final` marks the last `main` commit before this change, `docs/research/native-roadmap.md`, and archived native-first plan and milestones under `docs/archive/`. GitHub backlog: all native issues except four with assigned contributors and open pull requests were closed as not planned and indexed in `docs/research/native-issue-archive.md`; future-phase issues were parked in the roadmap; only the Phase 1 milestone is open.
|
||||
- Replaced the issue templates with hybrid task, bug, research, performance, validation and documentation forms and added a pull request template. Fixed invalid YAML in the agent-task template. README, CONTRIBUTING and the docs index now describe the hybrid direction.
|
||||
- Replaced our own references to a specific commercial game title (README non-affiliation line, research and integration notes, ignored diagnostics folder names) with generic "commercial title" wording. The ignored folder names are now `diagnostics/title-candidate-*` and `diagnostics/title-check`. Third-party repository names, URLs and code-span paths in research notes are unchanged so their provenance stays accurate. Our own prose references to the upstream project formerly named in the research notes now read "PE-Vulkan project". Added the PortWatch native-macOS research notes. No behavior change.
|
||||
- TLS setup now copies templates from 64 KiB up to 1 MiB straight into the zeroed thread data block, after checking that every template byte is readable, instead of staging them in a second buffer (#111). The pointer array and data block layout, the TLS index write and the error for an unreadable template are unchanged, and nothing is mapped when the template cannot be read. On an Apple M2 Pro, median setup time for original synthetic templates over 31 interleaved samples fell by 21.7 % at 64 KiB, 19.0 % at 256 KiB and 14.2 % at 768 KiB. Smaller and larger templates keep the single staged read and showed no change beyond run-to-run variation.
|
||||
- Removed the contributor avatar section from the README.
|
||||
- Added `.github/CODEOWNERS` so pull requests request review from the `MacosPorters/maintainers` team. With the `main` branch rule that requires code-owner review, a maintainer must approve each change before it merges.
|
||||
@@ -20,6 +46,7 @@ remains unsupported.
|
||||
- The native ARM64 DBT now runs the 32- and 64-bit register and immediate forms of ADC and SBB itself instead of falling back to the shared interpreter (#195). The guest CF is moved into the host carry before ADCS or SBCS, inverted for SBB because SBCS subtracts NOT C while SBB subtracts CF. Memory forms and 8- and 16-bit forms still use the shared semantics. `tests/x86_carry_chain.rs` runs 256-bit add and subtract chains of 64- and 32-bit limbs, in one block and split one block per limb, against widening `u128`/`i128` reference arithmetic in both engines, plus immediate 128-bit increments and decrements and the `sbb reg, reg` carry mask. Locally verified on Apple M5 only.
|
||||
- Removed the temporary region-list allocation from each instruction-byte fetch while preserving lookup order, execute-permission checks and error behavior (part of #104).
|
||||
- Release and bench builds now use fat link-time optimization with one codegen unit (#116). On a local Apple M5, `dbt_bench` medians over five alternating runs dropped by about 6 % for the interpreter (903 to 845 µs) and about 9 % for cold DBT (1.155 to 1.046 ms), while warm DBT (cache hits) became about 2 % slower (21.83-22.08 to 22.29-22.54 µs over four further runs). The `xenora` binary shrank from 2.73 to 2.11 MB. A clean release build of the workspace takes about 14 s instead of 6 s. Debug and test builds are unchanged.
|
||||
- The ARM64 assembler uses one 32-bit `MOVN` for zero-extended constants such as `0xFFFF1234` that previously took two wide moves (#89). On an Apple M1 Pro, a synthetic workload with 4,096 affected loads emitted 163,920 native bytes, down from 180,304 (9.1%). The native tests verify the encoding and the full 64-bit register result.
|
||||
- The ARM64 assembler loads 64-bit constants with the fewest MOVZ or MOVN plus MOVK instructions (#92). It no longer emits MOVK for zero halfwords and starts from MOVN when more halfwords are 0xFFFF than zero, so small negative values take one instruction instead of four. On Apple M5 the DBT benchmark emits 245,168 instead of 290,184 native bytes for its 626 blocks (-15.5%) and the 1,048 integer fixture instructions 128,724 instead of 145,732 (-11.7%); benchmark run times did not change measurably. New tests check the sequences against LLVM encodings and execute 1,056 of them on the host through the JIT.
|
||||
- Resolve the tiled BC1 mip and array layer once per linearization and copy contiguous block runs within each tile row. Partial edge blocks are retained and padding slots are skipped. Closes #349.
|
||||
- Changed the default report folder of `xenora probe` and `xenora imports sync` to `diagnostics/probe`, which Git ignores (#364). Anyone relying on the earlier default has to pass `--report`.
|
||||
@@ -33,6 +60,8 @@ remains unsupported.
|
||||
- Extended the read-only RDNA2 planning CLI (`python3 -m qa rdna2`) with family/status filters, compact summaries, Codex-ready manifests under `artifacts/`, active-claim exclusion (family claims exclude those families; path-only claims block overlapping permitted files), coverage reconcile against `semantic_coverage` without inflating counts, and inventory diffs. Covered by `tests/qa/test_rdna2_plan.py`; planning only, no GPU production edits.
|
||||
|
||||
### Fixed
|
||||
- Fixed the app's executable inspector so a late result from an earlier selection can no longer replace a newer one (#251). Each selection from the file picker, drag and drop or Finder Open With now takes a request number, and only the latest request may publish its report and status or clear the busy state. The previous report is cleared when a new file is chosen, and a failed inspection of the latest file is shown in red above its report. The read itself is unchanged: size checked before reading, balanced security-scoped access, nothing executed. `BetterXen --smoke-inspection-order`, run by `scripts/build-app.sh`, drives the model with an injected reader that blocks until the check releases each file, so the check (not timing) decides which read finishes first; it checks a stale success, a stale failure and a busy state held for the newer request, and all four checks fail without the change. Checked locally on Apple Silicon; not yet independently reviewed.
|
||||
- Startup reports now reject existing destinations before guest execution, surface journal write failures, and preserve late errors alongside signal termination.
|
||||
- Restored the DBT benchmark report-test fixture after the cache-invalidation counter was added. Its existing percentile, JSON and comparison tests now run in ordinary workspace CI instead of requiring a separate benchmark test-harness command.
|
||||
- DBT cache hits now compare an executable-generation token instead of rereading every instruction byte. Address-space or executable-memory changes trigger byte and execute-permission revalidation before a translation can be reused; changed code is retranslated. Ordinary data writes retain the fast path. Tests cover cloned spaces, loader bypass writes, split writes, remapping and bounded cache exhaustion. Same-dispatch self-modification and discarded-code reclamation remain unsupported.
|
||||
- Gate A2 checks the cross-compiler driver before invoking it, then checks its helpers before fixture compilation. CI also verifies the driver architecture before requesting its version.
|
||||
@@ -42,6 +71,9 @@ remains unsupported.
|
||||
- Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status.
|
||||
|
||||
### Added
|
||||
- Added opt-in `betterxen run --startup-report <path>` JSON diagnostics with the last observed startup stage, fixture verification outcome and preserved failure or termination detail (#255).
|
||||
- Added a `Native app build and smoke` CI job (#248). On the same native `macos-26` runner image and pinned Rust toolchain as the Rust checks, it runs `scripts/build-app.sh`, which builds the locked C ABI library and the Swift app together, bundles and ad-hoc signs `BetterXen.app`, and runs its `--smoke` check, so a Swift compile, link or smoke failure is designed to fail CI (implemented and verified locally; not yet shown on a CI run). `scripts/build-app.sh` also prints `file` and a single `otool -L` listing for the executable, fails if that listing fails or is empty, and fails if the executable links any library outside `/System/Library/` and `/usr/lib/`, naming bundle-relative (`@rpath`, `@executable_path`, `@loader_path`) entries separately (checked locally against stubbed failing, empty, bundle-relative and non-system listings). The job is an app build and smoke result; it runs no Metal fixture and is not GPU verification.
|
||||
- Added a CPU and loader coverage map (#154) with decoder inventory, native and shared execution paths, and test counts from a pinned Apple M5 run.
|
||||
- Recorded the migrated PR integration decisions, native verification and scope exclusions in the testing documentation.
|
||||
- Added `xenora-bench startup` (#178), which measures Metal startup in fresh processes and in repeated
|
||||
submissions within one process, phase by phase (launch, device and queue, translation, library, pipeline,
|
||||
|
||||
+6
-2
@@ -1,6 +1,10 @@
|
||||
# Contributing to BetterXen
|
||||
|
||||
BetterXen is an experimental Xbox Series X|S recompilation framework for Apple Silicon. Its graphics subsystem, XenoMetal, targets native Metal execution. Contributions should improve verified behavior rather than expand untested claims.
|
||||
BetterXen is hybrid-first Apple Silicon compatibility research built around an externally installed CrossOver, with a preserved but paused independent native implementation. Contributions should improve verified behavior rather than expand untested claims.
|
||||
|
||||
## Which work is active
|
||||
|
||||
The only active development track is the CrossOver-based hybrid architecture in [docs/roadmap.md](docs/roadmap.md). Planning is progressive: only the current milestone (Phase 1) has open issues; ideas for later phases are parked in the roadmap. Native research is paused, its backlog is closed and indexed in [docs/research/native-issue-archive.md](docs/research/native-issue-archive.md), and the few native issues still open only have assigned contributors with open pull requests. Do not start native work; if hybrid development needs a native component, file a focused hybrid issue. Pick an open issue in the current milestone and check its dependencies first. The engineering rules in `AGENTS.md` permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal (subject to licensing) and allow evaluating DXMT, DXVK, VKD3D-Proton and MoltenVK. CrossOver is proprietary: do not bundle or redistribute any of it, and record the exact versions you test. Before adopting or copying any upstream code, verify its license and provenance and add it to the [upstream registry](docs/research/upstream-registry.md); projects built around leaked or unauthorized game builds are not a source of code. Use the issue templates (hybrid task, bug, research, performance, validation, documentation) and fill in the licensing and provenance section.
|
||||
|
||||
## Getting started
|
||||
|
||||
@@ -44,7 +48,7 @@ Before incorporating third-party code, verify per-file license compatibility wit
|
||||
## Pull requests
|
||||
|
||||
- Branch from the current main branch, keep commits focused, and link relevant issues.
|
||||
- Fill in every section of the pull request template, keep `Closes #<number>` (or write `No linked issue: <reason>`), and tick the claimed-first and DCO checkboxes. The *PR template* check fails until the description does, and runs again each time you edit it.
|
||||
- Describe what changes and why, link the issue you claimed with `Closes #<number>`, state which checks you actually ran, and disclose material AI assistance. Separate unverified work from supported behavior.
|
||||
- Include a clear explanation, tests and any documentation/status updates. Separate unverified work from supported behavior.
|
||||
- Disclose material AI assistance and personally review generated changes. AI output is not an authoritative source, test oracle or substitute for independent review.
|
||||
- Never include secrets, personal paths, credentials or private data in patches or logs.
|
||||
|
||||
Generated
+17
-13
@@ -2,6 +2,23 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "betterxen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"xenora-decoder",
|
||||
"xenora-import-gen",
|
||||
"xenora-isa",
|
||||
"xenora-loader",
|
||||
"xenora-metal",
|
||||
"xenora-ref",
|
||||
"xenora-shader",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "betterxen-hybrid"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.2"
|
||||
@@ -149,19 +166,6 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "betterxen"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"xenora-decoder",
|
||||
"xenora-import-gen",
|
||||
"xenora-isa",
|
||||
"xenora-loader",
|
||||
"xenora-metal",
|
||||
"xenora-ref",
|
||||
"xenora-shader",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xenora-benchmarks"
|
||||
version = "0.1.0"
|
||||
|
||||
@@ -1,62 +1,119 @@
|
||||
<div align="center">
|
||||
|
||||
# BetterXen
|
||||
|
||||
BetterXen is a community-maintained continuation. Original Git history, licenses and contributor attribution are retained. See the [project history and migration notes](docs/migration.md) for source attribution and imported issue and pull-request records.
|
||||
**Hybrid-first Apple Silicon compatibility research built around CrossOver, with preserved independent native ARM64 and Metal research (paused).**
|
||||
|
||||
**Experimental Xbox Series X|S emulation research for Apple Silicon Macs.**
|
||||
[](https://github.com/MacosPorters/betterxen/actions/workflows/ci.yml)
|
||||
-1f6feb?logo=apple&logoColor=white)
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
BetterXen is an open-source project written primarily in Rust that builds and verifies a native, bounded execution environment on Apple Silicon: an independent x86-64 guest path, original PE32+ loading, AMD RDNA 2 shader translation, and a native Apple Metal graphics backend.
|
||||
**The paused native implementation described below uses no Wine, CrossOver, Rosetta or Vulkan runtime. The active hybrid direction intends to use CrossOver and Rosetta 2, subject to research and licensing review.**
|
||||
|
||||
**No Wine. No CrossOver. No Rosetta. No Vulkan runtime.**
|
||||
> [!IMPORTANT]
|
||||
> **Current direction.** BetterXen's only active development track is a CrossOver-based hybrid architecture: CrossOver (installed externally) as the compatibility foundation, with BetterXen providing whatever integration, configuration, diagnostics, benchmarking and optimization research shows is missing. This is the *intended* architecture, **not a verified Xbox compatibility stack**: no Xbox title has been shown to run through it, and CrossOver is not assumed to provide Xbox runtime compatibility. Work is at the research stage (Phase 1). Planning is progressive: only the current phase has open issues. The independent native implementation described below is **preserved but paused indefinitely**. See the [roadmap](docs/roadmap.md), [ADR 0005](docs/adr/0005-crossover-hybrid-direction.md), the [upstream research registry](docs/research/upstream-registry.md) and the [deferred native roadmap](docs/research/native-roadmap.md). The rewritten engineering rules are in [AGENTS.md](AGENTS.md).
|
||||
|
||||
BetterXen is still experimental. Verified work is restricted to independently authored synthetic programs and shaders; authentic Xbox executable loading, system-service compatibility and commercial game execution remain unsupported. See the [current limitations](#current-limitations).
|
||||
</div>
|
||||
|
||||
BetterXen is a community-maintained, open-source project written primarily in Rust. Its native research implementation (paused) builds and verifies a native, bounded execution environment on Apple Silicon: an independent x86-64 guest path, original PE32+ loading, AMD RDNA 2 shader translation, and a native Apple Metal graphics backend. The host runs as ARM64 code; the x86-64 code being emulated is guest data.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **BetterXen is experimental.** Verified work is restricted to independently authored synthetic programs and shaders. Authentic Xbox executable loading, system-service compatibility and commercial game execution are **not supported**. Progress is measured by reproducible tests, not by estimated game compatibility percentages. See the [current limitations](#current-limitations).
|
||||
|
||||
> [!CAUTION]
|
||||
> **BetterXen strictly opposes piracy.** BetterXen is an independent, clean-room, general-purpose emulation research project that neither distributes copyrighted game files nor supports unauthorized content, DRM circumvention, or leaked materials. Use only legally obtained software. BetterXen is not affiliated with Microsoft or any other publisher or platform holder.
|
||||
|
||||
[](https://github.com/MacosPorters/betterxen/actions/workflows/ci.yml)
|
||||
---
|
||||
|
||||
## How it fits together
|
||||
|
||||
One guest program travels through three native subsystems. Every stage is checked against an independently derived expectation.
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'fontFamily':'system-ui, sans-serif','lineColor':'#6e7781'}}}%%
|
||||
flowchart LR
|
||||
A["Original PE32+<br/>test program"]:::guest --> B["Loader<br/>relocations, TLS, imports"]:::guest
|
||||
B --> C["x86-64 interpreter<br/>+ ARM64 translator"]:::cpu
|
||||
C --> D["Typed runtime<br/>services"]:::cpu
|
||||
D --> E["Guest graphics<br/>commands"]:::gpu
|
||||
S["Original gfx1030<br/>shader bytes"]:::shader --> T["RDNA 2 decoder<br/>+ validated IR"]:::shader --> U["Metal Shading<br/>Language"]:::shader
|
||||
E --> M["Native Metal<br/>pipelines"]:::gpu
|
||||
U --> M
|
||||
M --> G["Apple Silicon GPU<br/>+ readback"]:::gpu
|
||||
G --> V{"Matches the<br/>independent<br/>CPU reference?"}:::check
|
||||
S -.-> R["Independent<br/>CPU reference"]:::check -.-> V
|
||||
|
||||
classDef guest fill:#ddf4ff,stroke:#0969da,color:#0a3069
|
||||
classDef cpu fill:#dafbe1,stroke:#1a7f37,color:#0f5323
|
||||
classDef shader fill:#fbefff,stroke:#8250df,color:#512a97
|
||||
classDef gpu fill:#fff8c5,stroke:#9a6700,color:#4d2d00
|
||||
classDef check fill:#ffebe9,stroke:#cf222e,color:#82071e
|
||||
```
|
||||
|
||||
Legend: 🟦 guest loading · 🟩 guest CPU and services · 🟪 shader translation · 🟨 native Metal · 🟥 independent verification.
|
||||
|
||||
---
|
||||
|
||||
## What works today?
|
||||
## Roadmap
|
||||
|
||||
BetterXen has progressed from executing individual x86-64 instructions to running original PE32+ guest programs that interact with translated GPU workloads on Apple Silicon.
|
||||
The active plan is the [roadmap](docs/roadmap.md): **Phase 1 — CrossOver Research, Feasibility and Baseline** is the only active phase, and later phases are provisional and will be defined from its findings. The current issues are in the [Phase 1 milestone](https://github.com/MacosPorters/betterxen/milestone/9). The native implementation's six phases and the X1 to X25 capability map are archived in [docs/archive/readme-native-milestones.md](docs/archive/readme-native-milestones.md) and the [native-first plan](docs/archive/development-phases-native-first.md). Native work is paused indefinitely and resumes only after an explicit maintainer decision.
|
||||
|
||||
The latest verified milestones include **translated gfx1030 vertex and pixel shaders executing through native Apple Metal**, the native Metal **blend pass** (`NativeCompute::render_blend`) and **indexed triangle draws** (`NativeCompute::render_indexed`) into offscreen targets, with rendered pixels compared against independently calculated reference results.
|
||||
|
||||
### Development milestones
|
||||
|
||||
| Milestone | Implementation | Status |
|
||||
| --- | --- | --- |
|
||||
| X1 — Guest CPU | Bounded x86-64 instruction execution on ARM64 macOS | Verified |
|
||||
| X2 — Executable loading | Loading original fixed-base PE32+ test executables | Verified |
|
||||
| X3 — GPU compute | Guest-submitted Metal compute workloads and readback | Verified |
|
||||
| X4 — Metal rendering | Guest-driven offscreen rendering using authored Metal shaders | Verified |
|
||||
| X5 — Guest execution expansion | Additional bounded CPU execution and fixture coverage | Implemented |
|
||||
| X6 — Guest control flow | Nested calls, returns, checked memory and synthetic PE execution | Verified |
|
||||
| X7 — Imported services | Named imports, guest-to-host service dispatch and result validation | Verified |
|
||||
| X8 — Translated compute | Original gfx1030 compute shaders executing on Metal, partial Wave32 handling and BC1 readback | Verified subset |
|
||||
| X9 — Translated graphics | Persistent resource handles, translated vertex/pixel stages and offscreen Metal rendering | Verified subset |
|
||||
| X10 — Texture sampling | Translated image instructions are still planned; upload, readback and decode of BC compressed formats is implemented (see [Texture support](#texture-support)) | Planned |
|
||||
| X11 — Graphics pipeline | Bounded multi-draw passes into offscreen RGBA8 targets: translated vertex and pixel stages, indexed triangle draws, colour write masks and blend state | Implemented |
|
||||
| X12 — Wave execution | Expand Wave32/Wave64 semantics, divergent control flow, cross-lane operations, LDS and barriers | Planned |
|
||||
| X13 — Advanced shaders | Mesh, geometry and additional compute shader capabilities with verified Metal execution | Planned |
|
||||
| X14 — CPU recompilation | Native ARM64 dynamic recompilation of supported x86-64 instructions in synthetic fixtures | Implemented subset |
|
||||
| X15 — Executable compatibility | Static PE inspection reports sections, relocations, thread-local storage (TLS) callbacks, imports and entry-point instructions | Static probe implemented |
|
||||
| X16 — Guest memory and threading | Virtual memory mapping, thread scheduling, synchronization primitives and atomic operations | Implemented subset |
|
||||
| X17 — System services | Implement a tested subset of Xbox-compatible runtime APIs, memory services, filesystem access and application lifecycle | Implemented subset |
|
||||
| X18 — Graphics API translation | Translate supported Xbox graphics commands, resource descriptors, command queues, barriers and fences into Metal operations | Planned |
|
||||
| X19 — Advanced GPU features | Indirect rendering, asynchronous compute, additional texture formats and ray-tracing compatibility research | Planned |
|
||||
| X20 — Integrated guest runtime | Connect CPU recompilation, executable loading, system services and graphics translation into one persistent runtime | Planned |
|
||||
| X21 — Application compatibility | Execute increasingly complex independently authored applications through the complete guest CPU and GPU pipeline | Planned |
|
||||
| X22 — First application boot | Establish a reproducible startup and error-reporting path for supported game-like applications | Planned |
|
||||
| X23 — Initial game compatibility | Investigate startup and execution of legally supported game software, identifying missing runtime and graphics behavior | Long-term goal |
|
||||
| X24 — Gameplay and performance | Expand rendering correctness, input, audio, memory management, shader caching and execution performance | Long-term goal |
|
||||
| X25 — Running games | Achieve reproducible, stable execution of compatible games on native Apple Silicon macOS using Metal | Long-term goal |
|
||||
|
||||
**Roadmap note:** X10–X25 are proposed engineering milestones, not completed implementations or a guaranteed sequence. Follow the [BetterXen development phases](docs/development-phases.md) for the current work order and existing issue/PR dependencies. Actual priorities will change as compatibility testing reveals new blockers. Successfully completing one milestone does not guarantee that a particular game will run.
|
||||
|
||||
All existing verification refers to independently authored synthetic programs and shaders. Commercial-game compatibility remains unverified.
|
||||
|
||||
---
|
||||
|
||||
## Repository at a glance
|
||||
|
||||
Counts below come from the generated registries and were read from the repository, not measured on new runs. They describe synthetic fixtures only.
|
||||
|
||||
| Area | Where | What exists today |
|
||||
| --- | --- | --- |
|
||||
| Guest CPU | `crates/loader` | A generated x86-64 decoder and interpreter, plus a native ARM64 dynamic binary translator (DBT) for a bounded subset. The instruction registry declares 213 operations, 403 forms and 498 opcode slots; 93 operations have at least one form lowered to ARM64 and the rest run through shared interpreter semantics. See the [instruction registry](docs/cpu/instruction-registry.md). |
|
||||
| Executable loading | `crates/loader` | PE32+ loading, relocations, thread-local storage, import binding and a static inspection report. |
|
||||
| Runtime services | `crates/loader`, `crates/import-gen` | A typed service registry: 47 declared services (7 implemented, 37 partial, 3 stubs), all exercised through guest dispatch, none independently accepted. See the [registry](docs/runtime/registry.md) and [generated coverage](docs/runtime/services.md). Guest threads run on a deterministic scheduler on one host thread. |
|
||||
| Shader ISA | `crates/isa`, `crates/decoder`, `crates/shader`, `crates/ref` | The RDNA 2 (gfx1030) instruction snapshot lists 1,465 forms; 189 are decoder-supported, 185 are lowered to Metal Shading Language, and 18 are Metal-verified on fixtures. See the [semantic coverage](docs/shaders/semantic-coverage.md). An independent CPU reference checks GPU output. |
|
||||
| Metal backend | `crates/metal` | Native compute, blend, indexed-draw, depth and sampled-texture passes, with Metal API and shader validation. |
|
||||
| Textures | `crates/texture` | Upload, readback, BC1 to BC7 decoding and sampler code. |
|
||||
| Application | `app`, `crates/ffi` | A Swift macOS app over a versioned C interface: frame loop, interactive input, persistent resources, audio and a sandboxed virtual filesystem, all against synthetic guests. |
|
||||
| Test and tooling | `tests`, `fuzz`, `benchmarks`, `scripts` | Original guest programs, independent validation, fuzz targets (CPU decode, PE parse, instruction streams, fixtures, reference, runtime services), mutation testing, correctness-gated benchmarks, and audit scripts for claims, status tables and dependency direction. |
|
||||
|
||||
The `betterxen` command-line tool provides `info`, `demo`, `inspect <pe>`, `probe --pe <path> --mode static`, `run`, `imports` and `shaders`. Run `cargo run -p betterxen` with no arguments to see its usage.
|
||||
|
||||
|
||||
### Where the numbers stand
|
||||
|
||||
Counts come from the repository's generated registries at this revision. They describe synthetic fixtures only and are not compatibility percentages.
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'pie1':'#1a7f37','pie2':'#d0d7de','pieTitleTextSize':'16px','pieStrokeColor':'#ffffff','pieOuterStrokeColor':'#ffffff','fontFamily':'system-ui, sans-serif'}}}%%
|
||||
pie showData title Guest CPU — 213 declared x86-64 operations
|
||||
"Lowered to ARM64 (at least one native form)" : 93
|
||||
"Shared interpreter semantics only" : 120
|
||||
```
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'pie1':'#1a7f37','pie2':'#d4a72c','pie3':'#cf222e','pieStrokeColor':'#ffffff','pieOuterStrokeColor':'#ffffff','fontFamily':'system-ui, sans-serif'}}}%%
|
||||
pie showData title Runtime services — 47 declared, none independently accepted
|
||||
"Implemented" : 7
|
||||
"Partial" : 37
|
||||
"Stub" : 3
|
||||
```
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'xyChart':{'plotColorPalette':'#8250df'}}}}%%
|
||||
xychart-beta
|
||||
title "gfx1030 instruction forms by stage (1,465 identified)"
|
||||
x-axis ["Decoder-supported", "Lowered to MSL", "Metal-verified"]
|
||||
y-axis "Forms" 0 --> 200
|
||||
bar [189, 185, 18]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Native graphics translation
|
||||
|
||||
BetterXen's graphics pipeline translates a supported subset of AMD RDNA 2 instructions into Metal Shading Language.
|
||||
@@ -177,9 +234,9 @@ Implemented and tested functionality includes:
|
||||
- Edge-block and transparency tests.
|
||||
- Invalid descriptor and bounds rejection.
|
||||
|
||||
**Translated texture-sampling instructions are not yet implemented.**
|
||||
**Translated texture sampling covers one instruction and one sampler mode.** A guest draw with the translated `image_sample_lz` pixel stage and a point/clamp sampler matched the software reference and hand-derived images on a local Apple M5 Pro run (one-level RGBA8 and an 8×8 BC1 texture). Other image instructions, filtering modes and formats are not implemented, and this is local verification, not independent acceptance.
|
||||
|
||||
The existing texture readback path uses authored Metal kernels. It should not be confused with executing arbitrary RDNA2 texture-fetch instructions.
|
||||
The texture upload and readback paths use authored Metal kernels. They should not be confused with executing arbitrary RDNA2 texture-fetch instructions.
|
||||
|
||||
Xbox-specific texture layouts and additional compression formats require further research and validation.
|
||||
|
||||
@@ -230,13 +287,22 @@ flowchart TD
|
||||
L --> M
|
||||
K --> M
|
||||
end
|
||||
|
||||
classDef guestNode fill:#dafbe1,stroke:#1a7f37,color:#0f5323
|
||||
classDef shaderNode fill:#fbefff,stroke:#8250df,color:#512a97
|
||||
classDef metalNode fill:#fff8c5,stroke:#9a6700,color:#4d2d00
|
||||
classDef checkNode fill:#ffebe9,stroke:#cf222e,color:#82071e
|
||||
class A,B,C,D guestNode
|
||||
class E,F,G,H shaderNode
|
||||
class I,J,K metalNode
|
||||
class L,M checkNode
|
||||
```
|
||||
|
||||
BetterXen's host execution environment is native ARM64. The guest architecture being interpreted is x86-64.
|
||||
|
||||
The native graphics pipeline runs translated vertex and pixel stages, the indexed-draw and blend passes and the depth pass into offscreen Metal targets, with GPU readback compared against independent CPU references.
|
||||
|
||||
The project does not currently provide a general-purpose x86-64 dynamic recompiler or a complete Xbox operating-system implementation.
|
||||
The native ARM64 dynamic recompiler covers a bounded subset of x86-64 instructions; the rest run through the shared interpreter semantics (see the [CPU coverage map](docs/testing/cpu-coverage.md) once it lands). The project does not provide a complete Xbox operating-system implementation.
|
||||
|
||||
See [Interface Contracts](docs/interfaces.md) for the documented execution and resource boundaries.
|
||||
|
||||
@@ -254,8 +320,8 @@ The following remain unsupported or incomplete:
|
||||
| Executable loader | General relocations, TLS, DLL initialization and authentic Xbox startup |
|
||||
| Xbox runtime | Console-specific services, system APIs, filesystem and application lifecycle |
|
||||
| RDNA2 shaders | General control flow, broader instructions, Wave64, cross-lane operations and mesh stages |
|
||||
| Graphics | Translated texture sampling and broader resource binding |
|
||||
| Textures | Authentic Xbox memory layouts and translated sampling |
|
||||
| Graphics | Broader translated texture sampling (one instruction and sampler mode exist) and broader resource binding |
|
||||
| Textures | Authentic Xbox memory layouts and broader translated sampling |
|
||||
| Performance | Production-scale workloads, CPU/GPU profiling and optimized execution |
|
||||
| Game compatibility | No demonstrated execution of commercial Xbox titles |
|
||||
|
||||
@@ -351,9 +417,21 @@ Testing distinguishes between:
|
||||
|
||||
Compiling a shader is not equivalent to proving its GPU output is correct.
|
||||
|
||||
### Contributing
|
||||
|
||||
Contributions are welcome, and several people and coding agents work in this repository at once. To avoid duplicated work:
|
||||
|
||||
1. Read every comment on an issue and check for open pull requests that link it.
|
||||
2. Claim the issue with a plain reply (for example "I'm taking this. Plan: ...") before you edit anything. The earliest live claim wins, and a claim is stale only after about seven days without a pull request.
|
||||
3. Stay inside the files the issue lists, and put `Closes #<n>` in the pull request description.
|
||||
4. Sign off every commit (DCO) and use only public documentation and original code. Anyone who has seen leaked or confidential Xbox material must not contribute.
|
||||
5. Update `CHANGELOG.md` for meaningful changes. Changes to `main` need maintainer review through [CODEOWNERS](.github/CODEOWNERS).
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md), [docs/legal.md](docs/legal.md) and the [documentation index](docs/README.md) for the full rules.
|
||||
|
||||
### Where the work is heading
|
||||
|
||||
See the [roadmap table](#development-milestones) for proposed milestones, and the [changelog](CHANGELOG.md) for the current unreleased additions, such as the native blend pass, indexed draws and the depth pass. The remaining research steps are the outstanding items in [current limitations](#current-limitations).
|
||||
See the [roadmap](docs/roadmap.md) for the current phase and the [changelog](CHANGELOG.md) for unreleased additions. The paused native implementation's open research items are listed under [current limitations](#current-limitations).
|
||||
|
||||
---
|
||||
|
||||
@@ -367,6 +445,6 @@ BetterXen is licensed under the [GNU General Public License v3 or later](LICENSE
|
||||
|
||||
See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) for third-party attribution and [docs/legal.md](docs/legal.md) for the project's research and legal boundaries.
|
||||
|
||||
BetterXen is an independent open-source project and is not affiliated with Microsoft, Xbox, Rockstar Games or Apple.
|
||||
BetterXen is an independent open-source project and is not affiliated with Microsoft, Xbox, any game publisher or Apple.
|
||||
|
||||
---
|
||||
@@ -15,3 +15,5 @@ Cargo resolves the Rust packages from crates.io at the source checksums in [Carg
|
||||
[LLVM 23.1.6](https://github.com/llvm/llvm-project/tree/5b10d2d74929eae78912771222c9855af97496f4) is used as an external fixture tool under Apache-2.0 WITH LLVM-exception. Xcode and Metal are separate Apple tools under Apple's license terms.
|
||||
|
||||
The [isolated fuzz workspace](fuzz/Cargo.lock) resolves developer-only dependencies, including [libfuzzer-sys](https://github.com/rust-fuzz/libfuzzer/tree/719e4efb9b8857ebaa782ae59376c8cbb78fed0f). See the [fuzz dependency inventory](docs/licenses.md#fuzz-development-dependencies) for locked revisions and selected licenses.
|
||||
|
||||
llvm-mingw release 20261117 is used as an external build tool for original Windows test programs under Apache-2.0 with LLVM exceptions plus its component licences; nothing from it is shipped or copied (see [hybrid-toolchain](docs/research/hybrid-toolchain.md)). `crates/hybrid/src/memory.rs` is a Rust reimplementation of the memory-guard logic in skakwy's [victory-mac](https://github.com/skakwy/victory-mac) `mac/run-victory.sh` (commit 22b3f8e45a59, GPL-3.0), used with the author's permission. The stall detection and memory-settle logic in `crates/hybrid/src/run.rs` follows supervision lessons from the same repository (`mac/PROGRESS.md`, `crates/victory-core/src/notes.rs`) and is reimplemented, not copied.
|
||||
@@ -638,13 +638,65 @@ final class InspectionModel: ObservableObject {
|
||||
@Published var report = ""
|
||||
@Published var status: Int32 = Int32(XENORA_OK)
|
||||
@Published var busy = false
|
||||
@Published var importing = false
|
||||
/// Why the last file selection could not be used, shown until the next selection.
|
||||
@Published var selectionError: String?
|
||||
|
||||
/// Called when a window is about to show the read-only file importer, from its
|
||||
/// button or File > Open Executable…. Each window presents its own importer.
|
||||
func requestImport() {
|
||||
selectionError = nil
|
||||
}
|
||||
|
||||
/// Handles the importer's completion. A cancelled picker is not a failure.
|
||||
func importFinished(_ result: Result<URL, Error>) {
|
||||
switch result {
|
||||
case .success(let url):
|
||||
inspect(url)
|
||||
case .failure(let error):
|
||||
if let cocoa = error as? CocoaError, cocoa.code == .userCancelled {
|
||||
return
|
||||
}
|
||||
selectionError = "The selected file could not be opened: \(error.localizedDescription)"
|
||||
}
|
||||
}
|
||||
|
||||
/// Reads and reports one file off the main thread. Replaceable only for the
|
||||
/// `--smoke-inspection-order` check.
|
||||
private let reader: @Sendable (URL) -> (Int32, String)
|
||||
/// Number of the latest `inspect` call. Only that call may publish a result.
|
||||
private var latestRequest: UInt64 = 0
|
||||
/// Reads that have finished, whether their result was published or discarded.
|
||||
/// `--smoke-inspection-order` waits on it instead of on a fixed delay.
|
||||
private(set) var finishedReads: UInt64 = 0
|
||||
|
||||
init(reader: @escaping @Sendable (URL) -> (Int32, String) = InspectionModel.run) {
|
||||
self.reader = reader
|
||||
}
|
||||
|
||||
var failed: Bool { !busy && fileName != nil && status != Int32(XENORA_OK) }
|
||||
|
||||
func inspect(_ url: URL) {
|
||||
latestRequest &+= 1
|
||||
let request = latestRequest
|
||||
selectionError = nil
|
||||
fileName = url.lastPathComponent
|
||||
report = ""
|
||||
status = Int32(XENORA_OK)
|
||||
busy = true
|
||||
let reader = reader
|
||||
Task {
|
||||
let (newStatus, newReport) = await Task.detached { InspectionModel.run(url) }.value
|
||||
// The read blocks on file I/O (and, in `--smoke-inspection-order`, on
|
||||
// its gate), so it runs on a Dispatch queue instead of occupying a
|
||||
// Swift concurrency worker that other tasks may need.
|
||||
let (newStatus, newReport) = await withCheckedContinuation { continuation in
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
continuation.resume(returning: reader(url))
|
||||
}
|
||||
}
|
||||
finishedReads &+= 1
|
||||
// A newer selection owns the published state, including `busy`;
|
||||
// an older read that finishes late is discarded.
|
||||
guard request == latestRequest else { return }
|
||||
status = newStatus
|
||||
report = newReport
|
||||
busy = false
|
||||
@@ -685,17 +737,51 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
/// Opens the file importer of the focused window. Absent when no window can
|
||||
/// present it, which disables File > Open Executable….
|
||||
struct OpenExecutableKey: FocusedValueKey {
|
||||
typealias Value = () -> Void
|
||||
}
|
||||
|
||||
extension FocusedValues {
|
||||
var openExecutable: OpenExecutableKey.Value? {
|
||||
get { self[OpenExecutableKey.self] }
|
||||
set { self[OpenExecutableKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
||||
/// File > Open Executable… (Command-O), routed to the focused window's importer.
|
||||
struct OpenExecutableCommand: Commands {
|
||||
@FocusedValue(\.openExecutable) private var openExecutable
|
||||
|
||||
var body: some Commands {
|
||||
CommandGroup(after: .newItem) {
|
||||
Button("Open Executable…") { openExecutable?() }
|
||||
.keyboardShortcut("o")
|
||||
.disabled(openExecutable == nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct InspectorView: View {
|
||||
@ObservedObject var model: InspectionModel
|
||||
let openImporter: () -> Void
|
||||
|
||||
var body: some View {
|
||||
Section("Executable inspection (read-only)") {
|
||||
HStack {
|
||||
Button("Open Executable…") { model.importing = true }
|
||||
Button("Open Executable…") { openImporter() }
|
||||
Text("or drop a file on this window").foregroundStyle(.secondary)
|
||||
}
|
||||
if let error = model.selectionError {
|
||||
Text(error).foregroundStyle(.red)
|
||||
}
|
||||
if let name = model.fileName {
|
||||
LabeledContent("File", value: model.busy ? "\(name) (inspecting…)" : name)
|
||||
if model.failed {
|
||||
Text("Inspection of \(name) failed (status \(model.status)).")
|
||||
.foregroundStyle(.red)
|
||||
}
|
||||
ScrollView {
|
||||
Text(model.report)
|
||||
.font(.system(.caption, design: .monospaced))
|
||||
@@ -716,12 +802,19 @@ struct ContentView: View {
|
||||
@ObservedObject var model: FrameModel
|
||||
@ObservedObject var loop: FrameLoopModel
|
||||
@ObservedObject var inspection = InspectionModel.shared
|
||||
/// This window's importer. Kept per window so only the window that asked shows it.
|
||||
@State private var importing = false
|
||||
private var frame: GuestFrame? { model.frame }
|
||||
private var running: Bool { model.running }
|
||||
|
||||
private func openImporter() {
|
||||
inspection.requestImport()
|
||||
importing = true
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
InspectorView(model: inspection)
|
||||
InspectorView(model: inspection, openImporter: openImporter)
|
||||
Section("Guest display") {
|
||||
if let image = frame?.image {
|
||||
Image(decorative: image, scale: 1)
|
||||
@@ -822,8 +915,8 @@ struct ContentView: View {
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.fileImporter(isPresented: $inspection.importing, allowedContentTypes: [.item]) { result in
|
||||
if case .success(let url) = result { inspection.inspect(url) }
|
||||
.fileImporter(isPresented: $importing, allowedContentTypes: [.item]) { result in
|
||||
inspection.importFinished(result)
|
||||
}
|
||||
.dropDestination(for: URL.self) { urls, _ in
|
||||
guard let url = urls.first, url.isFileURL else { return false }
|
||||
@@ -831,6 +924,7 @@ struct ContentView: View {
|
||||
return true
|
||||
}
|
||||
.frame(minWidth: 520, minHeight: 680)
|
||||
.focusedSceneValue(\.openExecutable, openImporter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -841,6 +935,7 @@ struct BetterXenApp: App {
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup("BetterXen") { ContentView(model: model, loop: loop) }
|
||||
.commands { OpenExecutableCommand() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1009,6 +1104,118 @@ if CommandLine.arguments.contains("--smoke-frame") {
|
||||
exit(frame.status == XENORA_OK ? 0 : 1)
|
||||
}
|
||||
|
||||
// `--smoke-inspection-order` checks that only the latest selection publishes an
|
||||
// inspection result. Files are never read: an injected reader blocks until the check
|
||||
// releases that file, so the check, not timing, decides which read finishes first.
|
||||
// It needs no GPU.
|
||||
if CommandLine.arguments.contains("--smoke-inspection-order") {
|
||||
final class ReadGates: @unchecked Sendable {
|
||||
private let lock = NSLock()
|
||||
private var gates: [String: DispatchSemaphore] = [:]
|
||||
func gate(_ name: String) -> DispatchSemaphore {
|
||||
lock.lock()
|
||||
defer { lock.unlock() }
|
||||
if let gate = gates[name] { return gate }
|
||||
let gate = DispatchSemaphore(value: 0)
|
||||
gates[name] = gate
|
||||
return gate
|
||||
}
|
||||
func release(_ name: String) { gate(name).signal() }
|
||||
}
|
||||
let gates = ReadGates()
|
||||
// "<scenario>-<a|b>-<ok|fail>"; a gate that is never released times out
|
||||
// instead of hanging, and the check then fails on its own deadline.
|
||||
let reader: @Sendable (URL) -> (Int32, String) = { url in
|
||||
let name = url.lastPathComponent
|
||||
_ = gates.gate(name).wait(timeout: .now() + 10)
|
||||
let status = name.hasSuffix("-ok") ? Int32(XENORA_OK) : Int32(XENORA_INVALID_ARGUMENT)
|
||||
return (status, "report \(name)")
|
||||
}
|
||||
func file(_ name: String) -> URL { URL(fileURLWithPath: "/nonexistent/\(name)") }
|
||||
|
||||
Task { @MainActor in
|
||||
var failures: [String] = []
|
||||
// Waits for the model to finish `count` reads. The deadline only bounds the
|
||||
// check; the order of completions is set by releasing gates.
|
||||
@MainActor func settle(_ model: InspectionModel, _ count: UInt64, _ label: String) async -> Bool {
|
||||
let deadline = Date().addingTimeInterval(5)
|
||||
while model.finishedReads < count {
|
||||
if Date() > deadline {
|
||||
failures.append("\(label): read \(count) did not finish")
|
||||
return false
|
||||
}
|
||||
try? await Task.sleep(nanoseconds: 2_000_000)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@MainActor func expect(_ model: InspectionModel, _ name: String, busy: Bool, report: String, ok: Bool, _ label: String) {
|
||||
let actual = "file=\(model.fileName ?? "-") busy=\(model.busy) status=\(model.status) report=\(model.report)"
|
||||
if model.fileName != name || model.busy != busy || model.report != report
|
||||
|| (model.status == Int32(XENORA_OK)) != ok {
|
||||
failures.append("\(label): \(actual)")
|
||||
}
|
||||
}
|
||||
// The newer read finishes first; the older one finishes afterwards and must
|
||||
// change nothing, whatever its outcome.
|
||||
for (scenario, first, second, ok) in [("s1", "a-ok", "b-ok", true), ("s2", "a-fail", "b-ok", true),
|
||||
("s3", "a-ok", "b-fail", false)] {
|
||||
let (older, newer) = ("\(scenario)-\(first)", "\(scenario)-\(second)")
|
||||
let model = InspectionModel(reader: reader)
|
||||
model.inspect(file(older))
|
||||
model.inspect(file(newer))
|
||||
gates.release(newer)
|
||||
if await settle(model, 1, "\(older) then \(newer)") {
|
||||
expect(model, newer, busy: false, report: "report \(newer)", ok: ok, "\(newer) finished")
|
||||
}
|
||||
gates.release(older)
|
||||
if await settle(model, 2, "\(older) then \(newer)") {
|
||||
expect(model, newer, busy: false, report: "report \(newer)", ok: ok, "stale \(older) finished")
|
||||
}
|
||||
}
|
||||
// The older read finishes first and must not clear the newer request's busy state.
|
||||
let model = InspectionModel(reader: reader)
|
||||
model.inspect(file("s4-a-ok"))
|
||||
model.inspect(file("s4-b-fail"))
|
||||
gates.release("s4-a-ok")
|
||||
if await settle(model, 1, "s4") {
|
||||
expect(model, "s4-b-fail", busy: true, report: "", ok: true, "stale s4-a-ok finished first")
|
||||
}
|
||||
gates.release("s4-b-fail")
|
||||
if await settle(model, 2, "s4") {
|
||||
expect(model, "s4-b-fail", busy: false, report: "report s4-b-fail", ok: false, "s4-b-fail finished")
|
||||
}
|
||||
for failure in failures { print("smoke-inspection-order: FAILED \(failure)") }
|
||||
print("smoke-inspection-order: \(failures.isEmpty ? "ok" : "\(failures.count) failed")")
|
||||
exit(failures.isEmpty ? 0 : 1)
|
||||
}
|
||||
dispatchMain()
|
||||
}
|
||||
|
||||
// `--smoke-import-result` checks how a file-importer result reaches the inspector:
|
||||
// a cancelled picker shows nothing, a failure is shown, and a new selection clears it.
|
||||
// No file is opened or read.
|
||||
if CommandLine.arguments.contains("--smoke-import-result") {
|
||||
let ok = MainActor.assumeIsolated { () -> Bool in
|
||||
var failures: [String] = []
|
||||
let model = InspectionModel()
|
||||
model.importFinished(.failure(CocoaError(.userCancelled)))
|
||||
if model.selectionError != nil || model.fileName != nil { failures.append("cancel shows a message") }
|
||||
model.importFinished(.failure(CocoaError(.fileReadNoPermission)))
|
||||
if model.selectionError == nil || model.fileName != nil { failures.append("failure is not shown") }
|
||||
model.requestImport()
|
||||
if model.selectionError != nil { failures.append("reopening keeps the old message") }
|
||||
model.importFinished(.failure(CocoaError(.fileReadNoPermission)))
|
||||
model.inspect(URL(fileURLWithPath: "/nonexistent/import-result-check"))
|
||||
if model.selectionError != nil || model.fileName != "import-result-check" {
|
||||
failures.append("a new selection keeps the old message")
|
||||
}
|
||||
for failure in failures { print("smoke-import-result: FAILED \(failure)") }
|
||||
return failures.isEmpty
|
||||
}
|
||||
print("smoke-import-result: \(ok ? "ok" : "failed")")
|
||||
exit(ok ? 0 : 1)
|
||||
}
|
||||
|
||||
// `--smoke` prints the probe and exits without opening a window, for scripts and CI.
|
||||
if CommandLine.arguments.contains("--smoke") {
|
||||
let probe = RuntimeProbe.run()
|
||||
|
||||
+120
-17
@@ -2,10 +2,10 @@
|
||||
|
||||
use std::error::Error;
|
||||
use std::ffi::OsString;
|
||||
use std::fs::{self, File};
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, ExitCode, Stdio};
|
||||
use std::process::{Child, Command, ExitCode, Stdio};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
@@ -16,6 +16,10 @@ use xenora_loader::{
|
||||
use xenora_metal::NativeCompute;
|
||||
use xenora_shader::{Architecture, PIXEL_ENTRY_POINT, VERTEX_ENTRY_POINT, compile_graphics};
|
||||
|
||||
#[path = "startup_report.rs"]
|
||||
mod startup_report;
|
||||
use startup_report::{Events, JOURNAL_ERROR_EXIT, Journal, Termination, WATCHDOG_EXIT};
|
||||
|
||||
const FIXTURE: &[u8] = include_bytes!("../../../fixtures/pe/trusted-runner.exe");
|
||||
const SERVICES_FIXTURE: &[u8] = include_bytes!("../../../fixtures/pe/runtime-services.exe");
|
||||
const WALL_LIMIT: Duration = Duration::from_secs(15);
|
||||
@@ -27,7 +31,7 @@ const TICKET: u64 = 17;
|
||||
const DRAW_RESULT: u64 = 0x42;
|
||||
const EXTENT: [usize; 2] = [4, 3];
|
||||
const EXPECTED_PIXEL: [u8; 4] = [255, 0, 0, 255];
|
||||
const USAGE: &str = "usage: betterxen run --pe <trusted-fixture> --experimental [--trace] [--metal-hud] [--max-steps <1..=10000>]";
|
||||
const USAGE: &str = "usage: betterxen run --pe <trusted-fixture> --experimental [--trace] [--metal-hud] [--max-steps <1..=10000>] [--startup-report <path>]";
|
||||
|
||||
struct Options {
|
||||
path: PathBuf,
|
||||
@@ -35,6 +39,8 @@ struct Options {
|
||||
worker: bool,
|
||||
trace: bool,
|
||||
hud: bool,
|
||||
report: Option<PathBuf>,
|
||||
journal: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl Options {
|
||||
@@ -42,6 +48,8 @@ impl Options {
|
||||
let mut args = args.into_iter();
|
||||
let mut path = None;
|
||||
let mut max_steps = None;
|
||||
let mut report = None;
|
||||
let mut journal = None;
|
||||
let (mut experimental, mut trace, mut hud, mut worker) = (false, false, false, false);
|
||||
while let Some(arg) = args.next() {
|
||||
match arg.to_str() {
|
||||
@@ -56,6 +64,16 @@ impl Options {
|
||||
.ok_or("--max-steps must be in 1..=10000")?,
|
||||
);
|
||||
}
|
||||
Some("--startup-report") if report.is_none() => {
|
||||
report = Some(PathBuf::from(
|
||||
args.next().ok_or("missing --startup-report path")?,
|
||||
));
|
||||
}
|
||||
Some("--startup-journal") if journal.is_none() => {
|
||||
journal = Some(PathBuf::from(
|
||||
args.next().ok_or("missing worker journal path")?,
|
||||
));
|
||||
}
|
||||
Some("--experimental") if !experimental => experimental = true,
|
||||
Some("--trace") if !trace => trace = true,
|
||||
Some("--metal-hud") if !hud => hud = true,
|
||||
@@ -66,12 +84,17 @@ impl Options {
|
||||
if !experimental {
|
||||
return Err("run requires --experimental".into());
|
||||
}
|
||||
if (worker && report.is_some()) || (!worker && journal.is_some()) {
|
||||
return Err("invalid startup report option for this process".into());
|
||||
}
|
||||
Ok(Self {
|
||||
path: path.ok_or("missing --pe path")?,
|
||||
max_steps: max_steps.unwrap_or(DEFAULT_STEPS),
|
||||
worker,
|
||||
trace,
|
||||
hud,
|
||||
report,
|
||||
journal,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -85,7 +108,7 @@ pub fn command(args: impl IntoIterator<Item = OsString>) -> ExitCode {
|
||||
}
|
||||
};
|
||||
let result = if options.worker {
|
||||
run_worker(&options).map(|()| ExitCode::SUCCESS)
|
||||
worker_command(&options)
|
||||
} else {
|
||||
launch_worker(&options)
|
||||
};
|
||||
@@ -99,8 +122,26 @@ pub fn command(args: impl IntoIterator<Item = OsString>) -> ExitCode {
|
||||
}
|
||||
|
||||
fn launch_worker(options: &Options) -> Result<ExitCode, Box<dyn Error>> {
|
||||
let journal = options
|
||||
.report
|
||||
.as_ref()
|
||||
.map(|_| Journal::create())
|
||||
.transpose()?;
|
||||
let executable = std::env::current_exe()?;
|
||||
let destination = options
|
||||
.report
|
||||
.as_ref()
|
||||
.map(|path| {
|
||||
OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(path)
|
||||
.map_err(|error| format!("could not create startup report: {error}"))
|
||||
})
|
||||
.transpose()?;
|
||||
let started = Instant::now();
|
||||
let mut child = Command::new(std::env::current_exe()?)
|
||||
let mut command = Command::new(executable);
|
||||
command
|
||||
.args([
|
||||
"run",
|
||||
"--experimental",
|
||||
@@ -112,29 +153,73 @@ fn launch_worker(options: &Options) -> Result<ExitCode, Box<dyn Error>> {
|
||||
.arg(options.max_steps.to_string())
|
||||
.arg("--pe")
|
||||
.arg(&options.path)
|
||||
.stdin(Stdio::null())
|
||||
.spawn()?;
|
||||
.stdin(Stdio::null());
|
||||
if let Some(journal) = &journal {
|
||||
command.arg("--startup-journal").arg(journal.path());
|
||||
}
|
||||
let termination = command
|
||||
.spawn()
|
||||
.and_then(|child| supervise(child, started, WALL_LIMIT));
|
||||
if let (Some(journal), Some(destination)) = (&journal, destination)
|
||||
&& let Err(error) = journal.finish(destination, &termination)
|
||||
{
|
||||
eprintln!("could not write startup report: {error}");
|
||||
if matches!(&termination, Ok(Termination::Exited(status)) if status.success()) {
|
||||
return Ok(ExitCode::FAILURE);
|
||||
}
|
||||
}
|
||||
match termination? {
|
||||
Termination::Exited(status) => match status.code() {
|
||||
Some(code) => Ok(ExitCode::from(u8::try_from(code)?)),
|
||||
None => Err(format!("worker terminated: {status}").into()),
|
||||
},
|
||||
Termination::Deadline => {
|
||||
Err("experimental worker exceeded its 15 second wall deadline".into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn supervise(mut child: Child, started: Instant, limit: Duration) -> std::io::Result<Termination> {
|
||||
loop {
|
||||
match child.try_wait() {
|
||||
Ok(Some(status)) => {
|
||||
return match status.code() {
|
||||
Some(code) => Ok(ExitCode::from(u8::try_from(code)?)),
|
||||
None => Err(format!("worker terminated: {status}").into()),
|
||||
};
|
||||
}
|
||||
Ok(None) if started.elapsed() < WALL_LIMIT => {
|
||||
Ok(Some(status)) => return Ok(Termination::Exited(status)),
|
||||
Ok(None) if started.elapsed() < limit => {
|
||||
std::thread::sleep(Duration::from_millis(10));
|
||||
}
|
||||
status => {
|
||||
let _ = child.kill();
|
||||
child.wait()?;
|
||||
status?;
|
||||
return Err("experimental worker exceeded its 15 second wall deadline".into());
|
||||
return Ok(Termination::Deadline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn worker_command(options: &Options) -> Result<ExitCode, Box<dyn Error>> {
|
||||
let mut events = match options.journal.as_deref().map(Events::open).transpose() {
|
||||
Ok(events) => events,
|
||||
Err(error) => {
|
||||
eprintln!("could not open startup journal: {error}");
|
||||
return Ok(ExitCode::from(JOURNAL_ERROR_EXIT));
|
||||
}
|
||||
};
|
||||
let result = run_worker(options, events.as_mut());
|
||||
if let Some(events) = events.as_mut() {
|
||||
if let Err(error) = &result {
|
||||
events.failure(error.as_ref());
|
||||
}
|
||||
if let Some(error) = events.write_error() {
|
||||
if let Err(error) = result {
|
||||
eprintln!("run failed: {error}");
|
||||
}
|
||||
eprintln!("could not write startup journal: {error}");
|
||||
return Ok(ExitCode::from(JOURNAL_ERROR_EXIT));
|
||||
}
|
||||
}
|
||||
result.map(|()| ExitCode::SUCCESS)
|
||||
}
|
||||
|
||||
fn verify_fixture(path: &Path) -> Result<&'static [u8], Box<dyn Error>> {
|
||||
let valid_metadata =
|
||||
|metadata: fs::Metadata| metadata.is_file() && metadata.len() == FIXTURE.len() as u64;
|
||||
@@ -158,14 +243,14 @@ fn verify_fixture(path: &Path) -> Result<&'static [u8], Box<dyn Error>> {
|
||||
.ok_or_else(|| rejection.into())
|
||||
}
|
||||
|
||||
fn run_worker(options: &Options) -> Result<(), Box<dyn Error>> {
|
||||
fn run_worker(options: &Options, mut events: Option<&mut Events>) -> Result<(), Box<dyn Error>> {
|
||||
std::thread::Builder::new()
|
||||
.name("xenora-deadline".into())
|
||||
.spawn(|| {
|
||||
std::thread::sleep(WALL_LIMIT);
|
||||
// The supervisor also enforces this deadline. The worker retains
|
||||
// its own deadline if it is invoked directly.
|
||||
std::process::exit(124);
|
||||
std::process::exit(i32::from(WATCHDOG_EXIT));
|
||||
})?;
|
||||
let fixture = verify_fixture(&options.path)?;
|
||||
let (name, ticket, bound_imports) = if fixture == SERVICES_FIXTURE {
|
||||
@@ -232,6 +317,16 @@ fn run_worker(options: &Options) -> Result<(), Box<dyn Error>> {
|
||||
imports,
|
||||
options.max_steps,
|
||||
|event| {
|
||||
if let Some(events) = events.as_deref_mut() {
|
||||
events.stage(match &event {
|
||||
StartupEvent::Parsed { .. } => "parsed",
|
||||
StartupEvent::Mapped { .. } => "mapped",
|
||||
StartupEvent::Relocated { .. } => "relocated",
|
||||
StartupEvent::ImportsBound { .. } => "imports_bound",
|
||||
StartupEvent::TlsCompleted { .. } => "tls_completed",
|
||||
StartupEvent::Entering { .. } => "entry",
|
||||
});
|
||||
}
|
||||
if options.trace {
|
||||
trace_startup(event);
|
||||
}
|
||||
@@ -244,6 +339,11 @@ fn run_worker(options: &Options) -> Result<(), Box<dyn Error>> {
|
||||
.take();
|
||||
let exit = startup.execution.exit_reason;
|
||||
let rax = startup.execution.final_state.get(Register::Rax);
|
||||
if exit == ExitReason::Halt
|
||||
&& let Some(events) = events.as_deref_mut()
|
||||
{
|
||||
events.stage("exit");
|
||||
}
|
||||
if options.trace {
|
||||
println!(
|
||||
"trace stage=exit entry_steps={} exit={exit:?} rax={rax:#x}",
|
||||
@@ -264,6 +364,9 @@ fn run_worker(options: &Options) -> Result<(), Box<dyn Error>> {
|
||||
return Err("trusted fixture startup or result differs from the expected values".into());
|
||||
}
|
||||
let frame = result.ok_or("guest halted without a draw")??;
|
||||
if let Some(events) = events {
|
||||
events.stage("framebuffer");
|
||||
}
|
||||
if options.trace {
|
||||
println!(
|
||||
"trace stage=framebuffer extent={}x{} verified_pixels={}",
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use std::fmt::Write as _;
|
||||
use std::fs::{self, File, OpenOptions};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::os::unix::fs::DirBuilderExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::ExitStatus;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
pub(super) const WATCHDOG_EXIT: u8 = 124;
|
||||
pub(super) const JOURNAL_ERROR_EXIT: u8 = 125;
|
||||
const VERSION: &str = "1";
|
||||
const RECORD_SEPARATOR: char = '\t';
|
||||
const MAX_BYTES: usize = 8192;
|
||||
const MAX_ERROR_BYTES: usize = 2048;
|
||||
const STAGES: [&str; 8] = [
|
||||
"parsed",
|
||||
"mapped",
|
||||
"relocated",
|
||||
"imports_bound",
|
||||
"tls_completed",
|
||||
"entry",
|
||||
"exit",
|
||||
"framebuffer",
|
||||
];
|
||||
|
||||
pub(super) struct Journal(PathBuf);
|
||||
|
||||
impl Journal {
|
||||
pub(super) fn create() -> io::Result<Self> {
|
||||
static NEXT: AtomicUsize = AtomicUsize::new(0);
|
||||
loop {
|
||||
let id = NEXT.fetch_add(1, Ordering::Relaxed);
|
||||
let directory =
|
||||
std::env::temp_dir().join(format!("betterxen-startup-{}-{id}", std::process::id()));
|
||||
match fs::DirBuilder::new().mode(0o700).create(&directory) {
|
||||
Ok(()) => return Ok(Self(directory)),
|
||||
Err(error) if error.kind() == io::ErrorKind::AlreadyExists => continue,
|
||||
Err(error) => return Err(error),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn path(&self) -> PathBuf {
|
||||
self.0.join("events")
|
||||
}
|
||||
|
||||
fn read(&self) -> Report {
|
||||
let mut bytes = Vec::new();
|
||||
match File::open(self.path())
|
||||
.and_then(|file| file.take((MAX_BYTES + 1) as u64).read_to_end(&mut bytes))
|
||||
{
|
||||
Ok(_) => Report::parse(&bytes),
|
||||
Err(error) if error.kind() == io::ErrorKind::NotFound => Report::default(),
|
||||
Err(_) => Report {
|
||||
integrity: "unreadable",
|
||||
..Report::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn finish(
|
||||
&self,
|
||||
mut destination: File,
|
||||
termination: &io::Result<Termination>,
|
||||
) -> io::Result<()> {
|
||||
destination.write_all(self.read().json(termination).as_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Journal {
|
||||
fn drop(&mut self) {
|
||||
let _ = fs::remove_file(self.path());
|
||||
let _ = fs::remove_dir(&self.0);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) struct Events(File, Option<io::Error>);
|
||||
|
||||
impl Events {
|
||||
pub(super) fn open(path: &Path) -> io::Result<Self> {
|
||||
OpenOptions::new()
|
||||
.write(true)
|
||||
.create_new(true)
|
||||
.open(path)
|
||||
.map(|file| Self(file, None))
|
||||
}
|
||||
|
||||
pub(super) fn stage(&mut self, stage: &str) {
|
||||
self.record(format_args!("{VERSION}\t{stage}"));
|
||||
}
|
||||
|
||||
pub(super) fn failure(&mut self, error: &dyn std::error::Error) {
|
||||
let message = error.to_string();
|
||||
let end = message.floor_char_boundary(MAX_ERROR_BYTES);
|
||||
let mut encoded = String::with_capacity(end * 2);
|
||||
for byte in message[..end].bytes() {
|
||||
write!(encoded, "{byte:02x}").unwrap();
|
||||
}
|
||||
self.record(format_args!(
|
||||
"{VERSION}\tfailure\t{}\t{encoded}",
|
||||
u8::from(end < message.len())
|
||||
));
|
||||
}
|
||||
fn record(&mut self, arguments: std::fmt::Arguments<'_>) {
|
||||
if self.1.is_none() {
|
||||
self.1 = writeln!(self.0, "{arguments}").err();
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn write_error(&self) -> Option<&io::Error> {
|
||||
self.1.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) enum Termination {
|
||||
Exited(ExitStatus),
|
||||
Deadline,
|
||||
}
|
||||
|
||||
struct Report {
|
||||
completed: usize,
|
||||
error: Option<String>,
|
||||
error_truncated: bool,
|
||||
integrity: &'static str,
|
||||
}
|
||||
|
||||
impl Default for Report {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
completed: 0,
|
||||
error: None,
|
||||
error_truncated: false,
|
||||
integrity: "complete",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Report {
|
||||
fn parse(bytes: &[u8]) -> Self {
|
||||
let mut report = Self::default();
|
||||
let bounded = &bytes[..bytes.len().min(MAX_BYTES)];
|
||||
for line in bounded.split_inclusive(|&byte| byte == b'\n') {
|
||||
let Some(line) = line.strip_suffix(b"\n") else {
|
||||
report.integrity = "truncated";
|
||||
break;
|
||||
};
|
||||
if !std::str::from_utf8(line).is_ok_and(|line| report.record(line)) {
|
||||
report.integrity = "malformed";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if bytes.len() > MAX_BYTES {
|
||||
report.integrity = "oversized";
|
||||
}
|
||||
report
|
||||
}
|
||||
|
||||
fn record(&mut self, line: &str) -> bool {
|
||||
let Some((VERSION, record)) = line.split_once(RECORD_SEPARATOR) else {
|
||||
return false;
|
||||
};
|
||||
if self.error.is_some() {
|
||||
return false;
|
||||
}
|
||||
if STAGES.get(self.completed) == Some(&record) {
|
||||
self.completed += 1;
|
||||
return true;
|
||||
}
|
||||
let Some((truncated, encoded)) = record
|
||||
.strip_prefix("failure\t")
|
||||
.and_then(|s| s.split_once('\t'))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
if !matches!(truncated, "0" | "1")
|
||||
|| encoded.len() > MAX_ERROR_BYTES * 2
|
||||
|| !encoded.len().is_multiple_of(2)
|
||||
|| !encoded.bytes().all(|byte| byte.is_ascii_hexdigit())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
let (pairs, _) = encoded.as_bytes().as_chunks::<2>();
|
||||
let Some(message) = pairs
|
||||
.iter()
|
||||
.map(|pair| u8::from_str_radix(std::str::from_utf8(pair).ok()?, 16).ok())
|
||||
.collect::<Option<Vec<_>>>()
|
||||
.and_then(|bytes| String::from_utf8(bytes).ok())
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
self.error = Some(message);
|
||||
self.error_truncated = truncated == "1";
|
||||
true
|
||||
}
|
||||
|
||||
fn json(&self, termination: &io::Result<Termination>) -> String {
|
||||
let unwritable = matches!(termination, Ok(Termination::Exited(status))
|
||||
if status.code() == Some(i32::from(JOURNAL_ERROR_EXIT)));
|
||||
let integrity = if unwritable {
|
||||
"unwritable"
|
||||
} else {
|
||||
self.integrity
|
||||
};
|
||||
let (outcome, status, detail) = match termination {
|
||||
Ok(Termination::Deadline) => (
|
||||
"timeout",
|
||||
None,
|
||||
Some("worker exceeded the wall deadline".into()),
|
||||
),
|
||||
Err(error) => ("unknown", None, Some(error.to_string())),
|
||||
Ok(Termination::Exited(status)) if status.code() == Some(i32::from(WATCHDOG_EXIT)) => (
|
||||
"timeout",
|
||||
Some(status),
|
||||
Some("worker watchdog expired".into()),
|
||||
),
|
||||
Ok(Termination::Exited(status)) if unwritable => (
|
||||
"unknown",
|
||||
Some(status),
|
||||
Some("worker could not write its startup journal".into()),
|
||||
),
|
||||
Ok(Termination::Exited(status))
|
||||
if status.success()
|
||||
&& self.error.is_none()
|
||||
&& self.completed == STAGES.len()
|
||||
&& self.integrity == "complete" =>
|
||||
{
|
||||
("verified", Some(status), None)
|
||||
}
|
||||
Ok(Termination::Exited(status))
|
||||
if status.code().is_some() && !status.success() && self.error.is_some() =>
|
||||
{
|
||||
("stage_failure", Some(status), None)
|
||||
}
|
||||
Ok(Termination::Exited(status)) if status.code().is_some() && !status.success() => {
|
||||
("early_exit", Some(status), Some(status.to_string()))
|
||||
}
|
||||
Ok(Termination::Exited(status)) => ("unknown", Some(status), Some(status.to_string())),
|
||||
};
|
||||
let stages = &STAGES[..self.completed];
|
||||
let records = stages
|
||||
.iter()
|
||||
.map(|stage| format!(r#"{{"schema_version":{VERSION},"stage":"{stage}"}}"#))
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
let last = json_string(stages.last().copied());
|
||||
let error = json_string(self.error.as_deref());
|
||||
let detail = json_string(detail.as_deref());
|
||||
let code = status
|
||||
.and_then(|status| status.code())
|
||||
.map_or("null".into(), |code| code.to_string());
|
||||
format!(
|
||||
"{{\"schema_version\":{VERSION},\"outcome\":\"{outcome}\",\"last_completed_stage\":{last},\"record_integrity\":\"{}\",\"worker_exit_code\":{code},\"termination_detail\":{detail},\"error\":{error},\"error_truncated\":{},\"stages\":[{records}]}}\n",
|
||||
integrity, self.error_truncated
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn json_string(value: Option<&str>) -> String {
|
||||
let Some(value) = value else {
|
||||
return String::from("null");
|
||||
};
|
||||
let mut escaped = String::from("\"");
|
||||
for ch in value.chars() {
|
||||
match ch {
|
||||
'"' => escaped.push_str("\\\""),
|
||||
'\\' => escaped.push_str("\\\\"),
|
||||
'\0'..='\u{1f}' => write!(escaped, "\\u{:04x}", u32::from(ch)).unwrap(),
|
||||
_ => escaped.push(ch),
|
||||
}
|
||||
}
|
||||
escaped.push('"');
|
||||
escaped
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::process::Command;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[test]
|
||||
fn journal_write_error_surfaces_in_report() {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let journal = Journal::create().unwrap();
|
||||
fs::write(journal.path(), b"1\tparsed\n").unwrap();
|
||||
let mut events = Events(File::open(journal.path()).unwrap(), None);
|
||||
events.stage("mapped");
|
||||
assert!(events.write_error().is_some());
|
||||
let status = ExitStatus::from_raw(i32::from(JOURNAL_ERROR_EXIT) << 8);
|
||||
let result = journal.read().json(&Ok(Termination::Exited(status)));
|
||||
assert!(
|
||||
result.contains(r#""record_integrity":"unwritable""#),
|
||||
"{result}"
|
||||
);
|
||||
assert!(
|
||||
result.contains(r#""last_completed_stage":"parsed""#),
|
||||
"{result}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn terminal_failure_keeps_signal_detail_after_all_stages() {
|
||||
use std::os::unix::process::ExitStatusExt;
|
||||
let journal = Journal::create().unwrap();
|
||||
let mut events = Events::open(&journal.path()).unwrap();
|
||||
for stage in STAGES {
|
||||
events.stage(stage);
|
||||
}
|
||||
events.failure(&io::Error::other("late error"));
|
||||
let report = journal.read();
|
||||
assert_eq!(report.integrity, "complete");
|
||||
let result = report.json(&Ok(Termination::Exited(ExitStatus::from_raw(15))));
|
||||
assert!(result.contains(r#""outcome":"unknown""#), "{result}");
|
||||
assert!(result.contains(r#""error":"late error""#), "{result}");
|
||||
assert!(result.contains("signal: 15"), "{result}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn supervisor_distinguishes_early_exit_watchdog_signal_and_deadline() {
|
||||
for (script, limit, outcome, code) in [
|
||||
("exit 9", Duration::from_secs(2), "early_exit", "9"),
|
||||
("exit 124", Duration::from_secs(2), "timeout", "124"),
|
||||
("kill -TERM $$", Duration::from_secs(2), "unknown", "null"),
|
||||
(
|
||||
"exec sleep 5",
|
||||
Duration::from_millis(250),
|
||||
"timeout",
|
||||
"null",
|
||||
),
|
||||
] {
|
||||
let journal = Journal::create().unwrap();
|
||||
let started = Instant::now();
|
||||
let child = Command::new("/bin/sh")
|
||||
.args([
|
||||
"-c",
|
||||
&format!("printf '1\\tparsed\\n' > \"$1\"; {script}"),
|
||||
"worker",
|
||||
])
|
||||
.arg(journal.path())
|
||||
.spawn()
|
||||
.unwrap();
|
||||
let termination = super::super::supervise(child, started, limit);
|
||||
let report = journal.read().json(&termination);
|
||||
assert!(
|
||||
report.contains(&format!(r#""outcome":"{outcome}""#)),
|
||||
"{report}"
|
||||
);
|
||||
assert!(
|
||||
report.contains(&format!(r#""worker_exit_code":{code}"#)),
|
||||
"{report}"
|
||||
);
|
||||
assert!(
|
||||
report.contains(r#""last_completed_stage":"parsed""#),
|
||||
"{report}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_records_keep_only_the_valid_prefix() {
|
||||
let mut oversized = b"1\tparsed\n1\tmapped".to_vec();
|
||||
oversized.resize(MAX_BYTES + 1, b'x');
|
||||
for (bytes, integrity) in [
|
||||
(&b"1\tparsed\n1\tmapped"[..], "truncated"),
|
||||
(&b"1\tparsed\n1\tentry\n1\tmapped\n"[..], "malformed"),
|
||||
(&b"1\tparsed\n1\tfailure\t0\tqq\n"[..], "malformed"),
|
||||
(oversized.as_slice(), "oversized"),
|
||||
] {
|
||||
let journal = Journal::create().unwrap();
|
||||
fs::write(journal.path(), bytes).unwrap();
|
||||
let report = journal.read();
|
||||
assert_eq!(report.completed, 1);
|
||||
assert_eq!(report.integrity, integrity);
|
||||
assert!(report.error.is_none());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failure_preserves_original_context_with_bounded_utf8() {
|
||||
let journal = Journal::create().unwrap();
|
||||
let mut events = Events::open(&journal.path()).unwrap();
|
||||
events.stage("parsed");
|
||||
let message = format!("line\nwith \"quote\" and \\{}", "é".repeat(MAX_ERROR_BYTES));
|
||||
events.failure(&io::Error::other(&message[..]));
|
||||
let report = journal.read();
|
||||
assert_eq!(
|
||||
report.error.as_deref(),
|
||||
Some(&message[..message.floor_char_boundary(MAX_ERROR_BYTES)])
|
||||
);
|
||||
assert!(report.error_truncated);
|
||||
let json = report.json(&Ok(Termination::Deadline));
|
||||
assert!(
|
||||
json.contains(r#"line\u000awith \"quote\" and \\"#),
|
||||
"{json}"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
const STARTUP_STAGES: &[&str] = &[
|
||||
"parsed",
|
||||
"mapped",
|
||||
"relocated",
|
||||
"imports_bound",
|
||||
"tls_completed",
|
||||
"entry",
|
||||
];
|
||||
|
||||
#[test]
|
||||
fn trusted_fixture_preserves_step_failure() {
|
||||
let report = run_fixture("1", false);
|
||||
assert!(report.contains(r#""outcome":"stage_failure""#), "{report}");
|
||||
assert!(
|
||||
report.contains(r#""last_completed_stage":"entry""#),
|
||||
"{report}"
|
||||
);
|
||||
assert!(report.contains("step budget exhausted"), "{report}");
|
||||
assert_stages(&report, STARTUP_STAGES);
|
||||
assert!(!report.contains(r#""stage":"exit""#), "{report}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires a native Metal device with Apple family 7 capabilities"]
|
||||
fn trusted_fixture_reports_verified_progress() {
|
||||
let report = run_fixture("100", true);
|
||||
assert!(report.contains(r#""outcome":"verified""#), "{report}");
|
||||
assert!(
|
||||
report.contains(r#""last_completed_stage":"framebuffer""#),
|
||||
"{report}"
|
||||
);
|
||||
let stages = [STARTUP_STAGES, &["exit", "framebuffer"]].concat();
|
||||
assert_stages(&report, &stages);
|
||||
}
|
||||
|
||||
fn run_fixture(steps: &str, success: bool) -> String {
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"betterxen-report-test-{}-{steps}.json",
|
||||
std::process::id()
|
||||
));
|
||||
let fixture = concat!(
|
||||
env!("CARGO_MANIFEST_DIR"),
|
||||
"/../../fixtures/pe/trusted-runner.exe"
|
||||
);
|
||||
let output = Command::new(env!("CARGO_BIN_EXE_betterxen"))
|
||||
.args([
|
||||
"run",
|
||||
"--experimental",
|
||||
"--pe",
|
||||
fixture,
|
||||
"--max-steps",
|
||||
steps,
|
||||
"--startup-report",
|
||||
])
|
||||
.arg(&path)
|
||||
.output()
|
||||
.unwrap();
|
||||
let report = std::fs::read_to_string(&path);
|
||||
if report.is_ok() {
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
}
|
||||
assert_eq!(output.status.success(), success, "{output:?}, {report:?}");
|
||||
report.unwrap()
|
||||
}
|
||||
|
||||
fn assert_stages(report: &str, stages: &[&str]) {
|
||||
assert!(report.contains(r#""schema_version":1"#), "{report}");
|
||||
let mut remaining = report;
|
||||
for stage in stages {
|
||||
remaining = remaining
|
||||
.split_once(&format!(r#""stage":"{stage}""#))
|
||||
.unwrap()
|
||||
.1;
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn existing_report_path_prevents_worker_launch() {
|
||||
let path = std::env::temp_dir().join(format!(
|
||||
"betterxen-report-existing-{}.json",
|
||||
std::process::id()
|
||||
));
|
||||
std::fs::write(&path, "previous report").unwrap();
|
||||
let result = Command::new(env!("CARGO_BIN_EXE_betterxen"))
|
||||
.args([
|
||||
"run",
|
||||
"--experimental",
|
||||
"--pe",
|
||||
"missing-fixture",
|
||||
"--startup-report",
|
||||
])
|
||||
.arg(&path)
|
||||
.output()
|
||||
.unwrap();
|
||||
let contents = std::fs::read_to_string(&path).unwrap();
|
||||
std::fs::remove_file(&path).unwrap();
|
||||
assert_eq!(contents, "previous report");
|
||||
assert!(!result.status.success());
|
||||
let stderr = String::from_utf8(result.stderr).unwrap();
|
||||
assert!(
|
||||
stderr.contains("could not create startup report"),
|
||||
"{stderr}"
|
||||
);
|
||||
assert!(!stderr.contains("No such file or directory"), "{stderr}");
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "betterxen-hybrid"
|
||||
description = "Host receipt, CrossOver discovery, frame-time statistics and Windows cross-toolchain probes for the hybrid direction"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "betterxen-hybrid"
|
||||
path = "src/main.rs"
|
||||
@@ -0,0 +1,13 @@
|
||||
//! Run a system tool and capture trimmed stdout. A missing tool or non-zero exit is `None`,
|
||||
//! never a guessed value.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
pub fn run(program: &str, args: &[&str]) -> Option<String> {
|
||||
let out = Command::new(program).args(args).output().ok()?;
|
||||
if !out.status.success() {
|
||||
return None;
|
||||
}
|
||||
let s = String::from_utf8_lossy(&out.stdout).trim().to_string();
|
||||
Some(s)
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
//! Discover installed CrossOver bundles and read standard bundle metadata.
|
||||
//!
|
||||
//! Only documented or standard macOS interfaces are used: the app bundle's `Info.plist`
|
||||
//! (read through `plutil`), `lipo -archs` on the bundle's main executable, and the
|
||||
//! `defaults` keys CodeWeavers documents in "Advanced CrossOver Mac Configuration"
|
||||
//! (`BottleDir`, `ManagedBottleDirs` in `com.codeweavers.CrossOver`). Bundle internals such
|
||||
//! as `Contents/SharedSupport` are NOT interpreted: they are undocumented and not a stable
|
||||
//! interface (#350). The graphics backend of a bottle is deliberately not read.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub const BUNDLE_ID: &str = "com.codeweavers.CrossOver";
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Install {
|
||||
pub path: PathBuf,
|
||||
pub bundle_id: Option<String>,
|
||||
pub short_version: Option<String>,
|
||||
pub build_version: Option<String>,
|
||||
pub executable_archs: Option<Vec<String>>,
|
||||
pub minimum_macos: Option<String>,
|
||||
}
|
||||
|
||||
/// Candidate bundle locations: standard application directories. Spotlight is consulted too.
|
||||
pub fn candidate_paths(home: &Path) -> Vec<PathBuf> {
|
||||
let mut v = vec![
|
||||
PathBuf::from("/Applications/CrossOver.app"),
|
||||
home.join("Applications/CrossOver.app"),
|
||||
];
|
||||
if let Some(found) = run(
|
||||
"/usr/bin/mdfind",
|
||||
&[&format!("kMDItemCFBundleIdentifier == '{BUNDLE_ID}'")],
|
||||
) {
|
||||
for line in found.lines().filter(|l| !l.is_empty()) {
|
||||
let p = PathBuf::from(line);
|
||||
if !v.contains(&p) {
|
||||
v.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
v
|
||||
}
|
||||
|
||||
pub fn discover(candidates: &[PathBuf]) -> Vec<Install> {
|
||||
candidates.iter().filter_map(|p| inspect(p)).collect()
|
||||
}
|
||||
|
||||
/// Inspect one bundle. Returns None if the path has no readable `Contents/Info.plist`.
|
||||
pub fn inspect(app: &Path) -> Option<Install> {
|
||||
let plist = app.join("Contents/Info.plist");
|
||||
if !plist.is_file() {
|
||||
return None;
|
||||
}
|
||||
let json = run(
|
||||
"/usr/bin/plutil",
|
||||
&["-convert", "json", "-o", "-", plist.to_str()?],
|
||||
)?;
|
||||
let exe = crate::host_string(&json, "CFBundleExecutable");
|
||||
let archs = exe.and_then(|e| {
|
||||
let p = app.join("Contents/MacOS").join(e);
|
||||
run("/usr/bin/lipo", &["-archs", p.to_str()?])
|
||||
.map(|s| s.split_whitespace().map(String::from).collect())
|
||||
});
|
||||
Some(Install {
|
||||
path: app.to_path_buf(),
|
||||
bundle_id: crate::host_string(&json, "CFBundleIdentifier"),
|
||||
short_version: crate::host_string(&json, "CFBundleShortVersionString"),
|
||||
build_version: crate::host_string(&json, "CFBundleVersion"),
|
||||
executable_archs: archs,
|
||||
minimum_macos: crate::host_string(&json, "LSMinimumSystemVersion"),
|
||||
})
|
||||
}
|
||||
|
||||
/// A documented CrossOver preference, or None when unset or unreadable.
|
||||
pub fn preference(key: &str) -> Option<String> {
|
||||
run("/usr/bin/defaults", &["read", BUNDLE_ID, key])
|
||||
}
|
||||
|
||||
impl Install {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("path", Json::str(self.path.display().to_string())),
|
||||
("bundle_id", Json::opt_str(self.bundle_id.clone())),
|
||||
("short_version", Json::opt_str(self.short_version.clone())),
|
||||
("build_version", Json::opt_str(self.build_version.clone())),
|
||||
(
|
||||
"executable_archs",
|
||||
self.executable_archs.as_ref().map_or(Json::Null, |a| {
|
||||
Json::Arr(a.iter().map(|s| Json::str(s.clone())).collect())
|
||||
}),
|
||||
),
|
||||
("minimum_macos", Json::opt_str(self.minimum_macos.clone())),
|
||||
(
|
||||
"bundle_id_is_codeweavers_crossover",
|
||||
Json::Bool(self.bundle_id.as_deref() == Some(BUNDLE_ID)),
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs;
|
||||
|
||||
// A synthetic bundle written by the test: it proves the metadata path, not that
|
||||
// any real CrossOver build has this layout.
|
||||
fn fake_bundle(dir: &Path) -> PathBuf {
|
||||
let app = dir.join("CrossOver.app");
|
||||
fs::create_dir_all(app.join("Contents/MacOS")).unwrap();
|
||||
fs::write(
|
||||
app.join("Contents/Info.plist"),
|
||||
r#"<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0"><dict>
|
||||
<key>CFBundleExecutable</key><string>CrossOver</string>
|
||||
<key>CFBundleIdentifier</key><string>com.codeweavers.CrossOver</string>
|
||||
<key>CFBundleShortVersionString</key><string>99.1.2</string>
|
||||
<key>CFBundleVersion</key><string>12345</string>
|
||||
<key>LSMinimumSystemVersion</key><string>14.0</string>
|
||||
</dict></plist>"#,
|
||||
)
|
||||
.unwrap();
|
||||
// Copy a real system executable so `lipo -archs` has a Mach-O to read.
|
||||
fs::copy("/usr/bin/true", app.join("Contents/MacOS/CrossOver")).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reads_bundle_metadata() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let tmp = std::env::temp_dir().join(format!("bxhybrid-co-{}", std::process::id()));
|
||||
let _ = fs::remove_dir_all(&tmp);
|
||||
fs::create_dir_all(&tmp).unwrap();
|
||||
let app = fake_bundle(&tmp);
|
||||
let i = inspect(&app).expect("inspect");
|
||||
assert_eq!(i.short_version.as_deref(), Some("99.1.2"));
|
||||
assert_eq!(i.build_version.as_deref(), Some("12345"));
|
||||
assert_eq!(i.minimum_macos.as_deref(), Some("14.0"));
|
||||
assert_eq!(i.bundle_id.as_deref(), Some(BUNDLE_ID));
|
||||
assert!(
|
||||
i.executable_archs.as_ref().is_some_and(|a| !a.is_empty()),
|
||||
"{:?}",
|
||||
i.executable_archs
|
||||
);
|
||||
assert_eq!(discover(&[app.clone(), tmp.join("Missing.app")]).len(), 1);
|
||||
fs::remove_dir_all(&tmp).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_or_plistless_bundle_is_none() {
|
||||
let tmp = std::env::temp_dir().join(format!("bxhybrid-co2-{}", std::process::id()));
|
||||
fs::create_dir_all(tmp.join("X.app/Contents")).unwrap();
|
||||
assert!(inspect(&tmp.join("X.app")).is_none());
|
||||
assert!(inspect(&tmp.join("Nope.app")).is_none());
|
||||
fs::remove_dir_all(&tmp).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
//! Frame-time statistics from a list of frame intervals in milliseconds (issue #145).
|
||||
//!
|
||||
//! Percentiles use the nearest-rank method on the sorted intervals: the p-th percentile is
|
||||
//! the value at rank ceil(p/100 * n) (1-based). "1 % low FPS" is 1000 divided by the 99th
|
||||
//! percentile interval. These definitions are fixed here so reports are comparable; other
|
||||
//! tools define lows differently (for example as the mean of the worst 1 %).
|
||||
|
||||
use crate::json::Json;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct FrameStats {
|
||||
pub frames: usize,
|
||||
pub total_ms: f64,
|
||||
pub mean_ms: f64,
|
||||
pub avg_fps: f64,
|
||||
pub min_ms: f64,
|
||||
pub max_ms: f64,
|
||||
pub p50_ms: f64,
|
||||
pub p95_ms: f64,
|
||||
pub p99_ms: f64,
|
||||
pub p999_ms: f64,
|
||||
pub low_1pct_fps: f64,
|
||||
pub low_01pct_fps: f64,
|
||||
/// Frames longer than twice the median interval.
|
||||
pub stutters: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum FrameError {
|
||||
Empty,
|
||||
Invalid { index: usize, value: f64 },
|
||||
Parse { line: usize, text: String },
|
||||
}
|
||||
|
||||
impl std::fmt::Display for FrameError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
FrameError::Empty => write!(f, "no frame intervals"),
|
||||
FrameError::Invalid { index, value } => {
|
||||
write!(
|
||||
f,
|
||||
"frame {index}: interval {value} is not a positive finite number of milliseconds"
|
||||
)
|
||||
}
|
||||
FrameError::Parse { line, text } => {
|
||||
write!(f, "line {line}: cannot parse {text:?} as milliseconds")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for FrameError {}
|
||||
|
||||
fn nearest_rank(sorted: &[f64], pct: f64) -> f64 {
|
||||
let n = sorted.len();
|
||||
let rank = ((pct / 100.0) * n as f64).ceil().max(1.0) as usize;
|
||||
sorted[rank.min(n) - 1]
|
||||
}
|
||||
|
||||
pub fn analyze(intervals_ms: &[f64]) -> Result<FrameStats, FrameError> {
|
||||
if intervals_ms.is_empty() {
|
||||
return Err(FrameError::Empty);
|
||||
}
|
||||
for (index, &value) in intervals_ms.iter().enumerate() {
|
||||
if !value.is_finite() || value <= 0.0 {
|
||||
return Err(FrameError::Invalid { index, value });
|
||||
}
|
||||
}
|
||||
let mut sorted = intervals_ms.to_vec();
|
||||
sorted.sort_by(|a, b| a.total_cmp(b));
|
||||
let total: f64 = intervals_ms.iter().sum();
|
||||
let n = sorted.len();
|
||||
let p50 = nearest_rank(&sorted, 50.0);
|
||||
let p99 = nearest_rank(&sorted, 99.0);
|
||||
let p999 = nearest_rank(&sorted, 99.9);
|
||||
Ok(FrameStats {
|
||||
frames: n,
|
||||
total_ms: total,
|
||||
mean_ms: total / n as f64,
|
||||
avg_fps: n as f64 / (total / 1000.0),
|
||||
min_ms: sorted[0],
|
||||
max_ms: sorted[n - 1],
|
||||
p50_ms: p50,
|
||||
p95_ms: nearest_rank(&sorted, 95.0),
|
||||
p99_ms: p99,
|
||||
p999_ms: p999,
|
||||
low_1pct_fps: 1000.0 / p99,
|
||||
low_01pct_fps: 1000.0 / p999,
|
||||
stutters: intervals_ms.iter().filter(|&&v| v > 2.0 * p50).count(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse one interval per line; blank lines and lines starting with `#` are skipped.
|
||||
pub fn parse_intervals(text: &str) -> Result<Vec<f64>, FrameError> {
|
||||
let mut out = Vec::new();
|
||||
for (i, line) in text.lines().enumerate() {
|
||||
let t = line.trim();
|
||||
if t.is_empty() || t.starts_with('#') {
|
||||
continue;
|
||||
}
|
||||
let v: f64 = t.parse().map_err(|_| FrameError::Parse {
|
||||
line: i + 1,
|
||||
text: t.to_string(),
|
||||
})?;
|
||||
out.push(v);
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
impl FrameStats {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("frames", Json::Num(self.frames as f64)),
|
||||
("total_ms", Json::Num(self.total_ms)),
|
||||
("mean_ms", Json::Num(self.mean_ms)),
|
||||
("avg_fps", Json::Num(self.avg_fps)),
|
||||
("min_ms", Json::Num(self.min_ms)),
|
||||
("max_ms", Json::Num(self.max_ms)),
|
||||
("p50_ms", Json::Num(self.p50_ms)),
|
||||
("p95_ms", Json::Num(self.p95_ms)),
|
||||
("p99_ms", Json::Num(self.p99_ms)),
|
||||
("p999_ms", Json::Num(self.p999_ms)),
|
||||
("low_1pct_fps", Json::Num(self.low_1pct_fps)),
|
||||
("low_0_1pct_fps", Json::Num(self.low_01pct_fps)),
|
||||
("stutters_over_2x_median", Json::Num(self.stutters as f64)),
|
||||
("percentile_method", Json::str("nearest-rank")),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
// Expected values below are worked out by hand, not produced by analyze().
|
||||
#[test]
|
||||
fn known_answer_ten_frames() {
|
||||
// Sorted: 10,10,10,10,10,10,10,10,20,100. Total 200 ms, n = 10.
|
||||
let v = [10.0, 10.0, 10.0, 10.0, 20.0, 10.0, 10.0, 10.0, 100.0, 10.0];
|
||||
let s = analyze(&v).unwrap();
|
||||
assert_eq!(s.frames, 10);
|
||||
assert_eq!(s.total_ms, 200.0);
|
||||
assert_eq!(s.mean_ms, 20.0);
|
||||
assert_eq!(s.avg_fps, 50.0);
|
||||
assert_eq!(s.p50_ms, 10.0); // rank 5
|
||||
assert_eq!(s.p95_ms, 100.0); // rank ceil(9.5) = 10
|
||||
assert_eq!(s.p99_ms, 100.0);
|
||||
assert_eq!(s.low_1pct_fps, 10.0);
|
||||
assert_eq!(s.stutters, 1); // threshold is 2 * 10 = 20; 20 is not > 20, only 100 is.
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stutter_threshold_is_strict() {
|
||||
let s = analyze(&[10.0, 10.0, 10.0, 20.0, 21.0]).unwrap();
|
||||
assert_eq!(s.stutters, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn one_frame_per_second() {
|
||||
let s = analyze(&[1000.0, 1000.0]).unwrap();
|
||||
assert_eq!(s.avg_fps, 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejects_bad_input() {
|
||||
assert_eq!(analyze(&[]), Err(FrameError::Empty));
|
||||
assert!(matches!(
|
||||
analyze(&[1.0, 0.0]),
|
||||
Err(FrameError::Invalid { index: 1, .. })
|
||||
));
|
||||
assert!(matches!(
|
||||
analyze(&[f64::NAN]),
|
||||
Err(FrameError::Invalid { .. })
|
||||
));
|
||||
assert!(matches!(analyze(&[-3.0]), Err(FrameError::Invalid { .. })));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_text() {
|
||||
assert_eq!(
|
||||
parse_intervals("# c\n16.5\n\n 8 \n").unwrap(),
|
||||
vec![16.5, 8.0]
|
||||
);
|
||||
assert_eq!(
|
||||
parse_intervals("1\nabc\n"),
|
||||
Err(FrameError::Parse {
|
||||
line: 2,
|
||||
text: "abc".into()
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
//! Host receipt: what this Mac is, from documented system interfaces (issue #353).
|
||||
//!
|
||||
//! Every field is `Option` where the probe can fail; absence is reported as null, not guessed.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct HostReceipt {
|
||||
pub macos_version: Option<String>,
|
||||
pub macos_build: Option<String>,
|
||||
pub chip: Option<String>,
|
||||
pub apple_silicon: Option<bool>,
|
||||
pub memory_bytes: Option<u64>,
|
||||
pub logical_cpus: Option<u32>,
|
||||
pub performance_cores: Option<u32>,
|
||||
pub efficiency_cores: Option<u32>,
|
||||
/// True only if an x86_64 slice of a system binary actually executed.
|
||||
pub rosetta_executes_x86_64: Option<bool>,
|
||||
pub gpu_name: Option<String>,
|
||||
pub gpu_cores: Option<String>,
|
||||
pub metal_support: Option<String>,
|
||||
pub host_arch_of_this_binary: &'static str,
|
||||
}
|
||||
|
||||
fn sysctl(name: &str) -> Option<String> {
|
||||
run("/usr/sbin/sysctl", &["-n", name])
|
||||
}
|
||||
|
||||
pub fn collect() -> HostReceipt {
|
||||
let gpu = run(
|
||||
"/usr/sbin/system_profiler",
|
||||
&["SPDisplaysDataType", "-json"],
|
||||
)
|
||||
.and_then(|j| parse_gpu(&j));
|
||||
HostReceipt {
|
||||
macos_version: run("/usr/bin/sw_vers", &["-productVersion"]),
|
||||
macos_build: sysctl("kern.osversion"),
|
||||
chip: sysctl("machdep.cpu.brand_string"),
|
||||
apple_silicon: sysctl("hw.optional.arm64").map(|v| v == "1"),
|
||||
memory_bytes: sysctl("hw.memsize").and_then(|v| v.parse().ok()),
|
||||
logical_cpus: sysctl("hw.logicalcpu").and_then(|v| v.parse().ok()),
|
||||
performance_cores: sysctl("hw.perflevel0.physicalcpu").and_then(|v| v.parse().ok()),
|
||||
efficiency_cores: sysctl("hw.perflevel1.physicalcpu").and_then(|v| v.parse().ok()),
|
||||
// Executes the x86_64 slice of /usr/bin/true. Failure means Rosetta cannot run it
|
||||
// now; it does not distinguish "not installed" from "disabled".
|
||||
rosetta_executes_x86_64: Some(
|
||||
run("/usr/bin/arch", &["-x86_64", "/usr/bin/true"]).is_some(),
|
||||
),
|
||||
gpu_name: gpu.as_ref().map(|g| g.0.clone()),
|
||||
gpu_cores: gpu.as_ref().and_then(|g| g.1.clone()),
|
||||
metal_support: gpu.as_ref().and_then(|g| g.2.clone()),
|
||||
host_arch_of_this_binary: std::env::consts::ARCH,
|
||||
}
|
||||
}
|
||||
|
||||
/// Pull `sppci_model`, `sppci_cores` and `spdisplays_mtlgpufamilysupport` of the first display
|
||||
/// entry from `system_profiler SPDisplaysDataType -json` output. Returns None if the model
|
||||
/// key is absent. Uses a small string scan because this crate has no JSON parser dependency.
|
||||
pub fn parse_gpu(json: &str) -> Option<(String, Option<String>, Option<String>)> {
|
||||
let model = string_value(json, "sppci_model")?;
|
||||
Some((
|
||||
model,
|
||||
string_value(json, "sppci_cores"),
|
||||
string_value(json, "spdisplays_mtlgpufamilysupport"),
|
||||
))
|
||||
}
|
||||
|
||||
fn string_value(json: &str, key: &str) -> Option<String> {
|
||||
let needle = format!("\"{key}\"");
|
||||
let at = json.find(&needle)? + needle.len();
|
||||
let rest = json[at..].trim_start().strip_prefix(':')?.trim_start();
|
||||
let rest = rest.strip_prefix('"')?;
|
||||
let end = rest.find('"')?;
|
||||
Some(rest[..end].to_string())
|
||||
}
|
||||
|
||||
impl HostReceipt {
|
||||
pub fn to_json(&self) -> Json {
|
||||
let n = |v: Option<u32>| v.map_or(Json::Null, |x| Json::Num(x as f64));
|
||||
Json::obj(vec![
|
||||
("macos_version", Json::opt_str(self.macos_version.clone())),
|
||||
("macos_build", Json::opt_str(self.macos_build.clone())),
|
||||
("chip", Json::opt_str(self.chip.clone())),
|
||||
(
|
||||
"apple_silicon",
|
||||
self.apple_silicon.map_or(Json::Null, Json::Bool),
|
||||
),
|
||||
(
|
||||
"memory_bytes",
|
||||
self.memory_bytes
|
||||
.map_or(Json::Null, |x| Json::Num(x as f64)),
|
||||
),
|
||||
("logical_cpus", n(self.logical_cpus)),
|
||||
("performance_cores", n(self.performance_cores)),
|
||||
("efficiency_cores", n(self.efficiency_cores)),
|
||||
(
|
||||
"rosetta_executes_x86_64",
|
||||
self.rosetta_executes_x86_64.map_or(Json::Null, Json::Bool),
|
||||
),
|
||||
("gpu_name", Json::opt_str(self.gpu_name.clone())),
|
||||
("gpu_cores", Json::opt_str(self.gpu_cores.clone())),
|
||||
("metal_support", Json::opt_str(self.metal_support.clone())),
|
||||
(
|
||||
"receipt_binary_arch",
|
||||
Json::str(self.host_arch_of_this_binary),
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn parses_gpu_fixture() {
|
||||
let j = r#"{"SPDisplaysDataType":[{"sppci_cores":"10","sppci_model":"Apple M4",
|
||||
"spdisplays_mtlgpufamilysupport":"spdisplays_metal4"}]}"#;
|
||||
let g = parse_gpu(j).unwrap();
|
||||
assert_eq!(g.0, "Apple M4");
|
||||
assert_eq!(g.1.as_deref(), Some("10"));
|
||||
assert_eq!(g.2.as_deref(), Some("spdisplays_metal4"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn missing_gpu_is_none() {
|
||||
assert!(parse_gpu("{}").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn collect_runs_on_this_host() {
|
||||
let r = collect();
|
||||
if cfg!(target_os = "macos") {
|
||||
assert!(r.macos_version.is_some());
|
||||
assert!(r.memory_bytes.unwrap() > 0);
|
||||
}
|
||||
assert!(r.to_json().render().contains("receipt_binary_arch"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
//! Minimal JSON value and writer. Output only; no parsing is needed by this crate.
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Json {
|
||||
Null,
|
||||
Bool(bool),
|
||||
Num(f64),
|
||||
Str(String),
|
||||
Arr(Vec<Json>),
|
||||
Obj(Vec<(String, Json)>),
|
||||
}
|
||||
|
||||
impl Json {
|
||||
pub fn str(s: impl Into<String>) -> Json {
|
||||
Json::Str(s.into())
|
||||
}
|
||||
pub fn opt_str(s: Option<String>) -> Json {
|
||||
s.map_or(Json::Null, Json::Str)
|
||||
}
|
||||
pub fn obj(fields: Vec<(&str, Json)>) -> Json {
|
||||
Json::Obj(
|
||||
fields
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k.to_string(), v))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn render(&self) -> String {
|
||||
let mut out = String::new();
|
||||
self.write(&mut out, 0);
|
||||
out.push('\n');
|
||||
out
|
||||
}
|
||||
|
||||
fn write(&self, out: &mut String, depth: usize) {
|
||||
let pad = |out: &mut String, d: usize| out.push_str(&" ".repeat(d));
|
||||
match self {
|
||||
Json::Null => out.push_str("null"),
|
||||
Json::Bool(b) => out.push_str(if *b { "true" } else { "false" }),
|
||||
Json::Num(n) if n.is_finite() => {
|
||||
if n.fract() == 0.0 && n.abs() < 1e15 {
|
||||
out.push_str(&format!("{}", *n as i64));
|
||||
} else {
|
||||
out.push_str(&format!("{n}"));
|
||||
}
|
||||
}
|
||||
// JSON has no NaN or infinity; refuse to invent a number.
|
||||
Json::Num(_) => out.push_str("null"),
|
||||
Json::Str(s) => escape(s, out),
|
||||
Json::Arr(items) if items.is_empty() => out.push_str("[]"),
|
||||
Json::Arr(items) => {
|
||||
out.push_str("[\n");
|
||||
for (i, item) in items.iter().enumerate() {
|
||||
pad(out, depth + 1);
|
||||
item.write(out, depth + 1);
|
||||
out.push_str(if i + 1 < items.len() { ",\n" } else { "\n" });
|
||||
}
|
||||
pad(out, depth);
|
||||
out.push(']');
|
||||
}
|
||||
Json::Obj(fields) if fields.is_empty() => out.push_str("{}"),
|
||||
Json::Obj(fields) => {
|
||||
out.push_str("{\n");
|
||||
for (i, (k, v)) in fields.iter().enumerate() {
|
||||
pad(out, depth + 1);
|
||||
escape(k, out);
|
||||
out.push_str(": ");
|
||||
v.write(out, depth + 1);
|
||||
out.push_str(if i + 1 < fields.len() { ",\n" } else { "\n" });
|
||||
}
|
||||
pad(out, depth);
|
||||
out.push('}');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn escape(s: &str, out: &mut String) {
|
||||
out.push('"');
|
||||
for c in s.chars() {
|
||||
match c {
|
||||
'"' => out.push_str("\\\""),
|
||||
'\\' => out.push_str("\\\\"),
|
||||
'\n' => out.push_str("\\n"),
|
||||
'\r' => out.push_str("\\r"),
|
||||
'\t' => out.push_str("\\t"),
|
||||
c if (c as u32) < 0x20 => out.push_str(&format!("\\u{:04x}", c as u32)),
|
||||
c => out.push(c),
|
||||
}
|
||||
}
|
||||
out.push('"');
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn escapes_and_nests() {
|
||||
let j = Json::obj(vec![
|
||||
("a", Json::str("q\"\\\n\u{1}")),
|
||||
(
|
||||
"b",
|
||||
Json::Arr(vec![Json::Num(1.0), Json::Num(0.5), Json::Null]),
|
||||
),
|
||||
("c", Json::Num(f64::NAN)),
|
||||
]);
|
||||
let r = j.render();
|
||||
assert!(r.contains(r#""a": "q\"\\\n\u0001""#), "{r}");
|
||||
assert!(r.contains("0.5"));
|
||||
assert!(r.contains(r#""c": null"#));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
//! BetterXen hybrid tooling: read-only inspection and measurement helpers around an
|
||||
//! externally installed CrossOver. Nothing here launches a game or claims compatibility.
|
||||
|
||||
pub mod cmdutil;
|
||||
pub mod crossover;
|
||||
pub mod frames;
|
||||
pub mod host;
|
||||
pub mod json;
|
||||
pub mod memory;
|
||||
pub mod run;
|
||||
pub mod toolchain;
|
||||
|
||||
/// Value of a top-level string key in flat JSON produced by `plutil -convert json`.
|
||||
pub fn host_string(json: &str, key: &str) -> Option<String> {
|
||||
let needle = format!("\"{key}\"");
|
||||
let at = json.find(&needle)? + needle.len();
|
||||
let rest = json[at..]
|
||||
.trim_start()
|
||||
.strip_prefix(':')?
|
||||
.trim_start()
|
||||
.strip_prefix('"')?;
|
||||
let mut out = String::new();
|
||||
let mut chars = rest.chars();
|
||||
while let Some(c) = chars.next() {
|
||||
match c {
|
||||
'"' => return Some(out),
|
||||
'\\' => out.push(chars.next()?),
|
||||
c => out.push(c),
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
use betterxen_hybrid::{crossover, frames, host, json::Json, memory, run, toolchain};
|
||||
use std::path::PathBuf;
|
||||
use std::process::ExitCode;
|
||||
|
||||
const USAGE: &str = "usage: betterxen-hybrid <command>
|
||||
host host receipt (JSON)
|
||||
crossover [--app P] CrossOver installs and documented preferences (JSON)
|
||||
toolchain Windows cross-compilers found on PATH (JSON)
|
||||
frames <file> frame-time statistics; file has one interval in ms per line (JSON)
|
||||
guard [--min-start-free N] [--min-free N] -- CMD ARGS...
|
||||
run CMD; refuse to start / stop it when free memory is low
|
||||
run --bottle B [--backend X] [--timeout S] [--stall-timeout S] [--settle-bound S] [--expect TEXT] [--out DIR]
|
||||
[--min-start-free N] [--min-free N] -- EXE [ARGS...]
|
||||
run a Windows program through CrossOver; write a JSON record
|
||||
bench --bottle B --backends a,b,c [--repeat N] [same options] -- EXE [ARGS...]
|
||||
run the program per backend N times; summarise frame times
|
||||
receipt host + crossover + toolchain in one JSON document";
|
||||
|
||||
fn crossover_json(app: Option<PathBuf>) -> Json {
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let cands = match app {
|
||||
Some(p) => vec![p],
|
||||
None => crossover::candidate_paths(&home),
|
||||
};
|
||||
let installs = crossover::discover(&cands);
|
||||
Json::obj(vec![
|
||||
("installed", Json::Bool(!installs.is_empty())),
|
||||
(
|
||||
"installs",
|
||||
Json::Arr(installs.iter().map(|i| i.to_json()).collect()),
|
||||
),
|
||||
(
|
||||
"bottle_dir_preference",
|
||||
Json::opt_str(crossover::preference("BottleDir")),
|
||||
),
|
||||
(
|
||||
"managed_bottle_dirs_preference",
|
||||
Json::opt_str(crossover::preference("ManagedBottleDirs")),
|
||||
),
|
||||
(
|
||||
"searched",
|
||||
Json::Arr(
|
||||
cands
|
||||
.iter()
|
||||
.map(|p| Json::str(p.display().to_string()))
|
||||
.collect(),
|
||||
),
|
||||
),
|
||||
(
|
||||
"note",
|
||||
Json::str(
|
||||
"Only Info.plist metadata, lipo -archs and documented defaults keys are read. Bottle graphics backend and bundle internals are not interpreted (undocumented, #350).",
|
||||
),
|
||||
),
|
||||
])
|
||||
}
|
||||
|
||||
fn toolchain_json() -> Json {
|
||||
let path = std::env::var("PATH").unwrap_or_default();
|
||||
Json::Arr(
|
||||
toolchain::probe(&path)
|
||||
.iter()
|
||||
.map(|c| c.to_json())
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
||||
fn guard(args: &[String]) -> ExitCode {
|
||||
let mut limits = memory::Limits {
|
||||
min_start_free: 70,
|
||||
min_free: 20,
|
||||
poll: std::time::Duration::from_secs(1),
|
||||
grace: std::time::Duration::from_secs(10),
|
||||
};
|
||||
let mut i = 0;
|
||||
while i < args.len() && args[i] != "--" {
|
||||
let v = args.get(i + 1).and_then(|v| v.parse::<u8>().ok());
|
||||
match (args[i].as_str(), v) {
|
||||
("--min-start-free", Some(v)) => limits.min_start_free = v,
|
||||
("--min-free", Some(v)) => limits.min_free = v,
|
||||
_ => {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
let Some(cmd) = args.get(i + 1) else {
|
||||
eprintln!("{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
};
|
||||
match memory::supervise(cmd, &args[i + 2..], limits, &mut memory::free_percentage) {
|
||||
memory::Outcome::Exited(Some(0)) => ExitCode::SUCCESS,
|
||||
memory::Outcome::Exited(c) => ExitCode::from(c.map_or(1, |c| c.clamp(1, 255)) as u8),
|
||||
other => {
|
||||
eprintln!("guard: {other:?}");
|
||||
ExitCode::from(3)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct RunArgs {
|
||||
cfg: run::RunConfig,
|
||||
backends: Vec<String>,
|
||||
repeat: u32,
|
||||
out: Option<PathBuf>,
|
||||
}
|
||||
|
||||
fn parse_run_args(args: &[String]) -> Result<RunArgs, String> {
|
||||
let mut bottle = None;
|
||||
let mut backend = None;
|
||||
let mut backends = Vec::new();
|
||||
let mut repeat = 1u32;
|
||||
let mut timeout = 300u64;
|
||||
let mut stall = None;
|
||||
let mut settle = 60u64;
|
||||
let mut expect = None;
|
||||
let mut out = None;
|
||||
let (mut min_start, mut min_free) = (50u8, 15u8);
|
||||
let mut i = 0;
|
||||
while i < args.len() && args[i] != "--" {
|
||||
let v = args
|
||||
.get(i + 1)
|
||||
.ok_or_else(|| format!("{} needs a value", args[i]))?
|
||||
.clone();
|
||||
match args[i].as_str() {
|
||||
"--bottle" => bottle = Some(v),
|
||||
"--backend" => backend = Some(v),
|
||||
"--backends" => backends = v.split(',').map(String::from).collect(),
|
||||
"--repeat" => repeat = v.parse().map_err(|_| "bad --repeat")?,
|
||||
"--timeout" => timeout = v.parse().map_err(|_| "bad --timeout")?,
|
||||
"--stall-timeout" => stall = Some(v.parse().map_err(|_| "bad --stall-timeout")?),
|
||||
"--settle-bound" => settle = v.parse().map_err(|_| "bad --settle-bound")?,
|
||||
"--expect" => expect = Some(v),
|
||||
"--out" => out = Some(PathBuf::from(v)),
|
||||
"--min-start-free" => min_start = v.parse().map_err(|_| "bad --min-start-free")?,
|
||||
"--min-free" => min_free = v.parse().map_err(|_| "bad --min-free")?,
|
||||
o => return Err(format!("unknown option {o}")),
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
let program = args.get(i + 1).ok_or("missing program after --")?.clone();
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
let installs = crossover::discover(&crossover::candidate_paths(&home));
|
||||
let install = installs.first().ok_or("no CrossOver installation found")?;
|
||||
let wine = run::wine_path(&install.path);
|
||||
if !wine.is_file() {
|
||||
return Err(format!(
|
||||
"{} not found in this CrossOver build",
|
||||
wine.display()
|
||||
));
|
||||
}
|
||||
let work = out
|
||||
.clone()
|
||||
.unwrap_or_else(|| PathBuf::from("artifacts/hybrid-runs"));
|
||||
Ok(RunArgs {
|
||||
cfg: run::RunConfig {
|
||||
wine,
|
||||
bottle: bottle.ok_or("--bottle is required")?,
|
||||
backend,
|
||||
program,
|
||||
args: args[i + 2..].to_vec(),
|
||||
timeout: std::time::Duration::from_secs(timeout),
|
||||
limits: memory::Limits {
|
||||
min_start_free: min_start,
|
||||
min_free,
|
||||
poll: std::time::Duration::from_millis(250),
|
||||
grace: std::time::Duration::from_secs(10),
|
||||
},
|
||||
expect,
|
||||
work_dir: work,
|
||||
stall_timeout: stall.map(std::time::Duration::from_secs),
|
||||
settle_bound: std::time::Duration::from_secs(settle),
|
||||
read_free: memory::free_percentage,
|
||||
},
|
||||
backends,
|
||||
repeat,
|
||||
out,
|
||||
})
|
||||
}
|
||||
|
||||
fn crossover_build() -> Option<String> {
|
||||
let home = PathBuf::from(std::env::var("HOME").unwrap_or_default());
|
||||
crossover::discover(&crossover::candidate_paths(&home))
|
||||
.first()
|
||||
.and_then(|i| {
|
||||
Some(format!(
|
||||
"{} ({})",
|
||||
i.short_version.clone()?,
|
||||
i.build_version.clone()?
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
fn save(dir: &std::path::Path, name: &str, j: &Json) {
|
||||
let _ = std::fs::create_dir_all(dir);
|
||||
let _ = std::fs::write(dir.join(name), j.render());
|
||||
}
|
||||
|
||||
fn run_cmd(args: &[String]) -> ExitCode {
|
||||
let a = match parse_run_args(args) {
|
||||
Ok(a) => a,
|
||||
Err(e) => {
|
||||
eprintln!("{e}\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
};
|
||||
let r = run::execute(&a.cfg, crossover_build());
|
||||
print!("{}", r.json.render());
|
||||
if let Some(dir) = &a.out {
|
||||
save(
|
||||
dir,
|
||||
&format!(
|
||||
"run-{}.json",
|
||||
std::time::SystemTime::now()
|
||||
.duration_since(std::time::UNIX_EPOCH)
|
||||
.map_or(0, |d| d.as_secs())
|
||||
),
|
||||
&r.json,
|
||||
);
|
||||
}
|
||||
if r.class == run::Class::Passed {
|
||||
ExitCode::SUCCESS
|
||||
} else {
|
||||
ExitCode::from(1)
|
||||
}
|
||||
}
|
||||
|
||||
fn bench_cmd(args: &[String]) -> ExitCode {
|
||||
let a = match parse_run_args(args) {
|
||||
Ok(a) if !a.backends.is_empty() => a,
|
||||
Ok(_) => {
|
||||
eprintln!("bench needs --backends\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e}\n{USAGE}");
|
||||
return ExitCode::from(2);
|
||||
}
|
||||
};
|
||||
let build = crossover_build();
|
||||
let mut per_backend = Vec::new();
|
||||
let mut all_ok = true;
|
||||
for b in &a.backends {
|
||||
let mut runs = Vec::new();
|
||||
for _ in 0..a.repeat {
|
||||
let mut cfg = a.cfg.clone();
|
||||
cfg.backend = if b == "default" {
|
||||
None
|
||||
} else {
|
||||
Some(b.clone())
|
||||
};
|
||||
let r = run::execute(&cfg, build.clone());
|
||||
all_ok &= r.class == run::Class::Passed;
|
||||
runs.push(r.json);
|
||||
}
|
||||
per_backend.push(Json::obj(vec![
|
||||
("backend", Json::str(b.clone())),
|
||||
("runs", Json::Arr(runs)),
|
||||
]));
|
||||
}
|
||||
let doc = Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-bench/0")),
|
||||
("repeat", Json::Num(a.repeat as f64)),
|
||||
("host", host::collect().to_json()),
|
||||
("results", Json::Arr(per_backend)),
|
||||
]);
|
||||
print!("{}", doc.render());
|
||||
if let Some(dir) = &a.out {
|
||||
save(dir, "bench.json", &doc);
|
||||
}
|
||||
if all_ok {
|
||||
ExitCode::SUCCESS
|
||||
} else {
|
||||
ExitCode::from(1)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() -> ExitCode {
|
||||
match std::env::args().nth(1).as_deref() {
|
||||
Some("run") => return run_cmd(&std::env::args().skip(2).collect::<Vec<_>>()),
|
||||
Some("bench") => return bench_cmd(&std::env::args().skip(2).collect::<Vec<_>>()),
|
||||
_ => {}
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("guard") {
|
||||
return guard(&std::env::args().skip(2).collect::<Vec<_>>());
|
||||
}
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let result: Result<Json, String> = match args.first().map(String::as_str) {
|
||||
Some("host") => Ok(host::collect().to_json()),
|
||||
Some("crossover") => {
|
||||
let app = match args.get(1).map(String::as_str) {
|
||||
Some("--app") => args.get(2).map(PathBuf::from),
|
||||
_ => None,
|
||||
};
|
||||
Ok(crossover_json(app))
|
||||
}
|
||||
Some("toolchain") => Ok(toolchain_json()),
|
||||
Some("frames") => match args.get(1) {
|
||||
None => Err("frames needs a file".into()),
|
||||
Some(f) => std::fs::read_to_string(f)
|
||||
.map_err(|e| format!("{f}: {e}"))
|
||||
.and_then(|t| frames::parse_intervals(&t).map_err(|e| e.to_string()))
|
||||
.and_then(|v| frames::analyze(&v).map_err(|e| e.to_string()))
|
||||
.map(|s| s.to_json()),
|
||||
},
|
||||
Some("receipt") => Ok(Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-receipt/0")),
|
||||
("host", host::collect().to_json()),
|
||||
("crossover", crossover_json(None)),
|
||||
("windows_cross_compilers", toolchain_json()),
|
||||
])),
|
||||
_ => Err(USAGE.into()),
|
||||
};
|
||||
match result {
|
||||
Ok(j) => {
|
||||
print!("{}", j.render());
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e}");
|
||||
ExitCode::from(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
//! Memory-pressure supervision of a child process.
|
||||
//!
|
||||
//! Adapted in concept from the memory guard in `mac/run-victory.sh` of
|
||||
//! <https://github.com/skakwy/victory-mac> (author skakwy, GPL-3.0; commit 22b3f8e, used with
|
||||
//! the author's permission): do not start a workload when little memory is free, and stop it
|
||||
//! when system-wide free memory falls below a limit, because GPU memory is wired under
|
||||
//! unified memory and a runaway workload can take the whole Mac down. This version is
|
||||
//! reimplemented in Rust, stops the child with SIGTERM before SIGKILL, and reports why it
|
||||
//! stopped. It supervises any command; it contains nothing game-specific.
|
||||
//!
|
||||
//! The reading is the "System-wide memory free percentage" line of `memory_pressure -Q`.
|
||||
//! That line was observed on macOS 27.0 (build 26A428); its format is not a documented
|
||||
//! stable interface, so an unreadable value is an error, never "assume enough memory".
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use std::process::{Child, Command};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
pub fn parse_free_percentage(output: &str) -> Option<u8> {
|
||||
let line = output
|
||||
.lines()
|
||||
.find(|l| l.contains("System-wide memory free percentage"))?;
|
||||
let digits: String = line
|
||||
.split(':')
|
||||
.nth(1)?
|
||||
.trim()
|
||||
.chars()
|
||||
.take_while(|c| c.is_ascii_digit())
|
||||
.collect();
|
||||
let v: u8 = digits.parse().ok()?;
|
||||
(v <= 100).then_some(v)
|
||||
}
|
||||
|
||||
pub fn free_percentage() -> Option<u8> {
|
||||
run("/usr/bin/memory_pressure", &["-Q"]).and_then(|o| parse_free_percentage(&o))
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct Limits {
|
||||
/// Refuse to start below this percent free.
|
||||
pub min_start_free: u8,
|
||||
/// Stop the child when free memory drops below this percent.
|
||||
pub min_free: u8,
|
||||
pub poll: Duration,
|
||||
/// Time between SIGTERM and SIGKILL.
|
||||
pub grace: Duration,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Outcome {
|
||||
/// The child ran to completion; `None` means it ended by a signal.
|
||||
Exited(Option<i32>),
|
||||
RefusedToStart {
|
||||
free: u8,
|
||||
need: u8,
|
||||
},
|
||||
StoppedLowMemory {
|
||||
free: u8,
|
||||
limit: u8,
|
||||
},
|
||||
/// Memory could not be read, so no guarantee can be given.
|
||||
MemoryUnreadable,
|
||||
SpawnFailed(String),
|
||||
}
|
||||
|
||||
pub(crate) fn terminate(child: &mut Child, grace: Duration) {
|
||||
let _ = Command::new("/bin/kill")
|
||||
.args(["-TERM", &child.id().to_string()])
|
||||
.status();
|
||||
let t0 = Instant::now();
|
||||
while t0.elapsed() < grace {
|
||||
if matches!(child.try_wait(), Ok(Some(_))) {
|
||||
return;
|
||||
}
|
||||
std::thread::sleep(Duration::from_millis(50));
|
||||
}
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
}
|
||||
|
||||
/// Run `program` under `limits`, reading memory through `read_free`.
|
||||
pub fn supervise(
|
||||
program: &str,
|
||||
args: &[String],
|
||||
limits: Limits,
|
||||
read_free: &mut dyn FnMut() -> Option<u8>,
|
||||
) -> Outcome {
|
||||
match read_free() {
|
||||
None => return Outcome::MemoryUnreadable,
|
||||
Some(free) if free < limits.min_start_free => {
|
||||
return Outcome::RefusedToStart {
|
||||
free,
|
||||
need: limits.min_start_free,
|
||||
};
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
let mut child = match Command::new(program).args(args).spawn() {
|
||||
Ok(c) => c,
|
||||
Err(e) => return Outcome::SpawnFailed(format!("{program}: {e}")),
|
||||
};
|
||||
loop {
|
||||
match child.try_wait() {
|
||||
Ok(Some(status)) => return Outcome::Exited(status.code()),
|
||||
Ok(None) => {}
|
||||
Err(e) => return Outcome::SpawnFailed(e.to_string()),
|
||||
}
|
||||
match read_free() {
|
||||
None => {
|
||||
terminate(&mut child, limits.grace);
|
||||
return Outcome::MemoryUnreadable;
|
||||
}
|
||||
Some(free) if free < limits.min_free => {
|
||||
terminate(&mut child, limits.grace);
|
||||
return Outcome::StoppedLowMemory {
|
||||
free,
|
||||
limit: limits.min_free,
|
||||
};
|
||||
}
|
||||
Some(_) => {}
|
||||
}
|
||||
std::thread::sleep(limits.poll);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn limits() -> Limits {
|
||||
Limits {
|
||||
min_start_free: 50,
|
||||
min_free: 20,
|
||||
poll: Duration::from_millis(20),
|
||||
grace: Duration::from_millis(500),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_memory_pressure_output() {
|
||||
let real = "The system has 25769803776 (1572864 pages with a page size of 16384).\nSystem-wide memory free percentage: 71%\n";
|
||||
assert_eq!(parse_free_percentage(real), Some(71));
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: 100%"),
|
||||
Some(100)
|
||||
);
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: 101%"),
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
parse_free_percentage("System-wide memory free percentage: x"),
|
||||
None
|
||||
);
|
||||
assert_eq!(parse_free_percentage("nothing"), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_to_start_when_low() {
|
||||
let out = supervise("/usr/bin/true", &[], limits(), &mut || Some(30));
|
||||
assert_eq!(out, Outcome::RefusedToStart { free: 30, need: 50 });
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unreadable_memory_is_an_error() {
|
||||
assert_eq!(
|
||||
supervise("/usr/bin/true", &[], limits(), &mut || None),
|
||||
Outcome::MemoryUnreadable
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn child_exit_code_is_reported() {
|
||||
let out = supervise(
|
||||
"/bin/sh",
|
||||
&["-c".into(), "exit 7".into()],
|
||||
limits(),
|
||||
&mut || Some(90),
|
||||
);
|
||||
assert_eq!(out, Outcome::Exited(Some(7)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stops_child_when_memory_drops() {
|
||||
let mut calls = 0;
|
||||
let t0 = Instant::now();
|
||||
let out = supervise("/bin/sleep", &["30".into()], limits(), &mut || {
|
||||
calls += 1;
|
||||
Some(if calls < 4 { 90 } else { 10 })
|
||||
});
|
||||
assert_eq!(
|
||||
out,
|
||||
Outcome::StoppedLowMemory {
|
||||
free: 10,
|
||||
limit: 20
|
||||
}
|
||||
);
|
||||
assert!(
|
||||
t0.elapsed() < Duration::from_secs(10),
|
||||
"child was not stopped promptly"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn real_reading_is_available_on_macos() {
|
||||
if cfg!(target_os = "macos") {
|
||||
assert!(free_percentage().is_some());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,685 @@
|
||||
//! Launch a Windows program through an installed CrossOver, supervise it, and write a
|
||||
//! structured record of what happened.
|
||||
//!
|
||||
//! Interface used: `<CrossOver.app>/Contents/SharedSupport/CrossOver/bin/wine --bottle B EXE`
|
||||
//! and `.../bin/wineserver -k`. These are **not documented by CodeWeavers** for macOS; they
|
||||
//! exist in the installed build and answer `--help` (cxbottle, cxstart) as observed on build
|
||||
//! 26.3.0.39832. Every record therefore carries the CrossOver build and a flag saying the
|
||||
//! launcher interface is vendor-help-only. The graphics backend is selected through the
|
||||
//! `CX_GRAPHICS_BACKEND` environment variable, which appears in third-party launch scripts and
|
||||
//! is likewise undocumented; an unrecognised value was observed to be ignored silently, so a
|
||||
//!
|
||||
//! Stall detection and the wait for memory to settle after a stop follow the supervision
|
||||
//! lessons in skakwy's <https://github.com/skakwy/victory-mac> (`mac/PROGRESS.md`,
|
||||
//! `mac/run-victory.sh`, `crates/victory-core/src/notes.rs` at commit 22b3f8e45a59; his own
|
||||
//! work, GPL-3.0, used with his permission): detect a hung run by absence of progress, stop a
|
||||
//! bottle with `wineserver -k` and its prefix, and do not start the next run until memory has
|
||||
//! been returned. Reimplemented here; none of his code is copied.
|
||||
//!
|
||||
//! A record names the backend *requested* and relies on the workload's own diagnostics
|
||||
//! (adapter name, backend log lines) to show what actually ran.
|
||||
|
||||
use crate::frames;
|
||||
use crate::json::Json;
|
||||
use crate::memory;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::{Command, Stdio};
|
||||
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct RunConfig {
|
||||
pub wine: PathBuf,
|
||||
pub bottle: String,
|
||||
pub backend: Option<String>,
|
||||
pub program: String,
|
||||
pub args: Vec<String>,
|
||||
pub timeout: Duration,
|
||||
pub limits: memory::Limits,
|
||||
/// Text that must appear in stdout for a zero exit to count as a pass.
|
||||
pub expect: Option<String>,
|
||||
pub work_dir: PathBuf,
|
||||
/// Stop the run when neither stdout nor stderr has grown for this long.
|
||||
pub stall_timeout: Option<Duration>,
|
||||
/// After a stop, wait at most this long for free memory to return to `min_start_free`.
|
||||
pub settle_bound: Duration,
|
||||
/// Free-memory reader; `memory::free_percentage` outside tests.
|
||||
pub read_free: fn() -> Option<u8>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum Class {
|
||||
Passed,
|
||||
FailedExit(i32),
|
||||
MissingExpectedMarker,
|
||||
TimedOut,
|
||||
/// No output on stdout or stderr for the stall timeout.
|
||||
Stalled,
|
||||
StoppedLowMemory,
|
||||
RefusedToStart,
|
||||
/// The Windows loader did not accept the file (for example an ARM64 PE this build cannot run).
|
||||
CannotExecute,
|
||||
/// The workload reported that no graphics device could be created.
|
||||
NoDevice,
|
||||
MemoryUnreadable,
|
||||
LaunchFailed,
|
||||
}
|
||||
|
||||
impl Class {
|
||||
pub fn name(&self) -> String {
|
||||
match self {
|
||||
Class::Passed => "passed".into(),
|
||||
Class::FailedExit(c) => format!("failed_exit_{c}"),
|
||||
Class::MissingExpectedMarker => "missing_expected_marker".into(),
|
||||
Class::TimedOut => "timed_out".into(),
|
||||
Class::Stalled => "stalled".into(),
|
||||
Class::StoppedLowMemory => "stopped_low_memory".into(),
|
||||
Class::RefusedToStart => "refused_to_start_low_memory".into(),
|
||||
Class::CannotExecute => "cannot_execute".into(),
|
||||
Class::NoDevice => "no_graphics_device".into(),
|
||||
Class::MemoryUnreadable => "memory_unreadable".into(),
|
||||
Class::LaunchFailed => "launch_failed".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Classify a finished (or stopped) run from observable facts only.
|
||||
pub fn classify(exit: Option<i32>, stdout: &str, stderr: &str, expect: Option<&str>) -> Class {
|
||||
if stderr.contains("cannot execute") {
|
||||
return Class::CannotExecute;
|
||||
}
|
||||
if stdout.contains("NO DEVICE") && exit == Some(2) {
|
||||
return Class::NoDevice;
|
||||
}
|
||||
match exit {
|
||||
Some(0) => match expect {
|
||||
Some(m) if !stdout.contains(m) => Class::MissingExpectedMarker,
|
||||
_ => Class::Passed,
|
||||
},
|
||||
Some(c) => Class::FailedExit(c),
|
||||
None => Class::FailedExit(-1),
|
||||
}
|
||||
}
|
||||
|
||||
/// Known host-environment noise in CrossOver output, reported as diagnostics instead of
|
||||
/// silently dropped. Returns (kind, line) for each recognised line.
|
||||
pub fn diagnostics(text: &str) -> Vec<(&'static str, String)> {
|
||||
let mut out = Vec::new();
|
||||
for line in text.lines() {
|
||||
if line.contains("LibClamAV Error") || line.contains("Can't open file or directory") {
|
||||
out.push(("clamav-database-missing", line.to_string()));
|
||||
} else if line.starts_with("warn:") && line.contains("DXVK") {
|
||||
out.push(("dxvk-warning", line.to_string()));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// Which graphics layer announced itself, judged from the workload's stdout and stderr.
|
||||
pub fn detected_backend(output: &str) -> &'static str {
|
||||
if output.contains("DXVK:") {
|
||||
"dxvk"
|
||||
} else if output.contains("DXMT") || output.contains("D3D_FEATURE_LEVEL_11_1\ninfo: Using") {
|
||||
"dxmt"
|
||||
} else if output.contains("adapter=AMD Compatibility Mode") {
|
||||
"d3dmetal (inferred: Apple-reported adapter identity)"
|
||||
} else if output.contains("adapter=Apple M") {
|
||||
"wined3d (inferred: native adapter name, no layer banner)"
|
||||
} else {
|
||||
"unknown"
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct Samples {
|
||||
pub peak_rss_kb: u64,
|
||||
pub mean_cpu_percent_of_core: f64,
|
||||
pub min_free_percent: Option<u8>,
|
||||
pub samples: u32,
|
||||
}
|
||||
|
||||
/// Sum RSS (KB) and CPU % of processes whose command line mentions the CrossOver bundle or the
|
||||
/// bottle directory. Heuristic: processes not started from those paths are not counted.
|
||||
fn sample_processes(needles: &[String]) -> (u64, f64) {
|
||||
let Some(out) = crate::cmdutil::run("/bin/ps", &["-axo", "rss=,pcpu=,command="]) else {
|
||||
return (0, 0.0);
|
||||
};
|
||||
let (mut rss, mut cpu) = (0u64, 0f64);
|
||||
for l in out.lines() {
|
||||
if !needles.iter().any(|n| l.contains(n.as_str())) {
|
||||
continue;
|
||||
}
|
||||
let mut it = l.split_whitespace();
|
||||
rss += it.next().and_then(|v| v.parse::<u64>().ok()).unwrap_or(0);
|
||||
cpu += it.next().and_then(|v| v.parse::<f64>().ok()).unwrap_or(0.0);
|
||||
}
|
||||
(rss, cpu)
|
||||
}
|
||||
|
||||
fn thermal() -> Json {
|
||||
match crate::cmdutil::run("/usr/bin/pmset", &["-g", "therm"]) {
|
||||
Some(t) => Json::Arr(
|
||||
t.lines()
|
||||
.map(|l| Json::str(l.trim()))
|
||||
.filter(|j| *j != Json::str(""))
|
||||
.collect(),
|
||||
),
|
||||
None => Json::Null,
|
||||
}
|
||||
}
|
||||
|
||||
pub struct RunRecord {
|
||||
pub class: Class,
|
||||
pub duration: Duration,
|
||||
pub exit: Option<i32>,
|
||||
pub stdout: String,
|
||||
pub stderr: String,
|
||||
pub samples: Samples,
|
||||
pub json: Json,
|
||||
}
|
||||
|
||||
pub fn execute(cfg: &RunConfig, crossover_build: Option<String>) -> RunRecord {
|
||||
let t_wall = SystemTime::now()
|
||||
.duration_since(UNIX_EPOCH)
|
||||
.map_or(0, |d| d.as_secs());
|
||||
let _ = std::fs::create_dir_all(&cfg.work_dir);
|
||||
let out_path = cfg
|
||||
.work_dir
|
||||
.join(format!("stdout-{t_wall}-{}.txt", std::process::id()));
|
||||
let err_path = cfg
|
||||
.work_dir
|
||||
.join(format!("stderr-{t_wall}-{}.txt", std::process::id()));
|
||||
let mut settle: Option<(Duration, bool)> = None;
|
||||
let thermal_before = thermal();
|
||||
let free_start = (cfg.read_free)();
|
||||
|
||||
let mut result = RunRecord {
|
||||
class: Class::LaunchFailed,
|
||||
duration: Duration::ZERO,
|
||||
exit: None,
|
||||
stdout: String::new(),
|
||||
stderr: String::new(),
|
||||
samples: Samples::default(),
|
||||
json: Json::Null,
|
||||
};
|
||||
|
||||
match free_start {
|
||||
None => result.class = Class::MemoryUnreadable,
|
||||
Some(f) if f < cfg.limits.min_start_free => result.class = Class::RefusedToStart,
|
||||
Some(_) => {
|
||||
let files = std::fs::File::create(&out_path)
|
||||
.and_then(|o| std::fs::File::create(&err_path).map(|e| (o, e)));
|
||||
if let Ok((o, e)) = files {
|
||||
let mut cmd = Command::new(&cfg.wine);
|
||||
cmd.arg("--bottle")
|
||||
.arg(&cfg.bottle)
|
||||
.arg(&cfg.program)
|
||||
.args(&cfg.args);
|
||||
cmd.stdout(Stdio::from(o)).stderr(Stdio::from(e));
|
||||
if let Some(b) = &cfg.backend {
|
||||
cmd.env("CX_GRAPHICS_BACKEND", b);
|
||||
}
|
||||
let started = Instant::now();
|
||||
if let Ok(mut child) = cmd.spawn() {
|
||||
let bundle = cfg
|
||||
.wine
|
||||
.to_string_lossy()
|
||||
.split("/Contents/")
|
||||
.next()
|
||||
.unwrap_or("")
|
||||
.to_string();
|
||||
let needles = vec![bundle, format!("Bottles/{}", cfg.bottle)];
|
||||
let (mut cpu_sum, mut n) = (0f64, 0u32);
|
||||
let mut stop: Option<Class> = None;
|
||||
let mut last_len = 0u64;
|
||||
let mut last_growth = Instant::now();
|
||||
loop {
|
||||
match child.try_wait() {
|
||||
Ok(Some(st)) => {
|
||||
result.exit = st.code();
|
||||
break;
|
||||
}
|
||||
Ok(None) => {}
|
||||
Err(_) => break,
|
||||
}
|
||||
let (rss, cpu) = sample_processes(&needles);
|
||||
result.samples.peak_rss_kb = result.samples.peak_rss_kb.max(rss);
|
||||
cpu_sum += cpu;
|
||||
n += 1;
|
||||
match (cfg.read_free)() {
|
||||
Some(f) => {
|
||||
let m = result.samples.min_free_percent.map_or(f, |x| x.min(f));
|
||||
result.samples.min_free_percent = Some(m);
|
||||
if f < cfg.limits.min_free {
|
||||
stop = Some(Class::StoppedLowMemory);
|
||||
}
|
||||
}
|
||||
None => stop = Some(Class::MemoryUnreadable),
|
||||
}
|
||||
let len = [&out_path, &err_path]
|
||||
.iter()
|
||||
.map(|p| std::fs::metadata(p).map_or(0, |m| m.len()))
|
||||
.sum::<u64>();
|
||||
if len != last_len {
|
||||
last_len = len;
|
||||
last_growth = Instant::now();
|
||||
}
|
||||
if stop.is_none() && started.elapsed() > cfg.timeout {
|
||||
stop = Some(Class::TimedOut);
|
||||
}
|
||||
if stop.is_none()
|
||||
&& cfg.stall_timeout.is_some_and(|d| last_growth.elapsed() > d)
|
||||
{
|
||||
stop = Some(Class::Stalled);
|
||||
}
|
||||
if stop.is_some() {
|
||||
memory::terminate(&mut child, cfg.limits.grace);
|
||||
stop_bottle(&cfg.wine, &cfg.bottle);
|
||||
break;
|
||||
}
|
||||
std::thread::sleep(cfg.limits.poll);
|
||||
}
|
||||
result.duration = started.elapsed();
|
||||
if stop.is_some() {
|
||||
let t = Instant::now();
|
||||
let need = cfg.limits.min_start_free;
|
||||
let mut recovered = false;
|
||||
loop {
|
||||
if (cfg.read_free)().is_some_and(|f| f >= need) {
|
||||
recovered = true;
|
||||
break;
|
||||
}
|
||||
if t.elapsed() >= cfg.settle_bound {
|
||||
break;
|
||||
}
|
||||
std::thread::sleep(cfg.limits.poll);
|
||||
}
|
||||
settle = Some((t.elapsed(), recovered));
|
||||
}
|
||||
result.samples.samples = n;
|
||||
result.samples.mean_cpu_percent_of_core =
|
||||
if n > 0 { cpu_sum / n as f64 } else { 0.0 };
|
||||
result.stdout = std::fs::read_to_string(&out_path).unwrap_or_default();
|
||||
result.stderr = std::fs::read_to_string(&err_path).unwrap_or_default();
|
||||
result.class = stop.unwrap_or_else(|| {
|
||||
classify(
|
||||
result.exit,
|
||||
&result.stdout,
|
||||
&result.stderr,
|
||||
cfg.expect.as_deref(),
|
||||
)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let intervals: Vec<f64> = result
|
||||
.stdout
|
||||
.lines()
|
||||
.filter_map(|l| l.strip_prefix("frame_ms "))
|
||||
.filter_map(|v| v.trim().parse().ok())
|
||||
.collect();
|
||||
let frame_stats = frames::analyze(&intervals).ok().map(|s| s.to_json());
|
||||
let combined = format!("{}\n{}", result.stdout, result.stderr);
|
||||
let diags: Vec<Json> = diagnostics(&combined)
|
||||
.into_iter()
|
||||
.map(|(k, l)| Json::obj(vec![("kind", Json::str(k)), ("line", Json::str(l))]))
|
||||
.collect();
|
||||
let tail = |s: &str| -> Json {
|
||||
let lines: Vec<&str> = s.lines().filter(|l| !l.starts_with("frame_ms ")).collect();
|
||||
let keep = if lines.len() > 40 {
|
||||
&lines[lines.len() - 40..]
|
||||
} else {
|
||||
&lines[..]
|
||||
};
|
||||
Json::Arr(keep.iter().map(|l| Json::str(*l)).collect())
|
||||
};
|
||||
result.json = Json::obj(vec![
|
||||
("schema", Json::str("betterxen-hybrid-run/0")),
|
||||
("unix_time", Json::Num(t_wall as f64)),
|
||||
("crossover_build", Json::opt_str(crossover_build)),
|
||||
(
|
||||
"launcher_interface",
|
||||
Json::str(
|
||||
"CrossOver bin/wine --bottle (vendor --help only; not documented by CodeWeavers for macOS)",
|
||||
),
|
||||
),
|
||||
("bottle", Json::str(cfg.bottle.clone())),
|
||||
("backend_requested", Json::opt_str(cfg.backend.clone())),
|
||||
("backend_variable_documented", Json::Bool(false)),
|
||||
("backend_detected", Json::str(detected_backend(&combined))),
|
||||
("program", Json::str(cfg.program.clone())),
|
||||
(
|
||||
"args",
|
||||
Json::Arr(cfg.args.iter().map(|a| Json::str(a.clone())).collect()),
|
||||
),
|
||||
("classification", Json::str(result.class.name())),
|
||||
(
|
||||
"exit_code",
|
||||
result.exit.map_or(Json::Null, |c| Json::Num(c as f64)),
|
||||
),
|
||||
(
|
||||
"duration_ms",
|
||||
Json::Num(result.duration.as_secs_f64() * 1000.0),
|
||||
),
|
||||
("timeout_s", Json::Num(cfg.timeout.as_secs_f64())),
|
||||
(
|
||||
"stall_timeout_s",
|
||||
cfg.stall_timeout
|
||||
.map_or(Json::Null, |d| Json::Num(d.as_secs_f64())),
|
||||
),
|
||||
(
|
||||
"memory_settle_after_stop",
|
||||
settle.map_or(Json::Null, |(d, ok)| {
|
||||
Json::obj(vec![
|
||||
("waited_ms", Json::Num(d.as_secs_f64() * 1000.0)),
|
||||
("recovered_to_start_threshold", Json::Bool(ok)),
|
||||
("bound_s", Json::Num(cfg.settle_bound.as_secs_f64())),
|
||||
])
|
||||
}),
|
||||
),
|
||||
(
|
||||
"free_memory_percent_at_start",
|
||||
free_start.map_or(Json::Null, |f| Json::Num(f as f64)),
|
||||
),
|
||||
(
|
||||
"min_free_memory_percent_during_run",
|
||||
result
|
||||
.samples
|
||||
.min_free_percent
|
||||
.map_or(Json::Null, |f| Json::Num(f as f64)),
|
||||
),
|
||||
(
|
||||
"peak_crossover_rss_kb_sampled",
|
||||
Json::Num(result.samples.peak_rss_kb as f64),
|
||||
),
|
||||
(
|
||||
"mean_crossover_cpu_percent_of_one_core_sampled",
|
||||
Json::Num(result.samples.mean_cpu_percent_of_core),
|
||||
),
|
||||
("process_samples", Json::Num(result.samples.samples as f64)),
|
||||
(
|
||||
"gpu_utilization",
|
||||
Json::str("not collected: no unprivileged documented source on this host"),
|
||||
),
|
||||
("thermal_before", thermal_before),
|
||||
("thermal_after", thermal()),
|
||||
("diagnostics", Json::Arr(diags)),
|
||||
("frame_stats", frame_stats.unwrap_or(Json::Null)),
|
||||
("stdout_tail", tail(&result.stdout)),
|
||||
("stderr_tail", tail(&result.stderr)),
|
||||
]);
|
||||
let _ = std::fs::remove_file(&out_path);
|
||||
let _ = std::fs::remove_file(&err_path);
|
||||
result
|
||||
}
|
||||
|
||||
/// Prefix directory of a bottle. CrossOver documents `BottleDir` in its preferences; otherwise
|
||||
/// the default location under Application Support is used.
|
||||
pub fn bottle_prefix(bottle: &str) -> PathBuf {
|
||||
let base = crate::crossover::preference("BottleDir")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(std::env::var("HOME").unwrap_or_default())
|
||||
.join("Library/Application Support/CrossOver/Bottles")
|
||||
});
|
||||
base.join(bottle)
|
||||
}
|
||||
|
||||
/// Stop every process of one bottle with `wineserver -k`, selecting the bottle through
|
||||
/// `WINEPREFIX`. Setting `CX_BOTTLE` instead was tried first and observed NOT to select the
|
||||
/// bottle: the Windows process kept running after the supervisor reported it stopped.
|
||||
pub fn stop_bottle(wine: &Path, bottle: &str) {
|
||||
if let Some(dir) = wine.parent() {
|
||||
let _ = Command::new(dir.join("wineserver"))
|
||||
.arg("-k")
|
||||
.env("WINEPREFIX", bottle_prefix(bottle))
|
||||
.status();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn wine_path(app: &Path) -> PathBuf {
|
||||
app.join("Contents/SharedSupport/CrossOver/bin/wine")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn classifies_from_observed_facts() {
|
||||
assert_eq!(classify(Some(0), "PASS", "", Some("PASS")), Class::Passed);
|
||||
assert_eq!(
|
||||
classify(Some(0), "ok", "", Some("PASS")),
|
||||
Class::MissingExpectedMarker
|
||||
);
|
||||
assert_eq!(classify(Some(0), "", "", None), Class::Passed);
|
||||
assert_eq!(classify(Some(1), "FAIL", "", None), Class::FailedExit(1));
|
||||
assert_eq!(
|
||||
classify(Some(2), "NO DEVICE hr=0x1", "", None),
|
||||
Class::NoDevice
|
||||
);
|
||||
assert_eq!(classify(Some(2), "other", "", None), Class::FailedExit(2));
|
||||
assert_eq!(
|
||||
classify(
|
||||
Some(1),
|
||||
"",
|
||||
"winewrapper.exe:error: cannot execute L\"a.exe\"",
|
||||
None
|
||||
),
|
||||
Class::CannotExecute
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recognises_noise_and_backends() {
|
||||
let d = diagnostics(
|
||||
"LibClamAV Error: x\nERROR: Can't open file or directory\nwarn: DXVK: No state cache\nfine",
|
||||
);
|
||||
assert_eq!(d.len(), 3);
|
||||
assert_eq!(d[0].0, "clamav-database-missing");
|
||||
assert!(detected_backend("info: DXVK: cxaddon\nadapter=Apple M4").starts_with("dxvk"));
|
||||
assert!(detected_backend("adapter=AMD Compatibility Mode").starts_with("d3dmetal"));
|
||||
assert_eq!(detected_backend("nothing"), "unknown");
|
||||
}
|
||||
|
||||
fn stub(dir: &Path, body: &str) -> PathBuf {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
std::fs::create_dir_all(dir).unwrap();
|
||||
let p = dir.join("wine");
|
||||
std::fs::write(&p, format!("#!/bin/sh\n{body}\n")).unwrap();
|
||||
std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
p
|
||||
}
|
||||
|
||||
fn cfg(wine: PathBuf, timeout_ms: u64, tag: &str) -> RunConfig {
|
||||
RunConfig {
|
||||
wine,
|
||||
bottle: "t".into(),
|
||||
backend: None,
|
||||
program: "x.exe".into(),
|
||||
args: vec![],
|
||||
timeout: Duration::from_millis(timeout_ms),
|
||||
limits: memory::Limits {
|
||||
min_start_free: 0,
|
||||
min_free: 0,
|
||||
poll: Duration::from_millis(30),
|
||||
grace: Duration::from_millis(500),
|
||||
},
|
||||
expect: Some("PASS".into()),
|
||||
work_dir: std::env::temp_dir().join(format!("bxrun-{tag}-{}", std::process::id())),
|
||||
stall_timeout: None,
|
||||
settle_bound: Duration::from_millis(200),
|
||||
read_free: memory::free_percentage,
|
||||
}
|
||||
}
|
||||
|
||||
// These use a stub standing in for the launcher: they prove the supervision and record
|
||||
// logic, not anything about CrossOver.
|
||||
#[test]
|
||||
fn stub_run_records_pass_frames_and_env() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stub1-{}", std::process::id()));
|
||||
let w = stub(
|
||||
&dir,
|
||||
"echo \"backend=$CX_GRAPHICS_BACKEND\"; echo 'frame_ms 10'; echo 'frame_ms 20'; echo PASS",
|
||||
);
|
||||
let mut c = cfg(w, 10_000, "a");
|
||||
c.backend = Some("dxmt".into());
|
||||
let r = execute(&c, Some("test".into()));
|
||||
assert_eq!(r.class, Class::Passed);
|
||||
let j = r.json.render();
|
||||
assert!(j.contains("\"frames\": 2"), "{j}");
|
||||
assert!(j.contains("backend=dxmt"), "{j}");
|
||||
assert!(j.contains("\"backend_requested\": \"dxmt\""));
|
||||
assert!(
|
||||
!j.contains("frame_ms 10"),
|
||||
"frame lines belong in frame_stats, not the tail"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stub_run_times_out_and_is_stopped() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stub2-{}", std::process::id()));
|
||||
let w = stub(&dir, "exec /bin/sleep 30");
|
||||
let t0 = Instant::now();
|
||||
let r = execute(&cfg(w, 300, "b"), None);
|
||||
assert_eq!(r.class, Class::TimedOut);
|
||||
assert!(t0.elapsed() < Duration::from_secs(10));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stub_failure_is_classified_with_exit_code() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stub3-{}", std::process::id()));
|
||||
let w = stub(&dir, "echo FAIL; exit 3");
|
||||
assert_eq!(
|
||||
execute(&cfg(w, 10_000, "c"), None).class,
|
||||
Class::FailedExit(3)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn silent_workload_is_stopped_as_stalled_before_the_timeout() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stall1-{}", std::process::id()));
|
||||
let w = stub(&dir, "exec /bin/sleep 30");
|
||||
let mut c = cfg(w, 20_000, "d");
|
||||
c.stall_timeout = Some(Duration::from_millis(300));
|
||||
let t0 = Instant::now();
|
||||
let r = execute(&c, None);
|
||||
assert_eq!(r.class, Class::Stalled);
|
||||
assert!(
|
||||
t0.elapsed() < Duration::from_secs(5),
|
||||
"stall must fire long before the 20 s timeout"
|
||||
);
|
||||
assert!(r.json.render().contains("\"classification\": \"stalled\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn workload_that_keeps_printing_is_not_stalled() {
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stall2-{}", std::process::id()));
|
||||
// Prints every 0.1 s for about 1.2 s: longer than the 0.5 s stall timeout in total.
|
||||
let w = stub(
|
||||
&dir,
|
||||
"i=0; while [ $i -lt 12 ]; do echo tick; i=$((i+1)); sleep 0.1; done; echo PASS",
|
||||
);
|
||||
let mut c = cfg(w, 20_000, "e");
|
||||
c.stall_timeout = Some(Duration::from_millis(500));
|
||||
assert_eq!(execute(&c, None).class, Class::Passed);
|
||||
}
|
||||
|
||||
static FREE: std::sync::atomic::AtomicU8 = std::sync::atomic::AtomicU8::new(90);
|
||||
fn fake_free() -> Option<u8> {
|
||||
Some(FREE.load(std::sync::atomic::Ordering::SeqCst))
|
||||
}
|
||||
|
||||
// One test owns the shared `FREE` value, so it does not race with the others.
|
||||
#[test]
|
||||
fn after_a_stop_the_run_waits_for_memory_to_return() {
|
||||
use std::sync::atomic::Ordering::SeqCst;
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-settle-{}", std::process::id()));
|
||||
let w = stub(&dir, "exec /bin/sleep 30");
|
||||
let mut c = cfg(w, 300, "f");
|
||||
c.read_free = fake_free;
|
||||
c.limits.min_start_free = 50;
|
||||
c.limits.min_free = 0; // only the timeout stops the run
|
||||
c.settle_bound = Duration::from_secs(5);
|
||||
|
||||
// Memory drops 100 ms in and returns 900 ms in; the timeout stop happens at about 300 ms.
|
||||
FREE.store(90, SeqCst);
|
||||
let h = std::thread::spawn(|| {
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
FREE.store(10, SeqCst);
|
||||
std::thread::sleep(Duration::from_millis(800));
|
||||
FREE.store(90, SeqCst);
|
||||
});
|
||||
let r = execute(&c, None);
|
||||
h.join().unwrap();
|
||||
assert_eq!(r.class, Class::TimedOut);
|
||||
let j = r.json.render();
|
||||
assert!(j.contains("\"recovered_to_start_threshold\": true"), "{j}");
|
||||
assert!(r.duration >= Duration::from_millis(300));
|
||||
|
||||
// Memory never returns: the wait gives up at the bound and says so.
|
||||
FREE.store(90, SeqCst);
|
||||
let h = std::thread::spawn(|| {
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
FREE.store(10, SeqCst);
|
||||
});
|
||||
c.settle_bound = Duration::from_millis(400);
|
||||
let t0 = Instant::now();
|
||||
let r = execute(&c, None);
|
||||
h.join().unwrap();
|
||||
assert!(t0.elapsed() < Duration::from_secs(5));
|
||||
assert!(
|
||||
r.json
|
||||
.render()
|
||||
.contains("\"recovered_to_start_threshold\": false")
|
||||
);
|
||||
FREE.store(90, SeqCst);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stopping_a_bottle_selects_it_through_wineprefix() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
if !cfg!(target_os = "macos") {
|
||||
return;
|
||||
}
|
||||
let dir = std::env::temp_dir().join(format!("bxrun-stop-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let log = dir.join("wineserver.log");
|
||||
let ws = dir.join("wineserver");
|
||||
std::fs::write(
|
||||
&ws,
|
||||
format!(
|
||||
"#!/bin/sh\necho \"args=$* WINEPREFIX=$WINEPREFIX\" > '{}'\n",
|
||||
log.display()
|
||||
),
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::set_permissions(&ws, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
stop_bottle(&dir.join("wine"), "my-bottle");
|
||||
let got = std::fs::read_to_string(&log).unwrap();
|
||||
assert!(got.contains("args=-k"), "{got}");
|
||||
assert!(
|
||||
got.contains("Bottles/my-bottle") || got.contains("/my-bottle"),
|
||||
"{got}"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
//! Probe Windows cross-compilers for original test programs (issue #364).
|
||||
//!
|
||||
//! Reports what is installed and what each compiler targets; it does not install anything.
|
||||
|
||||
use crate::cmdutil::run;
|
||||
use crate::json::Json;
|
||||
|
||||
/// (name, kind). Order is the discovery order only, not a preference.
|
||||
pub const CANDIDATES: &[&str] = &[
|
||||
"aarch64-w64-mingw32-clang",
|
||||
"x86_64-w64-mingw32-clang",
|
||||
"x86_64-w64-mingw32-gcc",
|
||||
"i686-w64-mingw32-gcc",
|
||||
];
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Compiler {
|
||||
pub name: String,
|
||||
pub path: String,
|
||||
pub version_line: Option<String>,
|
||||
pub target_machine: Option<String>,
|
||||
}
|
||||
|
||||
pub fn probe(search_path: &str) -> Vec<Compiler> {
|
||||
CANDIDATES
|
||||
.iter()
|
||||
.filter_map(|name| {
|
||||
let path = search_path
|
||||
.split(':')
|
||||
.map(|d| std::path::Path::new(d).join(name))
|
||||
.find(|p| p.is_file())?;
|
||||
let p = path.to_str()?.to_string();
|
||||
Some(Compiler {
|
||||
name: name.to_string(),
|
||||
version_line: run(&p, &["--version"])
|
||||
.and_then(|s| s.lines().next().map(String::from)),
|
||||
target_machine: run(&p, &["-dumpmachine"]),
|
||||
path: p,
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
impl Compiler {
|
||||
pub fn to_json(&self) -> Json {
|
||||
Json::obj(vec![
|
||||
("name", Json::str(self.name.clone())),
|
||||
("path", Json::str(self.path.clone())),
|
||||
("version", Json::opt_str(self.version_line.clone())),
|
||||
("target_machine", Json::opt_str(self.target_machine.clone())),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn empty_path_finds_nothing() {
|
||||
assert!(probe("").is_empty());
|
||||
assert!(probe("/nonexistent-dir").is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finds_a_stub_compiler_and_reports_its_output() {
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
let dir = std::env::temp_dir().join(format!("bxhybrid-tc-{}", std::process::id()));
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
let f = dir.join("x86_64-w64-mingw32-gcc");
|
||||
std::fs::write(&f, "#!/bin/sh\nif [ \"$1\" = -dumpmachine ]; then echo x86_64-w64-mingw32; else echo stub 1.0; fi\n").unwrap();
|
||||
std::fs::set_permissions(&f, std::fs::Permissions::from_mode(0o755)).unwrap();
|
||||
let found = probe(dir.to_str().unwrap());
|
||||
assert_eq!(found.len(), 1);
|
||||
assert_eq!(
|
||||
found[0].target_machine.as_deref(),
|
||||
Some("x86_64-w64-mingw32")
|
||||
);
|
||||
assert_eq!(found[0].version_line.as_deref(), Some("stub 1.0"));
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
}
|
||||
+33
-10
@@ -633,15 +633,22 @@ impl Arm64Assembler {
|
||||
self.emit(0x92800000 | (hw << 21) | ((imm16 as u32) << 5) | (xd as u32 & 0x1f));
|
||||
}
|
||||
|
||||
/// Load a full 64-bit constant into register Xd with the fewest MOVZ or
|
||||
/// MOVN plus MOVK instructions: one for each halfword that differs from
|
||||
/// the background the first instruction leaves, and always at least one.
|
||||
/// MOVZ leaves zero halfwords and MOVN leaves 0xFFFF ones, so MOVN is used
|
||||
/// when more halfwords are 0xFFFF than zero.
|
||||
/// Load a full 64-bit constant into Xd with the fewest wide moves.
|
||||
/// A 32-bit MOVN leaves one low halfword set to 0xFFFF and zero-extends
|
||||
/// the result into Xd. For other values, select a 64-bit MOVZ or MOVN
|
||||
/// background and use MOVK for the remaining halfwords.
|
||||
pub fn load_imm_64(&mut self, xd: u8, val: u64) {
|
||||
let halves: [u16; 4] = std::array::from_fn(|i| (val >> (16 * i)) as u16);
|
||||
let zeros = halves.iter().filter(|&&h| h == 0).count();
|
||||
let ones = halves.iter().filter(|&&h| h == 0xffff).count();
|
||||
// With only the top two halfwords zero, a 32-bit MOVN saves one
|
||||
// instruction when either of the lower halfwords is all ones.
|
||||
if zeros == 2 && ones != 0 && val >> 32 == 0 {
|
||||
let index = usize::from(halves[1] != u16::MAX);
|
||||
let imm16 = u32::from(!halves[index]);
|
||||
self.emit(0x1280_0000 | ((index as u32) << 21) | (imm16 << 5) | u32::from(xd & 0x1f));
|
||||
return;
|
||||
}
|
||||
let background = if ones > zeros { 0xffff } else { 0 };
|
||||
// The first halfword that differs from the background, or halfword 0
|
||||
// when none does (val is 0 or all ones).
|
||||
@@ -883,12 +890,14 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Constants at the halfword boundaries the MOVZ/MOVN choice depends on.
|
||||
const IMMEDIATE_EDGES: [u64; 16] = [
|
||||
const IMMEDIATE_EDGES: [u64; 18] = [
|
||||
0,
|
||||
1,
|
||||
0xffff,
|
||||
0x1_0000,
|
||||
0x8000_0000,
|
||||
0xffff_1234,
|
||||
0x1234_ffff,
|
||||
0xffff_ffff,
|
||||
0x1_0000_0000,
|
||||
0x1234_0000_0000_0000,
|
||||
@@ -904,10 +913,13 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn immediate_sequences_match_llvm_encodings() {
|
||||
// llvm-mc -triple=aarch64-apple-macos -show-encoding.
|
||||
// A64 words from llvm-mc and Apple Clang's integrated assembler.
|
||||
let cases: &[(u64, &[u32])] = &[
|
||||
(0, &[0xd2800000]), // movz x0, #0
|
||||
(u64::MAX, &[0x92800000]), // movn x0, #0
|
||||
(0xffff_1234, &[0x129db960]), // movn w0, #0xedcb
|
||||
(0x1234_ffff, &[0x12bdb960]), // movn w0, #0xedcb, lsl #16
|
||||
(0xffff_ffff, &[0x12800000]), // movn w0, #0
|
||||
(0xffff_ffff_ffff_1234, &[0x929db960]), // movn x0, #0xedcb
|
||||
(0x1234_0000_0000_0000, &[0xd2e24680]), // movz x0, #0x1234, lsl #48
|
||||
(0xffff_0000_ffff_ffff, &[0x92dfffe0]), // movn x0, #0xffff, lsl #32
|
||||
@@ -930,9 +942,16 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Fewest MOVZ/MOVN/MOVK instructions for `value`: every halfword that is
|
||||
/// neither zero (after MOVZ) nor 0xFFFF (after MOVN), and at least one.
|
||||
/// A 32-bit MOVN can write a zero-extended value if its low word's
|
||||
/// complement fits in a single halfword. Otherwise count the halfwords
|
||||
/// that differ from either 64-bit initializer's background.
|
||||
fn shortest_wide_move(value: u64) -> usize {
|
||||
if let Ok(low) = u32::try_from(value) {
|
||||
let complement = !low;
|
||||
if complement <= u32::from(u16::MAX) || complement.trailing_zeros() >= 16 {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
let halves = (0..4).map(|i| (value >> (16 * i)) & 0xffff);
|
||||
let not_zero = halves.clone().filter(|&h| h != 0).count();
|
||||
let not_ones = halves.filter(|&h| h != 0xffff).count();
|
||||
@@ -964,9 +983,13 @@ mod tests {
|
||||
for value in values {
|
||||
for register in [X0, X9] {
|
||||
let mut asm = Arm64Assembler::new();
|
||||
// Seed the destination so a W-register load must clear the high bits.
|
||||
asm.movn_64(register, 0, 0);
|
||||
// Assembler offsets count 32-bit instruction words.
|
||||
let start = asm.current_offset();
|
||||
asm.load_imm_64(register, value);
|
||||
assert_eq!(
|
||||
asm.instructions().len(),
|
||||
asm.current_offset() - start,
|
||||
shortest_wide_move(value),
|
||||
"{value:#x}"
|
||||
);
|
||||
|
||||
+19
-4
@@ -8,9 +8,16 @@ then read the [interface contracts](interfaces.md). Reproduce an
|
||||
[independent validation suite](../tests/validation/README.md) before changing
|
||||
either path. The [changelog](../CHANGELOG.md) records notable changes.
|
||||
|
||||
Use the [BetterXen development phases](development-phases.md) for current work
|
||||
order, existing issue/PR dependencies and measurable completion criteria.
|
||||
Historical phase checkpoints retain their original evidence scope.
|
||||
Use the [roadmap](roadmap.md) for the active CrossOver-based hybrid plan, phases,
|
||||
critical path and completion criteria; see [ADR 0005](adr/0005-crossover-hybrid-direction.md)
|
||||
for the decision and [project board setup](planning/project-board.md). Native work is
|
||||
paused: [deferred native roadmap](research/native-roadmap.md) and the archived
|
||||
[native-first plan](archive/development-phases-native-first.md) with
|
||||
[retired milestones](archive/native-first-milestones.json), the
|
||||
[native issue archive](research/native-issue-archive.md) and the retired
|
||||
[H0 to H7 breakdown](archive/hybrid-phases-h0-h7.md). Research inputs: the [upstream research registry](research/upstream-registry.md) and
|
||||
[component reuse matrix](research/component-reuse-matrix.md). Historical phase
|
||||
checkpoints retain their original evidence scope.
|
||||
|
||||
## Architecture and technical design
|
||||
|
||||
@@ -38,6 +45,7 @@ Historical phase checkpoints retain their original evidence scope.
|
||||
|
||||
- [Guest experiment guide](../experiments/x1/README.md) — Bounded x86-64 execution, executable loading, experimental services, native compute, and offscreen rendering.
|
||||
- [x86-64 instruction registry](cpu/instruction-registry.md) — Shared decoder, generated tables, semantics, native lowering and how to add a verified instruction form.
|
||||
- [Proposed AVX and AVX2 guest contract](cpu/avx-contract.md) — VEX decoding, vector state, fault behavior and an original integer fixture specification.
|
||||
- [Runtime service registry](runtime/registry.md) and [generated coverage](runtime/services.md) — Import resolution, typed Win64 adapters and how to add a tested service.
|
||||
- [Guest threads](runtime/threads.md) — Deterministic scheduler, thread services, limits and tests.
|
||||
- [Guest CPU research](research/cpu-boundary.md) — Public specifications and unresolved console requirements.
|
||||
@@ -49,7 +57,7 @@ Historical phase checkpoints retain their original evidence scope.
|
||||
- [Testing and acceptance index](testing/README.md) — Entry point for test procedures, evidence and review records.
|
||||
- [AMD RDNA2 desktop GPU (gfx1030) form acceptance](testing/shader-form-acceptance.md) — Independence, command, log and promotion rules for fixture-verified instruction forms.
|
||||
- [Engineering progress](progress.md) — Verification commands, metric definitions, and open release gates.
|
||||
- [CPU test runtime and shard selection](testing/cpu-coverage.md) — Measured CPU gate cost and deterministic test-target shards.
|
||||
- [CPU test runtime, shards and coverage map](testing/cpu-coverage.md) — Measured CPU gate cost, deterministic test-target shards, and a verified per-operation CPU/loader coverage map with exact test evidence.
|
||||
- [Test inventory comparison](testing/test-inventory.md) — Detect missing or newly ignored Cargo tests across commits.
|
||||
- [Persistent resource and translated rendering acceptance](testing/x9-acceptance.md) — Pinned upstream tests, native ARM64 results and unsupported cases.
|
||||
- [Baseline acceptance](testing/phase-02-baseline.md), [Phase 01 assurance](testing/phase01-assurance.md), and [independent reviews](testing/review-log.md) — Candidate-specific results and release findings.
|
||||
@@ -60,7 +68,14 @@ Historical phase checkpoints retain their original evidence scope.
|
||||
|
||||
- [Public sources](research/sources.md), [RDNA 2 notes](research/rdna2.md), and [Xbox GPU evidence](research/xbox-gpu.md) — Specifications, evidence scope, and unknown console behavior.
|
||||
- [Shader inputs](research/shader-containers.md) and [risk register](risk-register.md) — Input provenance and unresolved engineering risks.
|
||||
- [Upstream integration audit](research/upstream-integration-audit.md) — Source-level review of external macOS compatibility projects, licence and provenance decisions, and what was implemented in `crates/hybrid`.
|
||||
- [CrossOver baseline](research/crossover-baseline-2026-11-25.md) — First executions of original workloads under CrossOver 26.3 on the M4, backend comparison and its limits.
|
||||
- [Windows cross-toolchain](research/hybrid-toolchain.md) — Pinned llvm-mingw release, how original Windows workloads are built, and what was and was not executed.
|
||||
- [Texture format inventory](research/texture-formats.md) — Formats and layouts by stage (decode, layout, native upload, sampling, guest), their public specifications, unknowns and ranked follow-ups.
|
||||
- [PortWatch native macOS research](research/portwatch-native-macos.md) — Screening of public Xbox-on-Windows port projects for native macOS planning; discovery only.
|
||||
- [Synthetic integration and upstream evidence](research/synthetic-integration.md) — Audited source snapshots and remaining commercial startup prerequisites.
|
||||
- [Hybrid backlog research record](research/hybrid-backlog-research-2026-11-25.md) — Findings, registry candidates and the issues they produced (2026-11-25); not verified on hardware.
|
||||
- [Primary-source verification](research/primary-source-verification-2026-11-25.md) — Which hybrid-research claims were confirmed, contradicted or left unverified against vendor documentation.
|
||||
|
||||
## Security, licensing, and contributions
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# ADR 0005: CrossOver-based hybrid direction
|
||||
|
||||
Status: **Accepted (strategic direction).** Accepted by the maintainers' planning directive of 2026-11-25. The proposed technical architecture below is **not** accepted or verified; each integration still needs validation.
|
||||
|
||||
## Context
|
||||
|
||||
BetterXen was developed native-first: an independent x86-64 decoder, interpreter, ARM64 translator, runtime, shader compiler and Metal backend, verified only on synthetic programs and shaders. No Xbox title runs on it. The maintainers decided to focus all active engineering on a hybrid architecture and to pause native work.
|
||||
|
||||
## Accepted strategic direction
|
||||
|
||||
- CrossOver is the primary compatibility foundation, installed externally.
|
||||
- Hybrid is the only active development direction. Native research is preserved (tag `native-first-final` marks the last `main` commit before this change; the code stays in the workspace) and paused; resuming needs an explicit maintainer decision.
|
||||
- Reuse established infrastructure; build independent replacements only for demonstrated limitations.
|
||||
- The engineering rules in `AGENTS.md` (and `CLAUDE.md`, a symlink) were rewritten accordingly, replacing the former prohibition on Wine, CrossOver, Rosetta and MoltenVK.
|
||||
|
||||
## Proposed technical architecture (not accepted)
|
||||
|
||||
BetterXen provides integration, configuration, environment management, diagnostics, reproducible testing, benchmarking and measured optimization around CrossOver. Within CrossOver, the intended layers are Wine-based runtime APIs, Rosetta 2 for x86-64 translation and D3DMetal or DXMT for graphics, on Apple Silicon (ARM64, Metal, unified memory). The exact responsibility boundary is decided in #351, at the end of Phase 1.
|
||||
|
||||
## Unverified integration assumptions
|
||||
|
||||
- That CrossOver, Rosetta 2, D3DMetal or DXMT run any authorized workload BetterXen needs. Assumed not until measured (#355).
|
||||
- That CrossOver offers supported interfaces for bottle management, configuration, launching and diagnostics (#350).
|
||||
- Rosetta 2's support lifetime and D3DMetal's license terms (#349, #354).
|
||||
- That any of this provides Xbox runtime compatibility. It is assumed not to.
|
||||
|
||||
## Verified implementation capabilities
|
||||
|
||||
None for the hybrid architecture. Verified native-research capabilities (synthetic evidence only) are unchanged and listed in `docs/progress.md`.
|
||||
|
||||
## Planning consequence
|
||||
|
||||
Planning is progressive: Phase 1 (research, feasibility and baseline) is the only active phase; later phases are provisional and defined from its findings. Native work is paused indefinitely.
|
||||
|
||||
## Consequences
|
||||
|
||||
Positive: reuse of mature infrastructure. Negative: dependence on a proprietary vendor and on Rosetta 2 availability; limited ability to modify closed components; the former "No Wine, No CrossOver, No Rosetta" project identity is retired for active work. Anything derived from leaked or unauthorized material stays excluded, including projects built for such inputs (see the upstream registry).
|
||||
|
||||
## Alternatives considered
|
||||
|
||||
Continue native-first; maintain both tracks at 75/25; a generic Wine-based stack without CrossOver.
|
||||
@@ -1,3 +1,5 @@
|
||||
> **Archived 2026-11-25 (superseded). Not the active plan.** Native-first plan retained for history; the active roadmap is [../roadmap.md](../roadmap.md). Relative links below were written for `docs/` and may need `../`.
|
||||
|
||||
# BetterXen development phases
|
||||
|
||||
This is BetterXen's working development plan. Each phase ends with a reproducible
|
||||
@@ -26,10 +28,10 @@ Historical results below remain evidence for their recorded candidates only.
|
||||
| Native app | Swift app, Rust C interface, controller input and audio/virtual-filesystem fixtures | Existing fixtures do not establish one integrated threaded C++ 3D application. |
|
||||
| Quality tools | CPU/runtime inventories, shader coverage reconciliation, task queue, PR checks and acceptance records | Some inventories and ledgers contain stale limitation text. A successful tool invocation does not prove every catalog entry is current. |
|
||||
|
||||
Sources: [CPU registry](cpu/instruction-registry.md),
|
||||
[runtime registry](runtime/registry.md), [guest threads](runtime/threads.md),
|
||||
[interfaces](interfaces.md), [shader coverage](shaders/semantic-coverage.md),
|
||||
[Gate A](testing/gate-a.md), and [QA tooling](testing/infrastructure/README.md).
|
||||
Sources: [CPU registry](../cpu/instruction-registry.md),
|
||||
[runtime registry](../runtime/registry.md), [guest threads](../runtime/threads.md),
|
||||
[interfaces](../interfaces.md), [shader coverage](../shaders/semantic-coverage.md),
|
||||
[Gate A](../testing/gate-a.md), and [QA tooling](../testing/infrastructure/README.md).
|
||||
The read-only shader reconciliation reported zero mismatches during this task;
|
||||
that result is inventory consistency, not new GPU verification.
|
||||
|
||||
@@ -40,18 +42,18 @@ but their phase numbers are not the sequence for new BetterXen work.
|
||||
|
||||
| Existing record or name | Meaning | How to use it now |
|
||||
| --- | --- | --- |
|
||||
| [Phase 01 checkpoints and assurance](testing/phase01-assurance.md), [risk register](risk-register.md), [review log](testing/review-log.md) and [mutation record](testing/mutation.md) | Earlier bounded shader research and candidate-specific gates | Consult the original gate definitions and unresolved findings; do not relabel them as current acceptance. |
|
||||
| [Phase 02 GPU/guest baseline](testing/phase-02-baseline.md) and [CPU feasibility](research/phase02-cpu-feasibility.md), [ecosystem](research/phase02-ecosystem.md), [collaboration](research/phase02-collaboration.md) research | Early graphics expansion and CPU feasibility work | Reuse documented public sources and evidence limits, checking them against current source. |
|
||||
| [CPU/runtime campaign ledger](coordination/cpu-campaign-ledger.md) | Implementation batches and local evidence | Its older limitations are not a current feature inventory: scheduler, atomic and string work has since landed. |
|
||||
| [Infrastructure Phase II/III tooling](testing/infrastructure/README.md) and [compatibility ledger](testing/infrastructure/phase3-compat-ledger.md) | A separate QA campaign | Tool code now includes compatibility-gap analysis and verification profiles beyond the ledger's early checkpoint. Coordinate with existing issue #219 rather than starting another QA framework. |
|
||||
| [Gate A](testing/gate-a.md) | Compiled C execution, split into A1 and hosted-C A2 | A1 has a main-branch test. A2 is under review in PR #283; the document's “not started” description predates that PR. Neither is independently accepted by this plan. |
|
||||
| [Phase 01 checkpoints and assurance](../testing/phase01-assurance.md), [risk register](../risk-register.md), [review log](../testing/review-log.md) and [mutation record](../testing/mutation.md) | Earlier bounded shader research and candidate-specific gates | Consult the original gate definitions and unresolved findings; do not relabel them as current acceptance. |
|
||||
| [Phase 02 GPU/guest baseline](../testing/phase-02-baseline.md) and [CPU feasibility](../research/phase02-cpu-feasibility.md), [ecosystem](../research/phase02-ecosystem.md), [collaboration](../research/phase02-collaboration.md) research | Early graphics expansion and CPU feasibility work | Reuse documented public sources and evidence limits, checking them against current source. |
|
||||
| [CPU/runtime campaign ledger](../coordination/cpu-campaign-ledger.md) | Implementation batches and local evidence | Its older limitations are not a current feature inventory: scheduler, atomic and string work has since landed. |
|
||||
| [Infrastructure Phase II/III tooling](../testing/infrastructure/README.md) and [compatibility ledger](../testing/infrastructure/phase3-compat-ledger.md) | A separate QA campaign | Tool code now includes compatibility-gap analysis and verification profiles beyond the ledger's early checkpoint. Coordinate with existing issue #219 rather than starting another QA framework. |
|
||||
| [Gate A](../testing/gate-a.md) | Compiled C execution, split into A1 and hosted-C A2 | A1 has a main-branch test. A2 is under review in PR #283; the document's “not started” description predates that PR. Neither is independently accepted by this plan. |
|
||||
| Native app numbered gates in `crates/ffi` and `app` | Bounded session, graphics, audio and filesystem fixtures | Inspect their tests before proposing integration. Gate numbers are separate from shader acceptance gates. |
|
||||
| README X1–X25 milestones | Broad capability map | Retain as a capability reference; use the phases below for the next work order. |
|
||||
| Supplied Discord III, III-B, IV, V and VI excerpts | Broad runtime, graphics, application and performance objectives | Only excerpts were supplied. Their omitted requirements and completion status are unknown; they are not execution instructions. |
|
||||
|
||||
Bare issue numbers in historical documents may refer to the source repository.
|
||||
All issue and PR links in the work sections below refer to **MacosPorters/betterxen**.
|
||||
Use [migration records](migration.md) to resolve historical references.
|
||||
Use [migration records](../migration.md) to resolve historical references.
|
||||
|
||||
## Phase 1 — Establish a trustworthy working baseline
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
# Detailed hybrid phases H0 to H7 (retired planning)
|
||||
|
||||
**Archived 2026-11-25; not the active plan.** These eight phases were defined before any research had been done. The active roadmap is [../roadmap.md](../roadmap.md): five provisional phases, with only Phase 1 active. The text below preserves the objectives, scope and exit conditions of the retired H2 to H7 milestones (and H0/H1) for reference when later phases are defined. Issue numbers in it are historical.
|
||||
|
||||
## Phases as originally written
|
||||
|
||||
### H0 — CrossOver Architecture Transition
|
||||
|
||||
**Status:** In development
|
||||
|
||||
**Objective:** Make CrossOver the single authoritative active compatibility foundation across the repository and GitHub planning surfaces.
|
||||
|
||||
**Scope:** README, architecture docs, ADR 0005, rewritten engineering rules, roadmap, upstream research registry, technical plans, labels, milestones, issue and PR templates, issue triage, project board, preservation of the native implementation.
|
||||
|
||||
**Dependencies:** None.
|
||||
|
||||
**Deliverables:** Updated README and docs; ADR 0005; docs/roadmap.md; deferred docs/research/native-roadmap.md; rebuilt issues and milestones; project board; preserved native code.
|
||||
|
||||
**Validation:** Repository link/terminology check; GitHub consistency check.
|
||||
|
||||
**Exit conditions:** Repository, documentation, issues, milestones and board consistently state the CrossOver-based direction. The project board requires a token with the project scope and is not yet configured.
|
||||
|
||||
**Known risks:** Project board cannot be configured without the GitHub project token scope (#346). The engineering rules conflict was resolved by rewriting AGENTS.md (#345).
|
||||
|
||||
### H1 — CrossOver Research and Baseline
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Establish what the installed CrossOver version actually provides and a reproducible baseline, without assuming it provides Xbox runtime compatibility.
|
||||
|
||||
**Scope:** CrossOver architecture, supported macOS versions, Apple Silicon support, relationship to upstream Wine, CPU translation mechanism, graphics backends (D3DMetal, DXMT and others), supported Direct3D versions, configuration interfaces, documented command-line interfaces, bottle management, diagnostics and profiling options, licensing and redistribution, supported integration mechanisms, long-term maintenance. Open-source and proprietary components distinguished.
|
||||
|
||||
**Dependencies:** Engineering rules rewritten (#345, done). CrossOver is an externally installed dependency until its license says otherwise; nothing is bundled.
|
||||
|
||||
**Deliverables:** CrossOver capability and integration-boundary report; licensing and dependency assessment; reproducible environment; baselines of CPU, GPU, memory and stability on authorized workloads.
|
||||
|
||||
**Validation:** Every claim cites vendor or upstream documentation, or a recorded observation on the installed version. Unknown stays unknown. Equivalent workloads, settings, hardware and software versions.
|
||||
|
||||
**Exit conditions:** Capabilities and integration boundaries are documented for the installed version; environment is reproducible by another contributor; baselines recorded; BetterXen vs CrossOver responsibilities proposed.
|
||||
|
||||
**Known risks:** CrossOver is proprietary: bundling, modifying or redistributing may be prohibited; integration interfaces may be undocumented; Xbox titles may not run at all.
|
||||
|
||||
### H2 — BetterXen Integration Foundation
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Build the BetterXen layer around CrossOver: integration boundaries, configuration, diagnostics, reproducible test workflows and host integration.
|
||||
|
||||
**Scope:** Environment and configuration management, diagnostics, test workflows, verified host integration, regression testing. Only what CrossOver does not already provide adequately.
|
||||
|
||||
**Dependencies:** H1.
|
||||
|
||||
**Deliverables:** Boundary document; configuration and environment management where justified; diagnostic infrastructure; reproducible test workflows; verified host integration; regression tests.
|
||||
|
||||
**Validation:** Independent contributor reproduces the workflows; no placeholder components.
|
||||
|
||||
**Exit conditions:** Integration foundation builds, tests and reproduces on a second setup.
|
||||
|
||||
**Known risks:** Reliance on undocumented or changing CrossOver behavior.
|
||||
|
||||
### H3 — Compatibility Validation
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate authorized workloads and document verified behavior and limitations.
|
||||
|
||||
**Scope:** Authorized workloads, documented limitations, runtime behavior, graphics correctness, input and interaction, reproducible failures, integrated validation criteria.
|
||||
|
||||
**Dependencies:** H2.
|
||||
|
||||
**Deliverables:** Validation criteria; per-workload results; reproducible failure reports; verified runtime, graphics and input results.
|
||||
|
||||
**Validation:** Independent verification of rendering and behavior. Startup or a screenshot alone is not proof.
|
||||
|
||||
**Exit conditions:** Selected workloads show verified integrated behavior under documented criteria; failures reproducible.
|
||||
|
||||
**Known risks:** Failures may originate in CrossOver or its components outside project control.
|
||||
|
||||
### H4 — Graphics and Performance Engineering
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate graphics backends and optimize only demonstrated bottlenecks.
|
||||
|
||||
**Scope:** Supported backends, CPU/GPU utilization, unified memory, frame-time consistency, synchronization, shader compilation and caching. Metrics: average FPS, 1% low, frame-time percentiles, CPU and GPU utilization, unified memory, memory pressure, translation overhead where measurable, shader compile latency, startup, thermals, long-duration stability. Reference machine: M4 Mac, 24 GB.
|
||||
|
||||
**Dependencies:** H3; measurement protocol.
|
||||
|
||||
**Deliverables:** Backend comparison; profiling reports; bottleneck list; before/after results; regression tests.
|
||||
|
||||
**Validation:** Equivalent workloads, rendering settings, hardware and versions; correctness and rendering equivalence verified.
|
||||
|
||||
**Exit conditions:** Improvements measurable, reproducible and without loss of correctness or stability. No improvement is promised before measurement.
|
||||
|
||||
**Known risks:** Many components are closed and not modifiable; single reference machine.
|
||||
|
||||
### H5 — Stability and Hardware Scaling
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Evaluate Apple Silicon configurations, memory pressure, thermals and long-duration stability.
|
||||
|
||||
**Scope:** Available Apple Silicon configurations, memory pressure, thermal behavior, long-duration tests, hardware documentation, regression coverage.
|
||||
|
||||
**Dependencies:** H3; hardware access.
|
||||
|
||||
**Deliverables:** Hardware compatibility documentation; memory-pressure and thermal reports; long-duration results; expanded regression coverage.
|
||||
|
||||
**Validation:** Each documented configuration backed by a test run on it.
|
||||
|
||||
**Exit conditions:** Tested configurations documented; untested hardware never claimed.
|
||||
|
||||
**Known risks:** Only one reference machine currently available.
|
||||
|
||||
### H6 — Hybrid Architecture Maturity
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Maintainable integration infrastructure and contributor workflows.
|
||||
|
||||
**Scope:** Contributor workflows, verified-capability documentation, reproducible performance results, complexity reduction, long-term dependency risk (CrossOver, Rosetta 2, D3DMetal).
|
||||
|
||||
**Dependencies:** H3 to H5 evidence.
|
||||
|
||||
**Deliverables:** Maintainable infrastructure; contributor documentation; verified capability list; reproducible results; dependency risk assessment.
|
||||
|
||||
**Validation:** Contributors other than the authors maintain the workflow.
|
||||
|
||||
**Exit conditions:** The architecture shows demonstrated value and the team can maintain it.
|
||||
|
||||
**Known risks:** Vendor decisions (CrossOver licensing, Rosetta lifetime) are outside project control.
|
||||
|
||||
### H7 — Future Native Reassessment (deferred)
|
||||
|
||||
**Status:** Not started
|
||||
|
||||
**Objective:** Deferred. Reassess independent native components only on an explicit maintainer decision or when one offers a demonstrated benefit to the active architecture.
|
||||
|
||||
**Scope:** See docs/research/native-roadmap.md.
|
||||
|
||||
**Dependencies:** Explicit maintainer decision.
|
||||
|
||||
**Deliverables:** Reassessment record.
|
||||
|
||||
**Validation:** Maintainer decision recorded in an ADR.
|
||||
|
||||
**Exit conditions:** A recorded decision to continue, resume specific native work, or archive components.
|
||||
|
||||
**Known risks:** Premature reinvention of mature infrastructure.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
[{"closed_issues":15,"description":"G1–G15 for the bounded native ARM64 and Metal graphics foundation. Release acceptance requires all gates on the exact candidate.","html_url":"https://github.com/MacosPorters/betterxen/milestone/1","number":1,"open_issues":0,"state":"open","title":"Phase 01 - Native Graphics Foundation"},{"closed_issues":7,"description":"Develop independently authored interoperability tests and fixtures from public specifications. External emulator results may inform test selection. Xenora owns its Rust ARM64 runtime, decoder, typed IR, shader compiler and Metal backend. Emulator code, ports, decoder tables, internal metadata and platform-specific dependencies are outside scope.","html_url":"https://github.com/MacosPorters/betterxen/milestone/2","number":2,"open_issues":0,"state":"open","title":"Phase 02 - Ecosystem Integration"},{"closed_issues":8,"description":"Expand independently verified gfx1030 semantics, resource access, wave behavior and native offscreen drawing.\n\n### Deferred engineering\n- [#25](https://github.com/ranveersoni98/Xenora/issues/25) · Verify Wave64 pairing on native Metal. Exercise both halves, cross-half operations, asymmetric masks and barrier safety with 64-lane readback.\n- [#27](https://github.com/ranveersoni98/Xenora/issues/27) · Translate bounded vertex and fragment fixtures. Define stage IO and interpolation from public specifications; verify exact offscreen pixels.","html_url":"https://github.com/MacosPorters/betterxen/milestone/3","number":3,"open_issues":0,"state":"open","title":"Phase 03 - Graphics Maturation"},{"closed_issues":6,"description":"Measure correctness-gated CPU, translation and GPU behavior under reproducible host conditions. Track capability and failure evidence.\n\n### Deferred engineering\n- [#33](https://github.com/ranveersoni98/Xenora/issues/33) · Measure Metal pipeline reuse and cache identity. Separate cold and warm timing; test cache invalidation and verify shared output expectations.","html_url":"https://github.com/MacosPorters/betterxen/milestone/4","number":4,"open_issues":0,"state":"open","title":"Phase 04 - Performance and Compatibility"},{"closed_issues":7,"description":"Grow the bounded interpreter and independently demonstrate ARM64 recompilation, with precise state and fault behavior.\n\n### Deferred engineering\n- [#40](https://github.com/ranveersoni98/Xenora/issues/40) · Choose first measured recompilation target. Use interpreter profiles to choose one bounded basic block and document precise state and fault requirements.\n- [#41](https://github.com/ranveersoni98/Xenora/issues/41) · Execute one translated ARM64 guest basic block. Execute emitted ARM64 code natively, compare registers, flags, memory and traps with interpreter and independent vectors.\n- [#42](https://github.com/ranveersoni98/Xenora/issues/42) · Verify code cache and executable memory policy. Validate mapping permissions, publication, invalidation and dependency provenance on macOS.\n- [#43](https://github.com/ranveersoni98/Xenora/issues/43) · Measure ARM64 translation performance. Compare correctness-gated translated and interpreted inputs with matched native runs and resource records.","html_url":"https://github.com/MacosPorters/betterxen/milestone/5","number":5,"open_issues":0,"state":"open","title":"Phase 05 - CPU Recompilation"},{"closed_issues":6,"description":"Build isolated guest loading, memory, services and checked CPU-to-GPU commands using original inputs.\n\n### Deferred engineering\n- [#49](https://github.com/ranveersoni98/Xenora/issues/49) · Expand synthetic services and authorized runtime boundaries. Define explicit service ABI, faults and lifetimes with original inputs. Document evidence gaps for authentic Xbox platform contracts.\n\nFuture import behavior is tracked in [#55](https://github.com/ranveersoni98/Xenora/issues/55). Compatibility checks do not inspect user acquisition or ownership.","html_url":"https://github.com/MacosPorters/betterxen/milestone/6","number":6,"open_issues":0,"state":"open","title":"Phase 06 - Runtime Infrastructure"},{"closed_issues":5,"description":"Validate the integrated execution path and exact release candidate. Project-run title testing requires suitable inputs and independent evidence. The loader evaluates format and compatibility without checking where user files came from.","html_url":"https://github.com/MacosPorters/betterxen/milestone/7","number":7,"open_issues":1,"state":"open","title":"Phase 07 - Integrated Validation"}]
|
||||
@@ -0,0 +1,70 @@
|
||||
# Native-first README milestones (archived)
|
||||
|
||||
**Archived 2026-11-25; paused native research, not the active plan.** This section was the README's "Milestones" content on `main` when BetterXen moved to the CrossOver-based hybrid direction. Statuses describe the native implementation only, with synthetic evidence. The active plan is the [roadmap](../roadmap.md). Links below were written for the repository root README and may need adjusting.
|
||||
|
||||
## Native-first milestones
|
||||
|
||||
BetterXen's work order is the six [development phases](development-phases-native-first.md), which lead to one concrete target: the **first launchable application** (tracker [#311](https://github.com/MacosPorters/betterxen/issues/311)). That target is an original C program, built with native ARM64 tools, that runs through the ARM64 translator, controls its own translated shader pipeline, and shows its Metal frame in the native app window. It is **not** a commercial or authentic Xbox title, and no date or percentage is attached to it.
|
||||
|
||||
```mermaid
|
||||
%%{init: {'theme':'base','themeVariables':{'fontFamily':'system-ui, sans-serif','lineColor':'#6e7781'}}}%%
|
||||
flowchart LR
|
||||
P1["<b>Phase 1</b><br/>Trustworthy baseline"]:::wip --> P2["<b>Phase 2</b><br/>Hosted C application"]:::wip
|
||||
P2 --> P3["<b>Phase 3</b><br/>Coherent threading"]:::wip
|
||||
P3 --> P4["<b>Phase 4</b><br/>Resource updates<br/>to translated rendering"]:::wip
|
||||
P4 --> P5["<b>Phase 5</b><br/>One integrated<br/>interactive application"]:::plan
|
||||
P5 --> P6["<b>Phase 6</b><br/>Measured performance"]:::plan
|
||||
P2 --> L(["<b>First launchable app</b><br/>issue 311"]):::goal
|
||||
P4 --> L
|
||||
classDef wip fill:#fff8c5,stroke:#9a6700,color:#4d2d00
|
||||
classDef plan fill:#eaeef2,stroke:#8c959f,color:#24292f
|
||||
classDef goal fill:#dafbe1,stroke:#1a7f37,color:#0f5323,stroke-width:3px
|
||||
```
|
||||
|
||||
<sub>🟨 work under way · ⬜ not started · 🟩 the next original-workload target. Nothing here is independently accepted.</sub>
|
||||
|
||||
| Phase | Goal | State | What exists now |
|
||||
| --- | --- | --- | --- |
|
||||
| **1 · Baseline** | Contributors can tell what exists on `main`, what is pending review, and which checks ran | 🟡 In progress | CODEOWNERS review, a fast repository hygiene check, claim-before-work rules, generated status tables and claim audits |
|
||||
| **2 · Hosted C application** | An original hosted C program starts, uses the runtime, reports results and exits with checked cleanup | 🟡 In progress | CRT startup, arguments, exit handlers, formatted output, file streams and the hosted-C fixture (A2) are integrated; a stdio follow-up is still open and the result is not independently accepted |
|
||||
| **3 · Threaded behavior** | A worker-based application can block and resume without stalling other guest work | 🟡 In progress | Deterministic scheduler, guest thread contexts, guarded stacks and thread services. Guest `Sleep` still delays all guest threads (#304); worker TLS and callback lifecycle is a design draft (#312) |
|
||||
| **4 · Resource updates to rendering** | A guest updates a texture and geometry, submits translated rendering and gets a checked frame | 🟡 In progress | Persistent resources, descriptor-table texture binding, translated vertex and pixel stages, blend, depth and indexed draws. Guest-selected pipelines and the typed graphics bridge are open (#314–#316) |
|
||||
| **5 · Integrated interactive app** | Guest execution, rendering, input, audio, filesystem and lifecycle in one session | ⚪ Planned | Swift app with frame loop, input, audio and sandboxed filesystem fixtures exists, but those demonstrations are not guest-integration evidence |
|
||||
| **6 · Measured performance** | Faster execution of workloads whose correctness is already checked | ⚪ Planned | Startup, DBT and TLS measurements recorded; bottlenecks are chosen from measurements, not assumed |
|
||||
|
||||
The launch milestone's proposed acceptance is **60 bounded frames containing two independently distinguishable guest-controlled states, then a clean close and one restart**. Sixty is a fixture criterion, not a measured frame rate. The work is tracked as issues [#313](https://github.com/MacosPorters/betterxen/issues/313)–[#323](https://github.com/MacosPorters/betterxen/issues/323).
|
||||
|
||||
<details>
|
||||
<summary><b>Capability reference: the original X1–X25 map</b></summary>
|
||||
|
||||
The X1–X25 names are an older, broad capability map. Keep them as a reference; use the phases above for the next work order. X10–X25 are proposed engineering milestones, not completed implementations or a guaranteed sequence.
|
||||
|
||||
| Milestone | Implementation | Status |
|
||||
| --- | --- | --- |
|
||||
| X1 — Guest CPU | Bounded x86-64 instruction execution on ARM64 macOS | Verified |
|
||||
| X2 — Executable loading | Loading original fixed-base PE32+ test executables | Verified |
|
||||
| X3 — GPU compute | Guest-submitted Metal compute workloads and readback | Verified |
|
||||
| X4 — Metal rendering | Guest-driven offscreen rendering using authored Metal shaders | Verified |
|
||||
| X5 — Guest execution expansion | Additional bounded CPU execution and fixture coverage | Implemented |
|
||||
| X6 — Guest control flow | Nested calls, returns, checked memory and synthetic PE execution | Verified |
|
||||
| X7 — Imported services | Named imports, guest-to-host service dispatch and result validation | Verified |
|
||||
| X8 — Translated compute | Original gfx1030 compute shaders executing on Metal, partial Wave32 handling and BC1 readback | Verified subset |
|
||||
| X9 — Translated graphics | Persistent resource handles, translated vertex/pixel stages and offscreen Metal rendering | Verified subset |
|
||||
| X10 — Texture sampling | One translated `image_sample_lz` pixel stage with point/clamp sampling of RGBA8 and BC1 2D textures bound through descriptor tables, locally verified on Apple M5 Pro; upload, readback and decode of BC compressed formats (see [Texture support](#texture-support)). Other image instructions and formats are not implemented | Implemented subset |
|
||||
| X11 — Graphics pipeline | Bounded multi-draw passes into offscreen RGBA8 targets: translated vertex and pixel stages, indexed triangle draws, colour write masks and blend state | Implemented |
|
||||
| X12 — Wave execution | Expand Wave32/Wave64 semantics, divergent control flow, cross-lane operations, LDS and barriers | Planned |
|
||||
| X13 — Advanced shaders | Mesh, geometry and additional compute shader capabilities with verified Metal execution | Planned |
|
||||
| X14 — CPU recompilation | Native ARM64 dynamic recompilation of supported x86-64 instructions in synthetic fixtures | Implemented subset |
|
||||
| X15 — Executable compatibility | Static PE inspection reports sections, relocations, thread-local storage (TLS) callbacks, imports and entry-point instructions | Static probe implemented |
|
||||
| X16 — Guest memory and threading | Virtual memory mapping, thread scheduling, synchronization primitives and atomic operations | Implemented subset |
|
||||
| X17 — System services | Implement a tested subset of Xbox-compatible runtime APIs, memory services, filesystem access and application lifecycle | Implemented subset |
|
||||
| X18 — Graphics API translation | Translate supported Xbox graphics commands, resource descriptors, command queues, barriers and fences into Metal operations | Planned |
|
||||
| X19 — Advanced GPU features | Indirect rendering, asynchronous compute, additional texture formats and ray-tracing compatibility research | Planned |
|
||||
| X20 — Integrated guest runtime | Connect CPU recompilation, executable loading, system services and graphics translation into one persistent runtime | Planned |
|
||||
| X21 — Application compatibility | Execute increasingly complex independently authored applications through the complete guest CPU and GPU pipeline | Planned |
|
||||
| X22 — First application boot | Establish a reproducible startup and error-reporting path for supported game-like applications | Planned |
|
||||
| X23 — Initial game compatibility | Investigate startup and execution of legally supported game software, identifying missing runtime and graphics behavior | Long-term goal |
|
||||
| X24 — Gameplay and performance | Expand rendering correctness, input, audio, memory management, shader caching and execution performance | Long-term goal |
|
||||
| X25 — Running games | Achieve reproducible, stable execution of compatible games on native Apple Silicon macOS using Metal | Long-term goal |
|
||||
|
||||
</details>
|
||||
@@ -0,0 +1,136 @@
|
||||
# Proposed AVX and AVX2 guest contract
|
||||
|
||||
[Issue #299](https://github.com/MacosPorters/betterxen/issues/299) defines a
|
||||
reviewable first step for Advanced Vector Extensions (AVX) in the x86-64 guest.
|
||||
The current [instruction registry](instruction-registry.md) rejects VEX prefixes.
|
||||
[`CpuState`](../../crates/loader/src/cpu.rs) holds 16 XMM registers and MXCSR,
|
||||
the SIMD floating-point control and status register. The synthetic `CPUID`
|
||||
advertises basic leaves through 1 and reports no AVX or extended-state support.
|
||||
|
||||
The architectural expectations come from the public Intel Software Developer's
|
||||
Manual and apply to BetterXen's synthetic x86-64 guest profile. Which AVX and
|
||||
AVX2 features Xbox Series X|S CPUs expose, and which extended register state
|
||||
the console OS enables for applications, remain open research questions.
|
||||
Resolving them requires public platform documentation or authorized hardware
|
||||
evidence.
|
||||
|
||||
## Architectural state and encoding
|
||||
|
||||
In 64-bit mode, XMM0–XMM15 alias bits 127:0 of YMM0–YMM15. A legacy SSE
|
||||
instruction that writes an XMM destination preserves bits 255:128. For the
|
||||
packed VEX.128 forms in this proposal, writing an XMM destination clears that
|
||||
register's upper 128 bits. A VEX.256 register destination replaces all 256 bits.
|
||||
A store to memory leaves its source vector register intact. The proposed moves
|
||||
and integer add leave RFLAGS and MXCSR unchanged. [Intel SDM Vol. 1, §14.8,
|
||||
Accessing YMM Registers][sdm-ymm]. [Intel SDM Vol. 2B, MOVDQU and PADDD][sdm-2b].
|
||||
|
||||
The shared [decoder](../../crates/loader/src/x86_decode.rs) should retain the
|
||||
prefix family, opcode map, mandatory prefix, operand width and register
|
||||
extensions until it selects the form. In 64-bit mode the VEX lead byte
|
||||
identifies the prefix length. The table lists each payload byte's fields
|
||||
from bit 7 to bit 0.
|
||||
|
||||
| Lead byte | Payload byte 1 | Payload byte 2 | Implied fields |
|
||||
| --- | --- | --- | --- |
|
||||
| `C5` | `~R ~vvvv L pp` | — | Map `0F`, `W=0`, logical `X=B=0` |
|
||||
| `C4` | `~R ~X ~B mmmmm` | `W ~vvvv L pp` | Map selected by `mmmmm` |
|
||||
|
||||
The tilde indicates an inverted encoding. `R` extends ModRM.reg, while `X`
|
||||
and `B` extend the applicable index and r/m or base fields. `vvvv` supplies
|
||||
the first source of `VPADDD`. For `VMOVDQU` its encoded bits must be `1111b`.
|
||||
`L=0` selects 128 bits and `L=1` selects 256 bits for these forms. The three
|
||||
standard VEX maps are `00001b` (`0F`), `00010b` (`0F 38`) and `00011b`
|
||||
(`0F 3A`). `pp` values 0 through 3 represent no mandatory prefix, `66`, `F3`
|
||||
and `F2`. Both initial opcodes are in `0F`, with `W` ignored (`WIG`). Decode
|
||||
both valid prefix lengths for them. Reject reserved maps and encodings,
|
||||
including a physical `LOCK`, `66`, `F2`, `F3` or REX prefix before VEX, through
|
||||
the existing illegal-instruction path. Legal forms outside the implemented
|
||||
subset also stop explicitly. Keep the existing register and effective-address
|
||||
rules and 15-byte fetch limit. [Intel SDM Vol. 2A, §2.3, VEX encoding][sdm-2a].
|
||||
[Intel SDM Vol. 2B, MOVDQU and PADDD][sdm-2b].
|
||||
|
||||
## First implementation increments
|
||||
|
||||
1. Append one upper 128-bit half per vector register to `CpuState`, retaining
|
||||
the existing XMM storage as the low halves. Add layout assertions for the
|
||||
offsets the dynamic binary translator (DBT) uses. Initialize both halves
|
||||
in a fresh guest thread and carry them with the thread state when switching
|
||||
or resuming. Add the shared VEX decoder and encoding controls before execution.
|
||||
2. Implement `VMOVDQU` (128 and 256 bits, `F3.0F`, `6F /r` and `7F /r`,
|
||||
register and checked memory forms) and `VPADDD` (128 and 256 bits,
|
||||
`66.0F`, `FE /r`, register sources initially). The instruction entries
|
||||
assign both move widths and 128-bit `VPADDD` to AVX, and 256-bit `VPADDD`
|
||||
to AVX2. Read all sources before publishing the destination, including
|
||||
when the destination aliases a source. Compare both engines with the
|
||||
[original fixture specification](../../tests/compat_fixtures/avx/README.md).
|
||||
3. After shared semantics pass, lower register moves and `VPADDD` to native
|
||||
ARM64 vector operations on one or two 128-bit halves. Each `VPADDD` half
|
||||
is four independent 32-bit additions modulo 2³². Use the checked-memory
|
||||
helper for loads and stores. Check the DBT's fallback counter so a run
|
||||
through that helper establishes only helper coverage for those forms.
|
||||
|
||||
Stage memory-source `VPADDD` and aligned moves separately. Reject masked
|
||||
moves, gathers, cross-half permutations, floating-point forms, FMA, EVEX
|
||||
and guest extended-state instructions in the initial slice. AMD64 bytes
|
||||
remain guest data. All host execution uses native ARM64 code or checked
|
||||
Rust helpers.
|
||||
|
||||
## Memory, faults and instruction budget
|
||||
|
||||
`VMOVDQU` permits unaligned operands. Check the complete 16- or 32-byte
|
||||
guest span before publishing a load result or writing a store. A split
|
||||
span across adjacent permitted mappings succeeds. A missing or protected
|
||||
mapping produces the existing guest memory fault at the first inaccessible
|
||||
byte. For a later `VMOVDQA` form, a memory operand must be aligned to its
|
||||
width (16 or 32 bytes), with a misaligned operand raising
|
||||
`GeneralProtection`. [Intel SDM Vol. 2B, MOVDQU and MOVDQA][sdm-2b].
|
||||
|
||||
Intel's Type 4 rules for `VMOVDQU` specify `#SS(0)` when a memory reference
|
||||
through the stack segment (SS) has a noncanonical address and `#GP(0)`
|
||||
for other noncanonical references. The initial BetterXen profile uses the
|
||||
[existing 48-bit guest address check](../../crates/loader/src/x86_exec.rs)
|
||||
and reports `GeneralProtection` for either segment case, including a span
|
||||
whose first byte is canonical and whose last byte is noncanonical. Check
|
||||
canonicality before guest memory lookup and before committing the move.
|
||||
Distinct stack-segment exception reporting remains outside this profile.
|
||||
[Intel SDM Vol. 2A, Table 2-21, Type 4 exceptions][sdm-2a].
|
||||
|
||||
Before adding masked moves, use a separate per-lane access contract. For
|
||||
`VPMASKMOVD`, only lanes with the high mask bit set may access memory or
|
||||
report a memory fault. A clear bit zeroes a load lane and leaves a store
|
||||
lane untouched. A test with lane 4 on an unmapped page must pass with that
|
||||
lane disabled and fault with it enabled. A full-width span check would
|
||||
incorrectly reject the disabled case. Specify store commit behavior before
|
||||
admitting that form. [Intel SDM Vol. 2C, VPMASKMOV][sdm-2c].
|
||||
|
||||
Require interpreter and DBT parity for the exit reason, fault address when
|
||||
reported, RIP, instruction count and complete guest register and memory
|
||||
state. A rejected move or add has no partial destination update and does
|
||||
not retire. A successful 256-bit instruction consumes one guest step even
|
||||
when the DBT emits two halves. With an exhausted budget, stop at the next
|
||||
guest RIP before decoding or executing that instruction. Check cold and warm
|
||||
DBT paths and resume in the middle of the same sequence.
|
||||
|
||||
## Feature exposure
|
||||
|
||||
Run the initial forms only in explicitly enabled synthetic test cases.
|
||||
Keep normal guest `CPUID` and extended-state behavior at the current baseline.
|
||||
Before guest-visible AVX support, the guest OS model needs coherent reporting
|
||||
for `CPUID.1:ECX` bits 26 (XSAVE), 27 (OSXSAVE) and 28 (AVX), and `XGETBV`
|
||||
with `ECX=0` must report both XMM and YMM state enabled in `XCR0[2:1]`. The
|
||||
extended-state layout reported by `CPUID.0Dh`, save and restore behavior,
|
||||
and per-thread ownership must agree. Verify the exception behavior for
|
||||
disabled state and invalid `XGETBV` selectors before exposing the facility.
|
||||
AVX2 separately requires `CPUID.(7,0):EBX[5]` and the same OS state. Gate
|
||||
each advertised feature on its full instruction and state contract,
|
||||
with probes for enabled and disabled combinations. [Intel SDM Vol. 1,
|
||||
§14.3, AVX detection][sdm-avx]. [Intel SDM Vol. 1, §14.7.1, AVX2 detection][sdm-avx2].
|
||||
[Intel SDM Vol. 2A, CPUID][sdm-2a]. [Intel SDM Vol. 2D, XGETBV, XSAVE and XRSTOR][sdm-2d].
|
||||
|
||||
[sdm-ymm]: https://cdrdv2-public.intel.com/843827/253665-sdm-vol-1-dec-24.pdf#page=376
|
||||
[sdm-avx]: https://cdrdv2-public.intel.com/843827/253665-sdm-vol-1-dec-24.pdf#page=359
|
||||
[sdm-avx2]: https://cdrdv2-public.intel.com/843827/253665-sdm-vol-1-dec-24.pdf#page=375
|
||||
[sdm-2a]: https://cdrdv2-public.intel.com/929353/253666-093-sdm-vol-2a.pdf
|
||||
[sdm-2b]: https://cdrdv2-public.intel.com/929354/253667-093-sdm-vol-2b.pdf
|
||||
[sdm-2c]: https://cdrdv2-public.intel.com/929355/326018-093-sdm-vol-2c.pdf
|
||||
[sdm-2d]: https://cdrdv2-public.intel.com/929356/334569-093-sdm-vol-2d.pdf
|
||||
@@ -141,6 +141,31 @@ pages count toward the 256 MiB mapping budget of one image, which is checked
|
||||
before anything is mapped. `ParsedPe::parse` does not make these checks, so
|
||||
static inspection of a file is unchanged.
|
||||
|
||||
`betterxen run --experimental --pe <trusted-fixture> --startup-report <path>`
|
||||
writes a versioned JSON summary after the worker stops. The supervisor creates the new report path before launching the worker.
|
||||
The report is optional and uses the same exact-byte fixture admission, startup
|
||||
observer and wall deadline as an ordinary run.
|
||||
|
||||
Schema version 1 lists the observed stages in order in `stages` and copies
|
||||
the last valid stage to `last_completed_stage` (null if none). The order is
|
||||
`parsed`, `mapped`, `relocated`, `imports_bound`, `tls_completed`, `entry`,
|
||||
`exit`, and `framebuffer`. `entry` records the handoff to guest entry.
|
||||
`exit` records the fixture halt, and `framebuffer` records verification of its
|
||||
offscreen readback. The supervisor reports an `outcome` of `verified`,
|
||||
`stage_failure`, `early_exit`, `timeout`, or `unknown`. It includes the
|
||||
worker exit code when available, termination detail when applicable, and the
|
||||
original reported error when available. Errors are capped at 2 KiB of UTF-8
|
||||
and carry an `error_truncated` flag.
|
||||
|
||||
The supervisor reads at most 8 KiB plus one byte from the worker journal.
|
||||
`record_integrity` reports `complete`, `truncated`, `malformed`, `oversized`,
|
||||
`unreadable`, or `unwritable`. Worker exit codes 124 and 125 are reserved for
|
||||
its watchdog and journal I/O errors, respectively. `--startup-journal` is an
|
||||
internal worker option. Only the valid ordered prefix counts toward progress. A
|
||||
complete journal may still contain only a partial startup if the worker
|
||||
stopped between records. These records describe runtime observations from
|
||||
the trusted fixtures.
|
||||
|
||||
`betterxen probe --mode static` inventories ordinary and delay-loaded PE imports
|
||||
without guest execution. Without `--report` it writes to `diagnostics/probe`,
|
||||
where `betterxen imports sync` also looks. `missing_imports.csv` lists unresolved ordinary keys
|
||||
|
||||
@@ -12,6 +12,7 @@ The workspace is GPL-3.0-or-later. The following is the lead's preliminary compa
|
||||
| bitflags | 2.13.2, `80ce9b545acb0bd42150695fc351889cac1d8eb4` | MIT from MIT OR Apache-2.0 | Runtime transitive dependency |
|
||||
| AMD RDNA 2 ISA XML | 2026-02-20, schema 1.1.1 | MIT | Source for generated decoder constants |
|
||||
| LLVM AMDGPU tools | 23.1.6 | Apache-2.0 WITH LLVM-exception | External fixture tool, not linked |
|
||||
| llvm-mingw | 20261117 (sha256 `98d340bb…446aa`) | Apache-2.0 WITH LLVM-exception, plus component licences in its LICENSE.TXT (mingw-w64 runtime and headers have their own terms; not audited line by line) | External build tool for original Windows test programs, not linked, not distributed |
|
||||
| Xcode and Metal tools | Xcode 27.2 | Apple proprietary terms | External host tools, not distributed |
|
||||
|
||||
## Runtime redistribution review
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Project board setup
|
||||
|
||||
Status: **not configured, and not an engineering blocker.** The token used so far lacks the GitHub `project` scope, and GitHub's API cannot create views. Tracked by [#346](https://github.com/MacosPorters/betterxen/issues/346).
|
||||
|
||||
One simple board for active work only:
|
||||
|
||||
1. `gh auth refresh -s project`, then create a project named "BetterXen Development".
|
||||
2. Status (single select): Backlog, Ready, In Progress, In Review, Blocked, Done.
|
||||
3. Fields: Priority (p1, p2, p3), Area (text), and the built-in Milestone, Assignees and Status. No other custom fields.
|
||||
4. Add the open issues and pull requests (`gh project item-add`). Closed native issues stay out; they are indexed in [the native issue archive](../research/native-issue-archive.md).
|
||||
5. Optional view in the web UI: a table filtered to the current milestone and sorted by Priority. No phase views and no native board.
|
||||
@@ -0,0 +1,31 @@
|
||||
# Component reuse matrix
|
||||
|
||||
Companion to the [upstream registry](upstream-registry.md); same evidence limits (class D, nothing run, not legal advice). "External" means installed or supplied by the user and invoked, never bundled or copied. GPL-3.0-or-later is BetterXen's license.
|
||||
|
||||
| Need | Candidate | Decision | Reason and condition |
|
||||
| --- | --- | --- | --- |
|
||||
| Windows runtime APIs | CrossOver (Wine-based) | **Adopt as external dependency** (strategic decision, ADR 0005) | Proprietary product; do not bundle or redistribute. Capabilities and interfaces unverified (#348, #350). |
|
||||
| Windows runtime APIs | Upstream Wine | Reference; source may be consulted | LGPL 2.1. Copying source would need per-file review and a recorded pin. Not needed for the current plan. |
|
||||
| x86-64 on ARM64 | Rosetta 2 | **Permitted where Apple supports it**; external | Apple component; support lifetime unknown (#349). BetterXen's own code stays ARM64. |
|
||||
| x86-64 on ARM64 | FEX | **Not applicable now** | README targets ARM64 Linux. Re-check only if a macOS host path appears. |
|
||||
| Direct3D 12 to Metal | D3DMetal | **Evaluate as external**, subject to license | Not in CodeWeavers' FOSS list; terms and availability to verify (#349, #354). Not redistributable until proven. |
|
||||
| Direct3D 11/10 to Metal | DXMT | **Evaluate** as external binary or build | LGPL 2.1-or-later; usable as a separate process or library under LGPL terms; linking or copying needs legal review (#354). |
|
||||
| Direct3D to Vulkan | DXVK | **Evaluate** only together with MoltenVK | zlib/libpng is permissive and GPL-compatible. Value on macOS unknown. |
|
||||
| Direct3D 12 to Vulkan | VKD3D-Proton | **Evaluate**; blocked on a Vulkan 1.3 provider | Depends on MoltenVK feature coverage, unknown. |
|
||||
| Vulkan on Metal | MoltenVK | **Evaluate** | Apache-2.0 (compatible with GPLv3). Subset of Vulkan; coverage vs consumers unknown. |
|
||||
| Shader compiler / runtime | VIctory, VIctory-macOS | **Rejected for reuse** | Built for a specific commercial game's Xbox Series build whose provenance is not established as authorized. Ideas only. |
|
||||
| Project discovery | PortWatch VI | Reference only | Editorial tracker; not engineering evidence; nothing imported. |
|
||||
| x86-64 decode and ARM64 translation, runtime, gfx1030 compiler, Metal backend | BetterXen native implementation | **Preserved, paused** | Reuse only where hybrid needs it and it shows a demonstrated advantage; not forced into the architecture. |
|
||||
| Test and diagnostics methodology | BetterXen existing audits, benchmark harness, claims registry | **Reuse** | Existing evidence classes, claims audit and benchmark gating apply to hybrid work (Phase 1 onward). |
|
||||
| Configuration, diagnostics, benchmarking around CrossOver | BetterXen | **Build** (Phase 2, provisional) | Only after Phase 1 shows what CrossOver does not already provide (#351). |
|
||||
| Host receipt, frame statistics, cross-toolchain probe | `crates/hybrid` | **Build** (original Rust, public system interfaces) | ossover and Whisky are Swift references; no code adapted. See [audit](upstream-integration-audit.md). |
|
||||
| Metal HUD log parsing | ossover `MetalHUDLog` | **Reference only** | Log format is documented only by third-party observation; implement after a real trace is captured (#145). |
|
||||
| Bottle and bundle internals (`cxbottle.conf`, SharedSupport layout) | ossover and others | **Do not depend** | Undocumented, derived from reverse engineering; #350 decides. |
|
||||
| Game-specific XCL layers | MacBox, ScarlettMac | **Rejected** | GPL-2.0-only and game-specific. |
|
||||
|
||||
| Memory-pressure guard for workloads | skakwy/victory-mac `mac/run-victory.sh` | **Adapted** into `crates/hybrid/src/memory.rs` | Contributor-authored, GPL-3.0, permission granted; reimplemented in Rust. |
|
||||
| Windows cross-linker wrapper | skakwy/victory-mac `tools/macos/gnullvm-cc.sh` | **Not used** | Failed with Homebrew `llvm@17`; llvm-mingw covers the need. |
|
||||
| Windows cross toolchain | llvm-mingw 20261117 | **External dependency**, not vendored | Apache-2.0 with LLVM exceptions; checksum recorded in [hybrid-toolchain.md](hybrid-toolchain.md). |
|
||||
| Zero-copy Metal swizzle, D3DMetal state fixes | skakwy/victory-mac `mac/unixlib`, `PROGRESS.md` | **Rejected** | Act on D3DMetal internals; Apple licence forbids reverse engineering. |
|
||||
|
||||
Open items: license text for every selected component must be read from the exact release used; DXMT, DXVK and Wine contributor and file-level notices are not reviewed.
|
||||
@@ -0,0 +1,59 @@
|
||||
# CrossOver baseline on the M4 reference machine (2026-11-25)
|
||||
|
||||
Evidence class: observed runs on one machine by one person (class B in the sense of [claims.toml](../claims.toml)); **not independently reproduced**, so #355 and #353 stay open. Every result is for original BetterXen workloads, never for a game. Nothing here shows Xbox compatibility.
|
||||
|
||||
## Environment
|
||||
|
||||
| Item | Value (source) |
|
||||
| --- | --- |
|
||||
| Machine | Apple M4, 10 cores (4 performance, 6 efficiency), 24 GiB, macOS 27.0 build 26A428 (`betterxen-hybrid host`) |
|
||||
| CrossOver | `/Applications/CrossOver.app`, 26.3, build 26.3.0.39832, bundle id `com.codeweavers.CrossOver`, main executable universal (x86_64, arm64) (`betterxen-hybrid crossover`). Licence or trial state not inspected; runs worked |
|
||||
| Wine host binaries | `wineloader` and `wineserver` are **x86_64 only** (`lipo -archs`), so CrossOver's Wine runs under Rosetta 2 on this Mac. `arch -x86_64 /usr/bin/true` executes |
|
||||
| Bottle | `betterxen-test`, template `win11_64`, created in 18.7 s with `cxbottle --bottle betterxen-test --create --template win11_64` |
|
||||
| Launch interface | `bin/wine --bottle B program` and `bin/wineserver -k`. `cxbottle --help` and `cxstart --help` exist in the bundle. **None of these command-line interfaces is documented by CodeWeavers for macOS**: the [Mac user guide](https://support.codeweavers.com/en_US/crossover-mac-user-guide) and [advanced configuration page](https://support.codeweavers.com/advanced-crossover-mac-configuration) cover the GUI and hook variables only. They are used here as observed vendor behaviour of this build |
|
||||
| Backend selection | `CX_GRAPHICS_BACKEND=<name>` in the environment. Undocumented (see #350). An unknown value (`bogus`) was **accepted silently** and gave the same result as the default |
|
||||
| Toolchain | llvm-mingw 20261117, Rust 1.100.0; see [hybrid-toolchain.md](hybrid-toolchain.md) |
|
||||
| Host noise | CrossOver's antivirus helper prints `LibClamAV Error` and `Can't open file or directory` because Homebrew's ClamAV has no database in `/opt/homebrew/var/lib/clamav`. Harmless to results; the run record reports it as a diagnostic |
|
||||
|
||||
## Workloads executed
|
||||
|
||||
Run with `betterxen-hybrid run --bottle betterxen-test --expect PASS -- <exe>`, default backend.
|
||||
|
||||
| Workload | x86-64 result | ARM64 result |
|
||||
| --- | --- | --- |
|
||||
| C self-check (CRC-32, four threads) | passed, exit 0, 1.4 s | `cannot_execute` |
|
||||
| Rust self-check (threads, TLS) | passed, exit 0, 0.6 s | `cannot_execute` |
|
||||
| D3D11 clear and readback | passed, exit 0, 1.1 s | `cannot_execute` |
|
||||
| D3D11 indexed triangle, shaders, frame loop | passed, exit 0, 0.8 s | `cannot_execute` |
|
||||
|
||||
CrossOver 26.3 here **rejects Windows ARM64 executables** with `winewrapper.exe:error: cannot execute`. The ARM64 builds exist and have the correct PE type, but cannot be run in this environment. Process memory sampled while running was about 325 MB (CrossOver's persistent processes, identical across workloads, so it says nothing about the workloads themselves); minimum system free memory stayed at 64 to 68 %.
|
||||
|
||||
Negative controls (#365): `d3d11-clear --negative-control` and `d3d11-frameloop --negative-control` expect a deliberately wrong colour and exit 1; the normal runs exit 0.
|
||||
|
||||
### Defects found in BetterXen's own workloads, not in CrossOver
|
||||
|
||||
1. **Clear test required exact bytes.** The first run read green as 127 where the program expected 128 (0.5 × 255 = 127.5, an exact tie). Re-derived from the primary source ([Direct3D data conversion rules](https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-data-conversion)): the ideal conversion adds 0.5 and drops the fraction (128), but implementations are permitted a tolerance of 0.6 unit-last-place on the integer side (`D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP (0.6f)` in the mingw-w64 header; the D3D11 constant is described by the same page). 127 is 0.5 from 127.5 and is within tolerance. The workload now checks that tolerance and prints how many pixels differ from the ideal. This was a correction to match the specification, not a loosening to get a pass: the negative control still fails.
|
||||
2. **Triangle was culled.** The first frame-loop run left the centre black. The index order was counter-clockwise, which Direct3D 11 culls by default. Fixed to clockwise; the centre then read (51, 102, 204, 255) exactly.
|
||||
|
||||
## Graphics backend comparison
|
||||
|
||||
`betterxen-hybrid bench --backends default,d3dmetal,dxmt,dxvk,wined3d --repeat 5`, 2000 frames per run, workload `d3d11-frameloop`: a 640x360 offscreen RGBA8 target, one indexed triangle with a vertex and a pixel shader, an event query waited on every frame. **No window and no presentation.** All 25 runs passed. Medians across five runs:
|
||||
|
||||
| Backend (detected from workload output) | Adapter reported | Median frame | p95 | p99 | Frame rate | Startup + run, median |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| default | AMD Compatibility Mode | 0.281 ms | 0.448 ms | 0.929 ms | 3153 | 1.42 s |
|
||||
| d3dmetal | AMD Compatibility Mode | 0.282 ms | 0.558 ms | 1.805 ms | 2898 | 1.44 s |
|
||||
| dxmt | Apple M4 | 0.158 ms | 0.239 ms | 0.382 ms | 5896 | 1.13 s |
|
||||
| dxvk (via MoltenVK, "cxaddon-1.10.3") | Apple M4 | 0.150 ms | 0.263 ms | 0.478 ms | 5835 | 1.13 s |
|
||||
| wined3d | Apple M4 | 0.150 ms | 0.256 ms | 0.419 ms | 5788 | 1.13 s |
|
||||
|
||||
Observations, with their limits:
|
||||
|
||||
- **The default behaved like D3DMetal** (same adapter identity, same timings) for a bottle made from `win11_64` and an unknown executable. CodeWeavers' Advanced Settings page, as recorded in [primary-source-verification](primary-source-verification-2026-11-25.md), says Auto falls back to wined3d without a per-game database entry. The observation disagrees with that reading; why was not investigated.
|
||||
- D3DMetal's median per-frame submit-and-wait time was about 1.8 times that of the other three, with a larger tail. This is the cost of a trivial draw plus synchronisation, **not rendering throughput**, and shows nothing about real scenes. It identifies a candidate for investigation, not a bottleneck.
|
||||
- Sustained run, 200,000 frames: D3DMetal 64.1 s, median 0.283 ms, p99 0.987 ms, p99.9 2.07 ms, maximum 20.3 ms; DXMT 29.6 s, median 0.135 ms, p99 0.339 ms, p99.9 0.48 ms, maximum 7.4 ms. No failure, no hang, and free memory did not trend downward (minimum 64 % and 66 %).
|
||||
- Not measured: GPU utilization (no unprivileged documented source on this host), memory use of the workload itself, thermal behaviour under load (pmset reported no thermal, performance or CPU-power warning before and after; the workload loads the GPU too lightly for that to mean anything), presentation and frame pacing, texture sampling, depth testing, and Direct3D 12.
|
||||
|
||||
## What this does and does not establish
|
||||
|
||||
Established on this machine and build: CrossOver 26.3 runs original x86-64 console, threaded, Direct3D 11 clear and triangle programs under four graphics backends with correct pixels; it does not run ARM64 Windows programs; BetterXen can detect, supervise, classify and record such runs. Not established: anything about Direct3D 12, real-scene performance, other macOS or CrossOver versions, other machines, or any game. A second contributor still has to reproduce this.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Hybrid backlog research record (2026-11-25)
|
||||
|
||||
Evidence class D: public documentation and repository metadata, plus search summaries; see [primary-source-verification-2026-11-25.md](primary-source-verification-2026-11-25.md) for the re-check. Nothing was installed, built or run. Not legal advice. Candidate registry rows are listed here; merge them into [upstream-registry.md](upstream-registry.md) once that file's pending commit has landed.
|
||||
|
||||
## Findings that created issues
|
||||
|
||||
| Finding | Source | Consequence |
|
||||
| --- | --- | --- |
|
||||
| CrossOver 27 reportedly requires Apple silicon and macOS Sonoma+, drops 32-bit bottles, and an ARM64 build without Rosetta 2 is planned; Apple keeps Rosetta fully through macOS 27, a subset after | CodeWeavers blog 2026-06-11 and Apple WWDC 2025 (search summaries; primary pages not retrieved) | [#374](https://github.com/MacosPorters/betterxen/issues/374), comment on #349 |
|
||||
| Bottle backend is reportedly set by `CX_GRAPHICS_BACKEND` (d3dmetal, dxmt, dxvk, wined3d) in `cxbottle.conf`; no official documentation found | Third-party projects | Unverified; #350 must confirm before [#366](https://github.com/MacosPorters/betterxen/issues/366) relies on it |
|
||||
| Cross-building anything for Wine needs mingw-w64 or llvm-mingw | DXMT `docs/DEVELOPMENT.md` | [#364](https://github.com/MacosPorters/betterxen/issues/364) |
|
||||
| Wine and vkd3d-proton ship Direct3D conformance tests that can be built as standalone PE programs | `wine-mirror/wine` `dlls/d3d11/tests`, `vkd3d-proton` `tests/` | [#369](https://github.com/MacosPorters/betterxen/issues/369) |
|
||||
| DXMT offers Metal-coordinated frame pacing and MetalFX upscaling; DXMT is D3D11/10 only | DXMT `docs/CUSTOMIZATION.md`, README | [#370](https://github.com/MacosPorters/betterxen/issues/370) |
|
||||
| DXMT compiles shaders at runtime with an LLVM-based compiler | DXMT `src/airconv` | [#371](https://github.com/MacosPorters/betterxen/issues/371) (hypothesis to test) |
|
||||
| Metal HUD frame data is logged with `MTL_HUD_ENABLED`; logging variable name differs between sources; frame data may be redacted in the unified log | Apple tech talk, community tools | #145, [#372](https://github.com/MacosPorters/betterxen/issues/372) |
|
||||
| D3DMetal license reportedly limits use to evaluation and restricts redistribution | Secondary sources | #354 must read Apple's License.pdf; never bundle |
|
||||
|
||||
## Registry candidates
|
||||
|
||||
| Project | Pin / state observed | License as reported | Classification | Issue |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| llvm-mingw / mingw-w64 | not pinned yet | to read per release | External dependency | #364 |
|
||||
| Wine conformance tests | `wine-mirror/wine`, pushed 2026-11-24 | LGPL-2.1-or-later | Run as external programs, not copied | #369 |
|
||||
| vkd3d-proton tests | pushed 2026-11-25 | LGPL-2.1 | Requires feasibility validation (D3D12 path unconfirmed) | #369 |
|
||||
| DXMT | v0.80 (2026-04-23) | LGPL-2.1-or-later | Requires feasibility validation; external | #370, #371 |
|
||||
| Apple Game Porting Toolkit / D3DMetal | not retrieved | Apple license, reportedly restrictive | Requires licensing clarification; user-supplied only | #354 |
|
||||
| Whisky | archived 2025-05-11 | GPL-3.0 | Technical reference only | #366 |
|
||||
| Gcenx macOS Wine builds, Sikarugir | Sikarugir reports no license | unknown | Technical reference only; no reuse | none |
|
||||
| MetalHUDLogger and similar community tools | not reviewed | unknown | Technical reference only | #145 |
|
||||
| FEX, QEMU, LLVM, MoltenVK, DXVK, Xenia | see upstream registry | see registry | FEX: not applicable on macOS. Others: no change from existing registry | none |
|
||||
| VIctory family, PortWatch VI | see upstream registry | GPL-3.0 (repos) | Rejected for reuse: the tracker describes efforts built around a leaked Xbox Series build of a commercial game; PortWatch is used for discovery only | none |
|
||||
|
||||
Not investigated in depth: Xenia internals and QEMU, because neither runs Windows x86-64 programs on macOS ARM64 in a way relevant to the CrossOver architecture; this is a judgement, not a finding.
|
||||
|
||||
## Issues created
|
||||
|
||||
Existing hybrid issues #344 to #355, #363, #145, #204, #257, #303 were left to the other planning session. New: #364 to #374, and phase trackers #375 (H3), #376 (H4), #377 (H5). Dependencies are recorded as GitHub blocked-by and sub-issue relationships.
|
||||
|
||||
## Conditional work deliberately not filed
|
||||
|
||||
D3D12 workloads (after #349 confirms a path), input-injection tests, a compatibility matrix generator (after #368), upstream contributions to DXMT or Wine (after #369 and #370 produce concrete findings), and release engineering (H6).
|
||||
@@ -0,0 +1,36 @@
|
||||
# Windows cross-toolchain for original workloads (issue #364)
|
||||
|
||||
Evidence class B for the build results (commands run on the reference machine, 2026-11-25), class D for licences. The x86-64 programs were later run under CrossOver 26.3; results are in [crossover-baseline-2026-11-25.md](crossover-baseline-2026-11-25.md).
|
||||
|
||||
## Pinned toolchain
|
||||
|
||||
| Item | Value |
|
||||
| --- | --- |
|
||||
| Toolchain | [llvm-mingw](https://github.com/mstorsjo/llvm-mingw) release `20261117`, asset `llvm-mingw-20261117-ucrt-macos-universal.tar.xz` |
|
||||
| SHA-256 | `98d340bbb8d46b09ad6886ffba88bd9d5415e131c316de48e6bd7647377446aa`, equal to the digest GitHub shows for the asset; computed locally with `shasum -a 256` after download |
|
||||
| Host binaries | Mach-O universal (x86_64, arm64); `codesign -dv` shows the clang driver is signed. Runs natively on Apple Silicon |
|
||||
| Targets used | `x86_64-w64-mingw32` and `aarch64-w64-mingw32` (clang), Rust `x86_64-pc-windows-gnullvm` and `aarch64-pc-windows-gnullvm` |
|
||||
| Licence | `LICENSE.TXT` in the release opens with "The LLVM Project is under the Apache License v2.0 with LLVM Exceptions" and then lists further component licences (the mingw-w64 runtime has its own terms). The full file was **not** audited line by line. It is an external build tool: nothing from it is shipped or copied into this repository |
|
||||
| Install | Download, check the digest, unpack outside the repository (for example `~/toolchains/`), pass the directory to the build script. It is not vendored |
|
||||
|
||||
Rust 1.100.0 with `rustup target add x86_64-pc-windows-gnullvm aarch64-pc-windows-gnullvm`.
|
||||
|
||||
## Build and result
|
||||
|
||||
`scripts/hybrid/build-windows-workloads.sh <llvm-mingw-dir>` builds three original programs for both architectures with `-Wall -Wextra -Werror` and then checks each output with `file`; it exits non-zero if a PE has the wrong machine type.
|
||||
|
||||
| Program | Source | x86-64 | ARM64 | Executed under CrossOver 26.3 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| C self-check: CRC-32 check value, four threads, interlocked counter | `workloads/win-selfcheck-c` | built; passed | built; rejected (`cannot execute`) | x86-64 yes, ARM64 no |
|
||||
| Rust self-check: thread-local storage across four threads | `workloads/win-selfcheck-rust` | built; passed | built; rejected | x86-64 yes, ARM64 no |
|
||||
| Direct3D 11 clear and readback of a 64x64 RGBA8 target (first step of #365) | `workloads/d3d11-clear` | built; passed within the specified tolerance | built; rejected | x86-64 yes, ARM64 no |
|
||||
|
||||
A fourth program, `workloads/d3d11-frameloop` (indexed triangle, shaders, sustained frame loop; needs `-ldxguid -ld3dcompiler`), builds the same way. The D3D11 programs exit 2 ("no device") rather than passing when no hardware device exists, so a missing GPU path cannot be mistaken for success.
|
||||
|
||||
## Alternative evaluated: skakwy's `gnullvm-cc.sh`
|
||||
|
||||
The contributor's `tools/macos/gnullvm-cc.sh` (victory-mac commit `22b3f8e45a59`) links `x86_64-pc-windows-gnullvm` with Homebrew clang and rustup's lld. On the reference machine, with Homebrew `llvm@17` as `LLVM_PREFIX`, it failed at link time: `clang-17` aborted with `dyld: Symbol not found: _LLVMInitializeLanaiAsmParser`, because the script sets `DYLD_LIBRARY_PATH` to the Rust toolchain's `libLLVM`. It probably expects a newer Homebrew LLVM; which version was not asked. llvm-mingw covers the same need without that dependency, so the script was **not integrated**. His note that the plain `x86_64-pc-windows-gnu` target aborts on thread start is unverified here, since no program was run.
|
||||
|
||||
## Reproducibility
|
||||
|
||||
Rebuilding twice on one machine and path gives byte-identical SHA-256 for all eight outputs, after adding `-Wl,--no-insert-timestamp` (the C programs differed before because of the PE timestamp). The Rust outputs were identical without it. A build in a different directory was not tested and may embed paths; the second-contributor reproduction that #364 requires has not happened. The `file` check shows the llvm-mingw host binaries are universal (x86_64 and arm64), so the issue's "arm64 only" criterion is not met by this release asset.
|
||||
@@ -0,0 +1,183 @@
|
||||
# Native issue archive
|
||||
|
||||
**Preserved history, not a backlog.** BetterXen's active direction is the CrossOver-based hybrid architecture ([roadmap](../roadmap.md)). The independent native implementation is paused indefinitely; this page replaces its GitHub issue backlog so the work can be found without occupying the active Issues tab. Native source code, tests, benchmarks, Git history and attribution are untouched. Resuming native work needs an explicit maintainer decision ([native roadmap](native-roadmap.md)).
|
||||
|
||||
Every issue below keeps its full text, comments and attribution on GitHub and can be reopened; closing used the reason "not planned". Issues imported from the earlier Xenora repository say so in their first lines, and their original author is recorded below. Excerpts are the first sentence of the issue's objective, not a summary of acceptance criteria.
|
||||
|
||||
## Active-work transitions
|
||||
|
||||
Four native issues stay open because a contributor is assigned and has an open pull request. They are the only open native-only issues and each carries a comment asking the contributor to say whether to continue as archived native research, re-scope, or withdraw:
|
||||
|
||||
| Issue | Assignee | Pull request |
|
||||
| --- | --- | --- |
|
||||
| [#247](https://github.com/MacosPorters/betterxen/issues/247) native app quick start | atesahmet0 | [#310](https://github.com/MacosPorters/betterxen/pull/310) |
|
||||
| [#291](https://github.com/MacosPorters/betterxen/issues/291) executable writes inside a translated block | maridogolpeador | [#327](https://github.com/MacosPorters/betterxen/pull/327) |
|
||||
| [#307](https://github.com/MacosPorters/betterxen/issues/307) CRT stdio follow-up | soggyramennoodle | [#263](https://github.com/MacosPorters/betterxen/pull/263), [#290](https://github.com/MacosPorters/betterxen/pull/290) |
|
||||
| [#313](https://github.com/MacosPorters/betterxen/issues/313) original compiled C guest | soggyramennoodle | [#330](https://github.com/MacosPorters/betterxen/pull/330) |
|
||||
|
||||
Open pull requests for issues that were closed (#308, #312, #328, #329, #339, #340, #341, #342) were left untouched; each received a comment explaining the transition so maintainers and authors can decide whether to merge them as research or close them.
|
||||
|
||||
## Native pieces hybrid development might use
|
||||
|
||||
Nothing in the native backlog is a prerequisite for the hybrid phases. One possible reuse is already noted: the original compiled C guest fixture of #313/#330 could serve as one authorized test workload for hybrid baselines ([#364](https://github.com/MacosPorters/betterxen/issues/364)). If hybrid work needs any other native component, it should be filed as a focused hybrid issue.
|
||||
|
||||
## Findings preserved from discussions
|
||||
|
||||
- **Remill evaluation ([#324](https://github.com/MacosPorters/betterxen/issues/324)).** An isolated, native ARM64 evaluation pinned Remill at `66c488c9911fd9b368e4d0c9647d74239f8bba8b`. Five original AMD64 traces lifted and ran with 32 passing case/path checks. A second pass recorded eight floating-point mismatches (guest rounding, MXCSR sticky flags, denormals-are-zeros, an unmasked precision exception) and a loop that needed external termination; the decision was to retain the existing CPU path, and the failing gate was left failing. An adapter design was written. Published on branch `research/remill-arm64` (commit `e50268d8723a29a365a36c6b665db6d4e3733f6b`; `experiments/remill/`). Local test results, not CI; no independent acceptance.
|
||||
- **VIctory shader-compiler feasibility ([#261](https://github.com/MacosPorters/betterxen/issues/261)).** Local experiments (`experiments/victory-native/`, uncommitted, on a local branch) built a pinned shader compiler natively, translated original gfx1030 fixtures to DXIL, converted them with Apple's Metal shader converter and checked native Metal readback (a 4x4 pixel probe and a 32-word buffer transform) on an M4, plus a review of an upstream Xenora snapshot (114 tests passed). Those materials depend on VIctory-family source whose input provenance the [upstream registry](upstream-registry.md) does not clear for reuse; they are not part of this branch and nothing from them is adopted.
|
||||
- **PortWatch review and native plan ([#298](https://github.com/MacosPorters/betterxen/issues/298), [PR #308](https://github.com/MacosPorters/betterxen/pull/308)).** Produced [portwatch-native-macos.md](portwatch-native-macos.md) and a seven-phase native plan (open PR #308, which replaces the README X1 to X25 table). The native plan is superseded by the hybrid roadmap; the PortWatch screening facts remain useful.
|
||||
- **Metal buffer pool ([#130](https://github.com/MacosPorters/betterxen/issues/130)).** A bounded completed-buffer pool imported from upstream Xenora commit `4f3d0ae1ca44ff5e01e569eab07f776af43d2f8e` (author Vedant Dadhich, GPL-3.0-or-later attribution retained) passed 58 native tests locally with a negative control; a pipeline-selection fixture was added under [#315](https://github.com/MacosPorters/betterxen/issues/315). Local branch `integration/xenora-metal-pool`, not pushed.
|
||||
- **C++ unwind prerequisite ([#343](https://github.com/MacosPorters/betterxen/issues/343)).** An isolated `experiments/cpp-unwind` workspace adapting restricted prolog-restoration logic from upstream Xenora (Swastick Chowdhury, SPDX notice retained); local branch `integration/cpp-unwind`, not pushed.
|
||||
|
||||
Local branches and worktrees named above are not on GitHub; their owners decide whether to publish them.
|
||||
|
||||
## Index
|
||||
|
||||
|
||||
### CPU correctness and translation
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#62](https://github.com/MacosPorters/betterxen/issues/62) [CPU] Verify RIP-relative effective-address computation | ranveersoni98 | 1 | - | closed, not planned | Audit the shared effective-address emitter for RIP-relative operands. Verify positive and negative displacements and instruction-end address |
|
||||
| [#63](https://github.com/MacosPorters/betterxen/issues/63) [CPU] Correct legacy high-byte register semantics | ranveersoni98 | 1 | - | closed, not planned | Verify AH, CH, DH and BH handling without REX and SPL, BPL, SIL and DIL with REX. Reject unsupported combinations explicitly. |
|
||||
| [#64](https://github.com/MacosPorters/betterxen/issues/64) [CPU] Implement bounded x86 instruction prefix decoding | ranveersoni98 | 1 | - | closed, not planned | Enforce architectural instruction-length limits and validate repeated or conflicting prefixes. Add truncated-input and boundary regression t |
|
||||
| [#65](https://github.com/MacosPorters/betterxen/issues/65) [CPU] Verify guest flags across translated block boundaries | ranveersoni98 | 1 | - | closed, not planned | Verify architectural flags survive translated block transitions, helper calls and subsequent conditional branches. Use independent expected |
|
||||
| [#66](https://github.com/MacosPorters/betterxen/issues/66) [CPU] Add parity flag and parity-dependent branch semantics | ranveersoni98 | 1 | - | closed, not planned | Implement a documented and tested parity-flag subset, including JP and JNP. Preserve existing CPU state layout contracts. |
|
||||
| [#68](https://github.com/MacosPorters/betterxen/issues/68) [CPU] Correct LEA effective-address semantics | ranveersoni98 | 1 | - | closed, not planned | Verify LEA operand widths, SIB calculations, RIP-relative addressing and the distinction between effective-address computation and segment-r |
|
||||
| [#113](https://github.com/MacosPorters/betterxen/issues/113) [CPU-NEXT] Add independently verified MOVSXD semantics | ranveersoni98 | 1 | - | closed, not planned | Verify signed 32-to-64 extension for register and memory operands, both signs, and fault-state preservation. |
|
||||
| [#114](https://github.com/MacosPorters/betterxen/issues/114) [CPU-NEXT] Add 16-bit operand-size semantics for bounded integer instr | ranveersoni98 | 1 | - | closed, not planned | Test low-word updates, preservation of upper bits, immediate length, and unsupported prefix combinations; compare native and independent exp |
|
||||
| [#115](https://github.com/MacosPorters/betterxen/issues/115) [CPU-NEXT] Implement CMP and TEST memory operand coverage | ranveersoni98 | 1 | - | closed, not planned | Verify 8/16/32/64-bit forms within the supported subset, taken and untaken branches, flags, no memory writes, and precise faults. |
|
||||
| [#116](https://github.com/MacosPorters/betterxen/issues/116) [CPU-NEXT] Implement memory operand integer ALU subset | ranveersoni98 | 1 | - | closed, not planned | Add independently verified ADD/SUB/AND/OR/XOR memory forms; verify read-modify-write boundaries, flags, widths and no partial side effects o |
|
||||
| [#118](https://github.com/MacosPorters/betterxen/issues/118) [CPU-NEXT] Implement integer multiply and divide semantics | ranveersoni98 | 1 | - | closed, not planned | Cover selected documented MUL/IMUL/DIV/IDIV forms, signedness, implicit registers, quotient overflow and divide-by-zero guest faults. |
|
||||
| [#119](https://github.com/MacosPorters/betterxen/issues/119) [CPU-NEXT] Implement conditional moves and SETcc | ranveersoni98 | 1 | - | closed, not planned | Test supported conditions across signed/unsigned boundaries, aliasing, byte register writes and documented memory-fault behavior. |
|
||||
| [#120](https://github.com/MacosPorters/betterxen/issues/120) [CPU-NEXT] Define and verify guest SIMD architectural state | ranveersoni98 | 1 | - | closed, not planned | Introduce a bounded, documented XMM state representation with layout assertions and correct save/preservation across helpers. No instruction |
|
||||
| [#121](https://github.com/MacosPorters/betterxen/issues/121) [CPU-NEXT] Implement bounded SSE2 vector move and bitwise operations | ranveersoni98 | 1 | - | closed, not planned | Verify selected aligned/unaligned vector moves and packed AND/OR/XOR against original known answers, including aliasing and memory faults. |
|
||||
| [#122](https://github.com/MacosPorters/betterxen/issues/122) [CPU-NEXT] Implement bounded SSE2 packed integer arithmetic | ranveersoni98 | 1 | - | closed, not planned | Verify selected packed adds/subtracts, comparisons and lane widths against independently derived vectors; no unsupported saturation behavior |
|
||||
| [#123](https://github.com/MacosPorters/betterxen/issues/123) [CPU-NEXT] Implement verified scalar SSE floating-point subset | ranveersoni98 | 1 | - | closed, not planned | Define rounding and supported FP domain before implementing selected scalar operations. Test signed zero, finite boundary values and explici |
|
||||
| [#124](https://github.com/MacosPorters/betterxen/issues/124) [CPU-NEXT] Define guest floating-point control and exception state | ranveersoni98 | 1 | - | closed, not planned | Verify documented MXCSR subset, reserved bits, reset state, preservation and unsupported-mode diagnostics; do not globally modify host FP mo |
|
||||
| [#127](https://github.com/MacosPorters/betterxen/issues/127) [CPU-NEXT] Audit ARM64 assembler encoding coverage for new CPU operati | ranveersoni98 | 1 | - | closed, not planned | Compare representative legal encodings with native LLVM assembler results; reject invalid ranges and preserve existing independently derived |
|
||||
| [#191](https://github.com/MacosPorters/betterxen/issues/191) [CPU] Model guest memory ordering and fence instructions | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#291](https://github.com/MacosPorters/betterxen/issues/291) Handle executable writes within an active translated block | Arths17 | 3 | #327 | open (active work) | PR #269 revalidates translated code at dispatch boundaries. A guest store that modifies a later instruction in the currently executing trans |
|
||||
| [#300](https://github.com/MacosPorters/betterxen/issues/300) [CPU RESEARCH] Specify bounded AMD64 unwind before guest exception dis | Arths17 | 2 | #329 | closed, not planned | Guest faults currently terminate execution; the hosted-C A2 fixture imports __C_specific_handler but never calls it. That stub traps. Window |
|
||||
| [#324](https://github.com/MacosPorters/betterxen/issues/324) [CPU RESEARCH] Evaluate Remill in an isolated native ARM64 experiment | Arths17 | 9 | - | closed, not planned | Evaluate Remill as an isolated native Apple Silicon CPU-backend experiment. Requested by the maintainer; do not replace the production DBT o |
|
||||
| [#343](https://github.com/MacosPorters/betterxen/issues/343) [C++ INTEGRATION] Add isolated bounded unwind prerequisite | Arths17 | 3 | - | closed, not planned | User-authorized first C++ integration slice: a bounded, read-only AMD64 unwind prerequisite, adapted from the pinned native Xenora implement |
|
||||
|
||||
### DBT performance
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#80](https://github.com/MacosPorters/betterxen/issues/80) [CPU] Add native DBT performance regression benchmarks | ranveersoni98 | 1 | #341 | closed, not planned | Expand original CPU benchmarks to measure cold translation, cached execution, branch-heavy workloads and checked memory operations. Report r |
|
||||
| [#82](https://github.com/MacosPorters/betterxen/issues/82) [PERF-CPU] Implement adaptive DBT basic-block sizing | ranveersoni98 | 1 | - | closed, not planned | Benchmark alternatives to the fixed 16-instruction block limit. Preserve instruction budgets, fault accounting and deterministic execution. |
|
||||
| [#84](https://github.com/MacosPorters/betterxen/issues/84) [PERF-CPU] Implement guest-to-host register allocation | ranveersoni98 | 1 | - | closed, not planned | Investigate keeping frequently accessed guest registers in ARM64 registers. Implement correct spilling, helper-call preservation and archite |
|
||||
| [#85](https://github.com/MacosPorters/betterxen/issues/85) [PERF-CPU] Eliminate redundant guest register loads and stores | ranveersoni98 | 1 | - | closed, not planned | Track register values within translated blocks and eliminate redundant CPU-state accesses without changing observable guest behavior. |
|
||||
| [#86](https://github.com/MacosPorters/betterxen/issues/86) [PERF-CPU] Implement conservative DBT dead-store elimination | ranveersoni98 | 1 | - | closed, not planned | Eliminate overwritten register assignments where safe. Preserve state at faults, service calls and block exits. |
|
||||
| [#87](https://github.com/MacosPorters/betterxen/issues/87) [PERF-CPU] Implement lightweight leaf-block generation | ranveersoni98 | 1 | - | closed, not planned | Avoid unnecessary stack-frame operations in translated blocks that do not call host helpers. Verify ARM64 ABI compliance. |
|
||||
| [#90](https://github.com/MacosPorters/betterxen/issues/90) [PERF-CPU] Investigate safe direct basic-block linking | ranveersoni98 | 1 | - | closed, not planned | Reduce dispatcher overhead through validated block linking. Preserve cache invalidation, instruction limits and executable-memory protection |
|
||||
| [#91](https://github.com/MacosPorters/betterxen/issues/91) [PERF-CPU] Implement hot-block execution profiling | ranveersoni98 | 1 | - | closed, not planned | Measure guest block execution frequencies and identify expensive frequently executed blocks. Keep instrumentation optional and bounded. |
|
||||
| [#92](https://github.com/MacosPorters/betterxen/issues/92) [PERF-CPU] Investigate tiered native translation | ranveersoni98 | 1 | - | closed, not planned | Design a lightweight first-tier translator and optional optimized translation for measured hot blocks. Implement only after profiling and co |
|
||||
| [#93](https://github.com/MacosPorters/betterxen/issues/93) [PERF-CPU] Implement fast DBT dispatch lookup cache | ranveersoni98 | 1 | - | closed, not planned | Benchmark a small front cache ahead of existing HashMap lookups. Preserve complete cache identity and invalidation. |
|
||||
| [#94](https://github.com/MacosPorters/betterxen/issues/94) [PERF-CPU] Reduce budget-limited translation duplication | ranveersoni98 | 1 | - | closed, not planned | Measure duplicate translations in limited_block_cache. Safely reuse compatible blocks only where instruction accounting remains exact. |
|
||||
| [#95](https://github.com/MacosPorters/betterxen/issues/95) [PERF-CPU] Implement bounded JIT cache reclamation | ranveersoni98 | 1 | - | closed, not planned | Design safe reclamation for exhausted code caches. Ensure no live translated pointer references reclaimed code. |
|
||||
| [#96](https://github.com/MacosPorters/betterxen/issues/96) [PERF-CPU] Measure and optimize JIT code publication | ranveersoni98 | 1 | - | closed, not planned | Measure code-copy and instruction-cache synchronization costs. Investigate bounded batching while retaining all macOS JIT protections. |
|
||||
| [#97](https://github.com/MacosPorters/betterxen/issues/97) [PERF-CPU] Reuse DBT fault-guard scratch storage | ranveersoni98 | 1 | - | closed, not planned | Measure allocation overhead from per-block fault_guards vectors. Reuse bounded scratch storage without retaining stale patch locations. |
|
||||
| [#98](https://github.com/MacosPorters/betterxen/issues/98) [PERF-CPU] Replace linear guest memory lookup with indexed regions | ranveersoni98 | 1 | - | closed, not planned | Compare sorted-region binary search with the current linear region scan. Preserve permissions, overflow checks and exact fault behavior. |
|
||||
| [#99](https://github.com/MacosPorters/betterxen/issues/99) [PERF-CPU] Implement checked guest memory locality cache | ranveersoni98 | 1 | - | closed, not planned | Cache recently accessed guest region identities. Invalidate on mapping changes and revalidate permissions and access bounds. |
|
||||
| [#100](https://github.com/MacosPorters/betterxen/issues/100) [PERF-CPU] Optimize guest instruction-byte fetch | ranveersoni98 | 1 | - | closed, not planned | Reduce repeated region lookups during sequential instruction decoding using bounded, execute-permission-checked fetch windows. |
|
||||
| [#102](https://github.com/MacosPorters/betterxen/issues/102) [PERF-CPU] Optimize mapped-region insertion and removal | ranveersoni98 | 1 | - | closed, not planned | Benchmark mapping operations across realistic synthetic region counts. Improve lookup and maintenance costs while preserving overlap rejecti |
|
||||
| [#103](https://github.com/MacosPorters/betterxen/issues/103) [PERF-CPU] Measure guest memory allocation and copying costs | ranveersoni98 | 1 | - | closed, not planned | Identify avoidable allocations and copies in original memory workloads. Preserve zero initialization and guest isolation. |
|
||||
| [#104](https://github.com/MacosPorters/betterxen/issues/104) [PERF-CPU] Optimize repeated PE RVA resolution | ranveersoni98 | 1 | - | closed, not planned | Benchmark section lookup and introduce a validated indexed representation where beneficial. Depend on checked PE range validation. |
|
||||
| [#106](https://github.com/MacosPorters/betterxen/issues/106) [PERF-CPU] Profile PE loading and startup stages | ranveersoni98 | 1 | - | closed, not planned | Measure parsing, mapping, relocation, import binding, TLS setup and entry execution separately. Use original fixtures only. |
|
||||
| [#111](https://github.com/MacosPorters/betterxen/issues/111) [PERF-CPU] Expand DBT performance instrumentation | ranveersoni98 | 1 | - | closed, not planned | Track translation time, dispatch time, guest-memory helper calls, cache-hit ratios, emitted bytes per guest instruction and code-cache utili |
|
||||
| [#169](https://github.com/MacosPorters/betterxen/issues/169) [CPU] Measure native code expansion by guest instruction family | ranveersoni98 | 1 | #342 | closed, not planned | criteria |
|
||||
|
||||
### GPU, shader and Metal
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#129](https://github.com/MacosPorters/betterxen/issues/129) [GPU-NEXT] Benchmark Metal render pipeline reuse | ranveersoni98 | 1 | - | closed, not planned | Measure repeated render setup separately from GPU time; verify complete pipeline identity, output pixels and cache lifetime. |
|
||||
| [#130](https://github.com/MacosPorters/betterxen/issues/130) [GPU-NEXT] Reduce verified Metal buffer allocation churn | ranveersoni98 | 4 | - | closed, not planned | Profile allocation count and latency in repeated original compute/render fixtures; implement bounded reuse with initialization and completio |
|
||||
| [#132](https://github.com/MacosPorters/betterxen/issues/132) [GPU-NEXT] Measure and reduce synchronous GPU readback overhead | ranveersoni98 | 1 | - | closed, not planned | Separate submission, completion and readback timings. Add a bounded opt-in asynchronous original-fixture path only if justified; verify outp |
|
||||
| [#133](https://github.com/MacosPorters/betterxen/issues/133) [GPU-NEXT] Benchmark multi-command Metal submission batching | ranveersoni98 | 1 | - | closed, not planned | Compare individual versus batched independent original commands; verify barriers, ordering, bounded queue depth and matching outputs. |
|
||||
| [#135](https://github.com/MacosPorters/betterxen/issues/135) [GPU-NEXT] Separate shader translation validation from reusable compil | ranveersoni98 | 1 | - | closed, not planned | Measure repeated translation of identical original inputs; define complete validated artifact identity including architecture and semantic o |
|
||||
| [#136](https://github.com/MacosPorters/betterxen/issues/136) [GPU-NEXT] Measure shader IR allocation and MSL emission costs | ranveersoni98 | 1 | - | closed, not planned | Profile decode, lift, analysis and emission separately on original workloads; reduce demonstrated temporary allocation costs without changin |
|
||||
| [#139](https://github.com/MacosPorters/betterxen/issues/139) [GPU-NEXT] Benchmark bounded BC1 linearization and upload paths | ranveersoni98 | 1 | - | closed, not planned | Measure untile, staging and upload costs on original texture patterns across sizes, mips and layers; verify pixel equality and malformed-inp |
|
||||
| [#141](https://github.com/MacosPorters/betterxen/issues/141) [GPU-NEXT] Benchmark partial mip updates and upload coalescing | ranveersoni98 | 1 | - | closed, not planned | Compare whole and selected-mip updates; verify dimensions, row pitch, unchanged neighboring mips and completion semantics. |
|
||||
| [#142](https://github.com/MacosPorters/betterxen/issues/142) [GPU-NEXT] Measure shader and graphics resource budget scaling | ranveersoni98 | 1 | - | closed, not planned | Characterize existing 4096-scale fixture limits and resource use. If justified, add configurable bounded synthetic workload tiers with check |
|
||||
| [#179](https://github.com/MacosPorters/betterxen/issues/179) [GPU] Implement runtime-dependent uniform shader branches | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#180](https://github.com/MacosPorters/betterxen/issues/180) [GPU] Add bounded shader loop semantics and termination checks | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#181](https://github.com/MacosPorters/betterxen/issues/181) [GPU] Implement typed scalar buffer reads with checked resource ranges | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#182](https://github.com/MacosPorters/betterxen/issues/182) [GPU] Add vector multiply-add and explicit floating-point rounding con | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#205](https://github.com/MacosPorters/betterxen/issues/205) [GPU] Build a metadata-driven RDNA2 semantic expansion pipeline | ranveersoni98 | 1 | - | closed, not planned | Xenora currently identifies approximately 1,460 RDNA2 instruction forms but semantically decodes only 25. |
|
||||
| [#208](https://github.com/MacosPorters/betterxen/issues/208) [GPU] Decode BC6H two-region modes (CPU) | elforeign | 1 | - | closed, not planned | criteria |
|
||||
| [#209](https://github.com/MacosPorters/betterxen/issues/209) [GPU] Native Metal upload and readback of BC6H and BC7 | elforeign | 1 | - | closed, not planned | criteria |
|
||||
| [#224](https://github.com/MacosPorters/betterxen/issues/224) [GPU] Guest graphics fences with Metal shared events | elforeign | 1 | - | closed, not planned | ## Goal Give the guest graphics runtime (`crates/loader/src/graphics.rs`) a fence object with the publicly documented D3D12 contract: a que |
|
||||
| [#225](https://github.com/MacosPorters/betterxen/issues/225) [QA] Define and run acceptance for the 86 locally verified gfx1030 for | elforeign | 1 | - | closed, not planned | ## Area QA / GPU ## Problem `docs/status.toml` at `eb85731` lists 104 gfx1030 forms. Only 18 count as accepted (`gpu = "fixture verified"`) |
|
||||
| [#258](https://github.com/MacosPorters/betterxen/issues/258) [PERF] Evaluate bounded Metal cache prewarming and persistence after s | Arths17 | 1 | - | closed, not planned | Xenora already has a [bounded context-local compute cache](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046 |
|
||||
| [#302](https://github.com/MacosPorters/betterxen/issues/302) [GPU RESEARCH] Define explicit shader entry and resource bindings beyo | Arths17 | 1 | #340 | closed, not planned | graphics.rs already translates image_sample_lz and #226 added guest texture/sampler descriptor tables. The remaining gap is not “add texture |
|
||||
|
||||
### Integration workloads and shared accounting
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#143](https://github.com/MacosPorters/betterxen/issues/143) [INTEGRATION-NEXT] Add original CPU-to-GPU mixed workload benchmark | ranveersoni98 | 1 | - | closed, not planned | Create a small original synthetic workload that executes verified CPU arithmetic, checked buffer updates and native rendering; validate know |
|
||||
| [#146](https://github.com/MacosPorters/betterxen/issues/146) [INTEGRATION-NEXT] Add deterministic synthetic transform workload | ranveersoni98 | 1 | - | closed, not planned | Use independently authored integer and supported finite FP transforms with known expected outputs; compare supported CPU and GPU implementat |
|
||||
| [#147](https://github.com/MacosPorters/betterxen/issues/147) [INTEGRATION-NEXT] Add original texture-update and draw workload | ranveersoni98 | 1 | - | closed, not planned | Build an original multi-frame texture update/draw case with known texels and pixels, bounded resources and explicit native verification. |
|
||||
| [#148](https://github.com/MacosPorters/betterxen/issues/148) [INTEGRATION-NEXT] Verify CPU and GPU shared resource ownership under | ranveersoni98 | 1 | - | closed, not planned | Use synthetic resources to verify permitted transitions, stale-handle rejection, completion-aware cleanup and deterministic failure without |
|
||||
| [#149](https://github.com/MacosPorters/betterxen/issues/149) [INTEGRATION-NEXT] Add long-running bounded original workload soak tes | ranveersoni98 | 1 | - | closed, not planned | Run a fixed number of validated synthetic iterations; report peak memory, cache growth, handles and deterministic outputs. Enforce time/reso |
|
||||
| [#150](https://github.com/MacosPorters/betterxen/issues/150) [INTEGRATION-NEXT] Add replayable original workload input corpus | ranveersoni98 | 1 | - | closed, not planned | Define versioned independently authored fixture inputs, deterministic seeds and expected outcomes. Replay only original data; verify limits |
|
||||
| [#159](https://github.com/MacosPorters/betterxen/issues/159) [SHARED-NEXT] Define shared CPU/GPU frame workload and timing interfac | ranveersoni98 | 1 | #328 | closed, not planned | Agree on bounded original workload inputs, frame completion, metrics units, resource lifetime and deterministic failure contracts before any |
|
||||
| [#160](https://github.com/MacosPorters/betterxen/issues/160) [SHARED-NEXT] Define bounded native GPU workload resource budget contr | ranveersoni98 | 1 | - | closed, not planned | Document limits for buffers, textures, queued work, compilation and staging; define explicit resource-exhaustion behavior and compatibility |
|
||||
| [#199](https://github.com/MacosPorters/betterxen/issues/199) [SHARED] Define unified CPU JIT and GPU allocation accounting | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
|
||||
### Runtime and loader
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#195](https://github.com/MacosPorters/betterxen/issues/195) [RUNTIME] Add virtual memory reserve commit decommit state tests | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#198](https://github.com/MacosPorters/betterxen/issues/198) [RUNTIME] Add CRT overlapping memory move and bounded string edge case | ranveersoni98 | 1 | - | closed, not planned | criteria |
|
||||
| [#211](https://github.com/MacosPorters/betterxen/issues/211) feat: Add a read-only dependency census for PE packages | elforeign | 1 | - | closed, not planned | The static probe takes one PE file at a time. With an EXE and companion DLLs, it takes a separate manual pass to tell which symbols the pack |
|
||||
| [#212](https://github.com/MacosPorters/betterxen/issues/212) [SHARED] Decide whether to relax the CLI runner's exact-bytes trust ga | Swastickc | 1 | - | closed, not planned | ## Question for the maintainer Should the CLI runner's exact-bytes trust gate be relaxed? A contributor asked for this error to be removed: |
|
||||
| [#227](https://github.com/MacosPorters/betterxen/issues/227) Audio: native PCM mixer and CoreAudio output (location and Gate 6 brid | elforeign | 1 | - | closed, not planned | ### Area audio ### Summary I have a standalone prototype of a native PCM mixer with opt-in CoreAudio output for Apple Silicon: a bounded co |
|
||||
| [#228](https://github.com/MacosPorters/betterxen/issues/228) [RUNTIME] Deterministic guest thread scheduler | jelly013 | 1 | - | closed, not planned | guest threads do not exist yet: CreateThread is absent and, as synch.rs states, a call that would block another guest thread stops the gues |
|
||||
| [#301](https://github.com/MacosPorters/betterxen/issues/301) [LOADER] Specify and test an original two-DLL startup graph | Arths17 | 1 | - | closed, not planned | run_synthetic_startup accepts one image, and services/modules.rs exposes built-in service modules. Those are not general guest DLL mapping, |
|
||||
| [#304](https://github.com/MacosPorters/betterxen/issues/304) [RUNTIME] Make guest Sleep yield without blocking other scheduled thre | Arths17 | 1 | - | closed, not planned | docs/runtime/threads.md explicitly says Sleep delays every guest thread. A deterministic single-host-thread scheduler is already implemented |
|
||||
| [#305](https://github.com/MacosPorters/betterxen/issues/305) [RUNTIME RESEARCH] Specify static TLS and callback lifecycle for sched | Arths17 | 1 | #312 | closed, not planned | the scheduler already gives each worker a TEB, stack, dynamic TLS/FLS values and cleanup, but docs/runtime/threads.md explicitly excludes PE |
|
||||
| [#307](https://github.com/MacosPorters/betterxen/issues/307) [RUNTIME] CRT stdio follow-up: fread/fseek/ftell, fgetc/ungetc and hos | soggyramennoodle | 1 | #263, #290 | open (active work) | PR #290 took its own CRT stdio module (`crt_stdio.rs`) out in `e1f7176`, because `main` gained its own `fopen`/`fclose`/`fwrite`/`__acrt_iob |
|
||||
| [#322](https://github.com/MacosPorters/betterxen/issues/322) [RUNTIME] Replace the VirtualQuery trap for a documented guest-memory | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for memory-query contract and failing guest tests. Production metadata changes coordinate #195 and memory.rs |
|
||||
| [#323](https://github.com/MacosPorters/betterxen/issues/323) [RUNTIME] Implement a bounded data-page VirtualProtect subset with tra | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for protection contract/failing-test design. Implementation follows the agreed memory metadata model in #322/ |
|
||||
| [#331](https://github.com/MacosPorters/betterxen/issues/331) Keep host-mounted file opens nonblocking | soggyramennoodle | 1 | - | closed, not planned | Follow-up from the review of #290. Harden regular-file opens so a host-side file type change cannot leave a BetterXen host thread waiting in |
|
||||
| [#332](https://github.com/MacosPorters/betterxen/issues/332) Bound the cost of lookups in large host-mounted directories | soggyramennoodle | 1 | - | closed, not planned | Follow-up from the review of #290. Host-backed drive lookup currently enumerates an entire directory and refuses directories exceeding 4,096 |
|
||||
| [#333](https://github.com/MacosPorters/betterxen/issues/333) Runtime compatibility follow-ups from PR #290 | soggyramennoodle | 1 | - | closed, not planned | Track the remaining nonblocking review items from #290. - Invalidate aligned-allocation tracking in shared guest heap free paths and test ow |
|
||||
| [#336](https://github.com/MacosPorters/betterxen/issues/336) [RUNTIME] SetFilePointerEx should fail a negative distance from FILE_B | Arths17 | 1 | #339 | closed, not planned | Found while auditing #290. This behaviour already exists on `main` (`crates/loader/src/services/files.rs`), so it is not part of that PR. Th |
|
||||
|
||||
### Compiled launch milestone and native app
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#247](https://github.com/MacosPorters/betterxen/issues/247) [DOCS] Add a native app quick start ending in a synthetic frame | Arths17 | 2 | #310 | open (active work) | The [README build section](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/README.md#building-xenora) |
|
||||
| [#249](https://github.com/MacosPorters/betterxen/issues/249) [APP] Avoid unchanged-frame image copies and reduce paused polling | Arths17 | 1 | - | closed, not planned | [`FrameLoopModel.startPolling`](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/app/Sources/Xenora/mai |
|
||||
| [#250](https://github.com/MacosPorters/betterxen/issues/250) [APP] Surface session command failures and centralize loop lifecycle | Arths17 | 1 | - | closed, not planned | [`FrameLoopModel`](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/app/Sources/Xenora/main.swift#L441) |
|
||||
| [#253](https://github.com/MacosPorters/betterxen/issues/253) [APP] Audit inspector and fixture controls with keyboard and VoiceOver | Arths17 | 1 | - | closed, not planned | The comparison found native controls and frame accessibility labels, but VoiceOver, keyboard navigation, text scaling and dark-mode behavior |
|
||||
| [#254](https://github.com/MacosPorters/betterxen/issues/254) [DIAGNOSTICS] Share a versioned static compatibility report across CLI | Arths17 | 1 | - | closed, not planned | Xenora already exposes metadata, loader validation, imports, relocations, TLS and a bounded first-unsupported-instruction finding through it |
|
||||
| [#256](https://github.com/MacosPorters/betterxen/issues/256) [INTEGRATION] Prove a multi-module synthetic startup through a checked | Arths17 | 1 | - | closed, not planned | Existing trusted startup and app fixtures establish bounded pieces. The comparison proposes one original integration scenario connecting exe |
|
||||
| [#259](https://github.com/MacosPorters/betterxen/issues/259) [RELEASE] Prepare versioned, signed and notarized contributor previews | Arths17 | 1 | - | closed, not planned | The [app build script](https://github.com/ranveersoni98/Xenora/blob/3b47c21bb008dcb38be704d540776f7cd046681e/scripts/build-app.sh) hardcodes |
|
||||
| [#311](https://github.com/MacosPorters/betterxen/issues/311) [LAUNCH TRACKER] First compiled guest application through native ARM64 | Arths17 | 2 | - | closed, not planned | / --- / / Build and admit / Source/tool/file-license identity, native host tools, exact admitted profile; unsupported input refused. / / En |
|
||||
| [#313](https://github.com/MacosPorters/betterxen/issues/313) [LAUNCH] Build an original compiled C guest for the launch milestone | Arths17 | 3 | #330 | open (active work) | ## Outcome and readiness Ready for fixture specification and native build-recipe work. Runtime execution waits for the agreed frame/service |
|
||||
| [#314](https://github.com/MacosPorters/betterxen/issues/314) [GPU] Add bounded creation and explicit release for guest graphics obj | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Ready for a narrow lifetime/budget design and failing tests. Agree budget values through #160 and coordinate graphi |
|
||||
| [#315](https://github.com/MacosPorters/betterxen/issues/315) [GPU] Let a bounded guest pipeline select original translated vertex a | Arths17 | 4 | - | closed, not planned | ## Outcome and readiness Design/fixture work can start. Production changes follow #159 contract agreement and #314; serialize graphics.rs ed |
|
||||
| [#316](https://github.com/MacosPorters/betterxen/issues/316) [RUNTIME/GPU] Expose the minimal typed graphics command bridge to comp | Arths17 | 2 | - | closed, not planned | ## Outcome and readiness ABI review and original failing guest tests can start. Implementation waits for #159 plus #315/#314 and coordinatio |
|
||||
| [#317](https://github.com/MacosPorters/betterxen/issues/317) [SESSION] Run the compiled launch fixture through a bounded built-in w | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Profile design can begin. Worker execution integration is blocked on #313/#316, the required #212 maintainer admiss |
|
||||
| [#318](https://github.com/MacosPorters/betterxen/issues/318) [SESSION] Bound stop and failure recovery when the compiled guest does | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Design and hostile-original-fixture specifications can start; implementation follows #317 and coordination with its |
|
||||
| [#319](https://github.com/MacosPorters/betterxen/issues/319) [INPUT] Verify compiled guest input snapshots change guest state and r | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness Original C test/expected-state design can start after the fixture/header contract is agreed. End-to-end execution w |
|
||||
| [#320](https://github.com/MacosPorters/betterxen/issues/320) [APP] Present actual compiled-guest frames in a native launch session | Arths17 | 1 | - | closed, not planned | ## Outcome and readiness UI acceptance specification can start. Swift implementation waits for #317/#318, #250 lifecycle agreement and overl |
|
||||
| [#321](https://github.com/MacosPorters/betterxen/issues/321) [QA] Independently gate first compiled launch from source build throug | Arths17 | 1 | #328 | closed, not planned | ## Outcome and readiness Ready for acceptance-protocol/independent expected-value work. The executable harness runs only after #313/#316/#31 |
|
||||
|
||||
### Roadmap and ecosystem research
|
||||
|
||||
| Issue | Original author | Comments | Pull requests | After this change | Objective excerpt |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| [#261](https://github.com/MacosPorters/betterxen/issues/261) [ROADMAP] Native workflow and runtime integration improvements from th | Arths17 | 9 | - | closed, not planned | Turn the supplied Victory for macOS teardown and integration map into actionable Xenora improvements, preserving original implementation, na |
|
||||
| [#298](https://github.com/MacosPorters/betterxen/issues/298) [RESEARCH] Review PortWatch projects and revise the native macOS execu | Arths17 | 7 | #308 | closed, not planned | / --- / --- / / CPU / Guest x86-64 runs on a matching x86-64 CPU; several projects require AVX2 / Decode/execute or translate each supporte |
|
||||
| [#306](https://github.com/MacosPorters/betterxen/issues/306) [RESEARCH] Track public evidence for console launch and graphics ABI b | Arths17 | 1 | - | closed, not planned | BetterXen's tested contracts are synthetic PE32+/gfx1030 contracts. They do not establish the Xbox launch environment, shader entry state, d |
|
||||
|
||||
#158 (native optimization evidence audit) was also closed as obsolete and belongs with DBT performance. The seven earlier "[Deferred native research]" umbrella issues were replaced by one closed index issue.
|
||||
@@ -0,0 +1,27 @@
|
||||
# Native research roadmap
|
||||
|
||||
**Deferred — not part of the active development roadmap, and paused indefinitely.** The active direction is the [CrossOver-based hybrid roadmap](../roadmap.md). Native work resumes only after an explicit maintainer decision, with no date. Native tasks needed by hybrid work are filed as focused hybrid issues instead.
|
||||
|
||||
## Existing implementation (preserved in the workspace)
|
||||
|
||||
Rust crates under `crates/` and `app/`, tests under `tests/`, fixtures, fuzz targets and benchmarks. The last `main` commit before the hybrid transition is tagged `native-first-final`. Contributor history is untouched.
|
||||
|
||||
## Verified achievements (synthetic evidence only)
|
||||
|
||||
Per [docs/progress.md](../progress.md) and the [status registry](../status.toml): translated gfx1030 shaders executing on native Metal on Apple M5 for synthetic fixtures, bounded x86-64 guest execution, an ARM64 dynamic binary translator for supported instruction subsets, a deterministic scheduler running guest threads serially on one host thread. No Xbox title runs. These are the original evidence classes, not new verification.
|
||||
|
||||
## Known limitations
|
||||
|
||||
See the archived [native-first plan](../archive/development-phases-native-first.md) and [README current limitations](../../README.md#current-limitations): serial guest threading, partial runtime services, partial RDNA2 coverage, unknown console launch ABI.
|
||||
|
||||
## Previously planned work
|
||||
|
||||
The native-first phases 1 to 6 (trustworthy baseline, hosted C application, threaded behavior, translated rendering, integrated interactive application, measured bottlenecks) and the X1 to X25 capability map, kept in the archive. The issue backlog was closed as not planned and is indexed, with preserved findings, in the [native issue archive](native-issue-archive.md).
|
||||
|
||||
## Potential future architecture
|
||||
|
||||
Independent CPU translation and Metal components that could replace or complement CrossOver, Rosetta 2 or D3DMetal where a demonstrated limitation or availability risk justifies it.
|
||||
|
||||
## Conditions for resuming (maintainer decision, not automatic)
|
||||
|
||||
Hybrid reaches verified maturity; reliable baselines exist; a native component solves a demonstrated hybrid limitation; a dependency imposes an unavoidable constraint or becomes unavailable; or resources allow it without slowing hybrid work.
|
||||
@@ -19,16 +19,16 @@ Request original gfx1030 Wave64 assembly, a mask/lane design note and per-lane e
|
||||
|
||||
KyTx declares GPL-2.0. Tx's conditional GPL-2.0-or-later offer covers only material they own and can license. Require file-level authorship, explicit compatible terms (GPL-3.0-or-later preferred for new Xenora fixtures), preserved notices and DCO. Inherited GPL-2.0-only code cannot enter the GPL-3.0-or-later combined work under those terms. The separate Kyty MIT notice does not settle a derived file's full provenance. No KyTx submodule is justified for the fixture. [KyTx license and notices](https://github.com/TxCsOffc/KyTx/tree/10f50d3eff0c0df36ee5d7007848a7b0b15072eb/LICENSES), [KyTx license](https://github.com/TxCsOffc/KyTx/blob/10f50d3eff0c0df36ee5d7007848a7b0b15072eb/LICENSE)
|
||||
|
||||
## Leonida
|
||||
## PE-Vulkan project
|
||||
|
||||
Public revision `2d3369a4c82e6f36c5190c4c534d3df600e135ec`. Candidate study surfaces and limits:
|
||||
|
||||
| Surface | Evidence and disposition |
|
||||
| --- | --- |
|
||||
| Decode and translation | `decode_bytes` decodes RDNA words with an explicit wave-mode argument. The SPIR-V generator exposes `Gen` and `assemble`. Compare supported operand forms on independent synthetic inputs. Keep Xenora's typed decoder and MSL backend. [Decoder](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/tools/rdna2_decode.py#L1397), [Generator](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/tools/rdna2spirv.py#L219) |
|
||||
| Containers and GPU API | `wave_size` and `binding_table` expose Leonida's FSSM interpretation. The D3D12 Vulkan shim and its device test are concrete source paths. Their existence does not establish a public authoritative Xbox ABI or PM4 contract. Keep metadata and guest handles outside Xenora's decoder, with explicit wave size, checked byte ranges and validated resource bindings. [FSSM reader](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/tools/fssm_header.py#L155), [Device shim](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/shims/d3d12_vulkan_device.cpp), [Device test](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/test/d3d12_vulkan_device_test.cpp) |
|
||||
| Containers and GPU API | `wave_size` and `binding_table` expose PE-Vulkan project's FSSM interpretation. The D3D12 Vulkan shim and its device test are concrete source paths. Their existence does not establish a public authoritative Xbox ABI or PM4 contract. Keep metadata and guest handles outside Xenora's decoder, with explicit wave size, checked byte ranges and validated resource bindings. [FSSM reader](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/tools/fssm_header.py#L155), [Device shim](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/shims/d3d12_vulkan_device.cpp), [Device test](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/test/d3d12_vulkan_device_test.cpp) |
|
||||
| Executable and services | `Loader::load` and `Loader::load_runtime_module` establish an implemented Windows PE loading and shim boundary. CMake registers loader, bounds and TLS tests. The upstream stand-in run is reported. For Xenora, study the boundary using original PE fixtures, with checked image metadata, guest address translation and explicit service dispatch. Native Windows execution and the Vulkan runtime conflict with Xenora's host contract. [PE loader](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/src/pe_loader.cpp#L608), [Test registration](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/runtime/CMakeLists.txt#L516) |
|
||||
|
||||
The README reports 26,503 translations and SPIR-V validation at specific earlier revisions. It contains conflicting Wave64 counts, so leave that count unresolved. The linked GPU reports cover synthetic cases and include a MoltenVK path. Validation and pipeline creation do not check game shader output. The pinned status explicitly says the game does not boot. Xenora's GTA VI intro remains unverified, and no authorized test input was established in this review. [Pinned status](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/README.md#project-status), [Reported validator run](https://github.com/ItsNotRexed/Leonida/issues/644#issuecomment-7072972586), [Upstream GPU reports](https://github.com/ItsNotRexed/Leonida/issues/166)
|
||||
The README reports 26,503 translations and SPIR-V validation at specific earlier revisions. It contains conflicting Wave64 counts, so leave that count unresolved. The linked GPU reports cover synthetic cases and include a MoltenVK path. Validation and pipeline creation do not check game shader output. The pinned status explicitly says the game does not boot. Xenora's commercial-title intro remains unverified, and no authorized test input was established in this review. [Pinned status](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/README.md#project-status), [Reported validator run](https://github.com/ItsNotRexed/Leonida/issues/644#issuecomment-7072972586), [Upstream GPU reports](https://github.com/ItsNotRexed/Leonida/issues/166)
|
||||
|
||||
Leonida carries GPL v3 text at the inspected pin. Any adoption still requires R1 to establish exact file terms and ownership, check generated tables and SDK-derived material, and review the separate `third_party/rpf9-explorer` gitlink at `e2939175c36a02d6ed25fa2c217b9d6ddcb8b516`. Game-derived metadata, shaders and asset outputs are outside this collaboration. Use public design references and original synthetic inputs. No Leonida submodule is justified. [Leonida license](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/LICENSE), [Submodule declaration](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/.gitmodules)
|
||||
PE-Vulkan project carries GPL v3 text at the inspected pin. Any adoption still requires R1 to establish exact file terms and ownership, check generated tables and SDK-derived material, and review the separate `third_party/rpf9-explorer` gitlink at `e2939175c36a02d6ed25fa2c217b9d6ddcb8b516`. Game-derived metadata, shaders and asset outputs are outside this collaboration. Use public design references and original synthetic inputs. No PE-Vulkan project submodule is justified. [PE-Vulkan project license](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/LICENSE), [Submodule declaration](https://github.com/ItsNotRexed/Leonida/blob/2d3369a4c82e6f36c5190c4c534d3df600e135ec/.gitmodules)
|
||||
@@ -5,7 +5,7 @@ Historical reuse discussion records the earlier survey. Xenora uses
|
||||
public specifications and original fixtures, with other emulator
|
||||
projects serving only as references for test selection.
|
||||
|
||||
Screened the eight A3 leads on 2026-11-23 against section 6 of the dual-track brief. The pins below identify the default-branch snapshots and their latest observed commits in UTC. The OpenScarlett tip changes documentation. A recent tip establishes activity, and its commit message records the subject of that activity. See the companion notes for [KyTx and Leonida](phase02-collaboration.md) and [CPU engine selection and original interpreter fixture](phase02-cpu-feasibility.md).
|
||||
Screened the eight A3 leads on 2026-11-23 against section 6 of the dual-track brief. The pins below identify the default-branch snapshots and their latest observed commits in UTC. The OpenScarlett tip changes documentation. A recent tip establishes activity, and its commit message records the subject of that activity. See the companion notes for [KyTx and PE-Vulkan project](phase02-collaboration.md) and [CPU engine selection and original interpreter fixture](phase02-cpu-feasibility.md).
|
||||
|
||||
GitHub metadata and tree entries establish availability and paths. Pinned text inspection establishes what a selected function does in source. Upstream test counts, captures and README statements remain upstream reports. No upstream code, builds, fixtures or GPU workloads were executed here. Repository-level license labels are provisional for reuse. File-specific grants, origin and transitive terms remain unverified for every code surface below.
|
||||
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
> **Superseded in part (2026-11-25).** This review recommended against Rosetta, Wine and CrossOver under the native-first plan. BetterXen's direction is now the CrossOver-based hybrid architecture ([roadmap](../roadmap.md), [ADR 0005](../adr/0005-crossover-hybrid-direction.md)); the screening facts below remain useful, the native-first recommendations do not. See the [upstream registry](upstream-registry.md) for the current provenance decision on VIctory-family projects.
|
||||
|
||||
# PortWatch review and a native macOS execution plan
|
||||
|
||||
Reviewed November 24, 2026 (America/Chicago). This is a public-documentation and
|
||||
source-boundary review, not a competitor execution campaign or independent
|
||||
acceptance. **BetterXen does not support commercial Xbox game execution.**
|
||||
|
||||
## Recommendation
|
||||
|
||||
Continue BetterXen as an original ARM64 runtime with its own x86-64 CPU
|
||||
translation and direct Metal backend. The Windows projects expose useful
|
||||
engineering questions, test structures and failure categories. Their code is
|
||||
not a drop-in native port. Do not fork a Windows emulator into this repository,
|
||||
replace the CPU with Rosetta, or add a Vulkan/Windows compatibility runtime.
|
||||
|
||||
The next useful result is an original compiled application that starts through
|
||||
a checked module/runtime path and reaches a translated, checked Metal frame.
|
||||
Broader vector instructions, thread lifecycle, binding metadata and console
|
||||
contracts must advance through explicit fixture-backed increments. Completing
|
||||
synthetic applications alone cannot prove Xbox compatibility.
|
||||
|
||||
## What was inspected
|
||||
|
||||
The tracker snapshot is [PortWatch 2cedf62a](https://github.com/4lwayz/portwatch-vi/blob/2cedf62a16b63697f096763ecb99b4c10d4dbccc/data/tracker.json),
|
||||
whose update timestamp is `2026-11-25T04:22:56.289Z` (November 24 locally).
|
||||
Its 35 efforts, 22 tools and 30 candidates were screened. One candidate repeats
|
||||
XCL. Three efforts have no public repository; seven repository endpoints were
|
||||
unavailable across the combined list. Available repositories were pinned to
|
||||
their observed default-branch commit; their metadata, README and public tree
|
||||
were used to classify target, host assumptions, lineage and evidence scope.
|
||||
The per-project tables below include every entry in these three lists: 85
|
||||
unique repository endpoints were checked, 78 available and seven unavailable.
|
||||
|
||||
This is not a line-by-line audit of every source file, proof of all contributor
|
||||
provenance, or a claim to understand unavailable/private code. No upstream
|
||||
project, setup script, Windows executable, game, shader corpus, asset collection,
|
||||
restricted SDK or decryption tool was run. Archive and protection-related entries
|
||||
were screened at metadata/README level only; no mirrored implementation or
|
||||
restricted payload was recovered. The tracker's flagged/ignored discovery/spam
|
||||
queues are not endorsed engineering candidates and were not imported.
|
||||
|
||||
Selected public architecture/status documentation was read more deeply for
|
||||
VIctory, VIctory-macOS, TuxBox, NativeX, SeriesX and XValkyrie; XSXEmu's README
|
||||
provides detailed admission, TLS and graphics boundaries. Those documents
|
||||
explain their own designs; they do not verify their claimed test/hardware results.
|
||||
The supplied `/so` website URL was unavailable to the web reader; the public,
|
||||
pinned repository data was accessible and matched the initial screened JSON.
|
||||
|
||||
BetterXen's working tree started at `f02eb2678e76e91876be5706ce91dca25dcc3017`
|
||||
with existing local documentation edits. Read-only `git fetch` found newer main
|
||||
[`b2654e93`](https://github.com/MacosPorters/betterxen/tree/b2654e93a42e74e29570183da1f31bb8cdc6f721).
|
||||
A separate ignored source snapshot was inspected without switching, resetting
|
||||
or merging the working tree. This distinction changes the hosted-C status.
|
||||
Local documentation edits from this review do not install that newer runtime.
|
||||
|
||||
## Why the PC results do not transfer directly
|
||||
|
||||
| Layer | Common PC approach described upstream | Native ARM64 BetterXen requirement |
|
||||
| --- | --- | --- |
|
||||
| CPU | Guest x86-64 runs on a matching x86-64 CPU; several projects require AVX2 | Decode/execute or translate each supported form, preserve precise state/faults, and advertise only satisfied guest features. |
|
||||
| Loader/runtime | Windows APIs or Wine/Proton supply much of PE startup, TLS, exceptions, threads, files and CRT behavior | Original checked guest memory, module lifecycle, service implementations, callback bridges and guest exception design. |
|
||||
| Graphics API | Console-facing objects dispatch onto desktop D3D12, sometimes through Vulkan | Explicit validated guest handles/commands and native Metal objects, lifetime, resource state and completion. |
|
||||
| Shaders | RDNA machine code becomes HLSL/DXIL or SPIR-V | Independently verified RDNA-to-IR-to-MSL behavior, entry state and resource bindings. SPIR-V may be an intermediate, not a Vulkan runtime requirement. |
|
||||
| Assets | Title supplies its own loaders or tools convert game-specific data | No need to become an archive viewer to prove guest execution; codecs/layouts require public contracts and demonstrated workload needs. |
|
||||
| Evidence | README milestones, streams, screenshots, compilation counts or self-reported FPS | Pinned original fixtures, independent expectations, actual native execution/readback and candidate-specific receipts. |
|
||||
|
||||
PortWatch is a discovery/editorial service. Its percentages are not compatibility
|
||||
measurements. The observed entries label their verification self-reported;
|
||||
phrases such as “confirmed” inside editorial summaries do not become BetterXen
|
||||
acceptance. Several forks share VIctory/XCL/Leonida lineage: ten forks are not
|
||||
ten independent confirmations. Compilation, shader validation, first pixels,
|
||||
scene completeness, interactive progress and stable play are distinct outcomes.
|
||||
|
||||
## macOS efforts and what “native” means here
|
||||
|
||||
[VIctory-macOS edba53dd](https://github.com/pragyaangaur/VIctory-macOS/blob/edba53ddc2207e6c537679f4ce06f966b7a63a59/README.md)
|
||||
uses Rosetta, CrossOver Wine and D3DMetal for the guest route. Native builds of
|
||||
its portable crates are a different result. Its reported passing tests neither
|
||||
establish a fully ARM64 runtime nor demonstrate playable game execution here.
|
||||
Its [port notes](https://github.com/pragyaangaur/VIctory-macOS/blob/edba53ddc2207e6c537679f4ce06f966b7a63a59/docs/macos.md)
|
||||
provide leads for cache identity, upload visibility, floating-point edge cases,
|
||||
capability/behavior mismatches and masked-store page faults. Reproduce relevant
|
||||
questions with original Metal/CPU fixtures; do not copy its workarounds or assume
|
||||
a D3DMetal defect exists in BetterXen's direct Metal path.
|
||||
|
||||
[XSXEmu 2d937f83](https://github.com/daeken/XSXEmu/blob/2d937f8360fbcdac368a0e363c24df322fa24db2/README.md)
|
||||
is another macOS effort, so “nobody is working on Mac” would be inaccurate.
|
||||
Its guest path uses an x86-64 Mach-O process and Rosetta, while owned shader
|
||||
translation fixtures use Metal. It explicitly separates static audit from
|
||||
execution admission and says no game frame has been produced. Its useful
|
||||
lesson is that entry/binding information and DLL/TLS lifecycle are separate
|
||||
contracts; its Rosetta guest route does not satisfy BetterXen's ARM64 rule.
|
||||
|
||||
[6stars 480d9a4d](https://github.com/meetox80/6stars/blob/480d9a4d00ed11560f7b4d989643723a0f5c451c/README.md)
|
||||
and the separately listed 6stars engine candidate describe Swift/Metal world-data
|
||||
rendering. An independent renderer may produce a convincing scene while never
|
||||
executing the original game program. That is valuable work with a different
|
||||
scope. No verified reusable component or file-level license clearance was
|
||||
established by this review.
|
||||
|
||||
[nativ64 3b826108](https://github.com/Ybucaille/nativ64/blob/3b82610882bc55cb27f0ec563c126a226855a8ea/README.md)
|
||||
targets Linux x86-64. Its central observation is relevant: host Windows APIs
|
||||
that a Windows project forwards still need implementation on a different OS.
|
||||
Its Linux syscalls/futexes and x64 ABI are not native Darwin ARM64 services.
|
||||
BetterXen should prioritize from its own import/fixture failures, not copy that
|
||||
project's title-specific API totals or implementation.
|
||||
|
||||
## BetterXen's actual starting point
|
||||
|
||||
| Area | Observed on current main b2654e93 | Consequence |
|
||||
| --- | --- | --- |
|
||||
| CPU inventory | 498 declared forms, 213 operations; tool classifies 93 operations native and 120 shared-semantics | These are inventory/lowering categories, not 498 independently accepted instructions or a compatibility percentage. VEX remains rejected. |
|
||||
| Typed runtime registry | 47 services: 7 implemented, 37 partial, 3 stubs; tool reports 0 verified entries | This is the typed subset, not the total handwritten runtime. Named exports alone do not prove behavior. |
|
||||
| Hosted C | A1 and A2 are present; PR #283 merged as d26af53c. Gate A records local passes awaiting independent review | Do not open another “implement hosted C” issue. Reproduce/accept the candidate and expand from a failing original workload. |
|
||||
| Modules | startup.rs accepts one image; modules.rs exposes built-in service modules | Built-in LoadLibrary/GetProcAddress is not general EXE plus guest-DLL startup and teardown. |
|
||||
| Threads | Deterministic serial guest scheduler with worker stacks/TEBs, waits and handles | Sleep can stall all workers; static worker TLS and thread/FLS callbacks remain documented gaps. Serial scheduling does not prove parallel x86 memory ordering. |
|
||||
| Graphics | Translated image_sample_lz pixel stage, native texture tests and guest descriptor-table bindings already exist | README X10 and generic “no sampling” descriptions are stale for this bounded path. Broader bindings, control flow and sampling still need contracts. |
|
||||
| Shader inventory | Table records 1,465 identified forms, 189 decoded, 185 IR/MSL, 18 accepted Metal forms; reconciliation finds zero mismatches | Different domains and acceptance stages must stay separate. The compute inventory does not fully describe graphics-only sampling. #225 owns pending acceptance. |
|
||||
| Texture/resource work | Packed BC footprints and bounded private texture staging merged; original resource/draw tests exist | Reuse them. Do not duplicate #260's active format inventory or assume guest/console integration from host upload success. |
|
||||
| Native app | Existing Swift/FFI fixtures; app/CI and usability PRs remain separate | UI/audio/input fixtures are not one integrated compiled guest application. #256 is the existing integration task. |
|
||||
| Console contract | Public AMD desktop ISA/PE/D3D12 documentation and explicit synthetic ABIs | Authentic launch, descriptors/commands and console-specific behavior remain unknown or unverified. No Xbox hardware access exists. |
|
||||
|
||||
Evidence for these boundaries: current-main
|
||||
[CPU registry](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/docs/cpu/instruction-registry.md),
|
||||
[Gate A](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/docs/testing/gate-a.md),
|
||||
[startup](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/crates/loader/src/startup.rs),
|
||||
[module services](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/crates/loader/src/services/modules.rs),
|
||||
[threads](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/docs/runtime/threads.md),
|
||||
[graphics compiler](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/crates/shader/src/graphics.rs),
|
||||
and [semantic coverage](https://github.com/MacosPorters/betterxen/blob/b2654e93a42e74e29570183da1f31bb8cdc6f721/docs/shaders/semantic-coverage.md).
|
||||
These are source/inventory observations. Historical hardware results retain
|
||||
their existing class A scope; none was rerun or independently certified here.
|
||||
|
||||
## What to take forward
|
||||
|
||||
Take **questions and test designs**, then implement independently from primary
|
||||
sources. No emulator source was copied, ported, translated, vendored or adapted.
|
||||
Repository-level license labels below are metadata only. They do not establish
|
||||
per-file grants, GPL-3.0-or-later compatibility or rights to fixtures/data.
|
||||
|
||||
1. Build a small, falsifiable workload before expanding an entire subsystem.
|
||||
TuxBox/NativeX-style separation of loader, ABI, GPU and presentation tests is
|
||||
useful; their own expected outputs cannot become BetterXen's oracle.
|
||||
2. Treat unresolved host services as a concrete inventory. Reuse #211's package
|
||||
census, #254's report schema and #255's startup diagnostics. Keep unsupported
|
||||
calls explicit; never return success merely to get farther.
|
||||
3. Model CPU state and faults before optimizing translation. AVX/YMM, masked
|
||||
memory accesses, unwinding and lifecycle cannot be supplied by ARM64 host
|
||||
calling conventions or a renamed Windows DLL.
|
||||
4. Make shader entry state, resources and pipeline identity explicit. A shader
|
||||
can compile and still read the wrong descriptor or run under the wrong mask.
|
||||
A replaced/skipped shader or an empty draw cannot pass a correctness gate.
|
||||
5. Validate resource ownership and completion before pursuing zero-copy. Apple
|
||||
unified memory does not remove guest/host address translation, storage modes,
|
||||
alignment, cache visibility or in-flight lifetime requirements.
|
||||
6. Expand wave behavior, loops, mesh and ray tracing only as separate reviewed
|
||||
contracts. A first simple scene does not require all of them; future console
|
||||
workloads may. Do not infer optional Metal features from a product name.
|
||||
7. Measure startup/steady-state and correctness separately, with actual host
|
||||
receipts. Cache keys must cover full relevant identity; prewarming is an
|
||||
experiment under #258, not a prerequisite or promised performance win.
|
||||
|
||||
Primary semantic authorities are the [Intel SDM](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-sdm.html),
|
||||
[public PE format](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format),
|
||||
[Microsoft x64 exception handling](https://learn.microsoft.com/en-us/cpp/build/exception-handling-x64),
|
||||
[AMD ISA publications](https://gpuopen.com/amd-gpu-architecture-programming-documentation/),
|
||||
[public resource-binding specification](https://microsoft.github.io/DirectX-Specs/d3d/ResourceBinding.html),
|
||||
and [Apple Metal feature tables](https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf).
|
||||
Class B applies only to what the relevant public specification documents;
|
||||
applying desktop behavior to Xbox needs separate evidence (often C or U).
|
||||
Feature tables are documentation, not our execution evidence across M1–M5.
|
||||
|
||||
## Contributor work and dependencies
|
||||
|
||||
The review is tracked in [#298](https://github.com/MacosPorters/betterxen/issues/298).
|
||||
The new tasks below have bounded deliverables, proposed paths, public references,
|
||||
negative controls and acceptance limits. They are unclaimed implementation work.
|
||||
Design tasks can begin with public documentation; runtime changes must respect
|
||||
parent claims and shared-file ownership. Read every issue comment and linked PR
|
||||
before claiming. Do not claim several tasks in one comment.
|
||||
|
||||
| Priority/order | Work | Dependency and boundary |
|
||||
| --- | --- | --- |
|
||||
| First, research | [#299 AVX/AVX2 state and decode contract](https://github.com/MacosPorters/betterxen/issues/299) | Extends beyond existing #120–#124; keeps CPUID honest. No blanket AVX2 implementation claim. |
|
||||
| First, research | [#300 bounded AMD64 unwind](https://github.com/MacosPorters/betterxen/issues/300) | Separates metadata/stack walking from SEH and C++ exceptions; existing trap stubs remain. |
|
||||
| First, loader contract/fixtures | [#301 original EXE plus two-DLL startup](https://github.com/MacosPorters/betterxen/issues/301) | Reuses #211 census and supplies a prerequisite to #256. Production mapping changes are separately coordinated. |
|
||||
| First, GPU contract | [#302 shader entry and resource bindings](https://github.com/MacosPorters/betterxen/issues/302) | Builds on existing #226 sampling/table work; coordinates #205, #179, #180 and #224. |
|
||||
| First, QA design | [#303 native capability receipts](https://github.com/MacosPorters/betterxen/issues/303) | Reuses #254 schema, #248 app CI and #158 dependency evidence. No automatic fleet posting. |
|
||||
| Next, scheduler implementation | [#304 Sleep yields ready workers](https://github.com/MacosPorters/betterxen/issues/304) | Narrow #228 child; coordinate parent and runtime PRs before code edits. |
|
||||
| First, lifecycle design | [#305 worker static TLS and callbacks](https://github.com/MacosPorters/betterxen/issues/305) | Depends on module/scheduler contracts for production; no competing scheduler. |
|
||||
| Parallel, public research | [#306 console launch/graphics evidence ledger](https://github.com/MacosPorters/betterxen/issues/306) | Links existing public research; unknown console details remain blockers rather than guesses. |
|
||||
|
||||
Reuse existing tasks rather than adding duplicates: #179 runtime uniform
|
||||
branches, #180 bounded loops, #205 semantic expansion, #225 independent shader
|
||||
acceptance, #224 fences, #147 resource-update workload, #148 shared lifetime,
|
||||
#256 startup-to-frame integration, #260 format inventory, #247 quick start,
|
||||
#250 session errors, #254 compatibility reports and #255 worker diagnostics.
|
||||
PRs #293–#297 already cover app CI, CPU coverage, selection ordering, Open and
|
||||
texture inventory respectively. Runtime PRs #263/#290 overlap substantially;
|
||||
their author/maintainer must resolve them before new runtime edits. These
|
||||
references are destination-repository numbers, not imported source numbers.
|
||||
|
||||
The replacement [development phases](../archive/development-phases-native-first.md) define the sole
|
||||
active work order, from compiled guest boot through modular workers, a
|
||||
guest-controlled Metal scene, an interactive application, a compatibility
|
||||
corpus, sustained native execution and conditional Xbox experiments.
|
||||
Hosted C is implemented on inspected main, awaiting independent acceptance;
|
||||
it is no longer an untouched prerequisite. Original integration, then measured
|
||||
optimization, then only evidence-admissible compatibility experiments is the
|
||||
path. There is no supported date or estimate for running a commercial game.
|
||||
|
||||
## Complete project screen
|
||||
|
||||
Each pin links to the exact README reviewed. “Unavailable” means that the
|
||||
observed public GitHub endpoint returned 404; it does not prove why or justify
|
||||
looking for restricted mirrors. “Unresolved” licenses and NOASSERTION are not
|
||||
reuse permission. Descriptions below classify documentation, not executed code.
|
||||
|
||||
### Tracker efforts (35)
|
||||
|
||||
| Entry | Pinned public documentation | Classification and BetterXen decision |
|
||||
| --- | --- | --- |
|
||||
| ZETTROX (`Zettrox/ztrx`) | [`90b529f8`](https://github.com/Zettrox/ztrx/blob/90b529f878a470fec9bf07b7be316bc769a12232/README.md); license metadata: `GPL-3.0` | VIctory/victory-fork lineage; Windows x64 + D3D12. Hardware tuning and reported gameplay are not independent native-Mac evidence. |
|
||||
| Uilian (`uiliannn/VItoriaBr`) | [`c2485475`](https://github.com/uiliannn/VItoriaBr/blob/c24854750132af24c10e954765047525e0249bd3/README.md); license metadata: `GPL-3.0` | VIctory-family Windows/DXIL fork; README and tracker differ on readiness. Keep results self-reported; no ARM64 execution path. |
|
||||
| suri | No public repository in tracker | Private/stream report only; no implementation inspection or reproducibility. No source/fixture reuse proposed. |
|
||||
| omonkey | No public repository in tracker | Private/stream report only; no implementation inspection or reproducibility. No source/fixture reuse proposed. |
|
||||
| CGBJ | No public repository in tracker | Private/stream report only; no implementation inspection or reproducibility. No source/fixture reuse proposed. |
|
||||
| hyphennn (`fxceless/victory-fork`) | [`310c6eb6`](https://github.com/fxceless/victory-fork/blob/310c6eb6c16822ab95076aad61fce19bba86bb98/README.md); license metadata: `GPL-3.0` | VIctory rendering fork, Windows x64/D3D12; useful failure categories include bindings and mesh work. No implementation reuse. |
|
||||
| VIctory (`Marvisak/VIctory`) | [`940d32f6`](https://github.com/Marvisak/VIctory/blob/940d32f69b22265690a0b5a15d6ded572ba33baf/README.md); license metadata: `GPL-3.0` | Windows x64 direct guest execution, HLE and D3D12/DXIL. Public architecture documents host pass-through and title-specific work. |
|
||||
| xbox-emulator (`omonkeyz/xbox-emulator`) | [`f89e4106`](https://github.com/omonkeyz/xbox-emulator/blob/f89e4106fe8a1728515afa34ceb5097132cadcda/README.md); license metadata: `GPL-3.0` | TomBox continuation; Windows-process runtime and RDNA shader work. README title reports are unverified here; assets/captures are excluded. |
|
||||
| XCL (`xcl-dev/xcl`) | [`f5c5bdf0`](https://github.com/xcl-dev/xcl/blob/f5c5bdf0e91035f8f1404f46f4f2f7aedc259e7f/README.md); license metadata: `GPL-2.0` | Windows x64 direct execution plus D3D12/DXIL; host services and pipeline behavior matter. GPL-2.0-only README; no reuse clearance. |
|
||||
| ScarlettX (`Freminet/ScarlettX`) | [`01c642cf`](https://github.com/Freminet/ScarlettX/blob/01c642cf62a6d9978f535e2c438c488ebcb4cd39/README.md); license metadata: `unresolved` | Windows x64 HLE/D3D12; separates console precompiled-shader gaps from desktop paths. Console-binary-derived findings need independent public evidence. |
|
||||
| TuxBox (`brcly/TuxBox`) | [`97b8ad31`](https://github.com/brcly/TuxBox/blob/97b8ad3192def18d491fe72ea3a55e204bc77a5d/README.md); license metadata: `Apache-2.0` | x86-64 Windows and Linux/Proton; owned guest fixtures and provider-specific failures are useful testing patterns, not an ARM64 solution. |
|
||||
| americas-recomp (`realdody/americas-recomp`) | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| PE-Vulkan project (`ItsNotRexed/Leonida`) | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| OpenScarlett (`californiaAlmonds/OpenScarlett`) | [`022a8b25`](https://github.com/californiaAlmonds/OpenScarlett/blob/022a8b25148cc08412df8ac7e752b9efed4cd819/README.md); license metadata: `MIT` | Windows x64, D3D12/Vulkan; broad completeness claims are upstream reports. Public-spec-backed original fixtures are the only proposed transfer. |
|
||||
| scarlett-layer (`jadeowaowa/scarlett-layer`) | [`0e436b3e`](https://github.com/jadeowaowa/scarlett-layer/blob/0e436b3e1c654765b193c1cb705918fbf101b10b/README.md); license metadata: `Apache-2.0` | Windows import interception/shims, D3D12 and synthetic test tiers; useful distinction between desktop samples and console compatibility. |
|
||||
| Xbox2Windows (`R0Y00/Xbox2Windows`) | [`ab9a020c`](https://github.com/R0Y00/Xbox2Windows/blob/ab9a020c0783f9ce1dd10876cbeb119707b9ada9/README.md); license metadata: `MIT` | x64-to-C++ AOT/loader and DXIL research; distinguishes modified diagnostic startup from original executable compatibility. Host ABI still differs. |
|
||||
| AnyXboxX (`LooperSalty/AnyXboxX`) | [`b92a71b9`](https://github.com/LooperSalty/AnyXboxX/blob/b92a71b9308e76f8ec9059c01d6e18f21611dc20/README.md); license metadata: `GPL-3.0` | Unicorn research and native Windows routes; current README also uses VIctory lineage. Do not treat its older interpreter label as ARM64 readiness. |
|
||||
| XValkyrie (`sammwyy/xvalkyrie`) | [`c4c04970`](https://github.com/sammwyy/xvalkyrie/blob/c4c04970930d029a25622743e3ff4ef873ac17a6/README.md); license metadata: `GPL-3.0` | Windows x64 console API and shader translation; useful subsystem boundaries. Console/title-specific ABI claims remain unverified. |
|
||||
| GTAVI-Recomp (`JamesCicada/GTAVI-Recomp`) | [`71766d8b`](https://github.com/JamesCicada/GTAVI-Recomp/blob/71766d8b5c669bc44639ad85bfd84edd8337c75a/README.md); license metadata: `GPL-2.0` | PS5/AnyPS5 route, not an Xbox launch contract; do not adapt emulator source or transfer PS5 APIs to Series. |
|
||||
| AnyXboxSeries (`edupode/anyxboxseries`) | [`9ca2d053`](https://github.com/edupode/anyxboxseries/blob/9ca2d05329fe878db6abea6060889f9a95566719/README.md); license metadata: `NOASSERTION` | Windows D3D12 loader/inspection and an original sample; sample presentation does not establish Xbox guest execution. |
|
||||
| SCARAB (`p-portela/SCARAB`) | [`8140e0be`](https://github.com/p-portela/SCARAB/blob/8140e0be4908499a5c4381eb4532410f05e39369/README.md); license metadata: `GPL-3.0` | Windows/D3D12 bridge, Linux through vkd3d-proton; memory/presentation incompleteness is explicit. Not native ARM64. |
|
||||
| AnyBox (`Dark3581/AnyBox`) | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| PercyScarlett (`rpatty-dev/PercyScarlett`) | [`64719f96`](https://github.com/rpatty-dev/PercyScarlett/blob/64719f96d32f74d9d68cec69243b515ba675741f/README.md); license metadata: `GPL-2.0` | Windows x64/D3D12; README distinguishes existing DXIL titles from RDNA lifting and reports instability. GPL-2.0-only; no reuse. |
|
||||
| GrandTheftXbox (`zohaiblazuli/GrandTheftXbox`) | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| Scarlett Windows Compat (`ProhorovIlja/NativeX-Runtime`) | [`b3087ce0`](https://github.com/ProhorovIlja/NativeX-Runtime/blob/b3087ce0ab191227dc9e7af37cab97a0b097bb98/README.md); license metadata: `MIT` | Portable inspection and separate Windows/Linux ABI/graphics probes. Useful test decomposition; not a complete application runtime. |
|
||||
| DedSec (`Hylanderry/DedSec`) | [`c44b38ca`](https://github.com/Hylanderry/DedSec/blob/c44b38ca0207900cd27c687bb9213a6c8474bc69/README.md); license metadata: `MIT` | Windows x64/direct execution and D3D12; performance/feature claims need reproducible evidence. No Mac execution established. |
|
||||
| Xbgtasix (`ljm-233/Xbgtasix`) | [`1a767872`](https://github.com/ljm-233/Xbgtasix/blob/1a7678729cd436f9adaa9772b76d97af3d292321/README.md); license metadata: `GPL-3.0` | Windows compatibility DLLs rely on the Windows loader for imports, relocation and TLS. This omitted host work is required on Darwin. |
|
||||
| SeriesX Emulator (`anrq0/SeriesX-Emulator`) | [`4f07d76f`](https://github.com/anrq0/SeriesX-Emulator/blob/4f07d76f9f641ce85ce4238081c06d1cef1b7521/README.md); license metadata: `MIT` | Interpreter, original test applications and desktop launcher; README explicitly excludes commercial compatibility. Reported vectors are not our oracle. |
|
||||
| GTA6-COMPAT-LAYER (ScarlettCompat) (`SSTGxf/ScarlettCompat`) | [`b92f060b`](https://github.com/SSTGxf/ScarlettCompat/blob/b92f060b1754580338dc30f57bb50777af38749d/README.md); license metadata: `MIT` | Windows native loader and console shims. Diagnostic bootstrap is a useful stage model; passing imports is not an implemented API. |
|
||||
| XlaunchVI (`JPTuba9/xlaunch-vi`) | [`40feebd7`](https://github.com/JPTuba9/xlaunch-vi/blob/40feebd73a59c13ac5d65c3e61d21906111294e7/README.md); license metadata: `unresolved` | Windows x64, D3D12/Vulkan and frontend. README explicitly denies game compatibility; UI work is separate from guest execution. |
|
||||
| OpenScarlett (Community Edition) (`OpenCommunityEdition/OpenScarlett`) | [`d1285fdd`](https://github.com/OpenCommunityEdition/OpenScarlett/blob/d1285fddbe399927581a772f536239b33a1e2cf4/README.md); license metadata: `AGPL-3.0` | Windows/Linux API layer; README build requires GDKX. Do not follow restricted tooling dependencies or import its sources. |
|
||||
| Five Star Recomp (`ThatRecompDev/five-star-recomp`) | [`fb3b3a2d`](https://github.com/ThatRecompDev/five-star-recomp/blob/fb3b3a2def5af6eef6004c954c11f2cd22574168/README.md); license metadata: `GPL-3.0` | Windows platform, shader and asset tools; title startup claims do not establish a complete scene or native Mac execution. |
|
||||
| G6Recomp (`Kajcsi/G6Recomp`) | [`82ccaa5d`](https://github.com/Kajcsi/G6Recomp/blob/82ccaa5d4b3fdc1edb9cdd95c8dbab4ee7cde352/README.md); license metadata: `GPL-3.0` | Windows AVX2/direct-execution loader with fixture tests; static-recompilation name does not remove reliance on x64/Windows ABI. |
|
||||
| GTA6-BootTest (`OnlyMoisties/GTA6-BootTest`) | [`32683d8f`](https://github.com/OnlyMoisties/GTA6-BootTest/blob/32683d8fe2841bddeb0b437109e97bc32cf55724/README.md); license metadata: `unresolved` | Windows debugger/shim/GPU startup harness. Reported first UI frame is not full scene correctness; no root license identified by metadata. |
|
||||
| Palmetto (`luizwidmer/palmetto`) | [`6416a273`](https://github.com/luizwidmer/palmetto/blob/6416a273336599341dfd31e64cc3da3fd1b855ed/README.md); license metadata: `GPL-3.0` | Windows runtime and RDNA-to-SPIR-V/Vulkan path; behavior-stage reporting is useful, runtime/backend is incompatible with our target. |
|
||||
|
||||
### Tracker tools (22)
|
||||
|
||||
| Entry | Pinned public documentation | Classification and BetterXen decision |
|
||||
| --- | --- | --- |
|
||||
| `lynxnathan/rage-tools-vi` | [`547ee9ba`](https://github.com/lynxnathan/rage-tools-vi/blob/547ee9ba2dde236644a597cef65a18f7bd5549be/README.md); license metadata: `MIT` | Asset/catalog tooling; README mentions executable-derived information. No derived corpus imported; not a CPU/runtime shortcut. |
|
||||
| `fishingpvalues/gta6-pc-port-hub` | [`3a7d8d18`](https://github.com/fishingpvalues/gta6-pc-port-hub/blob/3a7d8d18f6fdc2071f8609f35153fb07ac25d1b5/README.md); license metadata: `CC0-1.0` | Archived coordination hub. Its missing-executable snapshot is historical, not evidence of current file availability or native compatibility. |
|
||||
| `holdmysocks/SixNG` | [`8897a1f6`](https://github.com/holdmysocks/SixNG/blob/8897a1f60c6700553987954f567d9146f898d882/README.md); license metadata: `GPL-3.0` | Asset exporter with explicit texture fallback limitations; fallback pixels must never become BetterXen correctness evidence. Defer format work to #260. |
|
||||
| `rpatty-dev/PercyStar` | [`ca4cd4c0`](https://github.com/rpatty-dev/PercyStar/blob/ca4cd4c09bb3a4e29cc2d33e69385725c5fb2220/README.md); license metadata: `NOASSERTION` | Asset/shader/media tools with custom attribution terms. macOS tooling does not establish guest execution or GPL-compatible reuse. |
|
||||
| `breadbbbb/rpf9-explorer` | [`cab9bb6e`](https://github.com/breadbbbb/rpf9-explorer/blob/cab9bb6ebe6d46fec6ac90ee5004bdd8cfd9e31a/README.md); license metadata: `unresolved` | Cross-platform asset viewer/exporter; root grant unresolved in metadata. Exclude code/assets; sample viewing is not guest execution. |
|
||||
| `Ahmet-Dedeler/bcpack-rs` | [`b1c3099a`](https://github.com/Ahmet-Dedeler/bcpack-rs/blob/b1c3099a3402de8b76c9263a828791bd8bc0c930/README.md); license metadata: `NOASSERTION` | Texture codec research with reported synthetic tests; useful codec boundary, but exact tables/provenance/file licenses are unreviewed. Defer to #260. |
|
||||
| `nullbrik/RageForge` | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| `woreksami/ttpf-studio` | [`a2fe110d`](https://github.com/woreksami/ttpf-studio/blob/a2fe110d8e7aeb8ed3be37c365c75078a408c089/README.md); license metadata: `MIT` | Texture/archive/video tooling. No original executable execution; no proprietary payload or replacement asset imported. |
|
||||
| `walkthestars/GTA6-Asset-Info` | [`bad5bc21`](https://github.com/walkthestars/GTA6-Asset-Info/blob/bad5bc2180ade416eafdb50aa21e21eeec5adbda/README.md); license metadata: `GPL-3.0` | Asset-format notes for SixNG. Discovery only; derived samples/tables remain outside this review. |
|
||||
| `Ahmet-Dedeler/awesome-gta6-reverse-engineering` | [`34a6e945`](https://github.com/Ahmet-Dedeler/awesome-gta6-reverse-engineering/blob/34a6e945b9698975ccd4e0c2e039034914dcc278/README.md); license metadata: `NOASSERTION` | Discovery index. Linked tools, code and asset claims have separate provenance and terms; no linked payloads were obtained. |
|
||||
| `HolyRoses/gta6-explorer` | [`8e383a49`](https://github.com/HolyRoses/gta6-explorer/blob/8e383a49d07da5068fa30ebf208025e307018fcc/README.md); license metadata: `MIT` | Read-only package/asset inspection; not a guest runtime. No package bytes or format-derived corpus imported. |
|
||||
| `meetox80/6stars` | [`480d9a4d`](https://github.com/meetox80/6stars/blob/480d9a4d00ed11560f7b4d989643723a0f5c451c/README.md); license metadata: `unresolved` | Swift/Metal world-data renderer. Native graphics demonstration is a different objective from executing original Xbox CPU/shader code. |
|
||||
| `Ahmet-Dedeler/rage9-re` | [`30c6d215`](https://github.com/Ahmet-Dedeler/rage9-re/blob/30c6d2150ad9d3021802f509ff3ee232d466f499/README.md); license metadata: `NOASSERTION` | Animation/script asset-format tools, not executable compatibility. No asset samples or derived format tables imported. |
|
||||
| `Albotterin/AWC_from_RPF9_Extractor` | [`decfde54`](https://github.com/Albotterin/AWC_from_RPF9_Extractor/blob/decfde54243d9a982550b08c7db21c34a20a1775/README.md); license metadata: `MIT` | Audio extraction tooling with upstream dependency/license scopes. Does not implement guest audio APIs; no extracted audio or code reuse. |
|
||||
| `SentinelInteractive/0x52504639` | [`f1a383a7`](https://github.com/SentinelInteractive/0x52504639/blob/f1a383a72e90706b88d82f0ed1a674a0d7fcba58/README.md); license metadata: `MIT` | Format notes/catalogs, no execution evidence. Do not promote derived counts into console support. |
|
||||
| `JoshRob297/rpf9-research` | [`144d3451`](https://github.com/JoshRob297/rpf9-research/blob/144d345191bd37de3f6bd5e85df3e8ae8815552e/README.md); license metadata: `GPL-3.0` | Container research/catalogs; protected-index/key questions are outside BetterXen scope. No derived indexes imported. |
|
||||
| `Librett0/vice-lens` | [`8b8c8a84`](https://github.com/Librett0/vice-lens/blob/8b8c8a847ef926d8d6298ecfade142db19cfce5d/README.md); license metadata: `MIT` | Asset viewer/world renderer and media tooling; viewing a scene is not original-game execution. No asset/capture reuse. |
|
||||
| `batatinhafcbatatinha-pixel/xseriesrecomp` | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| `sub-north/xbox-hle-lab` | [`8863028b`](https://github.com/sub-north/xbox-hle-lab/blob/8863028b486dedf660303fcd3c756b05bbbebf91/README.md); license metadata: `MIT` | Separate original probes, docs and XCL patches with different license scopes. Useful falsifiable-reproduction discipline; no patch reuse. |
|
||||
| `kry-vex-gta/XBOX-Inspector` | [`0a3d067f`](https://github.com/kry-vex-gta/XBOX-Inspector/blob/0a3d067f7167a30b5e2517a4e781ec1ada3006d7/README.md); license metadata: `MIT` | Static inspection/recompilation prechecks. Metadata analysis is not guest execution; existing #211/#254 own comparable BetterXen work. |
|
||||
| `nineforge0/forge9` | [`f40381ca`](https://github.com/nineforge0/forge9/blob/f40381cac62ade007a62e728eaa988fd9677bec4/README.md); license metadata: `MIT` | README advertises decryption and executable-derived key/table workflow. Excluded from implementation/input research; no such code or inputs accessed. |
|
||||
| `TheoBIET/OpenVI` | [`fd415911`](https://github.com/TheoBIET/OpenVI/blob/fd4159118e750084451b9bad364169660daaa5e2/README.md); license metadata: `GPL-3.0` | Cross-platform asset explorer. macOS UI availability is not native emulation; no content or auto-update workflow executed. |
|
||||
|
||||
|
||||
### Tracker candidates (30, including repeated XCL)
|
||||
|
||||
| Entry | Pinned public documentation | Classification and BetterXen decision |
|
||||
| --- | --- | --- |
|
||||
| `edsuuu/VI-BR-PORT` | [`7a30f506`](https://github.com/edsuuu/VI-BR-PORT/blob/7a30f5063dafeda1ceab84d251c22dc581d4dfc6/README.md); license metadata: `GPL-3.0` | VIctory-family Windows/NVIDIA memory tuning; wave32 assumptions must not be transferred to Apple GPU capability claims. |
|
||||
| `xcl-dev/xcl` | [`f5c5bdf0`](https://github.com/xcl-dev/xcl/blob/f5c5bdf0e91035f8f1404f46f4f2f7aedc259e7f/README.md); license metadata: `GPL-2.0` | Windows x64 direct execution plus D3D12/DXIL; host services and pipeline behavior matter. GPL-2.0-only README; no reuse clearance. |
|
||||
| `ZigZagBoi1/ScarlettPort` | [`48ba23a9`](https://github.com/ZigZagBoi1/ScarlettPort/blob/48ba23a91a83121f8d0625a633e88fa463d5a0ca/README.md); license metadata: `NOASSERTION` | Windows x64/D3D12 compatibility route; no native Darwin CPU/runtime established. |
|
||||
| `Steinkoloss/port-of-the-americas` | [`0f3be36a`](https://github.com/Steinkoloss/port-of-the-americas/blob/0f3be36aaefe69c25f06e05222b88453f3557acd/README.md); license metadata: `unresolved` | Linux x64/Proton/vkd3d-proton shims; README names PE-Vulkan project shader conversion. No implementation reuse. |
|
||||
| `Leucodermique/VIce` | [`8c7b24fd`](https://github.com/Leucodermique/VIce/blob/8c7b24fda90eb08fe64044726b7c880065a86ee0/README.md); license metadata: `GPL-3.0` | VIctory-based Windows distribution/frontend; consolidation does not independently validate combined changes. |
|
||||
| `flipflapov/DSTN` | [`7066ae66`](https://github.com/flipflapov/DSTN/blob/7066ae669c7b0e20d0b05675826169cdc7442883/README.md); license metadata: `GPL-3.0` | PE-Vulkan project fork; tool portability on macOS does not establish native guest execution. No implementation reuse. |
|
||||
| `daeken/XSXEmu` | [`2d937f83`](https://github.com/daeken/XSXEmu/blob/2d937f8360fbcdac368a0e363c24df322fa24db2/README.md); license metadata: `MIT` | macOS Rust host with Rosetta guest execution and separate native Metal shader fixtures; not a fully ARM64 guest CPU path. No game frame claimed. |
|
||||
| `SixLauncher/VILauncher` | [`bf2f6ca9`](https://github.com/SixLauncher/VILauncher/blob/bf2f6ca9a6445aee6ebdff2b1cef87266f9cf1f4/README.md); license metadata: `GPL-3.0` | Linux launcher selecting VIctory/XCL under Wine/Proton. Not a new guest execution or Metal implementation. |
|
||||
| `4Sakens/Project-Kalaga` | [`56b41fb4`](https://github.com/4Sakens/Project-Kalaga/blob/56b41fb4a68b89e5e356c1445699ba4ac6b8cc83/README.md); license metadata: `unresolved` | Windows consolidation of existing efforts; aggregated subsystems and local paths are not independent compatibility evidence. |
|
||||
| `idvwork/rebox` | [`a833078e`](https://github.com/idvwork/rebox/blob/a833078e3366a70a74edef0cbfe01b80a81dd55c/README.md); license metadata: `GPL-2.0` | WineGDK/vkd3d-proton and AnyPS5 shader lineage; incompatible runtime and no emulator adaptation permitted. |
|
||||
| `Yhozen/series-web` | [`d7512b29`](https://github.com/Yhozen/series-web/blob/d7512b299fe2836e08783665308cd8c4bb924345/README.md); license metadata: `GPL-2.0` | PISCO AOT x86-to-WebAssembly/runtime research; original browser workloads differ from native ARM64/Metal and Xbox compatibility. |
|
||||
| `DesignWithTommy/Neonbridge` | [`954c00c5`](https://github.com/DesignWithTommy/Neonbridge/blob/954c00c506a8616e985e94e8ea6bcbfba7f80f48/README.md); license metadata: `GPL-3.0` | Windows VIctory-family launcher/runtime; frontend and startup improvements are not CPU translation for ARM64. |
|
||||
| `moonrelax/basalt` | [`8af09135`](https://github.com/moonrelax/basalt/blob/8af091350e0d5cdf89f3736a756235a72b67bea9/README.md); license metadata: `MIT` | Original interpreter/cooperative scheduler research; GPU objects are fake and no rendering is claimed. Do not reuse stubs as acceptance. |
|
||||
| `ka1qux/victory-ka1qux` | [`77b8a9eb`](https://github.com/ka1qux/victory-ka1qux/blob/77b8a9eb0d29521f34ffe6061530cc873090e844/README.md); license metadata: `GPL-3.0` | VIctory-family AMD Windows rendering fork. Vendor-specific counters and claimed fixes need independent original tests. |
|
||||
| `ethan00013/keylime` | [`361c7e94`](https://github.com/ethan00013/keylime/blob/361c7e94ab9d29d88cb1e5bfaadc8c3fb909bebc/README.md); license metadata: `GPL-3.0` | Windows x64 runtime with Vulkan/SPIR-V; no native Mac route. Backend and console-specific claims need independent contracts. |
|
||||
| `Joaco9020/mangrove` | [`d16326c6`](https://github.com/Joaco9020/mangrove/blob/d16326c652b6f82e7b59b390f63e37cab816acd3/README.md); license metadata: `GPL-3.0` | VIctory-family Windows fork tuned for lower-VRAM NVIDIA GPUs. Settings are not portable Metal correctness work. |
|
||||
| `chvabalo-interactive/sludgemu` | [`29cf795e`](https://github.com/chvabalo-interactive/sludgemu/blob/29cf795e23bb4917b9a8acd6be95d38a0f3b99b1/README.md); license metadata: `unresolved` | Windows direct guest execution and D3D12/DXIL, early startup with logging stubs. Stubs are not behavior support. |
|
||||
| `larpingvibecoder/sonoma` | [`835f386a`](https://github.com/larpingvibecoder/sonoma/blob/835f386a144eca0b903b8bec63c0a003d7e07071/README.md); license metadata: `Apache-2.0` | Windows Rust runtime/direct DXIL, early proof of concept; name does not indicate macOS support. |
|
||||
| `7jycwjmbfn-eng/scenegate-vi` | [`d5908947`](https://github.com/7jycwjmbfn-eng/scenegate-vi/blob/d590894710631a3c6adc6cca526c44d3c0c2bd41/README.md); license metadata: `MIT` | Windows/Vulkan startup and scene work based on PE-Vulkan project; retain only documented failure categories, not code or title-derived inputs. |
|
||||
| `TaynanGT/victory-windows-anterior-20261125` | Unavailable (404); no source recovered | Unavailable public endpoint; implementation, provenance and current execution status remain unknown. |
|
||||
| `TaynanGT/victory-windows` | [`cdcff8fe`](https://github.com/TaynanGT/victory-windows/blob/cdcff8fe96182bade41343a10b985c028e9e8968/README.md); license metadata: `GPL-3.0` | VIctory-family Windows work on a non-main default branch; pin the actual branch, not its name. |
|
||||
| `Archivist-Atlas/gta-vi-astral` | [`ff21332e`](https://github.com/Archivist-Atlas/gta-vi-astral/blob/ff21332e5ea2ea1c254a97c0b3036d36ff8e79ce/README.md); license metadata: `unresolved` | Go Windows runtime research citing VIctory/Leonida designs; no independent ARM64/Metal execution established. |
|
||||
| `airpiglabs/crouton` | [`faad29e6`](https://github.com/airpiglabs/crouton/blob/faad29e6af4c45804cfa8a42901341a52d9c824c/README.md); license metadata: `GPL-2.0` | XCL/Bathyal lineage, Windows then Wine/Proton; GPL-2.0-only and incompatible host/runtime route. |
|
||||
| `natedemoss/vice-pc` | [`2f98c053`](https://github.com/natedemoss/vice-pc/blob/2f98c05325237bc8ed8faf0e7b95bc0e6d22b9bb/README.md); license metadata: `MIT` | Windows loader proof of concept; README says nothing boots. No ARM64 or Metal evidence. |
|
||||
| `JoseArranzSanchez/GTA6_PCPORT_INFO` | [`585b42a1`](https://github.com/JoseArranzSanchez/GTA6_PCPORT_INFO/blob/585b42a184bf1cdf1a5f8e76e0d2e7f8a9102857/README.md); license metadata: `NOASSERTION` | Secondary feasibility report, not implementation or primary legal authority. No legal conclusions adopted from it. |
|
||||
| `DBWilliamEngineering/IraRationis` | [`67106e80`](https://github.com/DBWilliamEngineering/IraRationis/blob/67106e80ef34407f545b82bbd9b2c244f304ca3c/README.md); license metadata: `GPL-3.0` | C#/.NET AOT adaptation of ztrx; Windows x64 target remains. Review mixed license scopes if ever considering unrelated tooling. |
|
||||
| `Guernica4u/GTA6-PC-Port-Archive` | [`7b69fa54`](https://github.com/Guernica4u/GTA6-PC-Port-Archive/blob/7b69fa5430ae19fd013b0ba19ffbd7badf3b93e8/README.md); license metadata: `unresolved` | Archive of other projects. Metadata/README screen only; do not use it to recover unavailable or prohibited implementation/material. |
|
||||
| `idvwork/6stars-gta-vi-engine` | [`26a52ba2`](https://github.com/idvwork/6stars-gta-vi-engine/blob/26a52ba2ce5504c2c94a77c15838573538da5b70/README.md); license metadata: `unresolved` | Swift/Metal asset-world renderer, same stated approach as 6stars. Rendering data is distinct from executing the original guest; license/provenance unresolved. |
|
||||
| `Ybucaille/nativ64` | [`3b826108`](https://github.com/Ybucaille/nativ64/blob/3b82610882bc55cb27f0ec563c126a226855a8ea/README.md); license metadata: `Apache-2.0` | Linux x86-64 Windows-API replacement library, not CPU translation. Its host-API inventory explains native-port work hidden by Windows pass-through. |
|
||||
| `sleep10dev/XPORT` | [`2baf2a0f`](https://github.com/sleep10dev/XPORT/blob/2baf2a0f7c2af9f031158e082dfc4a6bb5b8266c/README.md); license metadata: `GPL-3.0` | Windows Rust loader/HLE/partial RDNA/D3D12 research, no demonstrated game compatibility. |
|
||||
|
||||
|
||||
### Explicitly supplied Mac project and tracker
|
||||
|
||||
| Project | Pin | Decision |
|
||||
| --- | --- | --- |
|
||||
| `pragyaangaur/VIctory-macOS` | [`edba53dd`](https://github.com/pragyaangaur/VIctory-macOS/blob/edba53ddc2207e6c537679f4ce06f966b7a63a59/README.md); license metadata: `GPL-3.0` | Wine/CrossOver + Rosetta + D3DMetal guest route. Native platform unit tests are distinct from Windows-under-Wine GPU tests. |
|
||||
| `4lwayz/portwatch-vi` | [`2cedf62a`](https://github.com/4lwayz/portwatch-vi/blob/2cedf62a16b63697f096763ecb99b4c10d4dbccc/README.md); license metadata: `unresolved` | Editorial discovery site and JSON data, not an emulator. Scores and live-stream summaries are not independent acceptance. |
|
||||
|
||||
## Verification performed and remaining limits
|
||||
|
||||
Read-only inventories ran for both the working-tree baseline and the extracted
|
||||
current-main snapshot. Working-tree CPU/runtime counts were 491 forms/206
|
||||
operations and 20 typed services; current main reports 498/213 and 47. Shader
|
||||
reconciliation reported zero mismatches for both. These checks inspect catalogs;
|
||||
they are not CPU instruction execution, GPU tests or independent acceptance.
|
||||
|
||||
Documentation checks also ran successfully on the working-tree candidate:
|
||||
`python3 scripts/audit/status.py --check`, `scripts/audit/claims.sh` (22 claims),
|
||||
`scripts/audit/dependencies.sh` (five graphics crates), Markdown local-file link
|
||||
checks and `git diff --check`. These audit results do not verify runtime changes
|
||||
present only on the separately inspected newer main snapshot.
|
||||
|
||||
Research metadata and ignored raw documentation are retained locally under
|
||||
`artifacts/research-portwatch/`. GitHub API reads and issue/PR state checks
|
||||
establish accessibility and observed state. Python HTTPS initially failed
|
||||
certificate verification; authenticated `gh api` reads succeeded without
|
||||
turning off certificate checks. No dependency was installed to work around it.
|
||||
|
||||
No Rust build, CPU execution suite, native GPU test, demo, fuzz, mutation or
|
||||
benchmark ran for this documentation task. New acceptance must use the exact
|
||||
candidate, actual native tool architecture and actual eligible hardware.
|
||||
Independent reviewers have not certified this report's proposed implementations.
|
||||
Nothing was committed, pushed, merged, released or installed by this review.
|
||||
The GitHub research/follow-up issues were created at the user's request.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Primary-source verification (2026-11-25)
|
||||
|
||||
Re-checks claims first taken from search summaries in [hybrid-backlog-research-2026-11-25.md](hybrid-backlog-research-2026-11-25.md). Evidence class D (public documentation read; nothing installed or run). Not legal advice. #363 still has to re-derive these independently.
|
||||
|
||||
| Claim | Result | Primary source read |
|
||||
| --- | --- | --- |
|
||||
| CrossOver offers the backends Auto, D3DMetal, DXMT, DXVK and Wine | **Confirmed.** Auto uses CodeWeavers' per-game database and wined3d if none is given; D3DMetal covers DirectX 11 and 12; DXMT is Metal-based Direct3D 11; DXVK is Vulkan-based Direct3D 10 and 11; DLSS via MetalFX applies to D3DMetal and DXMT only | support.codeweavers.com "Advanced Settings in CrossOver Mac 26" (modified 2026-02-10). That page is for CrossOver 26 and does not name MoltenVK |
|
||||
| `CX_GRAPHICS_BACKEND` in `cxbottle.conf` is a supported interface | **Not confirmed.** Neither CodeWeavers page read mentions it or `cxbottle`, `cxstart` or `cxrun`. It appears only in third-party projects. Treat as undocumented; #350 decides | Same page and support.codeweavers.com "Advanced CrossOver Mac Configuration" |
|
||||
| Documented configuration surfaces | The second page documents `defaults` keys in `~/Library/Preferences/com.codeweavers.CrossOver.plist` (BottleDir, ManagedBottleDirs) and bottle hooks run with `CX_ROOT`, `CX_BOTTLE` and `WINEPREFIX` set | Same |
|
||||
| CrossOver needs Rosetta 2; ARM64 build without it planned; CrossOver 27 requirements | **Unverified.** The CodeWeavers blog returned HTTP 403 to automated fetches, and the documentation pages above do not cover it. Read it in a browser for #348 | CodeWeavers blog (blocked) |
|
||||
| Rosetta after macOS 27 | **Sources conflict.** Apple developer news of 2026-09-01 says macOS 27 is the final release supporting Rosetta, with continued support for older unmaintained games that rely on Intel-based frameworks. News of 2026-09-09 says macOS 26 is the final release supporting Intel Macs and Rosetta, and 27 is Apple silicon only. Record both until Apple clarifies | developer.apple.com/news (ids w5ngl9k2, k1mtkt1k) |
|
||||
| D3DMetal license | **Not located.** The `apple/game-porting-toolkit` repository is Apache-2.0 and never mentions D3DMetal; D3DMetal ships in the separate Game Porting Toolkit download whose license was not read. Secondary sources describe evaluation-only use and restricted redistribution. Stays user-supplied and unbundled | github.com/apple/game-porting-toolkit, LICENSE |
|
||||
| DXMT license and scope | **Confirmed.** LGPL-2.1-or-later (copyright 2023-2026 Feifan He for CodeWeavers). README: Direct3D 11 and 10 on Metal using Wine. Wiki: macOS 14 or later, Apple silicon supported, Intel GPUs experimental and planned for removal once macOS 28 is released, Wine 8+ required, DXMT needs symbols from `winemac.so`. Cross builds need LLVM 15 and a mingw cross-compiler. Latest release v0.80 (2026-04-23) | github.com/3Shain/dxmt (LICENSE, README, wiki, docs/DEVELOPMENT.md) |
|
||||
| Wine conformance tests exist as standalone Windows programs | **Confirmed in tree.** `dlls/d3d11/tests/Makefile.in` defines a `d3d11.dll` test target from `d3d11.c`. The Wine conformance-test documentation page loaded (HTTP 200) but its requirements were not read; build and run requirements remain unverified | wine-mirror/wine |
|
||||
|
||||
## Dependencies observed
|
||||
|
||||
DXMT lists Meson 1.3+, LLVM 15, Xcode 16+ with the Metal toolchain and a Windows cross-compiler as build requirements. The Rust workspace requires `rustc` 1.100 (`rust-version` in `Cargo.toml`).
|
||||
|
||||
## Rust toolchain
|
||||
|
||||
The default `stable` on the reference machine was rustc 1.94.1, which cannot build the workspace. rustc 1.100.0 is the current official stable (channel manifest dated 2026-11-12, release 2026-11-09) and was already installed as toolchain `1.100.0-aarch64-apple-darwin`, so nothing was installed. Run `rustup run 1.100.0 cargo ...` or update `stable`. With it, `cargo test --locked -p xenora-loader --test generated_runtime_integration --test runtime_x15` passed (3 and 35 tests, 1 ignored). These native tests are not needed for hybrid development; the full workspace suite was not run.
|
||||
|
||||
## Not verified
|
||||
|
||||
CrossOver's CPU-translation internals and ARM64 plans, CrossOver 27 requirements, D3DMetal license text, `cxbottle`/`cxstart` command-line syntax, Wine conformance-test requirements, and whether D3D12 is usable under any backend on the installed version. These belong to #348, #350 and #354.
|
||||
@@ -11,8 +11,8 @@ in this checkout uses original fixtures and public specifications.
|
||||
| Project and audited snapshot | Type and observed evidence | Claimed-only behavior or provenance risk | Xenora work and original acceptance fixture | Priority and owner |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| [Xenora `3133d8e`](https://github.com/ranveersoni98/Xenora/tree/3133d8e) | Native Rust guest and shader research. X1–X4 fixtures and gfx1030 compiler in tree. | GPL-3.0-or-later. Console execution unsupported. | Re-run the guest and translated compute fixtures on ARM64. | Immediate, integration |
|
||||
| [Leonida `3faac55`](https://github.com/ItsNotRexed/Leonida/tree/3faac55) | Windows PE mapping, service shims and Vulkan proxy tests. | GPL-3 family and Xenora no-port rule. Commercial boot absent in audit. | Original PE startup and GPU resource contracts. | Later, CPU and Metal |
|
||||
| [Project ReCity `cb4840b`](https://github.com/pixl27/ProjectReCity/tree/cb4840b) | Windows/Vulkan implementation and PE tests. | GPL-3, Leonida-derived. Separate retail proof absent. | Same synthetic startup coverage as Leonida, no parallel benchmark. | Later, CPU |
|
||||
| [PE-Vulkan project `3faac55`](https://github.com/ItsNotRexed/Leonida/tree/3faac55) | Windows PE mapping, service shims and Vulkan proxy tests. | GPL-3 family and Xenora no-port rule. Commercial boot absent in audit. | Original PE startup and GPU resource contracts. | Later, CPU and Metal |
|
||||
| [Project ReCity `cb4840b`](https://github.com/pixl27/ProjectReCity/tree/cb4840b) | Windows/Vulkan implementation and PE tests. | GPL-3, PE-Vulkan project-derived. Separate retail proof absent. | Same synthetic startup coverage as PE-Vulkan project, no parallel benchmark. | Later, CPU |
|
||||
| [Xbox2Windows `6de5738`](https://github.com/R0Y00/Xbox2Windows/tree/6de5738) | Static recompilation tests for imports, CPU startup, TLS and GPU output. See `tests/cpu/startup_exe.cpp`. | MIT at repository level. Full title startup unverified. | Build a source-authored PE guest and test exact service results. | Immediate, CPU |
|
||||
| [americas-recomp `9bf220e`](https://github.com/realdody/americas-recomp/tree/9bf220e) | Audited main root had a license file. | GPL-2.0. Other branches uninspected. | No fixture justified by audited tree. | Deferred, research |
|
||||
| [6stars `480d9a4`](https://github.com/meetox80/6stars/tree/480d9a4) | Swift/Metal renderer and sampler mapping in `Sources/SixStars`. | No verified root license. Guest CPU execution unverified. | Original translated shader, validated resource range and known readback. | Immediate, Metal |
|
||||
@@ -63,7 +63,7 @@ in this checkout uses original fixtures and public specifications.
|
||||
services, hardware queues, formats and memory initialization need their
|
||||
own sources and tests. [Xbox GPU evidence](../research/xbox-gpu.md) ·
|
||||
[PE format](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format)
|
||||
- GTA VI startup and execution remain unsupported. No authorized retail
|
||||
- Commercial-title startup and execution remain unsupported. No authorized retail
|
||||
executable was loaded. Actual title imports, startup ordering, resource
|
||||
bindings and pipeline behavior remain unverified. Relocation, thread-local
|
||||
storage, process and thread services, dynamic shader execution and
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
# Texture format and layout inventory
|
||||
|
||||
This page records which texture formats and memory layouts BetterXen handles today, and at which stage. It also records which gaps are worth closing and which are deferred. It is an inventory of the repository at the time of writing, built from the code and tests it links. It is not a support claim: a format listed here works only for the original synthetic fixtures named, on desktop specifications, and nothing here says anything about Xbox hardware or commercial titles.
|
||||
|
||||
## Stages
|
||||
|
||||
A format can be handled at one stage and missing at the next. The columns below keep them apart:
|
||||
|
||||
- **Container**: recognising a file or package format that holds textures (DDS, KTX and similar).
|
||||
- **CPU decode**: turning one compressed block into texels on the CPU, used as an independent reference.
|
||||
- **Layout**: converting between a stored memory layout and the row-major layout Metal expects.
|
||||
- **Native**: uploading to a Metal texture of that pixel format and reading it back on the GPU.
|
||||
- **Sampling**: a translated RDNA 2 image instruction reading the texture inside a shader.
|
||||
- **Host graphics API**: the D3D12-shaped `GraphicsContext` entry points, exercised by tests that call them directly from Rust. [The interface contract](../interfaces.md#guest-texture-binding-descriptor-tables) states they are not yet wired to guest imports, so this column is not guest evidence.
|
||||
- **Guest**: an original guest program (PE fixture) reaching the path through imported services, with a test that runs it.
|
||||
- **Specification**: the public sections the implementation and its expected values cite.
|
||||
|
||||
"—" means not implemented. "Rejected" means the input is refused with an error rather than handled.
|
||||
|
||||
## Formats
|
||||
|
||||
| Format | Container | CPU decode | Layout | Native | Sampling | Host graphics API | Guest | Specification |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| RGBA8 unorm | — | not needed | row-major mips, direct or budgeted staged upload ([`crates/metal/src/texture_pipeline.rs`](../../crates/metal/src/texture_pipeline.rs)) | upload and render target (`render_rgba8*`, [`crates/metal/tests/native/texture_sampling.rs`](../../crates/metal/tests/native/texture_sampling.rs)) | `image_sample_lz`, 2D, level 0 ([`crates/isa/src/lib.rs`](../../crates/isa/src/lib.rs), [`crates/metal/tests/native/translated_render.rs`](../../crates/metal/tests/native/translated_render.rs)) | one-level 2D SRV, `DXGI_FORMAT_R8G8B8A8_UNORM`, called from Rust ([`crates/loader/src/graphics.rs`](../../crates/loader/src/graphics.rs), [`crates/loader/tests/graphics_textures.rs`](../../crates/loader/tests/graphics_textures.rs)) | synthetic `xenora.dll` texture services (`texture_create`, `texture_update`, `frame_submit_textured`, `texture_destroy`) driven by the Gate 5 original PE fixture ([`crates/ffi/src/lib.rs`](../../crates/ffi/src/lib.rs), test `textured_pe_fixture_executes_dynamic_updates_and_retirement` in [`crates/ffi/tests/resources.rs`](../../crates/ffi/tests/resources.rs)); not through the descriptor-table API | [`MTLPixelFormat.rgba8Unorm`](https://developer.apple.com/documentation/metal/mtlpixelformat/rgba8unorm) |
|
||||
| BC1 | — | `decode_bc1` ([`crates/texture/src/lib.rs`](../../crates/texture/src/lib.rs)) | synthetic tiled layout, pitched uploads (`TiledBc1`, `Bc1Upload`) and per-subresource packed footprints (`BcTextureLayout`, `PackedBcUpload`) | `read_tiled_bc1`, `read_bc1_upload`, including packed footprints ([`crates/metal/tests/native/texture.rs`](../../crates/metal/tests/native/texture.rs), [`crates/metal/tests/packed_bc_upload.rs`](../../crates/metal/tests/packed_bc_upload.rs)) | sampled by the translated `image_sample_lz` pixel stage (`render_rgba8_sampled_bc1`, [`crates/metal/tests/native/translated_bc1.rs`](../../crates/metal/tests/native/translated_bc1.rs)) | one-level 2D SRV, `DXGI_FORMAT_BC1_UNORM`, called from Rust (same files as RGBA8) | — | [Khronos DFS 1.3, S3TC](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#S3TC) (BC1 with and without alpha); [Microsoft, BC1](https://learn.microsoft.com/en-us/windows/win32/direct3d11/texture-block-compression-in-direct3d-11) |
|
||||
| BC2, BC3 | — | `decode_bc2`, `decode_bc3` ([`crates/texture/src/bc.rs`](../../crates/texture/src/bc.rs), [`crates/texture/tests/bc_formats.rs`](../../crates/texture/tests/bc_formats.rs)) | pitched upload (`BcAlphaUpload`) and packed footprints | `read_bc_alpha_upload`, including packed footprints ([`crates/metal/tests/native/texture_bc_alpha.rs`](../../crates/metal/tests/native/texture_bc_alpha.rs), [`crates/metal/tests/packed_bc_upload.rs`](../../crates/metal/tests/packed_bc_upload.rs)) | — | — | — | [Khronos DFS 1.3, S3TC BC2](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#s3tc_bc2) and [BC3](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#s3tc_bc3); [Microsoft, BC2 and BC3](https://learn.microsoft.com/en-us/windows/win32/direct3d11/texture-block-compression-in-direct3d-11) |
|
||||
| BC4, BC5 (unorm, snorm) | — | `decode_bc4_*`, `decode_bc5_*` ([`crates/texture/src/bc.rs`](../../crates/texture/src/bc.rs), [`crates/texture/tests/bc_formats.rs`](../../crates/texture/tests/bc_formats.rs)) | pitched upload (`BcChannelUpload`) and packed footprints | `read_bc_channel_upload`, including packed footprints ([`crates/metal/tests/native/texture_bc_channel.rs`](../../crates/metal/tests/native/texture_bc_channel.rs), [`crates/metal/tests/packed_bc_upload.rs`](../../crates/metal/tests/packed_bc_upload.rs)) | — | — | — | [Khronos DFS 1.3, RGTC BC4](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#rgtc_bc4) and [BC5](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#rgtc_bc5); [Microsoft, BC4 and BC5](https://learn.microsoft.com/en-us/windows/win32/direct3d11/texture-block-compression-in-direct3d-11) |
|
||||
| BC6H (ufloat, sfloat) | — | single-subset modes only; two-subset modes rejected ([`crates/texture/src/bc6h.rs`](../../crates/texture/src/bc6h.rs), [`crates/texture/tests/bc6h.rs`](../../crates/texture/tests/bc6h.rs), vectors [`crates/texture/tests/fixtures/bc6h_vectors.txt`](../../crates/texture/tests/fixtures/bc6h_vectors.txt)) | packed footprints only, 16-byte blocks ([`crates/texture/src/footprint.rs`](../../crates/texture/src/footprint.rs)) | — | — | — | — | [Khronos DFS 1.3, BPTC BC6H](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#bptc_bc6h) (section 20.2, Tables 121 and 122); [Microsoft, BC6H Format](https://learn.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) |
|
||||
| BC7 unorm | — | all eight modes ([`crates/texture/src/bc7.rs`](../../crates/texture/src/bc7.rs), [`crates/texture/tests/bc7.rs`](../../crates/texture/tests/bc7.rs), vectors [`crates/texture/tests/fixtures/bc7_vectors.txt`](../../crates/texture/tests/fixtures/bc7_vectors.txt)) | packed footprints only, 16-byte blocks ([`crates/texture/src/footprint.rs`](../../crates/texture/src/footprint.rs)) | — | — | — | — | [Khronos DFS 1.3, BPTC BC7](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#bptc_bc7) (section 20.1, Tables 109–120); [Microsoft, BC7 Format](https://learn.microsoft.com/en-us/windows/win32/direct3d11/bc7-format) |
|
||||
| BC7 sRGB | — | same bytes as BC7; the sRGB transfer function is outside the decoder | — | — | — | — | — | as BC7 |
|
||||
| Depth32Float | — | not needed | render attachment | `render_depth` with depth readback ([`crates/metal/tests/native/depth.rs`](../../crates/metal/tests/native/depth.rs)) | — | — | — | [`MTLPixelFormat.depth32Float`](https://developer.apple.com/documentation/metal/mtlpixelformat/depth32float) |
|
||||
|
||||
Sampler state is limited to nearest filtering and clamp-to-edge addressing ([`crates/texture/src/sampler.rs`](../../crates/texture/src/sampler.rs)). Other filter or address modes are rejected.
|
||||
|
||||
Native BC paths require `supportsBCTextureCompression`. A device without it fails as a capability error ([`crates/metal/src/compute.rs`](../../crates/metal/src/compute.rs)), separately from implementation failures.
|
||||
|
||||
Known source differences, recorded where they are implemented:
|
||||
|
||||
- **BC6H:** the Khronos text and Microsoft's sample code disagree on whether a negative value that rounds to zero keeps its sign (`-0.0` against `0.0`). `bc6h.rs` follows Khronos.
|
||||
- **BC1:** Apple's hardware rounds BC1's interpolated palette entries differently from the spec-exact decoder (171/84 against 170/85, see `CHANGELOG.md`). The sampled BC1 fixtures therefore use only endpoint colours.
|
||||
|
||||
## Layouts
|
||||
|
||||
| Layout | State | Where |
|
||||
| --- | --- | --- |
|
||||
| Row-major RGBA8 mips | implemented | [`crates/metal/src/texture_pipeline.rs`](../../crates/metal/src/texture_pipeline.rs) |
|
||||
| Budgeted staged RGBA8 upload | implemented | `MetalRgba8Texture::upload_staged`, [`crates/metal/src/texture_pipeline.rs`](../../crates/metal/src/texture_pipeline.rs) |
|
||||
| Pitched, layer-major BC uploads (one pitch for every mip, padded slices) | implemented for BC1–BC5 | [`crates/texture/src/upload.rs`](../../crates/texture/src/upload.rs) |
|
||||
| Per-subresource packed footprints for block-compressed mip chains (tight or aligned rows) | layout implemented for BC1–BC7; native readback covers BC1–BC5 (#241, PR #278) | [`crates/texture/src/footprint.rs`](../../crates/texture/src/footprint.rs), [`crates/texture/tests/bc_footprint.rs`](../../crates/texture/tests/bc_footprint.rs), [`crates/metal/tests/packed_bc_upload.rs`](../../crates/metal/tests/packed_bc_upload.rs) |
|
||||
| The synthetic 2×2-tile BC1 layout | implemented; defined by the project's fixtures, not by any console | [`crates/texture/src/lib.rs`](../../crates/texture/src/lib.rs) |
|
||||
| Desktop RDNA 2 surface tiling (swizzle modes) | unknown; not researched in this repository | — |
|
||||
| Console texture memory layouts | unknown; no public source reviewed | — |
|
||||
|
||||
## Public specifications
|
||||
|
||||
These are the primary sources the implementations above cite. The format rows already name them in their source files.
|
||||
|
||||
- [Khronos Data Format Specification 1.3](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html): the [S3TC](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#S3TC) section (BC1–BC3), the [RGTC](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#RGTC) section (BC4, BC5), section 20.1 ["BC7"](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#bptc_bc7) and section 20.2 ["BC6H"](https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html#bptc_bc6h).
|
||||
- Microsoft Direct3D documentation: ["Texture Block Compression in Direct3D 11"](https://learn.microsoft.com/en-us/windows/win32/direct3d11/texture-block-compression-in-direct3d-11), ["Block Compression (Direct3D 10)"](https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-block-compression), ["BC6H Format"](https://learn.microsoft.com/en-us/windows/win32/direct3d11/bc6h-format) and ["BC7 Format"](https://learn.microsoft.com/en-us/windows/win32/direct3d11/bc7-format). These are used for the format definitions and DXGI format codes, not for console behaviour.
|
||||
- Apple Metal documentation: [`MTLPixelFormat`](https://developer.apple.com/documentation/metal/mtlpixelformat) and [`MTLDevice.supportsBCTextureCompression`](https://developer.apple.com/documentation/metal/mtldevice/supportsbctexturecompression), for the native pixel formats and the capability check.
|
||||
- AMD "RDNA 2" Instruction Set Architecture reference guide ([GPUOpen architecture documentation](https://gpuopen.com/amd-gpu-architecture-programming-documentation/)): MIMG instructions such as `image_sample_lz`, and the image resource and sampler descriptor formats. These cover desktop gfx1030 only. [Xbox GPU evidence](xbox-gpu.md) records why desktop statements do not transfer to the console without separate evidence.
|
||||
|
||||
## Unknowns
|
||||
|
||||
These are research questions, not missing features:
|
||||
|
||||
- **Console texture memory layouts and tiling.** No public specification has been reviewed. Desktop RDNA 2 tiling would be a separate research note and would still not establish console behaviour.
|
||||
- **Console resource descriptor formats.** Unknown. See [Xbox GPU evidence](xbox-gpu.md), which lists descriptor layout among the unresolved items.
|
||||
- **Asset and audio containers.** BetterXen parses none. The runtime's audio path accepts only raw PCM (`XENORA_AUDIO_FORMAT_PCM_S16LE` and `PCM_F32LE` in [`crates/ffi/include/xenora.h`](../../crates/ffi/include/xenora.h)). No original workload has shown a need for a container or a compressed audio format.
|
||||
|
||||
## Follow-ups
|
||||
|
||||
Ranked by how close each is to existing tested paths. The first item is already tracked; the others are proposals, so do not start them without an issue and a claim.
|
||||
|
||||
1. **BC6H two-subset modes and native BC6H/BC7.** Tracked in #208 (CPU decode, with an archived request to take it) and #209 (native upload and readback, whose imported proposal waits for maintainer approval). BC6H and BC7 already have packed footprints, so #209 can build on `PackedBcUpload`. Do not duplicate them.
|
||||
2. **Translated sampling of BC2–BC5.**
|
||||
- Fixture: original blocks with hand-chosen endpoints and indices, sampled by the existing `image_sample_lz` pixel stage.
|
||||
- Expected values: derived by hand from the Khronos tables. The `bc.rs` decoders must not produce them, so that the decoder and the reference stay independent.
|
||||
- Owners: Metal and Compiler.
|
||||
3. **Additional sampler state** (linear filtering, wrap and mirror addressing).
|
||||
- Fixture: a small original RGBA8 texture with distinct texels.
|
||||
- Expected values: from the public Direct3D and Metal sampling equations, computed in exact fractions.
|
||||
- Owners: Metal and Compiler.
|
||||
4. **Desktop RDNA 2 image resource descriptor decoding.** Needed before guest-supplied descriptors can select formats.
|
||||
- Fixture: original descriptor words for each supported format.
|
||||
- Expected values: from the AMD RDNA 2 ISA guide's descriptor tables.
|
||||
- Owner: ISA.
|
||||
- This does not cover console descriptors.
|
||||
|
||||
Deferred, with no demonstrated need:
|
||||
|
||||
- BC7 sRGB
|
||||
- DDS and KTX containers
|
||||
- ASTC and ETC (not part of the desktop Direct3D 12 BC set this target uses)
|
||||
- any compressed audio format
|
||||
- console tiling, until a public source exists
|
||||
@@ -0,0 +1,114 @@
|
||||
# Upstream integration audit (2026-11-25)
|
||||
|
||||
Companion to the [upstream registry](upstream-registry.md) and [component reuse matrix](component-reuse-matrix.md); those two hold the canonical rows, this file holds the audit evidence behind the new ones. Evidence class D unless stated: public repository metadata, file trees and files read through the GitHub API, plus one Apple license read as text. **No upstream script, installer, binary or build hook was executed and no upstream code was copied.** Not legal advice. CrossOver is **not installed** on the reference machine (Apple M4, 24 GB, macOS 27.0 build 26A428), so nothing below was validated against CrossOver.
|
||||
|
||||
## Contributor-reported progress (unverified)
|
||||
|
||||
skakwy (a BetterXen contributor) maintains [skakwy/victory-mac](https://github.com/skakwy/victory-mac) (GPL-3.0 per GitHub; head `main` pushed 2026-11-25). Reports received: about 1 frame per second with a commercial game, and later "two rendered frames". Both are contributor statements. No hardware, macOS or CrossOver version, workload, instrumentation or raw data has been shared, and the repository's own README gives only build and run commands. Treat both as **unverified**; neither is a compatibility claim. The repository describes itself as a fork of VIctory, a project whose purpose is a leaked Xbox Series build of a commercial game (see the registry), so it is a discovery reference at documentation level only. Information worth requesting from skakwy is listed under "Contributor request" below.
|
||||
|
||||
## Projects reviewed
|
||||
|
||||
Pins are the default-branch head or the commit read on 2026-11-25. "Equivalent" is what BetterXen has or lacks. Status values: **implemented** (code and tests on this branch), **reference** (read, nothing taken), **rejected**.
|
||||
|
||||
| Project | URL | Pin | Licence (file read where stated) | Verified facts | BetterXen equivalent | Provenance | Classification | Status |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| victory-mac | github.com/skakwy/victory-mac | not pinned (not reviewed past README and tree) | GPL-3.0 (GitHub) | Rust workspace with `mac/` build and run scripts for CrossOver, D3DMetal, Rosetta 2; README says "VIctory fork with a Mac build" | none needed | Built on a game-specific upstream whose inputs are unauthorized; file-level review not done | Technical reference only | reference |
|
||||
| VIctory-macOS | github.com/pragyaangaur/VIctory-macOS | see registry | GPL-3.0 (GitHub) | Described as an attempt to run one commercial game | none needed | Same concern | Rejected for reuse | rejected |
|
||||
| MacBox | github.com/aykhanium/MacBox | not pinned | **GPL-2.0** (GitHub) | README is candid: "not playable", "retail gameplay is unverified", test suite "known failures"; layers on XCL, an Xbox Series runtime for unpacked console executables | none | Game-specific; also **GPL-2.0-only is not combinable with GPL-3.0-or-later** (see decisions) | Rejected for reuse | rejected |
|
||||
| ScarlettMac | github.com/paveledits/ScarlettMac | not pinned | GPL-2.0 (GitHub); also `LICENSE-silicon-rans`, `SOURCE-NOTICES.md` | Patch set and shell scripts for XCL on CrossOver; README states game screenshots and a game-specific status | none | Game-specific; mixed licences | Rejected for reuse | rejected |
|
||||
| PortWatch VI | portwatch-vi.xyz | see registry | NOASSERTION | Editorial tracker | none | Not engineering evidence | Reference only | reference |
|
||||
| ossover | github.com/hemkum/ossover | `5c11bd7be8da` | GPL-3.0-or-later (README, `ATTRIBUTION.md` lists per-file adaptations from Whisky and highball) | Swift package: `SysInfo` (macOS, chip, memory, Rosetta probe), `Bench/MetalHUDLog` (parser for `metal-HUD:` log lines), `Bench/Harness`, `Store/EngineProbe`, `Renderer/CrossOverBottleConfig`, `doctor` command. README: alpha, one game verified on one machine, "no benchmark numbers have been published". Its design was derived from reverse engineering a CrossOver 26.3.0 bundle | Host receipt, frame statistics (this branch) | Clean, attribution explicit. Reverse-engineered CrossOver internals are **not** a supported interface | Technical reference; ideas re-implemented independently | reference |
|
||||
| Whisky | github.com/Whisky-App/Whisky | `fd5480a76b3e` | GPL-3.0-or-later (file header read: "version 3 ... or (at your option) any later version") | Archived 2025-05-11. `WhiskyKit`: bottle settings, Wine process control, PE parser, Rosetta 2 check | Rust host receipt covers the Rosetta check | Clear | Technical reference only (Swift; no reuse path) | reference |
|
||||
| rum | github.com/lunguini/rum | `657461b194e1` | GPL-3.0 (GitHub) | Active Whisky fork: DXMT/DXVK setup, run history, graphics settings views | none needed | Fork of Whisky | Technical reference only | reference |
|
||||
| Sikarugir | github.com/Sikarugir-App/Sikarugir | `5446b7d18072` | none reported | 23 files; hosts copies of Apple's Game Porting Toolkit documents (`D3DMetal/<ver>/License.pdf`) | none | Redistributes Apple documents; no licence of its own | Reference only; no reuse | reference |
|
||||
| Sikarugir-foss-sources | github.com/Sikarugir-App/Sikarugir-foss-sources | not reviewed | LGPL-2.1 (GitHub) | Fork of Wineskin sources | none | Unreviewed | Reference only | reference |
|
||||
| Mythic | github.com/MythicApp/Mythic | see registry | GPL-3.0 | Launcher using a custom GPTK implementation | none | Not reviewed | Reference only | reference |
|
||||
| DXMT | github.com/3Shain/dxmt | see registry | LGPL-2.1-or-later (LICENSE read by prior pass); GitHub shows NOASSERTION | D3D11/10 on Metal under Wine | Selected by CrossOver as a backend | Clear | External dependency (via CrossOver) | reference |
|
||||
| DXVK, VKD3D-Proton, MoltenVK | see registry | see registry | zlib, LGPL-2.1, Apache-2.0 | No change from registry | none | Clear | External (via CrossOver) | reference |
|
||||
| Gcenx macOS Wine builds | github.com/Gcenx/macOS_Wine_builds | `72f8915f2d01` | none reported | Community Wine packages | none | Binary provenance unreviewed | Reference only | reference |
|
||||
| llvm-mingw | github.com/mstorsjo/llvm-mingw | `903f4cf7faa2` | NOASSERTION per GitHub; LICENSE not yet read | ARM64-capable mingw toolchain | `toolchain` probe (this branch) finds it if installed | Clear | External dependency (candidate for #364) | reference |
|
||||
| Wine | github.com/wine-mirror/wine | see registry | LGPL-2.1 | Upstream of CrossOver's runtime | none | Clear | Reference | reference |
|
||||
| Apple Game Porting Toolkit licence | text of `D3DMetal/4.0/License.pdf`, copy hosted by Sikarugir | document read, 6 pages | Apple proprietary agreement | See next section | none | Third-party copy of an Apple document; the original download was not read | Proprietary; user-supplied only | reference |
|
||||
|
||||
## Apple Game Porting Toolkit licence (for #354)
|
||||
|
||||
Read from the 4.0 `License.pdf` copy in the Sikarugir repository (not from Apple's site; confirm against Apple's download before relying on it). Section 2A grants a limited, personal licence to install, internally use and test the software "for the sole purpose of developing, testing, or evaluating video games for use on Apple-branded products", and to distribute it "solely for non-commercial purposes". Section 2C forbids use on non-Apple hardware, says components may not be separated from the bundle except that the Framework and Redistributables may be distributed separately (still non-commercial only), and section 2D forbids reverse engineering. Consequence for BetterXen: D3DMetal stays a user-supplied external component and is never bundled or redistributed by this repository. Whether running unrelated Windows software through it fits "evaluating video games for use on Apple-branded products" is a question for a lawyer, not answered here.
|
||||
|
||||
## Decisions
|
||||
|
||||
1. **No external code was incorporated.** The useful general-purpose ideas (host receipt, frame statistics, toolchain probe) are small, and the closest implementations are Swift, so they were written independently in Rust from public system interfaces. ossover and Whisky are credited as technical references in this file; nothing is adapted.
|
||||
2. **GPL-2.0-only projects (MacBox, ScarlettMac) cannot be combined into this GPL-3.0-or-later workspace** regardless of provenance. Both are also game-specific.
|
||||
3. **Undocumented CrossOver internals are not a stable interface.** ossover reads `cxbottle.conf` and bundle internals derived from reverse engineering. The new CrossOver module reads only `Info.plist`, `lipo -archs` and the `defaults` keys CodeWeavers documents, and states so in its output.
|
||||
4. **The Metal HUD log parser in ossover was not ported.** Its line format (`metal-HUD: …`) is documented only by that project's observation; it was not verified against Apple documentation or a real trace here. Frame statistics therefore take plain intervals. A HUD parser can be added when a real trace is captured (#145).
|
||||
|
||||
## Implemented on this branch
|
||||
|
||||
New crate `crates/hybrid` (`betterxen-hybrid`, no third-party dependencies, native arm64 verified with `lipo -archs`: `arm64`).
|
||||
|
||||
| Command | Purpose | Issue | Validated |
|
||||
| --- | --- | --- | --- |
|
||||
| `host` | macOS version and build, chip, memory, core split, whether an x86_64 binary executes (Rosetta), GPU and Metal family from `system_profiler` | #353 | Run on the M4 reference machine; unit tests parse a GPU fixture |
|
||||
| `crossover` | Finds `CrossOver.app` in standard locations and by Spotlight bundle identifier; reads version, build, executable architectures, minimum macOS, and the documented `BottleDir` and `ManagedBottleDirs` preferences | #350, #355 | Unit test on a **synthetic** bundle only. On the reference machine it reports `installed: false`. It has never inspected a real CrossOver |
|
||||
| `toolchain` | Lists mingw-w64 and llvm-mingw cross-compilers on `PATH` with version and target | #364 | Stub-compiler unit test; on the reference machine it found Homebrew `x86_64-w64-mingw32-gcc` 16.2.0 and `i686-w64-mingw32-gcc`. No ARM64 Windows target is installed. No program was compiled or run |
|
||||
| `frames <file>` | Frame-time statistics: mean, FPS, nearest-rank p50/p95/p99/p99.9, 1 % and 0.1 % lows, stutter count | #145 | Hand-derived known-answer tests, rejection of non-positive or non-finite intervals |
|
||||
| `receipt` | The above as one JSON document, `betterxen-hybrid-receipt/0` | #353 | Run once; no second contributor has reproduced it |
|
||||
|
||||
Not implemented: launching programs, bottle management, graphics-backend selection or detection, GPU or thermal sampling, a HUD parser, any rendering workload. None is justified yet by Phase 1 evidence.
|
||||
|
||||
## Contributor request (to send, not sent)
|
||||
|
||||
Ask skakwy only for shareable, general information: Mac model, macOS and CrossOver versions, how frame rate was measured and over what duration, whether the two frames were presented or merely rendered, and any general-purpose tooling and authorized test workloads he wrote himself. Do not ask for game files, traces or instructions for running the leaked build.
|
||||
|
||||
## Remaining blockers
|
||||
|
||||
CrossOver is not installed here, so criteria 2 and 6 of Phase 1 cannot progress on this machine; `docs/research/primary-source-verification-2026-11-25.md` lists documents still to read. The Rust toolchain default (`stable`, 1.94.1) is older than the workspace's 1.100; use `rustup run 1.100.0 cargo`.
|
||||
|
||||
## skakwy/victory-mac: component-level review (second pass)
|
||||
|
||||
skakwy, the repository's maintainer and a BetterXen contributor, authorized integrating his independently developed work. His permission cannot cover third-party material, and the repository's purpose fixes what most of it is. Reviewed: full history (302 commits, 65 by skakwy, 194 tracked files at `22b3f8e45a59`, `main` on 2026-11-25), every file he authored under `mac/` and `tools/macos/`, and the headers and authorship of the game-facing crates. Nothing was executed; the checkout stayed outside this repository with git hooks disabled.
|
||||
|
||||
### What the reported result is
|
||||
|
||||
From his own `mac/PROGRESS.md` and `mac/run-victory.sh` (his statements, unverified): the workload is an unpacked Xbox Series X dump of a commercial game, about 209 GB, run through VIctory under a CrossOver Preview bottle with Rosetta 2 and D3DMetal 4.0b2 on an Apple M3 Max with 36 GB and macOS 27.2.1. "About 1 fps" is 1 to 1.9 seconds per frame in the game world over a 17-minute run ("run 31, ~1.1 fps"), with 5,000 to 7,000 draws per frame and a GPU share of 0.15 to 0.5 s of each frame, taken from VIctory's own per-frame log line. So it is real presented frames from a program VIctory drives, measured by that program, on an input that BetterXen's rules forbid. It is **not** reproducible here, was not measured with independent instrumentation, and says nothing about authorized workloads. It does indicate, as an unverified observation, that a Rust-built Windows x86-64 program using D3D12 can reach D3DMetal under CrossOver on macOS 27. BetterXen has no evidence of that yet; the original D3D11 workload built on this branch is the authorized way to test it once CrossOver is installed.
|
||||
|
||||
### Component record
|
||||
|
||||
Original repository for every row: https://github.com/skakwy/victory-mac (GPL-3.0, file `LICENSE`). Author: skakwy unless stated. Permission: granted by skakwy through the maintainer, not recorded in the repository itself.
|
||||
|
||||
| Component | Source path (commit) | Provenance | Classification | BetterXen destination and method | Validation | Limits |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| Memory guard: do not start below N % free, stop a workload below M % | `mac/run-victory.sh` (`22b3f8e45a59`) | skakwy only; logic is general | **Integrated, adapted** | `crates/hybrid/src/memory.rs` and the `guard` command, reimplemented in Rust, SIGTERM then SIGKILL, unreadable memory is an error | 6 unit tests including a child stopped on a simulated drop; end-to-end runs of refuse, pass-through and stop; real `memory_pressure -Q` parsed on macOS 27.0 | Output format of `memory_pressure -Q` is not a documented stable interface; one machine |
|
||||
| Windows cross-link wrapper for the gnullvm target | `tools/macos/gnullvm-cc.sh` (`22b3f8e45a59`) | skakwy only | **Unnecessary here** | Evaluated; not functional with Homebrew `llvm@17`; superseded by llvm-mingw (see hybrid-toolchain.md). Awaiting clarification of the LLVM version he uses | Link failure reproduced | Not integrated |
|
||||
| Build wrapper for the victory exe | `mac/build.sh` | skakwy only | Unnecessary | Three lines around `cargo build`; `scripts/hybrid/build-windows-workloads.sh` replaces the idea | n/a | n/a |
|
||||
| CrossOver launch conventions: `bin/wine --bottle B --cx-app EXE run`, `wineserver -k`, prefix at `~/Library/Application Support/CrossOver/Bottles/B`, `CX_GRAPHICS_BACKEND` and `_VERSION` | `mac/run-victory.sh` | skakwy only; observations of "CrossOver Preview" | **Awaiting clarification** / reference | Recorded for #350 as undocumented third-party observations. Not coded: they are not documented interfaces. His note that backend version 3 gave a black screen and 4 worked is game-specific evidence | none | Undocumented; version unknown beyond "Preview" |
|
||||
| Rosetta observations: AVX masked stores and `vcvtps2ph` stores to write-watched memory hung on macOS 26, handled on 27; `ROSETTA_ADVERTISE_AVX` | `mac/PROGRESS.md`, `mac/run-victory.sh` | skakwy only | Reference | Hypotheses to test with an original workload; no code adopted | none | Unverified; tied to his loader |
|
||||
| Native helpers: `mach_vm_remap` aliases as a Wine unixlib (`valias`), Metal zero-copy swizzle | `mac/unixlib/*` | skakwy only; the swizzle credits UTM's d3dmetal-native | **Rejected** | The swizzle acts on D3DMetal internals; Apple's licence section 2D forbids reverse engineering and his notes give D3DMetal struct offsets (`+0x58`, `+0x28c`) found that way. The alias code serves game-memory copy-back | none | Awaiting clarification only for `valias` as a generic Wine unixlib example |
|
||||
| Instruction and shader scanner | `mac/scan/*` | skakwy only | **Rejected** | Parses the game's shader pack format and a Rosetta-unsafe instruction census of its image | none | Game-specific |
|
||||
| Game-specific loader patches: watchdog stepping, masked-store and MWAIT patching, BCPack placeholder fills | `crates/victory-loader/*`, `mac/PROGRESS.md` | skakwy and others | **Rejected** | Defeats a title's own self-protection and patches a leaked image; never adopted | none | n/a |
|
||||
| GPU layer, shader emitters, HLE (`victory-gpu`, `victory-shader`, `victory-hle`, `victory-loader`, `victory-core`) | skakwy commits `ea9da87` to `22b3f8e45a59` on top of Marvis, fxceless, Duff and others (about 260 inherited commits) | Mixed: inherited files carry other authors, and the content is console-game recompilation | **Rejected / requires provenance** | His share is real but inseparable from a runtime whose input is unauthorized; the console-shader work is also native-paused scope | none | File-level provenance would be needed for any future reuse |
|
||||
| Run notes (`mac/PROGRESS.md`, `mac/new_agent.md`) | same | skakwy only | Reference | Source of the context above; not copied | none | Contains game-specific detail, not republished |
|
||||
|
||||
Counts for this pass: 11 component groups reviewed; 1 integrated (adapted); 0 integrated verbatim; 3 reference or awaiting clarification; 2 unnecessary; 5 rejected (some groups overlap categories above).
|
||||
|
||||
### Other repositories, completed
|
||||
|
||||
- **VIctory-macOS** (`pragyaangaur/VIctory-macOS`, 215 files): a fork whose README describes running "the Xbox Series build" of one game; PortWatch calls the efforts it tracks builds of a "leaked Xbox Series build". Workflow files `fleet-*.yml` orchestrate an agent fleet, not build or test infrastructure of value here. Its README says it was built "with Claude on a free Claude Pro plan" and asks for sponsorship; irrelevant to reuse. Rejected, unchanged.
|
||||
- **PortWatch VI** (portwatch-vi.xyz): its own description says "leaked Xbox Series build of GTA VI". Reference for discovery only, unchanged.
|
||||
- **MacBox, ScarlettMac:** see above; unchanged.
|
||||
- **ossover CI** (`.github/workflows/ci.yml`): a macOS arm64 runner running `bash -n` over shell scripts, a standard-library Python manifest check with `python3 -I`, and `swift build`/`test`. The two cheap ideas (shell syntax check, isolated-interpreter script) match what `docs_hygiene.py` already does; a `bash -n` step for `scripts/hybrid/*.sh` is a candidate follow-up, not added.
|
||||
|
||||
### Per-file authorship of victory-mac (measured with `git blame` at `22b3f8e45a59`)
|
||||
|
||||
"Owned" means every line is attributed to skakwy. His permission covers these; it cannot cover lines written by others, and some owned files still carry other restrictions.
|
||||
|
||||
| File (lines, all his) | What it is | Decision |
|
||||
| --- | --- | --- |
|
||||
| `crates/victory-shader/src/emit/f64.rs` (409) | fp64 by 64-bit integer operations, with tests against the CPU's `f64` | General-purpose. Candidate for the native shader compiler; native work is paused, so it waits for a maintainer decision (#387) |
|
||||
| `mac/run-victory.sh` (139), `crates/victory-core/src/notes.rs` (135) | Run script with memory guard; stall bookkeeping | Memory guard adapted (`guard`); stall detection and settle adapted in #385; the rest is game-specific launch configuration |
|
||||
| `mac/unixlib/*`, `crates/victory-gpu/src/alias.rs` (369), `zerocopy.rs` (365), `crates/victory-hle/src/modules/vmem.rs` (208) | Alias mappings and a Metal swizzle over game memory | Not integrated: they act on D3DMetal internals and game memory (Apple's licence section 2D forbids reverse engineering; his notes give D3DMetal struct offsets) |
|
||||
| `crates/victory-loader/src/maskmov.rs` (830), `masked_stores.rs` (243) | Rewrites masked AVX stores in a console title's image for Rosetta | Not integrated: the header says it follows XCL's `maskmov.rs`, which is GPL-2.0-only (incompatible with GPL-3.0-or-later), and it patches a title image |
|
||||
| `crates/victory-gpu/src/ambient.rs` (193), `mac/scan/*` | Replaces one game's lighting output; scans its shader pack | Not integrated: game-specific |
|
||||
| `crates/victory-gpu/src/dxc.rs` (110) | Loads Microsoft's `dxcompiler.dll` to compile HLSL under Wine | General-purpose. Not needed yet: D3D12 minimal tests can use SM 5.1 through `d3dcompiler_47`. Revisit when a workload needs SM 6 |
|
||||
| `tools/macos/gnullvm-cc.sh`, `mac/build.sh` | Windows cross-link wrapper, build wrapper | Evaluated; failed with Homebrew `llvm@17`; superseded by llvm-mingw |
|
||||
|
||||
Everything else in the repository is mostly or entirely other authors' work (for example `victory-gpu/src/host.rs` is 8 % his, `victory-shader/src/emit/lower.rs` 1 %).
|
||||
@@ -0,0 +1,51 @@
|
||||
# Upstream research registry
|
||||
|
||||
Reviewed 2026-11-25. Every entry is **evidence class D** (non-normative official or project material) in the sense used by the issue templates and [claims.toml](../claims.toml): a review of public documentation and repository metadata. Nothing here was installed, built or run, so none of it is a statement that a project works for BetterXen's goals. Licenses are what the repository's own license file or GitHub's license detection reported; they still need the per-file check in the [reuse matrix](component-reuse-matrix.md) and are not legal advice. Pins are the default-branch head observed with `git ls-remote` on the review date. Independent re-derivation of this table is tracked in issue #363.
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Role for BetterXen | Findings |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| CrossOver (CodeWeavers) | [source page](https://www.codeweavers.com/crossover/source) | CrossOver 26.3.0 source listed | Proprietary product; page lists GPL/LGPL and other FOSS components it uses | Primary compatibility foundation (external install) | The page offers FOSS source for CrossOver 26.3.0 and lists Wine, Vkd3d, DXVK, MoltenVK, FAudio, SDL, LLVM, GMP and others. It says users should prefer each project's own home page. D3DMetal and Rosetta 2 are not in that list. What else is proprietary, the supported integration interfaces and redistribution terms are **unknown** (#348, #350, #354). |
|
||||
| Wine | [wine-mirror/wine](https://github.com/wine-mirror/wine) | `a79470449d03` | LGPL 2.1 (repository LICENSE and COPYING.LIB); GitHub reports NOASSERTION | Runtime APIs, via CrossOver | Upstream of CrossOver's runtime. CrossOver's exact delta from upstream is not reviewed. |
|
||||
| DXMT | [3Shain/dxmt](https://github.com/3Shain/dxmt) | `faa73e4a0686` | LGPL, version 2.1 or any later version (LICENSE text); copyright notice "for CodeWeavers" | Direct3D 11/10 to Metal under Wine; candidate backend | README: Metal-based D3D11/D3D10 layer for macOS using Wine. Status is on the project wiki (not reviewed). D3D12 is not claimed. |
|
||||
| DXVK | [doitsujin/dxvk](https://github.com/doitsujin/dxvk) | `57b2a7c1e87b` | zlib/libpng (LICENSE; GitHub: Zlib) | Direct3D to Vulkan; candidate backend only with MoltenVK | Listed among CrossOver's FOSS components. Whether it is used for any macOS path is unknown. |
|
||||
| VKD3D-Proton | [HansKristian-Work/vkd3d-proton](https://github.com/HansKristian-Work/vkd3d-proton) | `71cae091b065` | LGPL 2.1 (GitHub) | Direct3D 12 to Vulkan; candidate for evaluation | README requires Vulkan 1.3 and modern extensions. Whether MoltenVK exposes what it needs is **unknown**. CrossOver's page lists "Vkd3d" from source.winehq.org, which is the Wine vkd3d, not necessarily this fork. |
|
||||
| MoltenVK | [KhronosGroup/MoltenVK](https://github.com/KhronosGroup/MoltenVK) | `5189f8de86ec` | Apache-2.0 | Vulkan on Metal; candidate under DXVK/VKD3D-Proton | A Vulkan Portability layer, a subset of Vulkan. Listed among CrossOver's FOSS components. Last push observed 2026-10-13. |
|
||||
| FEX | [FEX-Emu/FEX](https://github.com/FEX-Emu/FEX) | `3ee25399232a` | MIT (GitHub) | x86/x86-64 emulation reference | README describes ARM64 **Linux**; tested distributions listed are Linux. No macOS host support is stated. Not a macOS option on this evidence; useful as design reference. |
|
||||
| VIctory | [Marvisak/VIctory](https://github.com/Marvisak/VIctory) | `13f91caee25f` | GPL-3.0 (GitHub); a prior local review found per-file notices (see `experiments/victory-native/licenses.md`, local, untracked) | Discovery reference only | Described as an attempt at running one commercial game on PC. Its inputs are an Xbox Series build of that game. PortWatch describes the efforts it tracks as targeting a "leaked Xbox Series build". |
|
||||
| VIctory-macOS | [pragyaangaur/VIctory-macOS](https://github.com/pragyaangaur/VIctory-macOS) | `485b230ef596` | GPL-3.0 (GitHub) | Discovery reference only | A macOS port of VIctory using Rosetta, CrossOver Wine and D3DMetal per its README (also noted in [portwatch-native-macos.md](portwatch-native-macos.md)). Same input concern. Its test and "works" claims are self-reported and not verified here. The repository has no parent fork, so the "canonical upstream" is VIctory. |
|
||||
| PortWatch VI | [portwatch-vi.xyz](https://portwatch-vi.xyz/), [4lwayz/portwatch-vi](https://github.com/4lwayz/portwatch-vi) | `ed00263cc0c9` | NOASSERTION | Project discovery reference | A tracker of community efforts; progress figures are editorial, with self-reported claims labelled. Not engineering evidence; flagged and ignored queues are not endorsed. |
|
||||
|
||||
## Additional candidates found by search (not reviewed)
|
||||
|
||||
Found by GitHub search on 2026-11-25. Only repository metadata was read; none was evaluated, installed or run, and none is a recommendation. Licenses are what GitHub reported.
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Why listed |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| llvm-mingw | [mstorsjo/llvm-mingw](https://github.com/mstorsjo/llvm-mingw) | `903f4cf7faa2` | GitHub: other (read LICENSE before use) | Cross-compiler candidate for building original Windows test programs (#364). README says its compilers come in x86_64 and aarch64 builds, built on Ubuntu; availability and behaviour on a macOS host are **unknown**. |
|
||||
| Sikarugir | [Sikarugir-App/Sikarugir](https://github.com/Sikarugir-App/Sikarugir) | `5446b7d18072` | not reported | Wine-wrapper project (successor to Wineskin per its README, macOS 14.6+): a reference for bottle and wrapper management. |
|
||||
| macOS Wine builds | [Gcenx/macOS_Wine_builds](https://github.com/Gcenx/macOS_Wine_builds) | `72f8915f2d01` | not reported | Community Wine builds for macOS: possible Wine reference builds. Provenance of the binaries is unreviewed. |
|
||||
| Mythic | [MythicApp/Mythic](https://github.com/MythicApp/Mythic) | `754223978e61` | GPL-3.0 | Open-source macOS launcher that runs Windows games through Wine: an architecture reference for configuration and launching. |
|
||||
| Playdock | [Jasonilization/Playdock](https://github.com/Jasonilization/Playdock) | `f58b8ef7fb70` | MIT | Describes itself as a free alternative to CrossOver; unreviewed. |
|
||||
|
||||
## Reviewed in the integration audit (2026-11-25)
|
||||
|
||||
Source read through the GitHub API; nothing executed. Detail and decisions are in [upstream-integration-audit.md](upstream-integration-audit.md).
|
||||
|
||||
| Project | Source | Pin (head) | License as reported | Role for BetterXen | Findings |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| victory-mac | [skakwy/victory-mac](https://github.com/skakwy/victory-mac) | `22b3f8e45a59` | GPL-3.0 (LICENSE file read) | Per-component review with contributor permission; one memory-guard idea adapted | The maintainer authorized integration of his own work. His runtime targets a leaked console-game dump, so game-facing code is not adopted. Component table in [upstream-integration-audit.md](upstream-integration-audit.md). Reported frame rates are his unverified statements. |
|
||||
| llvm-mingw | [mstorsjo/llvm-mingw](https://github.com/mstorsjo/llvm-mingw) | release `20261117` | Apache-2.0 with LLVM exceptions plus component licences (LICENSE.TXT; not audited line by line) | External build tool for #364 | Digest verified, used to build original workloads for x86-64 and ARM64; see [hybrid-toolchain.md](hybrid-toolchain.md). |
|
||||
| MacBox | [aykhanium/MacBox](https://github.com/aykhanium/MacBox) | not pinned | GPL-2.0 (GitHub) | Rejected for reuse | Game-specific XCL layer; GPL-2.0-only is not combinable with GPL-3.0-or-later. Its README states gameplay is unverified. |
|
||||
| ScarlettMac | [paveledits/ScarlettMac](https://github.com/paveledits/ScarlettMac) | not pinned | GPL-2.0 (GitHub), extra licence files | Rejected for reuse | Game-specific patches and scripts. |
|
||||
| ossover | [hemkum/ossover](https://github.com/hemkum/ossover) | `5c11bd7be8da` | GPL-3.0-or-later (README, attribution file) | Technical reference | Swift CLI with system-info, Metal HUD log parsing and benchmark harness. Uses reverse-engineered CrossOver internals, which BetterXen does not treat as an interface. |
|
||||
| Whisky | [Whisky-App/Whisky](https://github.com/Whisky-App/Whisky) | `fd5480a76b3e` | GPL-3.0-or-later (file header read) | Technical reference | Archived 2025-05-11. |
|
||||
| rum | [lunguini/rum](https://github.com/lunguini/rum) | `657461b194e1` | GPL-3.0 (GitHub) | Technical reference | Active Whisky fork. |
|
||||
| Game Porting Toolkit licence | copy of `D3DMetal/4.0/License.pdf` in Sikarugir | read | Apple proprietary | User-supplied only | Non-commercial distribution, evaluation purpose, no reverse engineering. See audit file. |
|
||||
|
||||
## Not yet researched
|
||||
|
||||
Apple's Game Porting Toolkit documentation and license (D3DMetal's actual terms), Rosetta 2's support lifetime, CrossOver's documented command-line interfaces and bottle management, and other established projects. These are issues #349, #350 and #354; nothing is claimed about them here.
|
||||
|
||||
## Provenance decision
|
||||
|
||||
VIctory-family projects are not adopted. Their GPL grants apply to their own source; they do not establish that the material they were built for is authorized. The registry records them for architecture ideas visible in public documentation (cache identity, upload visibility, test structure). No code, shader corpus, asset or tooling from them enters BetterXen without a recorded per-file review, and anything game-specific or decryption-related is excluded.
|
||||
@@ -0,0 +1,96 @@
|
||||
# BetterXen roadmap
|
||||
|
||||
**This is the single authoritative active roadmap.** GitHub Issues hold the current phase's tasks, the open milestone names the current phase, and this file explains strategy, phase order, parked work and completion criteria. If another document disagrees, this one governs, except [ADR 0005](adr/0005-crossover-hybrid-direction.md) for the decision itself.
|
||||
|
||||
## Direction
|
||||
|
||||
BetterXen's active direction is a **CrossOver-based hybrid architecture for Apple Silicon**. CrossOver is the intended compatibility foundation and is an **externally installed dependency**, never bundled or redistributed. BetterXen's own work is the layer around it: integration, configuration, diagnostics, reproducible testing, benchmarking and measured optimization. The independent native implementation (x86-64 decoder, ARM64 translator, runtime, gfx1030 shader compiler, Metal backend) is **preserved but paused**; see the [native roadmap](research/native-roadmap.md) and the [native issue archive](research/native-issue-archive.md).
|
||||
|
||||
This is the intended architecture, **not a verified Xbox compatibility stack**. Nothing in this repository demonstrates that CrossOver, Rosetta 2 or D3DMetal run any Xbox title, and CrossOver is not assumed to provide Xbox runtime compatibility. All workloads must be independently authored, publicly licensed or otherwise authorized.
|
||||
|
||||
```
|
||||
BetterXen: integration, configuration, diagnostics, benchmarking, optimization
|
||||
|
|
||||
CrossOver (external): Wine-based runtime APIs | Rosetta 2 CPU translation | D3DMetal / DXMT graphics
|
||||
|
|
||||
Apple Silicon: ARM64, Metal, unified memory
|
||||
```
|
||||
|
||||
Priorities, in order: practical compatibility, functional integrated execution, rendering correctness, stability, performance, Apple Silicon-specific optimization, long-term independence. Reuse before reinvention; measure before optimizing; evidence before claims.
|
||||
|
||||
## Rolling planning
|
||||
|
||||
Only the current phase has a GitHub milestone and detailed issues. Later phases are described below and become milestones and issues only when the evidence from the current phase makes their requirements clear. Work that was specified early but depends on unverified assumptions is listed under [Parked ideas](#parked-ideas) with its closed issue, so it can be reopened rather than rewritten. Phase numbers are provisional. The earlier eight-phase plan (H0 to H7) is archived in [archive/hybrid-phases-h0-h7.md](archive/hybrid-phases-h0-h7.md).
|
||||
|
||||
## Engineering rules
|
||||
|
||||
[AGENTS.md](../AGENTS.md) (`CLAUDE.md` is a symlink to it) was rewritten to permit CrossOver, Wine-based infrastructure, Rosetta 2 and D3DMetal subject to licensing; ADR 0005 records the decision. The honesty, verification, provenance and clean-room rules are unchanged. Both are on the local branch `planning/hybrid-first-transition` and await maintainer review; nothing has been pushed.
|
||||
|
||||
## How progress is reported
|
||||
|
||||
Phase status is one of: Not started, Researching, In development, Blocked, In validation, Verified complete, Retired. A phase is Verified complete only with the evidence its completion criteria name. Progress is not derived from commits, lines of code, closed issues, instruction counts or passing isolated fixtures. No phase is currently Verified complete.
|
||||
|
||||
## Phase 1 — CrossOver Research, Feasibility and Baseline (active)
|
||||
|
||||
**Status:** Researching. **Milestone:** `Phase 1 - CrossOver Research, Feasibility and Baseline`.
|
||||
|
||||
**Objective:** Establish what the installed CrossOver version actually provides, which interfaces are supported, what may be reused or redistributed, and a reproducible baseline on authorized workloads.
|
||||
|
||||
**Completion criteria** (all required, each with recorded evidence):
|
||||
|
||||
1. CrossOver architecture, platform support, CPU translation and graphics backends documented from primary sources, with unknowns listed ([#348](https://github.com/MacosPorters/betterxen/issues/348)).
|
||||
2. Supported integration interfaces separated from undocumented behavior ([#350](https://github.com/MacosPorters/betterxen/issues/350)).
|
||||
3. Licensing and redistribution boundaries documented ([#354](https://github.com/MacosPorters/betterxen/issues/354)); the registry independently re-derived ([#363](https://github.com/MacosPorters/betterxen/issues/363)).
|
||||
4. A reproducible way to build original Windows test programs ([#364](https://github.com/MacosPorters/betterxen/issues/364)) and original graphics workloads with self-verifying output ([#365](https://github.com/MacosPorters/betterxen/issues/365)).
|
||||
5. Workload set, measurement protocol and host receipt defined ([#353](https://github.com/MacosPorters/betterxen/issues/353)) and a frame-time capture method ([#145](https://github.com/MacosPorters/betterxen/issues/145)).
|
||||
6. A reproducible CrossOver environment and a recorded baseline of CPU, GPU, memory and stability, reproduced by a second contributor ([#355](https://github.com/MacosPorters/betterxen/issues/355)).
|
||||
7. BetterXen's responsibilities versus CrossOver's recorded in an ADR a maintainer accepts ([#351](https://github.com/MacosPorters/betterxen/issues/351)).
|
||||
|
||||
**Open issues:** #145, #348, #350, #351, #353, #354, #355, #363, #364, #365, plus #346 (project board, needs the GitHub `project` token scope; does not block engineering).
|
||||
|
||||
**Known risks:** CrossOver is proprietary, so bundling or modifying may be prohibited; integration interfaces may be undocumented (see below); Xbox titles may not run at all.
|
||||
|
||||
### Critical path
|
||||
|
||||
1. Desk research needs nothing installed and can start now: #348, #350, #354, #364 (build only), #353.
|
||||
2. #363 re-derives the registry independently of its author.
|
||||
3. #365 needs #364 and #353.
|
||||
4. #355 needs #364, #353 and the interface findings of #350.
|
||||
5. #351 needs #348, #350, #354 and #355.
|
||||
|
||||
Hard dependencies are recorded as GitHub blocked-by relationships; everything else is preferred order.
|
||||
|
||||
### Verified and unverified (2026-11-25)
|
||||
|
||||
Details and sources are in [primary-source-verification-2026-11-25.md](research/primary-source-verification-2026-11-25.md). In short: CodeWeavers' public documentation names the backends Auto, D3DMetal, DXMT, DXVK and Wine, but **`CX_GRAPHICS_BACKEND` and `cxbottle.conf` are not documented there and must not be treated as a supported interface** until #350 resolves it. Apple's two September 2026 developer news items about Rosetta disagree with each other. D3DMetal's license text was not located; it stays user-supplied and unbundled.
|
||||
|
||||
## Provisional later phases (no milestone yet)
|
||||
|
||||
| Phase | Purpose | Starts when |
|
||||
| --- | --- | --- |
|
||||
| 2. Integration foundation | Only the tooling Phase 1 shows is missing: environment inspection, workload runner and run records, output-path policy | Phase 1 criteria 2 and 6 are met |
|
||||
| 3. Compatibility validation | Run authorized workloads and upstream conformance tests, record reproducible failures | A runner exists and a baseline is recorded |
|
||||
| 4. Graphics and performance | Backend comparison and measured bottleneck work; no improvement promised before measurement | Phase 3 shows what to measure |
|
||||
| 5. Stability and maturity | Soak, memory pressure, thermals, version matrices, dependency maintenance, upstream contributions | Phase 4 results exist |
|
||||
|
||||
Independent native reassessment is separate and deferred: it needs an explicit maintainer decision.
|
||||
|
||||
## Parked ideas
|
||||
|
||||
Specified in detail on 2026-11-25, then closed as premature for Phase 1 with the text preserved. Reopen when the stated prerequisite is met. Parking is not rejection.
|
||||
|
||||
| Issue | Subject | Reopen when |
|
||||
| --- | --- | --- |
|
||||
| [#366](https://github.com/MacosPorters/betterxen/issues/366) | Read-only CrossOver inspection command | The #353 receipt script proves insufficient |
|
||||
| [#367](https://github.com/MacosPorters/betterxen/issues/367) (absorbs #368) | Workload runner and run records | Phase 1 finds #350 supports scripted launches (Phase 2) |
|
||||
| [#257](https://github.com/MacosPorters/betterxen/issues/257) | Output-path policy for exports and caches | A tool that writes exports exists (Phase 2) |
|
||||
| [#369](https://github.com/MacosPorters/betterxen/issues/369) | Upstream Wine conformance subset in a bottle | Runner and baseline exist (Phase 3) |
|
||||
| [#370](https://github.com/MacosPorters/betterxen/issues/370) | Backend comparison on equal workloads | Baseline and workloads exist (Phase 4) |
|
||||
| [#371](https://github.com/MacosPorters/betterxen/issues/371), [#372](https://github.com/MacosPorters/betterxen/issues/372) | Shader-compile latency; Metal System Trace recipe | Baseline names a bottleneck (Phase 4) |
|
||||
| [#373](https://github.com/MacosPorters/betterxen/issues/373), [#204](https://github.com/MacosPorters/betterxen/issues/204) | Soak and thermal drift; memory-pressure benchmark | Workloads and baseline exist (Phase 5) |
|
||||
| [#374](https://github.com/MacosPorters/betterxen/issues/374) | Re-baseline on a Rosetta-free CrossOver build | Such a build ships (Phase 5); facts folded into #348 |
|
||||
| #173, #174, #219 | Contributor-workflow administration | A concrete need appears |
|
||||
|
||||
## Native work
|
||||
|
||||
About 110 native issues were consolidated. All are closed with their text, comments and attribution intact except four with an assignee and an open pull request (#247, #291, #307, #313), which stay open until their authors decide. See the [native issue archive](research/native-issue-archive.md). Source code, tests, benchmarks and history are untouched.
|
||||
@@ -1,9 +1,10 @@
|
||||
# CPU test runtime and shard selection
|
||||
# CPU test runtime, shards and coverage map
|
||||
|
||||
This page records what the CPU test gate costs and describes
|
||||
`scripts/cpu-tests.sh`, which splits that gate into deterministic shards. The
|
||||
shards are a convenience for local iteration and parallel runners. They do not
|
||||
replace any gate: `cargo test --locked --workspace` stays the full CPU gate, and
|
||||
This page records what the CPU test gate costs, describes
|
||||
`scripts/cpu-tests.sh`, which splits that gate into deterministic shards, and
|
||||
maps which x86-64 and loader behavior the tests verify. The shards are a
|
||||
convenience for local iteration and parallel runners. They do not replace any
|
||||
gate: `cargo test --locked --workspace` stays the full CPU gate, and
|
||||
`scripts/test-gpu.sh` stays the GPU gate.
|
||||
|
||||
## What counts as a CPU test
|
||||
@@ -96,3 +97,168 @@ than the full gate, because each target pays Cargo start-up.
|
||||
different commits are not comparable.
|
||||
- The experiment workspace `experiments/x1` is outside the selection. CI runs
|
||||
it separately.
|
||||
|
||||
## CPU and loader coverage map
|
||||
|
||||
This map inventories what the CPU and loader tests verify, per operation
|
||||
family, with the exact evidence commands and counts behind every number. It is
|
||||
documentation of verified state, not a compatibility claim, and it contains no
|
||||
percentages: every figure below is a count that a recorded command produced on
|
||||
one machine. The behavioral rules behind the map (how forms are declared, what
|
||||
"implemented" means, which forms are rejected on purpose) are documented in
|
||||
[docs/cpu/instruction-registry.md](../cpu/instruction-registry.md) and are not
|
||||
repeated here except where the map adds evidence.
|
||||
|
||||
### Method and revision
|
||||
|
||||
All commands ran on Apple M5, macOS 26.6.2, native arm64, Rust
|
||||
`1.100.0-aarch64-apple-darwin` (the revision CI pins), `CARGO_BUILD_JOBS=2`,
|
||||
on the branch holding this change, based on upstream `main` at
|
||||
`67b8cff` (2026-11-25).
|
||||
Recorded evidence commands:
|
||||
|
||||
```sh
|
||||
python3 crates/loader/generate_x86.py validate # 213 operations, 403 forms, 498 opcode slots
|
||||
python3 crates/loader/generate_x86.py --check # x86_table.rs is fresh
|
||||
PYTHONPATH=scripts python3 -m qa cpu-inventory # advisory partitions, cross-checked below
|
||||
cargo test --locked --workspace # 116 result lines: 1015 passed, 0 failed, 34 ignored
|
||||
```
|
||||
|
||||
The registry numbers are the generator's own count, not a hand count. The
|
||||
advisory `qa cpu-inventory` output was cross-checked against the code before
|
||||
use, and one stale row is called out under "Intentionally rejected forms".
|
||||
The default run recorded 34 ignored tests.
|
||||
|
||||
| Count | Category | Files |
|
||||
| --- | --- | --- |
|
||||
| 26 | Native Metal correctness | Five in `crates/loader/tests/` (`dbt_render.rs`, `graphics_d3d12.rs`, `graphics_textures.rs`, `runtime_x15.rs`), seven in `tests/validation/known_answers.rs`, and fourteen across `tests/validation/tests/` (`operand_domains.rs`, `sop1_unary.rs`, `sop2_arith.rs`, `sop2_stage_c.rs`, `sopc_stage_d.rs`, `sopk.rs`, `vop1_integer.rs`, `vop2_integer.rs`, `vop2_vcc.rs`, `vop3_compare.rs`, `vop3_integer.rs`, `vopc_f_t.rs`, `vopc_wide.rs`). |
|
||||
| 5 | LLVM AMDGPU oracle | Two in `crates/decoder/tests/gfx1030.rs` and one each in `crates/isa/tests/extension_word_negative.rs`, `meta_corpus.rs` and `meta_llvm.rs`. |
|
||||
| 3 | Manual CPU timing | Warm guest memory in `crates/loader/src/memory.rs`, relocation in `crates/loader/src/reloc.rs` and TLS templates in `crates/loader/src/tls.rs`. |
|
||||
|
||||
The two manual GPU timing tests in `crates/metal/tests/native_compute.rs`
|
||||
are outside these totals. Cargo requires the `gpu-tests` feature to build
|
||||
that target.
|
||||
|
||||
### Declared instruction inventory
|
||||
|
||||
`crates/loader/x86/instructions.toml` declares the decodable x86-64 surface.
|
||||
`generate_x86.py validate` reports **213 operations, 403 forms, 498 opcode
|
||||
slots** at this revision. By opcode map the slots split 235 one-byte and 263
|
||||
`0F`; by mandatory prefix 352 none, 107 `66`, 16 `F2`, 23 `F3`; by operand size
|
||||
96 byte (`b`), 139 variable 16/32/64 (`v`), 160 XMM 16-byte (`x`), 58 no
|
||||
operand (`n`), 22 32/64-only (`y`), 23 64-bit (`q`).
|
||||
|
||||
A declared form is decodable, not implemented. A form counts as supported only
|
||||
when it has semantics and fixture evidence. The fixture half is enforced:
|
||||
`every_declared_form_is_executed_by_a_fixture` in
|
||||
`crates/loader/tests/x86_integer.rs` decodes every line of the three assembly
|
||||
corpora (`tests/x86/integer.txt`, `vector.txt`, `float.txt`) and fails if any
|
||||
declared form is never executed. It lists the operations that are covered
|
||||
elsewhere instead (control flow and exits, `LDMXCSR`, and the
|
||||
`MOVS`/`STOS`/`CLD`/`STD` string family, which need their own memory layout and
|
||||
are covered form by form in `tests/cpu_rep.rs` and the loop tests).
|
||||
|
||||
### Engine path per operation
|
||||
|
||||
Of the 213 declared operations, **93 have at least one ARM64-lowered form**.
|
||||
Some other forms of those operations still use the shared interpreter helper.
|
||||
**119 operations use the helper for every translated form**, and **one**,
|
||||
`SYSCALL`, is decoded but refused by `is_translatable` in the DBT. Helper
|
||||
calls count toward `DbtMetrics::interpreter_fallbacks`. The conditional gates
|
||||
in `is_native` in `crates/loader/src/dbt.rs` apply at form level.
|
||||
|
||||
- `ADD`, `SUB`, `CMP`, `AND`, `OR`, `XOR`, `TEST`, `INC`, `DEC`, `NEG`, `NOT`
|
||||
and `CMOV` are native only at 32- and 64-bit width; 8- and 16-bit forms use
|
||||
the shared semantics.
|
||||
- `ADC` and `SBB` are native only for register and immediate operands; a memory
|
||||
destination stays on the helper path.
|
||||
- `BT` is native only in the `0F A3` register-index form; the `0F BA /4`
|
||||
immediate-index form can read a memory operand and uses the helper.
|
||||
- `BSF` and `BSR` are native at 16/32/64-bit width.
|
||||
- `POP` is native only in the opcode-register form.
|
||||
|
||||
`tests/x86_integer.rs` asserts the split both ways for every fixture: native
|
||||
forms must never call the helper, and helper forms always must. The interpreter
|
||||
runs all 213 operations through the shared semantics.
|
||||
|
||||
### Test evidence by artifact
|
||||
|
||||
Counts are from the full gate run recorded above (target name, tests run,
|
||||
passed/ignored). Expectation sources are named so independence can be judged.
|
||||
|
||||
| Artifact (under `crates/loader/tests/`) | Expectations derived from | Run result |
|
||||
| --- | --- | --- |
|
||||
| `x86_integer.rs` + `x86/integer.txt` (1230 fixture lines) | LLVM-assembled encodings; byte-level references written from the SDM/APM operation text, independent of the production semantics | 16 passed, 0 failed |
|
||||
| `x86_vector.rs` + `x86/vector.txt` (374 lines) | same method, SSE2 packed forms | 9 passed |
|
||||
| `x86_float.rs` + `x86/float.txt` (172), `x86/float_vectors.txt` (6824), `x86/float_reference.py` | exact-fraction reference computed by script, following SDM Vol. 1 floating-point rules | 9 passed |
|
||||
| `cpu_known_answers.rs` (50 tests, 838 named case lines) | Intel SDM and AMD APM sections cited per case; both engines run each case | 50 passed, 0 ignored |
|
||||
| `movsxd.rs` | SDM operation text; modular arithmetic in the test; LLVM-assembled encodings | 9 passed |
|
||||
| `x86_atomic.rs` | SDM LOCK/XADD/CMPXCHG rules; both compare outcomes, unaligned operands, faults | 5 passed |
|
||||
| `x86_carry_chain.rs` | widening `u128`/`i128` reference arithmetic on 256-bit chains | 8 passed |
|
||||
| `x86_prefix_length.rs` | SDM prefix and length rules | 8 passed |
|
||||
| `cpu_loop.rs` | a loop-model reference over every count, match point and budget | 3 passed |
|
||||
| `cpu_rep.rs` | a byte-array model over every MOVS/STOS form, direction and count, plus step accounting and faults | 7 passed |
|
||||
| `cpu_features.rs` | CPUID feature-bit pairing per the SDM; each reported bit requires the feature's fixtures, each commonly-tested unreported bit requires a refused witness | 4 passed |
|
||||
| `cpu_differential.rs` | interpreter and DBT must agree on shared fixtures | 5 passed |
|
||||
| `arm64_encodings.rs` | LLVM encodings for the assembler's emitted ARM64 | 3 passed |
|
||||
| `memory_page_boundaries.rs`, `memory_validation.rs` | mapping/permission/boundary contracts | 8 + 9 passed |
|
||||
| `generated_conformance.rs`, `bootstrap.rs`, `gate_a1.rs`, `gate_a2.rs`, `indirect_control.rs`, `bswap.rs`, `dbt_render.rs`, `process_exit.rs` | per-file documented contracts (generated conformance vectors, startup gates, control flow) | all passed except one Metal-gated ignore in `dbt_render.rs` |
|
||||
|
||||
Count named known-answer rows, including both byte-encoded and decoded cases,
|
||||
with the following command. This excludes section directives, format comments
|
||||
and Rust match arms.
|
||||
|
||||
```sh
|
||||
rg -c '^[A-Za-z0-9_]+:.*=>' crates/loader/tests/cpu_known_answers.rs
|
||||
```
|
||||
|
||||
The cache revalidation change in [PR #269](https://github.com/MacosPorters/betterxen/pull/269)
|
||||
restored `dbt_executes_modified_code_after_a_jump`. It passed in this run,
|
||||
and `cpu_known_answers.rs` reported 50 passes and zero ignores.
|
||||
|
||||
### Operations covered by model tests instead of the fixture corpus
|
||||
|
||||
The mnemonic-level fixture scan behind the advisory
|
||||
`PYTHONPATH=scripts python3 -m qa cpu-inventory` reports no assembly-text
|
||||
fixture for eight operations: `cld`, `std`, `jrcxz`, `loop`, `loope`,
|
||||
`loopne`, `movs`, `stos`. That is by design, not a gap: those operations need
|
||||
their own memory layout or counter model and are covered form by form in
|
||||
`tests/cpu_rep.rs` (MOVS/STOS/REP, the direction flag set by `STD` and cleared
|
||||
by `CLD`) and `tests/cpu_loop.rs` (LOOP/LOOPE/LOOPNE, JRCXZ on zero RCX). The
|
||||
declared-form enforcement test also exempts `LDMXCSR`, `Jcc`, `JMP`,
|
||||
`CALL`, `RET`, `HLT` and `SYSCALL`. It checks the remaining forms against the
|
||||
corpora.
|
||||
|
||||
### Intentionally rejected forms
|
||||
|
||||
The rejection list with its scope rules (LOCK limited to the memory forms of
|
||||
XADD and CMPXCHG, every x87 instruction except FNINIT,
|
||||
LODS/CMPS/SCAS/REPE/REPNE, MMX, RCP/RSQRT approximations, SSE3 and later,
|
||||
VEX, address-size overrides, 16-bit stack/branch forms, 16-bit BSWAP and
|
||||
MOVSXD, bit tests of memory by register index, CMPXCHG8B/16B, and the DBT
|
||||
refusing raw SYSCALL) is maintained in
|
||||
[docs/cpu/instruction-registry.md](../cpu/instruction-registry.md) and is
|
||||
tested by refusal cases inside the files above; this map does not duplicate it.
|
||||
|
||||
One advisory-tool discrepancy is recorded for its owner: the hand-written
|
||||
`unsupported_catalog` in `scripts/qa/cpu_inventory.py` lists "RCL/RCR/SHLD/
|
||||
SHRD", "string instructions" and "atomics/fences", which is stale against the
|
||||
code and tests at this revision — RCL/RCR/SHLD/SHRD are declared registry
|
||||
forms with implemented semantics (`x86_exec.rs`), 9 named `rcl*` cases and 8 named `shld*` or `shrd*` cases using the rule above,
|
||||
and 72 SHLD/SHRD assembly fixture lines; MOVS/STOS and the
|
||||
LOCK forms of XADD/CMPXCHG and the fences are supported within the documented
|
||||
scope. The catalog is advisory only and does not feed any gate.
|
||||
|
||||
### Map limitations
|
||||
|
||||
- Every count is pinned to the revision, host and single run named above.
|
||||
- The fixture evidence is mnemonic-level where it comes from the assembly
|
||||
corpora: it proves every declared form executes somewhere, not that every
|
||||
encoding variant of a form has its own expected-value case. The known-answer
|
||||
files carry the per-case expectations; their case lines are counted, not
|
||||
audited one by one here.
|
||||
- The native/shared partition is read from `is_native` at this revision and
|
||||
asserted by the fixtures; it is not a promise for other revisions.
|
||||
- Nothing here was compared with x86 hardware, no compatibility percentage is
|
||||
implied, and this is local documentation evidence, not independent
|
||||
acceptance.
|
||||
@@ -48,7 +48,7 @@ separate backend evidence. The [host evidence](../research/host-lab.md) records
|
||||
| Gate | Baseline disposition |
|
||||
| --- | --- |
|
||||
| P2-01 | Baseline captured. Phase 01 evidence and blockers are linked above. |
|
||||
| P2-02 | KyTx, Leonida and eight additional projects screened. Original fixtures and public specifications are the implementation source. No emulator code, tables or metadata are in scope for adoption. |
|
||||
| P2-02 | KyTx, PE-Vulkan project and eight additional projects screened. Original fixtures and public specifications are the implementation source. No emulator code, tables or metadata are in scope for adoption. |
|
||||
| P2-03 | VGPR-only OR verified on Apple M5. |
|
||||
| P2-04 | Workspace, LLVM and native GPU regression runs passed after OR integration. |
|
||||
| P2-05 | Independent OR expected values matched CPU execution and Metal readback. |
|
||||
|
||||
@@ -8,7 +8,7 @@ limit. A CPU rejection pass does not certify GPU execution.
|
||||
|
||||
| Upstream reference | Tested behavior | Xenora equivalent | Current result | Blocker |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| [Leonida compute](https://github.com/ItsNotRexed/Leonida/blob/3faac557b1584d39004357918e60325b4d4ff0fe/runtime/test/d3d12_compute_test.cpp) | Vulkan replay submits three distinct bindings and compares every readback word. Null, denied, malformed and out-of-bounds views decode to zero descriptors in separate controls. | Guest buffer view and original XOR readback. Persistent lifetime and snapshot tests extend this gate. | PASS for X8 view and readback | Xenora uses explicit faults for bad views. |
|
||||
| [PE-Vulkan project compute](https://github.com/ItsNotRexed/Leonida/blob/3faac557b1584d39004357918e60325b4d4ff0fe/runtime/test/d3d12_compute_test.cpp) | Vulkan replay submits three distinct bindings and compares every readback word. Null, denied, malformed and out-of-bounds views decode to zero descriptors in separate controls. | Guest buffer view and original XOR readback. Persistent lifetime and snapshot tests extend this gate. | PASS for X8 view and readback | Xenora uses explicit faults for bad views. |
|
||||
| [Xbox2Windows startup](https://github.com/R0Y00/Xbox2Windows/blob/cea1d927f891007262af75e0d907fddcc511b424/tests/cpu/startup_exe.cpp) | CPU startup exercises loading two DLLs, thread notifications and wait failures. | Original named-import PE32+ startup and missing import control. DLL and thread-local storage ordering are separate gates. | UNIMPLEMENTED for DLL and thread ordering | Bounded fixed-base guest profile. |
|
||||
| [Xbox2Windows wave shuffle](https://github.com/R0Y00/Xbox2Windows/blob/cea1d927f891007262af75e0d907fddcc511b424/tests/wave_shuffle.cpp) | D3D12 dispatch maps output by reported wave and lane, checks affine and rotation shuffles plus mirror and uniform controls, and rejects duplicate lanes or wrong widths. Forced variants require device capability. | ARM64 CPU compiler rejects an original gfx1030 cross-lane permute with a supported compile control. Native Wave64 shuffle needs a two-wave exact oracle. | PASS for rejection. UNIMPLEMENTED for Wave64 Metal dispatch. | No cross-lane lowering or Wave64 execution contract. |
|
||||
| [Xbox2Windows compute services](https://github.com/R0Y00/Xbox2Windows/blob/cea1d927f891007262af75e0d907fddcc511b424/tests/cpu/shim_compute_check.py) | Checks allocation, dispatch and free observations. Independently calculates four readback words. Provider rejection must produce zero output bytes. Native hardware is selected for the explicit hardware case. | Exact guest XOR readback, invalid import commands and observable destroy/reuse. | PASS for X8 XOR and malformed commands | Persistent resources have a separate X9 gate. |
|
||||
@@ -57,9 +57,9 @@ data sections, and no native host pointer crosses that boundary.
|
||||
|
||||
| Upstream reference | Tested behavior | Xenora equivalent | Current result | Blocker |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Leonida compute and Xbox2Windows compute services | Repeat dispatch, update and release a resource with observable results | Original X9 PE repeats XOR with a nonzero view, updates words and destroys and reuses a slot. | PASS on Apple M5 | Device buffers are uploaded per completion. |
|
||||
| Leonida compute | Submission bindings and lifetime are independent of later changes | X9 queues a view, changes or destroys its owner and still gets the captured output. A second queued submission is rejected. | PASS on Apple M5 for queued snapshots | Actual GPU work already in flight during release is UNIMPLEMENTED. |
|
||||
| Leonida compute | Isolate guest runs and release resources at exit | X9 drops the table and any queued view at guest return. A queued-work exit returns guest status 73 and produces no GPU commands for that submission. | PASS for queued-work exit | Native Metal object residency across guest calls is UNIMPLEMENTED. |
|
||||
| Leonida compute | Reject malformed resource ranges | X9 rejects invalid or stale handles, out-of-range views, offset overflow, writeback into read-only memory and invalid resource types. | PASS for guest fault controls | The guest profile exposes one bounded submission at a time. |
|
||||
| PE-Vulkan project compute and Xbox2Windows compute services | Repeat dispatch, update and release a resource with observable results | Original X9 PE repeats XOR with a nonzero view, updates words and destroys and reuses a slot. | PASS on Apple M5 | Device buffers are uploaded per completion. |
|
||||
| PE-Vulkan project compute | Submission bindings and lifetime are independent of later changes | X9 queues a view, changes or destroys its owner and still gets the captured output. A second queued submission is rejected. | PASS on Apple M5 for queued snapshots | Actual GPU work already in flight during release is UNIMPLEMENTED. |
|
||||
| PE-Vulkan project compute | Isolate guest runs and release resources at exit | X9 drops the table and any queued view at guest return. A queued-work exit returns guest status 73 and produces no GPU commands for that submission. | PASS for queued-work exit | Native Metal object residency across guest calls is UNIMPLEMENTED. |
|
||||
| PE-Vulkan project compute | Reject malformed resource ranges | X9 rejects invalid or stale handles, out-of-range views, offset overflow, writeback into read-only memory and invalid resource types. | PASS for guest fault controls | The guest profile exposes one bounded submission at a time. |
|
||||
| Xbox2Windows pixel attributes | GPU pixels agree with a CPU expectation | X9 renders a constant or perspective-interpolated triangle through both translated stages. The PE checks every returned pixel. A separate host oracle checks exact values and the guest report. Changing the expected red byte of one interior pixel makes the PE return 93 after the same GPU readback. | PASS on Apple M5 | Shader selection uses original fixed fixture IDs. |
|
||||
| bcpack-rs round trips and Xbox2Windows texture LOD | Edge data and malformed input distinguish valid subresources | X9 validates a pitched descriptor, rejects wrong usage, layer, size and update requests, and reads selected BC1 mips and layers back through Metal. | PASS on Apple M5 for selected subresource readback | Translated texture sampling and GPU texture lifetime across guest calls are UNIMPLEMENTED. |
|
||||
@@ -6,7 +6,7 @@ identified the arithmetic shift as a candidate. Xenora uses the public
|
||||
and its existing pinned AMD XML generator for the VOP2 encoding. The lowering
|
||||
uses signed integer shift from the
|
||||
[Metal Shading Language Specification](https://developer.apple.com/metal/Metal-Shading-Language-Specification).
|
||||
The implementation and fixture were authored in Xenora. No Leonida code, tables,
|
||||
The implementation and fixture were authored in Xenora. No PE-Vulkan project code, tables,
|
||||
dependencies or game material were imported.
|
||||
|
||||
The decoder accepts the VOP2 VGPR/VGPR form. The shader lifter retains the synthetic
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Fast, deterministic documentation and repository hygiene checks.
|
||||
|
||||
Checks only tracked files:
|
||||
1. no merge-conflict markers in tracked text files;
|
||||
2. every relative Markdown link points at a tracked file or directory;
|
||||
3. every workflow file under .github/workflows parses as YAML.
|
||||
|
||||
External URLs and in-page anchors are not fetched or validated, so the result
|
||||
does not depend on the network. Exit status is 1 when a problem is found. Pass --require-yaml to fail, not skip,
|
||||
when PyYAML is missing.
|
||||
"""
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path, PurePosixPath
|
||||
from urllib.parse import unquote
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
MARKER = re.compile(r"^(<{7}( |$)|={7}$|>{7}( |$))")
|
||||
LINK = re.compile(r"(?<!\!)\[[^\]]*\]\(([^)\s]+)(?:\s+\"[^\"]*\")?\)")
|
||||
FENCE = re.compile(r"^\s*(```|~~~)")
|
||||
|
||||
|
||||
def tracked():
|
||||
out = subprocess.run(["git", "ls-files", "-z"], cwd=ROOT, check=True,
|
||||
capture_output=True).stdout.decode("utf-8", "replace")
|
||||
return [p for p in out.split("\0") if p and (ROOT / p).is_file()]
|
||||
|
||||
|
||||
def text(path):
|
||||
data = (ROOT / path).read_bytes()
|
||||
if b"\0" in data:
|
||||
return None
|
||||
return data.decode("utf-8", "replace")
|
||||
|
||||
|
||||
def check_markers(files, problems):
|
||||
for path in files:
|
||||
if path.endswith((".patch", ".diff")):
|
||||
continue
|
||||
body = text(path)
|
||||
if body is None:
|
||||
continue
|
||||
for number, line in enumerate(body.splitlines(), 1):
|
||||
if MARKER.match(line):
|
||||
problems.append(f"{path}:{number}: merge conflict marker")
|
||||
|
||||
|
||||
def check_links(files, problems):
|
||||
known = set(files)
|
||||
dirs = {str(d) for f in files for d in PurePosixPath(f).parents}
|
||||
for path in files:
|
||||
if not path.endswith(".md") or path.startswith(("artifacts/", "third_party/")):
|
||||
continue
|
||||
in_fence = False
|
||||
for number, line in enumerate((text(path) or "").splitlines(), 1):
|
||||
if FENCE.match(line):
|
||||
in_fence = not in_fence
|
||||
continue
|
||||
if in_fence:
|
||||
continue
|
||||
line = re.sub(r"`[^`]*`", "", line)
|
||||
for target in LINK.findall(line):
|
||||
if re.match(r"^([a-z][a-z0-9+.-]*:|#|//)", target, re.I):
|
||||
continue
|
||||
target = unquote(target.split("#", 1)[0].split("?", 1)[0])
|
||||
if not target:
|
||||
continue
|
||||
base = PurePosixPath(path).parent
|
||||
resolved = PurePosixPath(target.lstrip("/")) if target.startswith("/") else base / target
|
||||
parts = []
|
||||
for part in resolved.parts:
|
||||
if part == "..":
|
||||
if parts:
|
||||
parts.pop()
|
||||
elif part != ".":
|
||||
parts.append(part)
|
||||
norm = "/".join(parts)
|
||||
if norm and norm not in known and norm not in dirs:
|
||||
problems.append(f"{path}:{number}: broken relative link '{target}'")
|
||||
|
||||
|
||||
def check_workflows(files, problems, require_yaml):
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
if require_yaml:
|
||||
problems.append("PyYAML is not installed but --require-yaml was given")
|
||||
else:
|
||||
print("note: PyYAML not installed; workflow YAML parse check skipped", file=sys.stderr)
|
||||
return
|
||||
for path in files:
|
||||
if path.startswith(".github/workflows/") and path.endswith((".yml", ".yaml")):
|
||||
try:
|
||||
yaml.safe_load((ROOT / path).read_text(encoding="utf-8"))
|
||||
except yaml.YAMLError as err:
|
||||
problems.append(f"{path}: invalid YAML: {str(err).splitlines()[0]}")
|
||||
|
||||
|
||||
def main():
|
||||
files = tracked()
|
||||
problems = []
|
||||
check_markers(files, problems)
|
||||
check_links(files, problems)
|
||||
check_workflows(files, problems, "--require-yaml" in sys.argv[1:])
|
||||
for problem in problems:
|
||||
print(problem)
|
||||
print(f"docs hygiene: {len(files)} tracked files checked, {len(problems)} problem(s)")
|
||||
return 1 if problems else 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -54,5 +54,24 @@ codesign --force --sign - "$bundle"
|
||||
|
||||
binary="$bundle/Contents/MacOS/BetterXen"
|
||||
[ "$(lipo -archs "$binary")" = arm64 ] || fail "executable is not arm64-only: $(lipo -archs "$binary")"
|
||||
file "$binary"
|
||||
# Only system libraries may be linked: anything else would be a host dependency
|
||||
# shipped or expected outside macOS, which this bundle does not carry. List the
|
||||
# dependencies once, print that listing and check the same output.
|
||||
dependencies=$(otool -L "$binary") || fail "otool -L failed for $binary"
|
||||
printf '%s\n' "$dependencies"
|
||||
dependencies=$(printf '%s\n' "$dependencies" | tail -n +2 | awk '{print $1}')
|
||||
# Every Swift executable links at least libSystem, so an empty list is an error.
|
||||
[ -n "$dependencies" ] || fail "otool -L listed no dependencies for $binary"
|
||||
for dependency in $dependencies; do
|
||||
case "$dependency" in
|
||||
/System/Library/*|/usr/lib/*) ;;
|
||||
@rpath/*|@executable_path/*|@loader_path/*)
|
||||
fail "executable links a bundle-relative library, but this bundle ships none: $dependency" ;;
|
||||
*) fail "executable links a non-system library: $dependency" ;;
|
||||
esac
|
||||
done
|
||||
"$binary" --smoke
|
||||
"$binary" --smoke-inspection-order
|
||||
"$binary" --smoke-import-result
|
||||
echo "build-app: built $bundle"
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Build BetterXen's original Windows workloads (issue #364) with a pinned cross toolchain and
|
||||
# write the results to artifacts/hybrid-workloads/<arch>/. Nothing is executed; the script ends
|
||||
# by printing `file` and the PE machine type of every output so a build that produced the wrong
|
||||
# architecture fails here.
|
||||
#
|
||||
# scripts/hybrid/build-windows-workloads.sh <llvm-mingw-dir>
|
||||
#
|
||||
# <llvm-mingw-dir> is an unpacked llvm-mingw release (https://github.com/mstorsjo/llvm-mingw,
|
||||
# Apache-2.0 with LLVM exceptions); see docs/research/hybrid-toolchain.md for the pinned
|
||||
# release and checksum. Rust workloads use the x86_64-pc-windows-gnullvm and
|
||||
# aarch64-pc-windows-gnullvm targets (rustup target add ...) linked with that toolchain.
|
||||
set -eu
|
||||
TC=${1:?usage: $0 <llvm-mingw-dir>}
|
||||
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
||||
OUT="$ROOT/artifacts/hybrid-workloads"
|
||||
RUSTC_TC=${RUSTUP_TOOLCHAIN_FOR_WORKLOADS:-1.100.0}
|
||||
[ -x "$TC/bin/x86_64-w64-mingw32-clang" ] || { echo "no llvm-mingw at $TC" >&2; exit 1; }
|
||||
|
||||
for arch in x86_64 aarch64; do
|
||||
d="$OUT/$arch"; mkdir -p "$d"
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/selfcheck-c.exe" "$ROOT/workloads/win-selfcheck-c/selfcheck.c"
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/d3d11-clear.exe" "$ROOT/workloads/d3d11-clear/d3d11_clear.c" -ld3d11 -ldxgi
|
||||
"$TC/bin/$arch-w64-mingw32-clang" -O2 -Wall -Wextra -Werror -Wl,--no-insert-timestamp \
|
||||
-o "$d/d3d11-frameloop.exe" "$ROOT/workloads/d3d11-frameloop/frameloop.c" -ld3d11 -ldxgi -ldxguid -ld3dcompiler -lm
|
||||
env_arch=$(echo "$arch" | tr a-z A-Z)
|
||||
(
|
||||
export PATH="$TC/bin:$PATH"
|
||||
export "CARGO_TARGET_${env_arch}_PC_WINDOWS_GNULLVM_LINKER=$TC/bin/$arch-w64-mingw32-clang"
|
||||
cd "$ROOT/workloads/win-selfcheck-rust"
|
||||
CARGO_TARGET_DIR="$OUT/rust-target" rustup run "$RUSTC_TC" cargo build --release --target "$arch-pc-windows-gnullvm" -q
|
||||
)
|
||||
cp "$OUT/rust-target/$arch-pc-windows-gnullvm/release/win-selfcheck-rust.exe" "$d/selfcheck-rust.exe"
|
||||
done
|
||||
|
||||
fail=0
|
||||
for f in "$OUT"/x86_64/*.exe "$OUT"/aarch64/*.exe; do
|
||||
want=$(basename "$(dirname "$f")")
|
||||
desc=$(file -b "$f")
|
||||
case "$want:$desc" in
|
||||
x86_64:*"PE32+"*"x86-64"*) ok=ok ;;
|
||||
aarch64:*"PE32+"*"Aarch64"*|aarch64:*"PE32+"*"ARM64"*) ok=ok ;;
|
||||
*) ok=WRONG; fail=1 ;;
|
||||
esac
|
||||
echo "$ok $f: $desc"
|
||||
done
|
||||
exit $fail
|
||||
@@ -1,105 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check that a pull request description follows .github/PULL_REQUEST_TEMPLATE.md.
|
||||
|
||||
Standard library only. The description is read as data from the GitHub event
|
||||
file (or a plain text file with --body-file); it is never executed.
|
||||
Exit status 0 when the description passes, 1 when something is missing.
|
||||
"""
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
SECTIONS = (
|
||||
"Summary",
|
||||
"Implementation and evidence",
|
||||
"Verification",
|
||||
"Compatibility and limitations",
|
||||
"Checklist",
|
||||
"AI assistance",
|
||||
)
|
||||
# Checklist items that must be ticked, found by the start of their text.
|
||||
REQUIRED_TICKS = (
|
||||
("I claimed the linked issue", "the claimed-first checkbox"),
|
||||
("My commits are signed off under the DCO", "the DCO sign-off checkbox"),
|
||||
)
|
||||
ISSUE_LINK = re.compile(r"\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s+#\d+", re.I)
|
||||
NO_ISSUE = re.compile(r"^\s*No linked issue:\s*\S", re.I | re.M)
|
||||
COMMENT = re.compile(r"<!--.*?-->", re.S)
|
||||
EMPTY_LINK = re.compile(r"^\s*(?:close|fix|resolve)\w*\s*#\s*$", re.I)
|
||||
HEADING = re.compile(r"^##\s+(.+?)\s*$", re.M)
|
||||
|
||||
|
||||
def sections(body):
|
||||
"""Map each level-2 heading to its text, with HTML comments removed."""
|
||||
text = COMMENT.sub("", body.replace("\r\n", "\n"))
|
||||
found = {}
|
||||
marks = list(HEADING.finditer(text))
|
||||
for i, m in enumerate(marks):
|
||||
end = marks[i + 1].start() if i + 1 < len(marks) else len(text)
|
||||
found[m.group(1).strip().lower()] = text[m.end():end].strip()
|
||||
return text, found
|
||||
|
||||
|
||||
def has_content(name, value):
|
||||
if name == "Verification":
|
||||
# The empty table from the template does not count: some cell must be filled.
|
||||
rows = [r for r in value.splitlines() if r.strip().startswith("|")]
|
||||
filled = [r for r in rows[2:] if [c for c in r.strip().strip("|").split("|")[1:] if c.strip()]]
|
||||
prose = [r for r in value.splitlines() if r.strip() and not r.strip().startswith("|")]
|
||||
return bool(filled or prose)
|
||||
if name == "Checklist":
|
||||
return "- [" in value
|
||||
# A bare "Closes #" left over from the template is not content.
|
||||
rest = [l for l in value.splitlines() if l.strip() and not EMPTY_LINK.match(l)]
|
||||
return bool(rest)
|
||||
|
||||
|
||||
def check(body):
|
||||
"""Return a list of human-readable problems; empty means the body passes."""
|
||||
if not body or not body.strip():
|
||||
return ["The description is empty. Copy .github/PULL_REQUEST_TEMPLATE.md into it and fill it in."]
|
||||
text, found = sections(body)
|
||||
problems = []
|
||||
for name in SECTIONS:
|
||||
if name.lower() not in found:
|
||||
problems.append('Missing section "## %s".' % name)
|
||||
elif not has_content(name, found[name.lower()]):
|
||||
problems.append('Section "## %s" is empty.' % name)
|
||||
if not ISSUE_LINK.search(text) and not NO_ISSUE.search(text):
|
||||
problems.append('No linked issue: add "Closes #<number>", or a line "No linked issue: <reason>".')
|
||||
checklist = found.get("checklist", "")
|
||||
for prefix, label in REQUIRED_TICKS:
|
||||
item = re.search(r"^\s*[-*]\s*\[( |x|X)\]\s*" + re.escape(prefix), checklist, re.M)
|
||||
if not item:
|
||||
problems.append("Checklist is missing %s." % label)
|
||||
elif item.group(1) == " ":
|
||||
problems.append("Tick %s." % label)
|
||||
return problems
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
ap = argparse.ArgumentParser(description=__doc__)
|
||||
src = ap.add_mutually_exclusive_group(required=True)
|
||||
src.add_argument("--event", help="GitHub event JSON file (pull_request or pull_request_target)")
|
||||
src.add_argument("--body-file", help="file holding the description text")
|
||||
args = ap.parse_args(argv)
|
||||
if args.event:
|
||||
with open(args.event, encoding="utf-8") as fh:
|
||||
body = (json.load(fh).get("pull_request") or {}).get("body") or ""
|
||||
else:
|
||||
with open(args.body_file, encoding="utf-8") as fh:
|
||||
body = fh.read()
|
||||
problems = check(body)
|
||||
if problems:
|
||||
print("The pull request description does not follow .github/PULL_REQUEST_TEMPLATE.md:")
|
||||
for p in problems:
|
||||
print("- " + p)
|
||||
print("Edit the description to fix this; the check runs again on every edit.")
|
||||
return 1
|
||||
print("The pull request description follows the template.")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,90 @@
|
||||
# Original AVX integer fixture specification
|
||||
|
||||
This fixture is a proposed known-answer test for the
|
||||
[guest AVX contract](../../../docs/cpu/avx-contract.md). It uses only the
|
||||
source below, fixed register values and synthetic guest memory. Run the
|
||||
eventual fixture in both guest engines on fresh copies of the same initial
|
||||
state. Use the independent expected values below for each engine.
|
||||
|
||||
## Guest sequence
|
||||
|
||||
Set `r8` and `r9` to separate readable ranges containing arrays A and B.
|
||||
Set `r10` to a writable 96-byte output region initialized to `0xA5` with
|
||||
mapped sentinel bytes before and after it. Map the code separately as guest
|
||||
executable memory. Initialize flags, MXCSR and untouched vector registers to
|
||||
known nonzero values, then record their initial values. The sequence uses no
|
||||
stack, imports or host calls.
|
||||
|
||||
```asm
|
||||
.intel_syntax noprefix
|
||||
.text
|
||||
vmovdqu ymm1, ymmword ptr [r8]
|
||||
vmovdqu ymm2, ymmword ptr [r9]
|
||||
vpaddd ymm3, ymm1, ymm2
|
||||
vmovdqu ymmword ptr [r10], ymm3
|
||||
movdqu xmm3, xmm1
|
||||
vmovdqu ymmword ptr [r10 + 32], ymm3
|
||||
vmovdqu xmm3, xmm2
|
||||
vmovdqu ymmword ptr [r10 + 64], ymm3
|
||||
hlt
|
||||
```
|
||||
|
||||
The high base registers require three-byte VEX for the memory moves, while
|
||||
the low-register `VPADDD` and register `VMOVDQU` can use two-byte VEX.
|
||||
Store each table row as eight little-endian 32-bit words, with lane 0 at
|
||||
the lowest address. All entries are hexadecimal.
|
||||
|
||||
| Words | Lane 0 | Lane 1 | Lane 2 | Lane 3 | Lane 4 | Lane 5 | Lane 6 | Lane 7 |
|
||||
| --- | --- | --- | --- | --- | --- | --- | --- | --- |
|
||||
| A | `ffffffff` | `7fffffff` | `80000000` | `00000000` | `00000010` | `fffffffe` | `12345678` | `aaaaaaaa` |
|
||||
| B | `00000001` | `00000001` | `80000000` | `ffffffff` | `00000020` | `00000003` | `11111111` | `55555556` |
|
||||
| Output +0 | `00000000` | `80000000` | `00000000` | `ffffffff` | `00000030` | `00000001` | `23456789` | `00000000` |
|
||||
| Output +32 | `ffffffff` | `7fffffff` | `80000000` | `00000000` | `00000030` | `00000001` | `23456789` | `00000000` |
|
||||
| Output +64 | `00000001` | `00000001` | `80000000` | `ffffffff` | `00000000` | `00000000` | `00000000` | `00000000` |
|
||||
|
||||
For output +0, add corresponding words as unsigned integers and discard
|
||||
bits above bit 31 in each sum. For example, lane 0 wraps `0x100000000` to
|
||||
zero, so lane 1 has no incoming carry. At +32, the legacy move replaces the
|
||||
low four words with A and retains the high four words of the sum. At +64,
|
||||
the VEX.128 move replaces the low four words with B and clears the high
|
||||
four. Final YMM1 and YMM2 equal A and B. Final YMM3 equals output +64.
|
||||
All other vector registers, the input bytes, sentinels, general-purpose
|
||||
registers, flags and MXCSR retain their initial values. Expect `Halt` with
|
||||
nine steps, including the terminal `HLT`.
|
||||
|
||||
## Controls
|
||||
|
||||
| Case | Expected result |
|
||||
| --- | --- |
|
||||
| `VPADDD` writes to one of its input registers | Same eight-word sum using both inputs as they stood before the instruction. The other source survives. |
|
||||
| 128-bit `VPADDD` with seeded destination upper half | Output +0's low four words and four zero words. Both sources survive when distinct from the destination. |
|
||||
| 128-bit `VMOVDQU` store with sentinels | Exactly the low 16 bytes are stored. The entire source YMM and memory outside the operand survive. |
|
||||
| 256-bit `VMOVDQU` at a 32-byte-aligned address, at an address offset by one byte, and at `P-16` across adjacent accessible mappings | Same 32 bytes at each address. `P` is the start of the second mapping. |
|
||||
| Split load at `P-16`, with the second mapping unreadable or unmapped | Memory fault at `P`. Every destination bit retains its pre-instruction value. |
|
||||
| Split store at `P-16`, with the second mapping read-only or unmapped | Memory fault at `P`. The 16 writable bytes before `P` retain their sentinels. |
|
||||
| 256-bit `VMOVDQU` load and store at `0x0000_7fff_ffff_fff0` | Map the first 16 bytes read/write and leave the noncanonical half starting at `0x0000_8000_0000_0000` unmapped. Both operations report `GeneralProtection` under the BetterXen profile. The destination register and the mapped bytes retain their original values. |
|
||||
| 256-bit `VMOVDQU` load from `[rsp]` with `rsp = 0x0000_8000_0000_0000` | The BetterXen profile reports `GeneralProtection` and preserves the destination. Intel's Type 4 rules specify `#SS(0)` for this SS-based operand. |
|
||||
| Future `VMOVDQA` at aligned and misaligned addresses | An aligned, permitted span transfers the same bytes. A span misaligned by one byte produces `GeneralProtection` and has no data effects. Run at both widths. |
|
||||
| Future masked dword load from `P-16` | With only lanes 0–3 enabled, load four words and zero lanes 4–7 even if the mapping at `P` is absent. Enabling lane 4 faults at `P`. An all-zero mask reads no lanes and returns an all-zero destination. |
|
||||
| Future masked dword store to the same split span | With only lanes 0–3 enabled, write those four words; disabled lanes neither access the second mapping nor alter any bytes there when it is mapped. Enabling lane 4 with its mapping absent faults at `P`. |
|
||||
| Reserved move `vvvv`, reserved VEX map, prohibited prefix before VEX | Illegal instruction at the offending instruction's RIP. No destination or memory update. |
|
||||
| Equivalent legal `C5` and `C4` register forms, including both `W` values for `WIG` | Equal results and state, with RIP advancement matching each encoding length. Include a high ModRM.reg destination and high `vvvv` source. |
|
||||
| Budget of two steps | Stop at `VPADDD` (`entry + 0xA` with the encoding shown below) with both inputs loaded, YMM3 and output untouched. Resume with seven steps and reach the same final state as a nine-step run. Repeat with a warm DBT cache. |
|
||||
|
||||
For faults, place a completed instruction before the failing instruction.
|
||||
Assert that only the earlier instruction retires and its effects persist.
|
||||
Check snapshots of the full destination or nearby memory as appropriate.
|
||||
|
||||
## Build provenance
|
||||
|
||||
Use native Apple Silicon LLVM tools to assemble the sequence as an x86-64
|
||||
object, for example with `xcrun clang -arch x86_64 -c avx-fixture.s`.
|
||||
Verify the resolved Clang and `llvm-objdump` executables support ARM64 before
|
||||
running them. Record their versions and the output of disassembling the
|
||||
object. Apple Clang 21.0.0 emits `C4 C1 7E 6F 08` for the first load and
|
||||
`C5 F5 FE DA` for `VPADDD` at offset `0xA`. Keep generated sources and
|
||||
objects under ignored `artifacts/`.
|
||||
The test harness consumes only the object's verified instruction bytes
|
||||
as guest data. Reserved encodings can be authored separately from Intel's
|
||||
bit-field tables, since an assembler may reject them. Use source-derived
|
||||
lane values and checked-memory expectations for the test oracle.
|
||||
@@ -1,99 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
|
||||
import pr_template_check as c
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
TEMPLATE = open(os.path.join(ROOT, ".github", "PULL_REQUEST_TEMPLATE.md"), encoding="utf-8").read()
|
||||
|
||||
GOOD = """## Summary
|
||||
|
||||
Adds X.
|
||||
|
||||
Closes #12
|
||||
|
||||
## Implementation and evidence
|
||||
|
||||
Touches crates/texture only.
|
||||
|
||||
## Verification
|
||||
|
||||
| Check | Result / evidence |
|
||||
| --- | --- |
|
||||
| Formatting and lint | cargo fmt --check: clean |
|
||||
| Unit / integration tests | cargo test -p xenora-texture: 40 passed |
|
||||
|
||||
## Compatibility and limitations
|
||||
|
||||
None known.
|
||||
|
||||
## Checklist
|
||||
|
||||
- [x] I claimed the linked issue before starting, and the claim was still mine when I opened this pull request.
|
||||
- [x] I reviewed the changes and disclosed material AI assistance below, if applicable.
|
||||
- [x] My commits are signed off under the DCO.
|
||||
|
||||
## AI assistance
|
||||
|
||||
None.
|
||||
"""
|
||||
|
||||
|
||||
class Check(unittest.TestCase):
|
||||
def test_good_body_passes(self):
|
||||
self.assertEqual(c.check(GOOD), [])
|
||||
|
||||
def test_unfilled_template_fails_on_every_rule(self):
|
||||
problems = c.check(TEMPLATE)
|
||||
text = "\n".join(problems)
|
||||
for want in ('"## Summary" is empty', '"## Implementation and evidence" is empty',
|
||||
'"## Verification" is empty', '"## Compatibility and limitations" is empty',
|
||||
'"## AI assistance" is empty', "No linked issue", "claimed-first", "DCO"):
|
||||
self.assertIn(want, text)
|
||||
|
||||
def test_empty_and_freeform_bodies_fail(self):
|
||||
self.assertTrue(c.check(""))
|
||||
self.assertTrue(c.check("Fixes a bug. Closes #3"))
|
||||
|
||||
def test_missing_section_is_named(self):
|
||||
body = GOOD.replace("## Compatibility and limitations\n\nNone known.\n", "")
|
||||
self.assertEqual(c.check(body), ['Missing section "## Compatibility and limitations".'])
|
||||
|
||||
def test_unticked_boxes_fail(self):
|
||||
body = GOOD.replace("- [x] I claimed", "- [ ] I claimed").replace("- [x] My commits", "- [ ] My commits")
|
||||
problems = c.check(body)
|
||||
self.assertEqual(len(problems), 2)
|
||||
self.assertIn("claimed-first", problems[0])
|
||||
self.assertIn("DCO", problems[1])
|
||||
|
||||
def test_issue_link_forms(self):
|
||||
for link in ("Fixes #4", "resolves #4", "Closed #4", "No linked issue: requested by the maintainer"):
|
||||
self.assertEqual(c.check(GOOD.replace("Closes #12", link)), [], link)
|
||||
self.assertIn("No linked issue", "\n".join(c.check(GOOD.replace("Closes #12", "See issue 12"))))
|
||||
|
||||
def test_link_inside_comment_does_not_count(self):
|
||||
self.assertTrue(c.check(GOOD.replace("Closes #12", "<!-- Closes #12 -->")))
|
||||
|
||||
def test_new_claim_checkbox_wording_passes(self):
|
||||
body = GOOD.replace("I claimed the linked issue before starting, and the claim was still mine when I opened this pull request.",
|
||||
"I claimed the linked issue with a reply before starting, and nobody else held a live claim on it.")
|
||||
self.assertEqual(c.check(body), [])
|
||||
|
||||
def test_cli_exit_codes_from_event_file(self):
|
||||
script = os.path.join(ROOT, "scripts", "pr_template_check.py")
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
for body, want in ((GOOD, 0), (TEMPLATE, 1), (None, 1)):
|
||||
path = os.path.join(d, "event.json")
|
||||
with open(path, "w", encoding="utf-8") as fh:
|
||||
json.dump({"pull_request": {"body": body}}, fh)
|
||||
run = subprocess.run([sys.executable, script, "--event", path], capture_output=True, text=True)
|
||||
self.assertEqual(run.returncode, want, run.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,71 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #365, first step): Direct3D 11 clear and readback.
|
||||
// Creates a hardware device, clears a 64x64 RGBA8 render target to (0.25, 0.5, 0.75, 1.0),
|
||||
// copies it to a staging texture, maps it, and checks every pixel. Expected bytes by the ideal
|
||||
// FLOAT->UNORM rule (c*255, add 0.5, drop the fraction): 64, 128, 191, 255. The Direct3D data
|
||||
// conversion rules also permit a tolerance of 0.6 unit-last-place on the integer side
|
||||
// (D3D11/D3D12_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = 0.6f), so a byte passes when it is
|
||||
// within 0.6 of c*255. 0.5*255 = 127.5 is an exact tie, so both 127 and 128 are permitted.
|
||||
// The program prints whether the result matched the ideal exactly. This corrects an earlier
|
||||
// version that required exact equality, which was stricter than the specification.
|
||||
// Exit codes: 0 pass, 1 wrong pixel, 2 no device (reported, not a pass), 3 other API failure.
|
||||
#define COBJMACROS
|
||||
#include <d3d11.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// `--negative-control` expects a deliberately wrong colour; the program must then exit 1.
|
||||
int main(int argc, char **argv) {
|
||||
const int negative = argc > 1 && !strcmp(argv[1], "--negative-control");
|
||||
ID3D11Device *dev = NULL;
|
||||
ID3D11DeviceContext *ctx = NULL;
|
||||
D3D_FEATURE_LEVEL got;
|
||||
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0,
|
||||
D3D11_SDK_VERSION, &dev, &got, &ctx);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
printf("device ok feature_level=0x%x\n", (unsigned)got);
|
||||
|
||||
D3D11_TEXTURE2D_DESC d = {0};
|
||||
d.Width = 64; d.Height = 64; d.MipLevels = 1; d.ArraySize = 1;
|
||||
d.Format = DXGI_FORMAT_R8G8B8A8_UNORM; d.SampleDesc.Count = 1;
|
||||
d.Usage = D3D11_USAGE_DEFAULT; d.BindFlags = D3D11_BIND_RENDER_TARGET;
|
||||
ID3D11Texture2D *rt = NULL, *st = NULL;
|
||||
if (FAILED(ID3D11Device_CreateTexture2D(dev, &d, NULL, &rt))) { printf("FAIL create rt\n"); return 3; }
|
||||
d.Usage = D3D11_USAGE_STAGING; d.BindFlags = 0; d.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
if (FAILED(ID3D11Device_CreateTexture2D(dev, &d, NULL, &st))) { printf("FAIL create staging\n"); return 3; }
|
||||
ID3D11RenderTargetView *rtv = NULL;
|
||||
if (FAILED(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)rt, NULL, &rtv))) {
|
||||
printf("FAIL create rtv\n"); return 3;
|
||||
}
|
||||
const float color[4] = {0.25f, 0.5f, 0.75f, 1.0f};
|
||||
ID3D11DeviceContext_ClearRenderTargetView(ctx, rtv, color);
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)st, (ID3D11Resource *)rt);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
if (FAILED(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)st, 0, D3D11_MAP_READ, 0, &m))) {
|
||||
printf("FAIL map\n"); return 3;
|
||||
}
|
||||
const unsigned char ideal[4] = {64, 128, 191, 255};
|
||||
const float tol = 0.6f;
|
||||
int bad = 0, inexact = 0;
|
||||
for (UINT y = 0; y < 64; y++) {
|
||||
const unsigned char *row = (const unsigned char *)m.pData + (size_t)y * m.RowPitch;
|
||||
for (UINT x = 0; x < 64; x++) {
|
||||
const unsigned char *p = row + x * 4;
|
||||
int off_ideal = 0, off_tol = 0;
|
||||
for (int ch = 0; ch < 4; ch++) {
|
||||
if (p[ch] != ideal[ch] + (negative ? 100 : 0)) off_ideal = 1;
|
||||
if (fabsf(color[ch] * 255.0f + (negative ? 100.0f : 0.0f) - (float)p[ch]) > tol) off_tol = 1;
|
||||
}
|
||||
if (off_ideal) inexact++;
|
||||
if (off_tol) {
|
||||
if (bad < 3) printf("pixel (%u,%u) = %u %u %u %u\n", x, y, p[0], p[1], p[2], p[3]);
|
||||
bad++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)st, 0);
|
||||
if (bad) { printf("FAIL %d wrong pixels\n", bad); return 1; }
|
||||
printf("PASS 4096 pixels within tolerance; %d differ from the ideal rounding\n", inexact);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #365, #145): Direct3D 11 indexed triangle, shaders,
|
||||
// offscreen render target and a sustained frame loop with per-frame GPU-completion timing.
|
||||
//
|
||||
// Pipeline: HLSL vertex and pixel shaders compiled at run time with D3DCompile, a vertex
|
||||
// buffer (3 vertices), an index buffer (3 indices), a 640x360 RGBA8 render target, no window
|
||||
// and no presentation. Each frame clears, draws, issues an event query and waits for it to
|
||||
// complete; the interval between consecutive completions is printed as `frame_ms <value>`,
|
||||
// one line per frame, so `betterxen-hybrid frames` can summarise them. This measures
|
||||
// submit-to-completion of a trivial draw plus synchronisation, NOT presentation or realistic
|
||||
// rendering cost.
|
||||
//
|
||||
// Correctness (read back once after the first frame): pixel (0,0) lies outside the triangle
|
||||
// and must be the clear colour (0,0,0,255) exactly; the centre pixel must be the triangle
|
||||
// colour (0.2, 0.4, 0.8, 1.0) within 0.6 of c*255 (the Direct3D float-to-UNORM tolerance).
|
||||
// Usage: frameloop.exe [--negative-control] [frames] (default 300). Exit 0 pass, 1 wrong pixel, 2 no device,
|
||||
// 3 other API failure.
|
||||
#define COBJMACROS
|
||||
#include <d3d11.h>
|
||||
#include <d3dcompiler.h>
|
||||
#include <dxgi.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *VS =
|
||||
"struct V { float2 p : POSITION; };\n"
|
||||
"float4 main(V v) : SV_Position { return float4(v.p, 0, 1); }\n";
|
||||
static const char *PS =
|
||||
"float4 main() : SV_Target { return float4(0.2, 0.4, 0.8, 1.0); }\n";
|
||||
|
||||
#define CHECK(x, what) do { HRESULT hr_ = (x); if (FAILED(hr_)) { \
|
||||
printf("FAIL %s hr=0x%08lx\n", what, (unsigned long)hr_); return 3; } } while (0)
|
||||
|
||||
static ID3DBlob *compile(const char *src, const char *target) {
|
||||
ID3DBlob *code = NULL, *err = NULL;
|
||||
HRESULT hr = D3DCompile(src, strlen(src), NULL, NULL, NULL, "main", target, 0, 0, &code, &err);
|
||||
if (FAILED(hr)) {
|
||||
printf("FAIL D3DCompile %s hr=0x%08lx %s\n", target, (unsigned long)hr,
|
||||
err ? (const char *)ID3D10Blob_GetBufferPointer(err) : "");
|
||||
return NULL;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
// `--negative-control [frames]` expects a deliberately wrong centre colour and must exit 1.
|
||||
const int negative = argc > 1 && !strcmp(argv[1], "--negative-control");
|
||||
int frames = argc > 1 + negative ? atoi(argv[1 + negative]) : 300;
|
||||
if (frames < 1) frames = 1;
|
||||
ID3D11Device *dev = NULL;
|
||||
ID3D11DeviceContext *ctx = NULL;
|
||||
D3D_FEATURE_LEVEL fl;
|
||||
HRESULT hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, NULL, 0,
|
||||
D3D11_SDK_VERSION, &dev, &fl, &ctx);
|
||||
if (FAILED(hr)) { printf("NO DEVICE hr=0x%08lx\n", (unsigned long)hr); return 2; }
|
||||
printf("device ok feature_level=0x%x\n", (unsigned)fl);
|
||||
{
|
||||
IDXGIDevice *dd = NULL; IDXGIAdapter *ad = NULL; DXGI_ADAPTER_DESC desc;
|
||||
if (SUCCEEDED(ID3D11Device_QueryInterface(dev, &IID_IDXGIDevice, (void **)&dd)) &&
|
||||
SUCCEEDED(IDXGIDevice_GetAdapter(dd, &ad)) && SUCCEEDED(IDXGIAdapter_GetDesc(ad, &desc))) {
|
||||
char name[128]; size_t i = 0;
|
||||
for (; desc.Description[i] && i < 127; i++) name[i] = (char)desc.Description[i];
|
||||
name[i] = 0;
|
||||
printf("adapter=%s vendor=0x%x dedicated_vram_mb=%u\n", name, desc.VendorId,
|
||||
(unsigned)(desc.DedicatedVideoMemory >> 20));
|
||||
}
|
||||
}
|
||||
|
||||
ID3DBlob *vsb = compile(VS, "vs_4_0"), *psb = compile(PS, "ps_4_0");
|
||||
if (!vsb || !psb) return 3;
|
||||
ID3D11VertexShader *vs; ID3D11PixelShader *ps; ID3D11InputLayout *il;
|
||||
CHECK(ID3D11Device_CreateVertexShader(dev, ID3D10Blob_GetBufferPointer(vsb), ID3D10Blob_GetBufferSize(vsb), NULL, &vs), "vs");
|
||||
CHECK(ID3D11Device_CreatePixelShader(dev, ID3D10Blob_GetBufferPointer(psb), ID3D10Blob_GetBufferSize(psb), NULL, &ps), "ps");
|
||||
D3D11_INPUT_ELEMENT_DESC ied = {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0};
|
||||
CHECK(ID3D11Device_CreateInputLayout(dev, &ied, 1, ID3D10Blob_GetBufferPointer(vsb), ID3D10Blob_GetBufferSize(vsb), &il), "layout");
|
||||
|
||||
// A triangle that covers the centre of the target and not the (0,0) corner pixel.
|
||||
const float verts[6] = {-0.5f, -0.5f, 0.0f, 0.6f, 0.5f, -0.5f};
|
||||
const unsigned short idx[3] = {0, 1, 2}; // clockwise in clip space (y up) = front face; D3D11 culls back faces by default
|
||||
ID3D11Buffer *vb, *ib;
|
||||
D3D11_BUFFER_DESC bd = {0}; D3D11_SUBRESOURCE_DATA sd = {0};
|
||||
bd.ByteWidth = sizeof verts; bd.BindFlags = D3D11_BIND_VERTEX_BUFFER; sd.pSysMem = verts;
|
||||
CHECK(ID3D11Device_CreateBuffer(dev, &bd, &sd, &vb), "vb");
|
||||
bd.ByteWidth = sizeof idx; bd.BindFlags = D3D11_BIND_INDEX_BUFFER; sd.pSysMem = idx;
|
||||
CHECK(ID3D11Device_CreateBuffer(dev, &bd, &sd, &ib), "ib");
|
||||
|
||||
const UINT W = 640, H = 360;
|
||||
D3D11_TEXTURE2D_DESC td = {0};
|
||||
td.Width = W; td.Height = H; td.MipLevels = 1; td.ArraySize = 1;
|
||||
td.Format = DXGI_FORMAT_R8G8B8A8_UNORM; td.SampleDesc.Count = 1;
|
||||
td.Usage = D3D11_USAGE_DEFAULT; td.BindFlags = D3D11_BIND_RENDER_TARGET;
|
||||
ID3D11Texture2D *rt, *st; ID3D11RenderTargetView *rtv;
|
||||
CHECK(ID3D11Device_CreateTexture2D(dev, &td, NULL, &rt), "rt");
|
||||
td.Usage = D3D11_USAGE_STAGING; td.BindFlags = 0; td.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
CHECK(ID3D11Device_CreateTexture2D(dev, &td, NULL, &st), "staging");
|
||||
CHECK(ID3D11Device_CreateRenderTargetView(dev, (ID3D11Resource *)rt, NULL, &rtv), "rtv");
|
||||
|
||||
D3D11_QUERY_DESC qd = {D3D11_QUERY_EVENT, 0};
|
||||
ID3D11Query *q; CHECK(ID3D11Device_CreateQuery(dev, &qd, &q), "query");
|
||||
|
||||
D3D11_VIEWPORT vp = {0, 0, (float)W, (float)H, 0, 1};
|
||||
const float clear[4] = {0, 0, 0, 1};
|
||||
UINT stride = 8, off = 0;
|
||||
LARGE_INTEGER freq, prev, now; QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&prev);
|
||||
for (int f = 0; f < frames; f++) {
|
||||
ID3D11DeviceContext_OMSetRenderTargets(ctx, 1, &rtv, NULL);
|
||||
ID3D11DeviceContext_RSSetViewports(ctx, 1, &vp);
|
||||
ID3D11DeviceContext_ClearRenderTargetView(ctx, rtv, clear);
|
||||
ID3D11DeviceContext_IASetInputLayout(ctx, il);
|
||||
ID3D11DeviceContext_IASetPrimitiveTopology(ctx, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
||||
ID3D11DeviceContext_IASetVertexBuffers(ctx, 0, 1, &vb, &stride, &off);
|
||||
ID3D11DeviceContext_IASetIndexBuffer(ctx, ib, DXGI_FORMAT_R16_UINT, 0);
|
||||
ID3D11DeviceContext_VSSetShader(ctx, vs, NULL, 0);
|
||||
ID3D11DeviceContext_PSSetShader(ctx, ps, NULL, 0);
|
||||
ID3D11DeviceContext_DrawIndexed(ctx, 3, 0, 0);
|
||||
ID3D11DeviceContext_End(ctx, (ID3D11Asynchronous *)q);
|
||||
ID3D11DeviceContext_Flush(ctx);
|
||||
BOOL done = FALSE;
|
||||
while (ID3D11DeviceContext_GetData(ctx, (ID3D11Asynchronous *)q, &done, sizeof done, 0) != S_OK || !done) { }
|
||||
QueryPerformanceCounter(&now);
|
||||
printf("frame_ms %.4f\n", (double)(now.QuadPart - prev.QuadPart) * 1000.0 / (double)freq.QuadPart);
|
||||
prev = now;
|
||||
if (f == 0) {
|
||||
ID3D11DeviceContext_CopyResource(ctx, (ID3D11Resource *)st, (ID3D11Resource *)rt);
|
||||
D3D11_MAPPED_SUBRESOURCE m;
|
||||
CHECK(ID3D11DeviceContext_Map(ctx, (ID3D11Resource *)st, 0, D3D11_MAP_READ, 0, &m), "map");
|
||||
const unsigned char *c = (const unsigned char *)m.pData;
|
||||
const unsigned char *k = c + (size_t)(H / 2) * m.RowPitch + (W / 2) * 4;
|
||||
const float want[4] = {0.2f, 0.4f, 0.8f, 1.0f};
|
||||
int bad = 0;
|
||||
if (c[0] != 0 || c[1] != 0 || c[2] != 0 || c[3] != 255) {
|
||||
printf("FAIL corner pixel = %u %u %u %u, want 0 0 0 255\n", c[0], c[1], c[2], c[3]); bad = 1;
|
||||
}
|
||||
for (int ch = 0; ch < 4; ch++)
|
||||
if (fabsf(want[ch] * 255.0f + (negative ? 100.0f : 0.0f) - (float)k[ch]) > 0.6f) bad = 1;
|
||||
printf("centre pixel = %u %u %u %u\n", k[0], k[1], k[2], k[3]);
|
||||
ID3D11DeviceContext_Unmap(ctx, (ID3D11Resource *)st, 0);
|
||||
if (bad) { printf("FAIL pixels\n"); return 1; }
|
||||
QueryPerformanceCounter(&prev);
|
||||
}
|
||||
}
|
||||
printf("PASS frames=%d\n", frames);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #364): a Windows console program that checks itself.
|
||||
// It computes CRC-32 over "123456789" (the standard check value is 0xCBF43926), runs a
|
||||
// threaded counter, and prints the architecture it was compiled for. Exit code 0 means every
|
||||
// check passed; non-zero names the failing check. It touches no game data and no graphics.
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
|
||||
static uint32_t crc32(const unsigned char *p, size_t n) {
|
||||
uint32_t c = 0xFFFFFFFFu;
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
c ^= p[i];
|
||||
for (int k = 0; k < 8; k++) c = (c >> 1) ^ (0xEDB88320u & (0u - (c & 1u)));
|
||||
}
|
||||
return ~c;
|
||||
}
|
||||
|
||||
static volatile LONG counter;
|
||||
static DWORD WINAPI bump(LPVOID arg) {
|
||||
(void)arg;
|
||||
for (int i = 0; i < 100000; i++) InterlockedIncrement(&counter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// `--sleep-silent <seconds>` sleeps before printing anything, to exercise stall detection in
|
||||
// the supervisor; the checks still run afterwards.
|
||||
int main(int argc, char **argv) {
|
||||
if (argc > 2 && !strcmp(argv[1], "--sleep-silent")) Sleep((DWORD)atoi(argv[2]) * 1000u);
|
||||
#if defined(__x86_64__)
|
||||
const char *arch = "x86_64";
|
||||
#elif defined(__aarch64__)
|
||||
const char *arch = "aarch64";
|
||||
#else
|
||||
const char *arch = "other";
|
||||
#endif
|
||||
printf("selfcheck arch=%s pointer_bits=%zu\n", arch, sizeof(void *) * 8);
|
||||
uint32_t c = crc32((const unsigned char *)"123456789", 9);
|
||||
if (c != 0xCBF43926u) { printf("FAIL crc32 got %08x\n", (unsigned)c); return 1; }
|
||||
HANDLE t[4];
|
||||
for (int i = 0; i < 4; i++) t[i] = CreateThread(NULL, 0, bump, NULL, 0, NULL);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!t[i]) { printf("FAIL CreateThread\n"); return 2; }
|
||||
}
|
||||
WaitForMultipleObjects(4, t, TRUE, 30000);
|
||||
if (counter != 400000) { printf("FAIL counter=%ld\n", (long)counter); return 3; }
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "win-selfcheck-rust"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "win-selfcheck-rust"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-or-later"
|
||||
publish = false
|
||||
|
||||
# Standalone: built for a Windows target by scripts/hybrid/build-windows-workloads.sh, not a
|
||||
# member of the BetterXen workspace.
|
||||
[workspace]
|
||||
@@ -0,0 +1,44 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// Original BetterXen workload (issue #364): a Rust Windows console program that checks itself.
|
||||
// Exercises thread-local storage and threads, which the contributor notes in
|
||||
// docs/research/upstream-integration-audit.md report as the failure point of the plain
|
||||
// `-gnu` Windows target. Exit 0 means every check passed.
|
||||
use std::cell::Cell;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use std::thread;
|
||||
|
||||
thread_local! { static TLS: Cell<u64> = const { Cell::new(0) }; }
|
||||
static TOTAL: AtomicU64 = AtomicU64::new(0);
|
||||
|
||||
fn main() {
|
||||
println!("selfcheck-rust arch={} os={}", std::env::consts::ARCH, std::env::consts::OS);
|
||||
let handles: Vec<_> = (1..=4u64)
|
||||
.map(|n| {
|
||||
thread::spawn(move || {
|
||||
for _ in 0..1000 {
|
||||
TLS.with(|c| c.set(c.get() + n));
|
||||
}
|
||||
let v = TLS.with(Cell::get);
|
||||
TOTAL.fetch_add(v, Ordering::SeqCst);
|
||||
v
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
for (i, h) in handles.into_iter().enumerate() {
|
||||
let got = h.join().expect("thread panicked");
|
||||
let want = 1000 * (i as u64 + 1);
|
||||
if got != want {
|
||||
println!("FAIL tls thread {i}: got {got}, want {want}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
if TOTAL.load(Ordering::SeqCst) != 10_000 {
|
||||
println!("FAIL total");
|
||||
std::process::exit(2);
|
||||
}
|
||||
if TLS.with(Cell::get) != 0 {
|
||||
println!("FAIL main-thread TLS was modified by other threads");
|
||||
std::process::exit(3);
|
||||
}
|
||||
println!("PASS");
|
||||
}
|
||||
Reference in new issue
Block a user