userland: add assembly support

Move arm assembly cheat here, and start some work on x86 cheat as well.
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-03-22 00:00:00 +00:00
parent 4943c9ed2e
commit 287c83f3f9
117 changed files with 3870 additions and 547 deletions

33
userland/arch/arm/adr.S Normal file
View File

@@ -0,0 +1,33 @@
/* https://github.com/cirosantilli/arm-assembly-cheat#adr */
#include "common.h"
.data
data_label:
.word 0x1234678
ENTRY
adr r0, label
/* objdump tells us that this uses the literal pool,
* it does not get converted to adr, which is the better
* alternative here.
*/
adr r1, label
adrl r2, label
label:
ASSERT_EQ_REG(r0, r1)
ASSERT_EQ_REG(r0, r2)
#if 0
/* Error: symbol .data is in a different section.
*
* It works however in ARMv8.
* I think this means that there is no relocation type
* that takes care of this encoding in ARMv8, but there
* is one in ARMv8.
*
* If you have no idea what I'm talking about, read this:
* https://stackoverflow.com/questions/3322911/what-do-linkers-do/33690144#33690144
*/
adr r1, data_label
#endif
EXIT