Skip to content

Thumb2: Recognizing doubles #4262

Closed
Closed

Description

@joelreymont

Version and Platform (required):

  • Binary Ninja Version: 3.4.4251-dev, 3f761e0a
  • OS: ubuntu
  • OS Version: 22.10
  • CPU Architecture: x86_64

Code below is loading an 8-byte value into a floating point register.

000020792  93ed047b   vldr    d7, [r3, #0x10]  {data_dd908}  {0xfefa0000}

Why doesn't BN automatically define a double at data_dd908?

\x00\x00\x00\x00\x00\x008C\x00\x00\xfa\xfeB.v\xbf:;\x9e\xbc\x9a\xf7\x0c\xbd\xbd\xfd\xff\xff\xff\xff\xdf?

HLIL thinks I'm dealing with integers

00002078e          q1 = (0 - *(int64_t*)((char*)q1)[8]);

Is this because I implemented VLDR as a regular register load?

	case armv7::ARMV7_VLDR:
		if (instr->format->operandCount == 3)
		{
			uint32_t reg = GetRegisterByIndex(instr->fields[instr->format->operands[1].field0]);
			il.AddInstruction(WriteILOperand(il, instr, 0, il.Load(4, GetMemoryAddress(il, instr, 1, 4, false))));
			il.AddInstruction(il.SetRegister(4, reg, il.Add(4, il.Register(4, reg), ReadILOperand(il, instr, 2))));
		}
		else
		{
			il.AddInstruction(WriteILOperand(il, instr, 0, il.Load(4, GetMemoryAddress(il, instr, 1, 4))));
		}
		break;

Activity

  1. plafosse commented on Apr 24, 2023

    @plafosse
    Member

    Yes I would assume because the IL isn't loading it as a float

  2. joelreymont commented on Apr 24, 2023

    @joelreymont
    Author
  3. plafosse commented on Apr 24, 2023

    @plafosse
    Member

    Something like

    il.AddInstruction(WriteILOperand(il, instr, 0, il.FloatConvert(4, il.Load(4, GetMemoryAddress(il, instr, 1, 4)))));
    

    I think.

  4. plafosse commented on Apr 24, 2023

    @plafosse
    Member
  5. locked and limited conversation to collaborators on Apr 24, 2023
  6. converted this issue into a discussion #4263 on Apr 24, 2023
  7. added this to the Braize milestone on Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions