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

31
userland/arch/arm/push.S Normal file
View File

@@ -0,0 +1,31 @@
/* https://github.com/cirosantilli/arm-assembly-cheat#ldmia */
#include "common.h"
ENTRY
/* Save sp before push. */
mov r0, sp
/* Push. */
mov r1, 1
mov r2, 2
push {r1, r2}
/* Save sp after push. */
mov r1, sp
/* Restore. */
mov r3, 0
mov r4, 0
pop {r3, r4}
ASSERT_EQ(r3, 1)
ASSERT_EQ(r4, 2)
/* Check that stack pointer moved down by 8 bytes
* (2 registers x 4 bytes each).
*/
sub r0, r1
ASSERT_EQ(r0, 8)
EXIT