<cyrozap>
Of possible interest are the objdump disassembler wrapper (`md32_dis.py`) and the script that tries to identify opcodes (`find_instructions.py`). It's a little specialized for the MD32, but it should be fairly straightforward to port to other ISAs and disassemblers, since it's mostly just a bunch of regexes.
<cyrozap>
Apologies for the code quality, though--it's a bit spaghetti-like, and still in development.
<cyrozap>
I think probably the most important parts of this code are how instructions are uniquely identified, since that took me a while to figure out how to do: Basically, instructions should be matched based on the mnemonic and the format of the arguments, since generally you're only ever going to have one format per opcode/bit pattern (of course there's exceptions, but I didn't encounter any with this ISA).
<HdkR>
Research code is always messy, w/e
unoccupied is now known as _4of7
<cyrozap>
Also, the code identifies new instructions by just flipping bits in the instruction until the disassembler identifies it as a different instruction (matched on mnemonic+arg format). Then you can use that list of (un)essential bits to generate a mask for the opcode.
<cyrozap>
HdkR: I know, but generally I like to make sure things are clean so that other people can more easily understand what I've done. I've had to spend a lot of time picking apart other people's "research code" before, and would rather not inflict that kind of annoyance on others.
<cyrozap>
I also want to make sure my projects have a high "bus factor", to make it easier for others to help and to reduce the chances that any work is unnecessarily duplicated.
<macc24>
cyrozap: is this mediatek scp reverse engineering stuff?
<cyrozap>
I've seen far too many interesting RE projects where it was just one person working alone, and then when they stopped for whatever reason (burnout, legal harassment, life stuff, etc.), there was basically no progress for years and years.
<cyrozap>
macc24: Yes, though the MD32 is used in several places in MediaTek SoCs (VPU, sensor hub, one of the modem DSP cores).
<macc24>
cyrozap: that's interesting, which SoC are you targeting?
kaspter has joined #panfrost
<alyssa>
cyrozap: "one format per opcode/bit pattern" Try Bifrost :<
<alyssa>
Bifrost _does not have opcodes_
vstehle has quit [Ping timeout: 240 seconds]
<alyssa>
I cannot begin to explain how painful this makes things
<cyrozap>
alyssa: What do you mean? Surely there's some way the processor identifies different instructions?
<cyrozap>
Like, maybe the bits aren't always set in the same place, but they need to be set somewhere. Unless it's context-based or something?
<alyssa>
It's bit patterns
kinkinkijduet has joined #panfrost
* urjaman
vaguely remembers reading something about bifrost
<cyrozap>
macc24: Well, pretty much any MediaTek SoC that supports LTE (I don't care about the pre-LTE SoCs). My current "favored" targets are the MT6737 (used in the Orange Pi 4G-IoT), the MT6797/Helio X20 (used in the 96boards MediaTek X20 development board), and the MT8183/MT6771/Helio P60 (used in the 2019 Amazon Fire HD 10, the Lenovo Chromebook Duet, and several other ChromeOS devices).
* macc24
spotted lenovo chromebook duet
<macc24>
cyrozap: i have linux running semi-usably on duet, but sound on internal speakers is missing and there are some panfrost glitches
<macc24>
speaking of panfrost glitches, my screen froze and started doing weird things, this time i could switch to another tty from sway. it's on mesa git-2c9e7f73ad, some dmesg output, as far as i could get: https://bpa.st/BBMA
<cyrozap>
alyssa: Yeah, looking more at the Bifrost XML, it seems similar to how this MD32's instructions are encoded. It's basically just a prefix code, so you sort the instructions by the number of mask bits, then go down the list from most mask prefix bits to least mask prefix bits, and return whatever instruction matches first. Assuming the hardware is deterministic, the software decoder shouldn't end up too
<cyrozap>
terrible.
camus has joined #panfrost
kaspter has quit [Ping timeout: 272 seconds]
camus is now known as kaspter
<cyrozap>
Then again, maybe I'm missing something. I really only care about implementing a decoder in Ghidra, and maybe adding support to GCC, so I might not be hitting the pain points you are.
<alyssa>
cyrozap: Meh, it's just *annoying*
<alyssa>
And there are a bunch of weird edge cases, maybe to make the assembly seem nicer without affecting the hardware at the expense of the encoding itself not making sense
<alyssa>
(The various BRANCH instructions are the biggest offenders..)
<alyssa>
Once I hid everything behind the XML/Python the pain points went away. But I never appreciated how great 8-bit opcodes were :p
camus has joined #panfrost
kaspter has quit [Remote host closed the connection]
camus is now known as kaspter
camus has joined #panfrost
kaspter has quit [Ping timeout: 240 seconds]
camus is now known as kaspter
<kinkinkijduet>
oh dear, im afraid i mightve started enjoying using chromeos on this duet
camus has joined #panfrost
kaspter has quit [Ping timeout: 246 seconds]
camus is now known as kaspter
davidlt has joined #panfrost
icecream95 has quit [Ping timeout: 260 seconds]
camus has joined #panfrost
kaspter has quit [Read error: Connection reset by peer]
camus is now known as kaspter
vstehle has joined #panfrost
cyrozap has quit [Ping timeout: 272 seconds]
cyrozap has joined #panfrost
camus has joined #panfrost
cyrozap has quit [Ping timeout: 260 seconds]
kaspter has quit [Ping timeout: 272 seconds]
camus is now known as kaspter
cyrozap has joined #panfrost
kinkinkijduet has quit [Ping timeout: 260 seconds]
camus has joined #panfrost
kaspter has quit [Ping timeout: 272 seconds]
camus is now known as kaspter
raster has joined #panfrost
kaspter has quit [Ping timeout: 240 seconds]
kaspter has joined #panfrost
stikonas has joined #panfrost
<raster>
oh this is new
<raster>
earlyz bug still there and now... the "early z bug areas" are coming up transparent rather than the glclear color (a darkish grey)
<raster>
i believe birfost was also broken last i checked
<raster>
but i just rebased on mainline mesa and am building now
yann|work is now known as yann
<raster>
but interesting that the bug now is manifesting differently
<raster>
with alpha :)
icecream95 has joined #panfrost
icecream95 has quit [Ping timeout: 265 seconds]
icecream95 has joined #panfrost
stikonas has quit [Remote host closed the connection]
nlhowell has quit [Ping timeout: 264 seconds]
icecream95 has quit [Ping timeout: 264 seconds]
stikonas has joined #panfrost
rando25892 has joined #panfrost
robmur01 has joined #panfrost
<raster>
and on bifrost the bug is there .. but alpha is full not 0. so bug is there like it was originally. so midgard got some new funtimes added to the bug
robmur01 has quit [Ping timeout: 272 seconds]
alpernebbi has joined #panfrost
kinkinkijduet has joined #panfrost
<kinkinkijduet>
x86 computer officially dead, looks like this duet is gonna be my main driver for a bit
<HdkR>
neat
<kinkinkijduet>
not super neat, had unpublished code and an almost finished album on it
<HdkR>
Always back up your stuff
<HdkR>
always always
<macc24>
kinkinkijduet: dead as in?
<kinkinkijduet>
cant use cloud backups for productions due to not having a good one, and the rats that killed it also killed my local backups
<kinkinkijduet>
macc24 rats nested in the cable basement and under the gpu, was just woken up by digging noises, followed by a loud CLAP, followed by no more digging noises
<kinkinkijduet>
investigated, they got into the psu somehow and shorted it with their bodies
<HdkR>
Guess you just need new PSU hardware to bring back the drive data then?
<macc24>
how the hell do you get rats inside computers?
<kinkinkijduet>
macc24 the underside of this computer was protected by mesh and plastic for "configurability"
<macc24>
oh
<kinkinkijduet>
hdkr i inspected it, they also tore up the mobo, gpu, and heatsinks
<HdkR>
Also, I finally have a 321 backup solution in place. B2 is actually not that bad
<macc24>
the hdd should be fine
<kinkinkijduet>
drives are probably fine but the kicker is i dont have another computer to put them in to retrieve data
<HdkR>
Ruthless
<kinkinkijduet>
so im just gonna save the drives
<macc24>
cpu should be fine too
<macc24>
ram hopefully too
<kinkinkijduet>
this landlord has been refusing to call an exterminator for a month, and now this
<kinkinkijduet>
considerinr renting-related laws here i definitely have a case to get reimbursed by him, if not out of court then by order of the court
<kinkinkijduet>
big bummer though is that the total of all of the destroyed parts is only like... $1200, which while being enough that i cant afford it, is also too little to justify small claims
<macc24>
rip
<raster>
kinkinkijduet: now i see the use for RGB gaaaaaamer machines
<raster>
you have glass panels and lights on all the time to see in your computer to look for the rats :)
robmur01 has joined #panfrost
kaspter has quit [Quit: kaspter]
robmur01_ has joined #panfrost
robmur01 has quit [Ping timeout: 264 seconds]
kaspter has joined #panfrost
archetech has joined #panfrost
cphealy has quit [Remote host closed the connection]
cphealy_ has joined #panfrost
zkrx has quit [Quit: I'm done]
kinkinkijduet has quit [Read error: Connection reset by peer]
zkrx has joined #panfrost
archetech has quit [Quit: Leaving]
archetech has joined #panfrost
alpernebbi has quit [Remote host closed the connection]
archetech has quit [Remote host closed the connection]
popolon has joined #panfrost
kinkinkijduet has joined #panfrost
kaspter has quit [Quit: kaspter]
raster has quit [Quit: Gettin' stinky!]
davidlt has quit [Ping timeout: 240 seconds]
jernej has quit [Remote host closed the connection]