Skip to content

How to compute the effective address of a memory operand on ARM? #1013

@10110111

Description

@10110111

I'm a bit confused by all the fields in cs_arm_op for ARM_OP_MEM. At first I thought the calculation would be something like

op.mem.base+op.mem.disp+doShift(op.mem.index*op.mem.scale, op.shift)

but it appears that for an instruction like 82 f6 11 e7 ldr pc, [r1, -r2, lsl #13] we have op.mem.scale==1 and op.subtracted==1. So, what is the generally correct procedure to calculate the effective address? What are some examples of instructions where op.subtracted==0 and op.mem.scale==-1?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions