#asahi-dev · 2026-07-25 13:43
svenand xnu's code is effectively read-only anyway so i'm also fine with patching whatever#asahi-dev · 2026-07-25 13:40
svenbecause i only want to trap GXF/SPRR on M1 for now#asahi-dev · 2026-07-25 13:33
svenbut we'll see, i'm still busy figuring out how GXF actually works#asahi-dev · 2026-07-25 13:32
sveni think i can get away with swapping them around and keeping track in the hv, hence the "oh god, this is gonna be cursed"#asahi-dev · 2026-07-25 13:31
svenif i just replace the _GL1 exception regs with hvcs and then some exception happens while we're inside GL0 (which is actually cursed EL0 now) we'll get the exception state in the _EL1 registers and, uh, that's probably not gonna go great#asahi-dev · 2026-07-25 13:26
svengod is this going to be cursed if i want to support gl0 which svcs (or any other exception) up to gl1 which i can't easily trap#asahi-dev · 2026-07-25 12:54
svenhas anyone ever looked into what SPRR_UMPRR_EL1 does? xnu seems to access it afaict but i can't figure out what this changes#asahi-dev · 2026-07-25 10:00
svenand for the sptm stuff probably just follow discussions in this channel#asahi-dev · 2026-07-25 09:15
sveni think i'll start with just marking everything read-only. it'll be slow but easier to get right I think#asahi-dev · 2026-07-25 09:15
svenyeah, it's just python for now even :D#asahi-dev · 2026-07-25 09:13
svencan't accurately represent every SPRR permissions but the ones xnu actually uses should be fine#asahi-dev · 2026-07-25 09:12
svenalso, in cursed sprr hv news: i think my static pagetable rewrite code works \o/#asahi-dev · 2026-07-25 09:11
svenfunnily, thunderbolt 3 can effectively tunnel usb2 and usb3 via pcie but usb4 then only tunnels usb3 and still passes through the D+/- lines with a hub :D#asahi-dev · 2026-07-24 20:53
svenbut it's mostly guesswork#asahi-dev · 2026-07-24 20:53
sventhe register names allows some guessing, and e.g. PIPE is the interface between the PHY and dwc3#asahi-dev · 2026-07-24 20:52
svenblack box thingy :(#asahi-dev · 2026-07-24 20:48
sveniirc it's only critical around the BIST dance#asahi-dev · 2026-07-24 20:48
svenoh, when unplugging? not much#asahi-dev · 2026-07-24 20:41
svenhrm, doesn't it do usb3+dp even when usb3-only is requested? the dp part just has additional crap like dp aux enable#asahi-dev · 2026-07-24 20:36
svenah. 'caused i used to have a bug where some bit in there was never set whenever i got pipehandler lock not acked#asahi-dev · 2026-07-24 20:36
svenis that a wait for some bit in the BIST dance?#asahi-dev · 2026-07-24 20:35
svennice!!#asahi-dev · 2026-07-24 20:01
svenalright, gl0 works as well.#asahi-dev · 2026-07-24 19:02
svenhrm, though maybe i should test gl0 there as well#asahi-dev · 2026-07-24 19:00
svennow for the truly cursed part: the pagetables#asahi-dev · 2026-07-24 19:00
svenprobably breaks in various ways with XNU though, but my small test guest works#asahi-dev · 2026-07-24 19:00
svenhttps://f.svpe.de/847eb6e8e302dfe3d136f2bbde5106b4ddc23def82c4f613fe42157912c1df55_cursed_sprr.txt looks like basic genter/exit and _GL sysreg emulation works. that was surprisingly easy#asahi-dev · 2026-07-24 18:22
svennice! i'll pick them up sometime next week unless there are more comments#asahi-dev · 2026-07-24 17:31
sveni know we discussed that at some point#asahi-dev · 2026-07-24 17:29
svenfor linux we probably want some apple,firmware-abi compatible then :(#asahi-dev · 2026-07-24 16:18
svenonly one way to figure out :D#asahi-dev · 2026-07-24 16:10
svenalmost iirc#asahi-dev · 2026-07-24 16:06
svenso they wrote that gist instead of implementing anything themselves#asahi-dev · 2026-07-24 16:06
sventhrowing kexts at ghidra iirc#asahi-dev · 2026-07-24 16:06
sveni guess it just defaults to linear sq now and what i guessed what a chicken bit in unknown_ctrl just isn't required anymore then#asahi-dev · 2026-07-24 16:05
svenyeah, that's a bug in m1n1 because i misread the spec iirc#asahi-dev · 2026-07-24 15:32
svenGL0 also works essentially as i expected. i can eret there from GL1 and then svc back up to GL1#asahi-dev · 2026-07-24 15:31
svenalright, so genter with an imm values works kinda like hvc, the imm ends up in ESR_GL1#asahi-dev · 2026-07-24 13:24
svenUNK + some explanation why it's required is probably fine#asahi-dev · 2026-07-24 09:00
sveni'm gonna get some M3 or whatever soonish anyway, finally figured out the tax issues#asahi-dev · 2026-07-24 08:59
svenchaos_princess: hrm... no sure, to run SPTM and secure kernel, sure. but just XNU+PPL or even a basic m1n1 payload to test the shadow paging thing? #asahi-dev · 2026-07-24 08:28
svenand then by the time that works hopefully the student who's been working on SPTM for M2 has handed in his thesis and published his code and then I can move to M3 or whatever and see about SPTM#asahi-dev · 2026-07-24 08:28
svencould even use m1n1 as the first guest to test the gxf/sprr stuff#asahi-dev · 2026-07-24 08:26
svenhrm, thinking about it some more i think i can even start with the cursed sprr/gxf hv on m1#asahi-dev · 2026-07-23 20:34
svensecure kernel is gonna be extra fun. i think i could even prototype all this on an M3 by just pretending it doesn't have GXF/SPRR before trying bring up on M4 or M5#asahi-dev · 2026-07-23 20:26
svenstill need to mull this over a bit more but this is starting to sound like feasible plan #asahi-dev · 2026-07-23 20:25
svenSPTM will still do all the mapping, we'll just translate them to something the CPU understands in raw boot mode#asahi-dev · 2026-07-23 20:14
sventhough... what would GL0 do? i don't think it even wants anything like JIT#asahi-dev · 2026-07-23 20:12
svenGL0 is probably another story though i guess#asahi-dev · 2026-07-23 20:12
sventhen adjusting the commpage (or some other place) should be enough to at least prevent EL0 from accessing anything fancy