Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Katana-O opened this issue Mar 28, 2022 · 0 comments
Open

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

Katana-O opened this issue Mar 28, 2022 · 0 comments

Comments

@Katana-O
Copy link

Katana-O commented Mar 28, 2022

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);
}

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

No branches or pull requests

1 participant