Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
946 stars 214 forks source link

Awkward lifting for AArch64 system register writes #6037

Open jonpalmisc opened 1 month ago

jonpalmisc commented 1 month ago

Take the following assembly:

msr     daifset, #0x2

This writes 0x2 to the DAIFSet system register.

This gets rendered in LLIL and higher) as:

daifset = _WriteStatusReg(2)

This is misleading since daifset is not a local variable—it is a system register—and it looks identical to other (actual) variables in HLIL. Furthermore, representing this as an assignment implies that _WriteStatusReg returns a value (which it does not).

A better rendering would simply be:

_WriteStatusReg(daifset, 2)

As this does not create the false impression that the result of this expression is stored, and is also simply easier to read.

jonpalmisc commented 4 weeks ago

Per request: df4203d5 = msr DAIFSet, #0x2

psifertex commented 4 weeks ago
const uint8_t data[4] = 
{
    0xdf, 0x42, 0x03, 0xd5
};