Skip to content

Instantly share code, notes, and snippets.

@zhangbo
Created March 6, 2020 08:20
Show Gist options
  • Save zhangbo/3e0b82015c1eb50da5013585703aea03 to your computer and use it in GitHub Desktop.
Save zhangbo/3e0b82015c1eb50da5013585703aea03 to your computer and use it in GitHub Desktop.
tbz for AArch64 constructure
/*
* cbz Rn, location
*
* 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 <-- bit
* 0 0 1 1 0 1 0 0 [ <-- meaning
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 <-- bit
* location][ Rn] <-- meaning
* location is 4 byte aligned
*
* example: cbz x30, 0xFC
* x30 <=> 11110
* 0xFC <=> 1111 1100
* opcode: 34 00 07 FE
*
* 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 <-- bit
* 0 0 1 1 0 1 0 0 [0 0 0 0 0 0 0 0 <-- meaning
* 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 <-- bit
* 0 0 0 0 0 1 1 1 1 1 1][1 1 1 1 0] <-- meaning
*
* location is 0000 0000 0000 0111 111
* append 2 zeros: 0000 0000 0000 0111 11100
* re-separate: 0 0000 0000 0000 1111 1100
* 1111 1100 <=> 0xFC
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment