Skip to content

Conversation

@florianl
Copy link
Contributor

@florianl florianl commented Dec 5, 2025

Follow up to #890 as #984 got merged.

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
@florianl florianl requested review from a team as code owners December 5, 2025 15:30
return it
}

func (i *Interpreter) PC() int {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +90 to +92
if prevOp.Op == x86asm.MOV {
if dst, ok := prevOp.Args[0].(x86asm.Reg); ok && dst == mem.Base {
if prevMem, ok := prevOp.Args[1].(x86asm.Mem); ok && prevMem.Base == x86asm.RIP {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks overly complex, and tracking prevOp should be unneeded.
You should be able to just get the register from this mov and then use it.Regs.Get(reg) to get the register value which resolves directly to the virtual memory address since commit fac83fa. That should also handle the rip relative logic completely transparently and only the VritualMemory read is needed here. Or did I miss something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants