#
✕ nick:marcan
#asahi · 2021-02-06 15:48
marcandata aborts, like normal translation failures?
#asahi · 2021-02-06 15:47
marcananyway, off to dinner and sleep, and i'm taking tomorrow off - I have too much other stuff neglected over the past few weeks ;)
#asahi · 2021-02-06 15:45
marcan*non-sequitur
#asahi · 2021-02-06 15:45
marcanso as you might expect I don't have a high opinion of their understanding of copyright law :)
#asahi · 2021-02-06 15:44
marcan... reasons.
#asahi · 2021-02-06 15:44
marcanone thing the Corellium CTO did *directly* claim to me was that them having won against Apple on the copyright claims in that lawsuit means their Linux code is clean... which is a complete non-sequitor and total nonsense, because the lawsuit wasn't about that, plus it was a fair use defense which depends on application, plus it doesn't mean it magically covered all code they wrote, and many other ...
#asahi · 2021-02-06 15:42
marcankettenis: I mean, my first two interactions with corellium were first dismissal, then accusations from them, so... I may have some bias here :p
#asahi · 2021-02-06 15:41
marcaneither way, I don't like it
#asahi · 2021-02-06 15:41
marcan(or are they just writing bad code? :))
#asahi · 2021-02-06 15:40
marcanso: do they not *know* that (which means they're copying what apple code does without understanding it, which is a no-no in my book), or are they intentionally obfuscating their drivers to not give away too much hardware documentation because that's their business?
#asahi · 2021-02-06 15:39
marcanoh yeah, re: the corellium cpustart driver: I have no idea why they do the coresight unlock yet, also their code doesn't even document the fact that what they're doing *is* a standard coresight unlock there; the register offset is standard
#asahi · 2021-02-06 15:30
marcanit was more of a mental note than real docs
#asahi · 2021-02-06 15:30
marcanadmittedly those docs are barebones and quite terse
#asahi · 2021-02-06 15:29
marcanhttps://github.com/AsahiLinux/docs/wiki/HW:AIC
#asahi · 2021-02-06 15:29
marcanI did document that :)
#asahi · 2021-02-06 15:29
marcanyes
#asahi · 2021-02-06 15:29
marcanso once you do that, you will not be preempted again unless you unmask it, or another IRQ was pending, or comes in
#asahi · 2021-02-06 15:28
marcanif you read the reason bit, that already masks the IRQ for you
#asahi · 2021-02-06 15:28
marcanthe correct way to emulate it is: on reason register reads, find the lowest active not-masked IRQ bit with the affinity bit for your current CPU set, then return that as the reason, and set the mask bit
#asahi · 2021-02-06 15:27
marcan(for your CPU)
#asahi · 2021-02-06 15:27
marcanso as long as anything is pending in AIC it is active
#asahi · 2021-02-06 15:27
marcanthere is only one IRQ line
#asahi · 2021-02-06 15:27
marcanmodwizcode: yes
#asahi · 2021-02-06 15:26
marcanit's kind of like a FIFO
#asahi · 2021-02-06 15:26
marcanmodwizcode: one per CPU, whatever is the highest priority
#asahi · 2021-02-06 15:26
marcanso yeah, if they spent all this time reversing the SoCs, how about they share some docs instead of piles of vendor code :)
#asahi · 2021-02-06 15:25
marcanso how do we know what it does?
#asahi · 2021-02-06 15:25
marcanbut again, no docs
#asahi · 2021-02-06 15:25
marcanthat wasn't copied from apple, that was just something they cooked up presumably to hide address mapping errors in their port
#asahi · 2021-02-06 15:25
marcanthen I already mentioned the L2C serror reporting stuff :)
#asahi · 2021-02-06 15:24
marcan(even if they were on)
#asahi · 2021-02-06 15:24
marcan(in particular AIC wasn't even dispatching IRQs to its CPU aliases without the other bit, so it was clearly deeply aware of those CPUs being off)
#asahi · 2021-02-06 15:24
marcanthis is more information that can be gleaned from corellium's opaque "flip two magic bits with no register names" code
#asahi · 2021-02-06 15:23
marcanso my conclusion is the other bit is some kind of systemwide "this cpu is alive" bit or similar
#asahi · 2021-02-06 15:23
marcanthen I later found out IRQs were broken without the other one
#asahi · 2021-02-06 15:23
marcanI tried setting one and it worked
#asahi · 2021-02-06 15:23
marcanor for another example: corellium's cpustart driver sets *two* bits per core to start it, but with zero documentation as to what they do
#asahi · 2021-02-06 15:22
marcanalso, some of corellium's register names were just wrong :)
#asahi · 2021-02-06 15:22
marcanand then I could use the register documentation knowledge to e.g. fix the wfi problem without that linux patch
#asahi · 2021-02-06 15:22
marcanbut I can confidently say none of Apple's expression remains in my code, other than somewhat-similar register names and the bits that are set (facts are not copyrightable, names are facts and so are bits that need to be flipped to make the hardware work)
#asahi · 2021-02-06 15:21
marcando we have to set the same bits? sure, otherwise the CPUs explode
#asahi · 2021-02-06 15:21
marcanand sorted and cleaned them up
#asahi · 2021-02-06 15:21
marcan*then* I mapped all the actual chicken bits back to documented header bits
#asahi · 2021-02-06 15:21
marcanit was more obvious looking at Apple's code and comparing with open xnu, since the structure gave away those weren't part of the tunables section
#asahi · 2021-02-06 15:20
marcanbut that distinction was lost in their asm blobs
#asahi · 2021-02-06 15:20
marcanit wasn't even chicken bits
#asahi · 2021-02-06 15:20
marcane.g. the corellium chicken bits - there's stuff in there that is not necessary
#asahi · 2021-02-06 15:20
marcan(cleanroom is a legal defense, not a legal requirement)
#asahi · 2021-02-06 15:19
marcanit results in better code, better understanding of the hardware, and avoids copyright infringement (even though it doesn't have the person-to-person barrier that textbook cleanroom approaches do)
#asahi · 2021-02-06 15:19
marcanand *then* I use that knowledge to write my own code

plus ›