Files
Snapintosh/tools/test-panic-handoff.py
T
Acelogic 1510d8c6ce Snapintosh public release
An EL2 monitor/hypervisor and toolchain that boots macOS 27 on the ASUS A16
(Snapdragon X2 Elite), with an Adreno Metal plug-in and IOGPU kext, and
air2ir3, an AIR to Mesa ir3 shader compiler.

MIT, with GPL-2.0 components listed in LICENSE and THIRD_PARTY_NOTICES.md.
No Apple, Qualcomm, ASUS or Microsoft binaries are included.
2026-10-21 21:26:36 -04:00

29 lines
1.1 KiB
Python
Executable File

#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
from pathlib import Path
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'probes'))
import xnuboot as xb
class PanicHandoff(unittest.TestCase):
def test_reserved_page(self):
pa,va,size=xb.panic_state_reservation(xb.SCRATCH_PA-0x4000)
self.assertEqual((pa+size,size),(xb.SCRATCH_PA,16384))
self.assertEqual(va,xb.APERTURE_VA+pa-xb.PHYS_BASE)
self.assertFalse(pa%16384)
for overrun in (1,4096,16384):
with self.assertRaises(ValueError):xb.panic_state_reservation(pa+overrun)
def test_schema_and_abi(self):
row=next(f for f in xb.handoff_fields() if f[0]=='panic flag ptr')
self.assertEqual(row[1:3],(0x198,8))
self.assertFalse(xb.check_handoff_overlap())
# New field is within the 0x358 bytes copied by the shipped kernel.
self.assertLessEqual(row[1]+row[2],0x358)
# 1148 plus the appended struct early_stop_params (compat/early-stop.h).
self.assertEqual(xb.PARAMS_WORDS,1154)
if __name__=='__main__':unittest.main()