Skip to content

resolve RIP in some x86 fp semantics#1637

Open
Angs12 wants to merge 2 commits into
BinaryAnalysisPlatform:masterfrom
Angs12:master
Open

resolve RIP in some x86 fp semantics#1637
Angs12 wants to merge 2 commits into
BinaryAnalysisPlatform:masterfrom
Angs12:master

Conversation

@Angs12
Copy link
Copy Markdown
Contributor

@Angs12 Angs12 commented May 25, 2026

Bug

During lifting some fp x86 instructions to BIL the RIP is not resolved:

bap mc --show-insn=asm --show-bil -- 0f 54 0d 2a 00 00 00     
andps 0x2a(%rip), %xmm1
{
  YMM1 := high:128[YMM1].127:0[YMM1] & mem[RIP + 0x2A, el]:u128
}

Fix

This pr adds the reg# function already in x86-64.lisp that resolves the PC to the bitwise-rrm macro

The reg# function hardcodes the value 8 for the instruction length, but x86 instructions have variable lenght,
so i added a primus lisp primitive that uses provides the instruction length in bytes that is already in Knowledge Base
and substituted the hardcoded values with that primitive

After fix

bap mc --show-insn=asm --show-bil -- 0f 54 0d 2a 00 00 00
andps 0x2a(%rip), %xmm1
{
  YMM1 := high:128[YMM1].127:0[YMM1] & mem[0x31, el]:u128
}

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.

1 participant