#asahi-dev · 2026-07-26 21:06
svenand i didn't even need the fancy shadow tlb thingy, just repeating every PTE write to the guarded/non-guarded shadow seems to be fast enough#asahi-dev · 2026-07-26 21:06
svenhah, with a bigger shadow pagetable cache this is actually almost usable all the way to userspace even with just a single core running#asahi-dev · 2026-07-26 17:10
svenbut yeah, I’d write a kext that lets an ioclient or however they are called map and read anything from userspace #asahi-dev · 2026-07-26 17:10
svendon’t think you can read memory from userspace anymore #asahi-dev · 2026-07-26 17:09
svenwe could really use that hypervisor 🙃#asahi-dev · 2026-07-26 14:20
svenlet’s see about smp now #asahi-dev · 2026-07-26 14:19
svenand with fgt-at-home, aka just patch everything I care about with hvc instead of using TVM/TRVM, I’m down to about a minute now #asahi-dev · 2026-07-26 11:01
svenstill only on a single core #asahi-dev · 2026-07-26 11:01
svenwith proper tracking of changes and only updating what actually changed it now takes 1-2 minutes instead of 10+ to reach the login screen 😁 #asahi-dev · 2026-07-26 08:30
svenand with tlb trapping and dropping asids xnu throws away from the cache I get a stable but still slow boot to single core userspace 🥳#asahi-dev · 2026-07-26 07:28
sventime to trap tlb maintenance I guess #asahi-dev · 2026-07-26 07:28
svenlooks like it was the cache. this boot has been stable now #asahi-dev · 2026-07-26 07:12
svenit just took ~10 minutes to boot now, let's see how long it survives :D#asahi-dev · 2026-07-26 07:11
sveni think hitting that simd thing was lucky because i accidentally mapped everything RW to userspace and wouldn't have noticed as quickly otherwise#asahi-dev · 2026-07-26 07:11
svenand well... that cache still contained pagetables that XNU long dropped and later handed the memory to userspace for random allocations#asahi-dev · 2026-07-26 07:10
svenright now i rebuild the entire pagetable whenever i see a write anywhere so i figured i should cache the userspace ones because they'll change on every process switch#asahi-dev · 2026-07-26 07:09
sventhat one already had that cache, it just ran into the simd crap 9/10 boots#asahi-dev · 2026-07-26 06:59
svenlet's see if i can get a stable boot without that cache and then it's time to trap all TLB maintenance i guess and see once something in ttbr0 is fully invalidate and drop it#asahi-dev · 2026-07-26 06:58
svenand that was the simd store i saw#asahi-dev · 2026-07-26 06:58
svenso a process disappears and i just move the pagetables to my cache but still track them. meanwhile XNU frees all that memory and later hands it out to userspace which then does whatever with it#asahi-dev · 2026-07-26 06:58
svenit's my dumb cache. i guess this is what i get for being happy that i finally get to use my leetcode skills from years ago to implement a LRU cache for TTBR0 shadow pagetables :D#asahi-dev · 2026-07-26 06:01
svenhuh, the stores are entirely weird. so it’s not trying to update pagetables, xnu somehow handed out memory that I still consider pagetables to userspace #asahi-dev · 2026-07-26 05:43
svenNot just simd, it’s just the first I notice because the hv doesn’t emulate the store and I accidentally mapped the pages rw for userspace :D#asahi-dev · 2026-07-26 05:22
svenso probably some corruption somewhere #asahi-dev · 2026-07-26 05:22
svenit’s real EL0 and not my fake GL0 which makes sense because ppl was gl1 only back in that xnu release #asahi-dev · 2026-07-26 04:57
svenalright, time to see why EL0 wants to update pagetables with simd stores now #asahi-dev · 2026-07-26 04:37
svennice!!#asahi-dev · 2026-07-25 20:33
svenand because it's just PPL and not the entire SPTM/TXM mess#asahi-dev · 2026-07-25 20:32
sveni emulated it on a m1 because it's easy to compare what should happen with the real HW vs. what my emulation does and because i don't have a m4 yet ;)#asahi-dev · 2026-07-25 20:31
svenanyway, now it's really enough for today :D#asahi-dev · 2026-07-25 20:31
svenwhich probably explains why booting takes like 10 minutes#asahi-dev · 2026-07-25 20:31
svenxnu's ttbr0 and ttbr1 get a guarded and a non-guarded shadow pagetable each which right now is fully rewritten whenever anything in what xnu believes the real pagetable to be is touched#asahi-dev · 2026-07-25 20:30
sveni don't think this old mac os release has txm yet#asahi-dev · 2026-07-25 20:30
svenchaos_princess: oh... nope#asahi-dev · 2026-07-25 20:30
svenessentially i patch every genter/gexit and a whole bunch of msr/mrs to hvc and emulate everything#asahi-dev · 2026-07-25 20:29
svenyuka: yup#asahi-dev · 2026-07-25 20:28
svenstill very slow and very unstable because EL0 still wants to update its own pagetables somehow, but sometimes i get far enough for this https://f.svpe.de/6a1342f428a1724f2055ed3dddb6896aaab4603551f8d8802966e4ab170253c7_cursed2.jpg#asahi-dev · 2026-07-25 19:28
sveni've been at this since like 8am and just realized i didn't even eat lunch. time to call it a day :D#asahi-dev · 2026-07-25 19:27
sventhe more insane thing is EL0 updating pagetables#asahi-dev · 2026-07-25 19:26
svennow i get EL0 trying to use SIMD instructions to update its pagetables 9/10 tries so there's something terribly wrong, but 1/10 times this happens: https://f.svpe.de/21e408e29be8f1a75614159eec87752bd839eca0adadea8c5d1a9e75bef10559_cursed_progress.jpg#asahi-dev · 2026-07-25 19:25
svenOH FOR FUCK'S SAKE. why do i keep running into this cursed stuff that's been in our tree for ages: https://github.com/AsahiLinux/m1n1/pull/640#asahi-dev · 2026-07-25 18:02
svenmaaaaybe i should've written this in rust. i'm somehow corrupting dlmalloc's heap :/#asahi-dev · 2026-07-25 17:10
svendlmalloc: internal error 🙃#asahi-dev · 2026-07-25 16:53
svenTTY> hv_sprr[0]: first gexit -> 0xfffffe0012b801a4 (ASPSR 0x2)#asahi-dev · 2026-07-25 16:53
svenTTY> hv_sprr[0]: SPRR_PERM_EL1 0x2020a5053020f0f0 -> 0x2020a5063020f0e0#asahi-dev · 2026-07-25 16:53
svenbut, progress \o/ now just gotta figure out why the SP seems wrong after that gexit: TTY> hv_sprr[0]: first genter #0 from 0xfffffe0012b801a4 -> 0xfffffe00135a5a1c#asahi-dev · 2026-07-25 16:52
svengah, probably something wrong with the SP. and here i thought i understood how GXF works :/#asahi-dev · 2026-07-25 16:39
svenyay, xnu survives my first emulated genter and then immediately dies at gexit :D#asahi-dev · 2026-07-25 14:59
svenanother cursed idea: since i control the page tables anyway i can just map my own code and force VBAR_GL1 there and just do whatever is required there before jumping to the real one#asahi-dev · 2026-07-25 13:43
sveni have to patch genter/gexit to some hvc anyway