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

AArch64: movn w0, #0, lsl #16 and movz w0, #0, lsl #16 are indistinguishable #1857

Closed
thestr4ng3r opened this issue Mar 19, 2022 · 0 comments · Fixed by #2026
Closed

AArch64: movn w0, #0, lsl #16 and movz w0, #0, lsl #16 are indistinguishable #1857

thestr4ng3r opened this issue Mar 19, 2022 · 0 comments · Fixed by #2026

Comments

@thestr4ng3r
Copy link
Contributor

On next (31af3c3):

florian-macbook:capstone florian$ cstool -d arm64 0000a012
 0  00 00 a0 12  movn	w0, #0, lsl #16
	ID: 488 (mov)
	op_count: 2
		operands[0].type: REG = w0
		operands[0].access: READ | WRITE
		operands[1].type: IMM = 0x0
		operands[1].access: READ
			Shift: type = 1, value = 16
	Registers read: w0
	Registers modified: w0

florian-macbook:capstone florian$ cstool -d arm64 0000a052
 0  00 00 a0 52  movz	w0, #0, lsl #16
	ID: 488 (mov)
	op_count: 2
		operands[0].type: REG = w0
		operands[0].access: READ | WRITE
		operands[1].type: IMM = 0x0
		operands[1].access: READ
			Shift: type = 1, value = 16
	Registers read: w0
	Registers modified: w0

Notice how both instructions have the exact same id and details. However their semantics are different (write 0xffffffff vs. write 0).

Some context:

The #0, lsl #16 operands are an edge case of both instructions. In other cases, for example movn w0, #2, lsl #16 (4000a012) it gets disassembled as e.g. mov w0, #-0x20001 where the final value is already resolved and also reflected like this in the details, so there it's fine.
See also the condition in the reference manual:
Bildschirmfoto 2022-03-19 um 19 34 09

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 a pull request may close this issue.

1 participant