Incorporate the active SVC improvements from PR #151 around the existing alias bitmap and mapping registry. Serialize heap changes, physical maps, stack ownership and memory queries with one lock; report committed alias runs and borrowed sources; initialize reused logical pages while preserving live neighbors and lazy first exposure. Retain PR #127's fail-fast host protection policy and the log formats parsed by the NSP heap probe. Game smoke tests exposed two integration requirements: Raging Loop's SDK extends committed windows across borrowed stack sources, so allow recommit that preserves existing bytes; Tears of the Kingdom's audio helper needs guest-backed stacks, so allocate host-created guest-thread stacks through SDK malloc and free them after thread destruction and copyback. Keep SDK reservation ownership and existing patches. The unused host reservation allocator from #151 is not included. Validation: full host suite; focused UBSan, ASan and ThreadSanitizer tests; real dirty-tracker concurrency tests; heap-probe parser compatibility; Mac host builds; iOS arm64 syntax checks; all 60 profile layout checks. Raging Loop and Tears of the Kingdom passed guest-thread self-checks and ran to deliberate timeouts after the startup fixes. Their shader caches are stale for this checkout, so rendering/performance are not validated. No IPA build or iOS device validation was performed. Co-authored-by: b4f8abbb24dbf56a7d0280f296e16eeb <51352400+b4f8abbb24dbf56a7d0280f296e16eeb@users.noreply.github.com>
27 lines
951 B
Python
27 lines
951 B
Python
"""The NSP heap probe must still understand real dispatcher diagnostics."""
|
|
import subprocess
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
sys.path.insert(0, str(HERE.parents[1] / 'games'))
|
|
from profile_guess import heap_signals
|
|
|
|
|
|
class MemoryProfileTests(unittest.TestCase):
|
|
def test_dispatcher_logs(self):
|
|
result = subprocess.run([str(HERE / 'build/t_svc_memory'), '--heap-probe'],
|
|
capture_output=True, text=True, check=True)
|
|
signals = heap_signals(result.stderr, {
|
|
'mem_reserve': '0x140000000', 'mem_stack': '0x10000000',
|
|
'mem_alias': '0xb8000000', 'mem_used': '0x200000',
|
|
'app_pool': '0x1000000', 'sys_resource': '0x2000000',
|
|
})
|
|
self.assertEqual(signals['mem_alias'][0], '0x118000000')
|
|
self.assertEqual(signals['mem_used'][0], '0xe00000')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|