Skip to content

Instantly share code, notes, and snippets.

@uroboro
Created January 13, 2018 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uroboro/0bd729ec0f1bc1237ca458689a23f55c to your computer and use it in GitHub Desktop.
Save uroboro/0bd729ec0f1bc1237ca458689a23f55c to your computer and use it in GitHub Desktop.
/*
 * 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