arm: thumb understanding++

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-30 00:00:01 +00:00
parent ceadb1d776
commit 1f55dec44c
8 changed files with 140 additions and 41 deletions

View File

@@ -1,21 +1,12 @@
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-instruction-encodings
*
* Illustrates features that are only available in thumb.
* TODO ensure that we are actually inside of thumb.
*/
/* https://github.com/cirosantilli/linux-kernel-module-cheat#arm-thumb-encoding */
#include <lkmc.h>
.syntax unified
.text
.thumb_func
.global main
main:
main_after_prologue:
LKMC_PROLOGUE
/* CBZ: cmp and branch if zero instruction. Equivalent to CMP + BEQ.
* TODO create an interesting assertion here.
*/
/* TODO: #if 0 something that is not thumb encodable. */
cbz r1, 1f
1:
mov r0, 0
bx lr
LKMC_EPILOGUE