mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 13:30:43 +00:00
Parse import directories with one bounded parser shared by the static probe and the binder, and resolve imports through one registry lookup. Refuse conflicting registrations, keep ordinals apart from names, match API sets exactly, and bind only when every import resolves. Generate typed Win64 adapters, metadata and a coverage report from a declarative service registry. Pass floating-point arguments and results in XMM registers, and stop the guest if a service changes a nonvolatile register. Make unimplemented generated wrappers fail explicitly. Verify 20 services by calling them from translated guest code through bound import slots, and the parser on damaged tables. Refs #201, #270 Signed-off-by: jelly013 <22855910+jelly013@users.noreply.github.com>
2.2 KiB
2.2 KiB
Runtime service registry
Guest imports resolve through one lookup, ImportRegistry::resolve. Binding, the static probe and the command-line reports all use it, and they read the import directory with one bounded parser, import_table::parse_imports.
| Part | File | Role |
|---|---|---|
| Registry | crates/loader/runtime/services.txt |
Library, symbol, typed signature, API-set aliases, failure contract, status, reference and tests. Data only. |
| Generator | xenora-runtime-gen in crates/import-gen |
validate, generate and --check. Rejects conflicting keys, unlisted API sets, unsupported types, and behaviour without a named, existing test. |
| Adapters | crates/loader/src/runtime_table.rs |
Generated Win64 argument and result adapters and static metadata. |
| Handlers | handlers in crates/loader/src/services.rs |
Rust implementations. They see guest memory and service state, never the CPU. |
| Report | services.md | Generated counts. Aliases are counted apart from services. |
Rules
- Module names compare without case; symbol names are exact. A name spelled
Ordinal#7is not ordinal 7. - An API set resolves only if the registry lists that exact set for that symbol. A similar name forwards nowhere.
- Registering a key twice is an error. A host module cannot replace a standard service.
- Binding resolves every import before it writes any slot. A malformed table or an unresolved import leaves every slot unbound.
- A service call reads its return address first, and stops the guest with
ServiceAbiViolationif the service changed a nonvolatile register, including XMM6 to XMM15.
Adding a service
- Write a test in
crates/loader/tests/runtime_services.rsthat calls it from guest code and derives its expectations from the public documentation. - Add the entry to
services.txtand the handler toservices.rs. - Run
cargo run -p xenora-import-gen --bin xenora-runtime-gen generate.
Outside this registry
The fixture graphics services, XMemAlloc and the XMemFree stub are still registered by hand. The older import-list generator in crates/import-gen is separate: its output is not compiled into the loader, and several of its generated conformance tests check Rust library functions rather than a service.