diff --git a/docs/accuracy/bios_exit_critical_section.md b/docs/accuracy/bios_exit_critical_section.md index fde76f4d..1a6ba780 100644 --- a/docs/accuracy/bios_exit_critical_section.md +++ b/docs/accuracy/bios_exit_critical_section.md @@ -16,6 +16,15 @@ The specification allows K0 to change; this direct handler preserves it too. The host-only `cpu->pc = 0` continuation and C return value remain unchanged. `exit_critical_section_test` compiles the real `traps.c` implementation with -GNU LTO and tests 16 combinations of incoming `v0` and SR. It checks the full -CPU state, allowing only the documented SR update and host continuation change. +LTO and tests 16 combinations of incoming `v0` and SR. It checks the full CPU +state, allowing only the documented SR update and host continuation change. The test uses no BIOS, generated retail code, or game data. + +The fixture links only the real trap unit and its test driver. It relies on +interprocedural optimization removing syscall paths that the driver never +calls, rather than providing fake scheduler or exception implementations. +This link contract is verified with Windows x64 MinGW GCC 16.1.0 and is enabled +only for that toolchain. Other configurations still register the test, but +CTest reports it as **Skipped** with the unsupported compiler and reason. +They do not provide register-preservation coverage until the fixture's link +contract is validated there or a portable real-dependency harness replaces it. diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index 3796fcd1..e0101ec8 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -183,9 +183,12 @@ if(BUILD_TESTING) add_test(NAME mod_gpu_dma_aperture_test COMMAND mod_gpu_dma_aperture_test) - # Compile the real syscall branch. GNU LTO discards the unrelated scheduler - # and exception paths, avoiding stubs which could hide register corruption. - if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT APPLE) + # The real-handler fixture relies on LTO pruning its unused syscall paths. + # Enable only the toolchain on which that link contract is verified; keep + # the coverage gap visible in CTest for every other compiler/platform. + if(WIN32 AND MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 8 + AND CMAKE_C_COMPILER_ID STREQUAL "GNU" + AND CMAKE_C_COMPILER_VERSION VERSION_EQUAL "16.1.0") add_executable(exit_critical_section_test tests/test_exit_critical_section.c src/traps.c) target_include_directories(exit_critical_section_test PRIVATE include) @@ -193,6 +196,12 @@ if(BUILD_TESTING) target_compile_options(exit_critical_section_test PRIVATE -O3 -flto -ffunction-sections) target_link_options(exit_critical_section_test PRIVATE -flto -Wl,--gc-sections) add_test(NAME exit_critical_section_test COMMAND exit_critical_section_test) + else() + add_test(NAME exit_critical_section_test + COMMAND "${CMAKE_COMMAND}" -E echo + "SKIP: real-handler LTO fixture is verified only on Windows x64 MinGW GCC 16.1.0; current compiler is ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") + set_tests_properties(exit_critical_section_test PROPERTIES + SKIP_REGULAR_EXPRESSION "^SKIP:") endif() add_executable(dma_gpu_linked_list_timing_test