Skip to content

How to assemble instruction like "mov x0, <VariableValue>" ? #84

@Katana-O

Description

@Katana-O

Hi there. Normally in arm64 if we assemble an instruction like "mov x0, x1" or "mov x0, #0x100". it would be easily done. But in my case, "mov x0, Varaible" , the second operand is not fixed, its value will change. So, when I use ks_asm(&ks, ???, ......., ...., .... ) this API, what string I should input for the second argument?

Below is an example of my code, as you can see, each loop will increase the value of ucRun. So the value of ucRun is definitely not fixed here. So, could you give me some useful advise so I can make it work?

for(int i = 0; i < 10; ++i)
{
static size_t ucRun = 0x1000;
ucRun = ucRun + 0x100;
size_t ksAsmRet = ks_asm(ptrKS, "mov x9, ucRun", 0, &encodeBuf, &encodeSz, &encodeCount);
}

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