I'd like to get the inferred value of a register at a particular point in the disassembly listing in a Ghidra script.
In my case the target instruction is a
wrmsr instruction, which reads or writes the MSR at
ecx. While I could walk back through the previous instructions and look for a simple
mov ecx, const pattern, there are significantly more ways to set
ecx to some known value that the decompiler is capable of inferring.
I've tried calling
getRegisterValue on the
rdmsr instruction, passing in a
Register type describing
ecx, but this just returns
None. Is there a way to infer register values at a particular instruction?
Here's the disassembly:
And the decompiled result:
Here's the P-Code: