x86 asm: move jmp from x86-assembly-cheat

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-12 00:00:03 +00:00
parent 5f50217fdd
commit 9dd63f6f54
3 changed files with 41 additions and 0 deletions

View File

@@ -12375,6 +12375,13 @@ Bibliography:
* link:userland/arch/x86_64/or.S[OR] * link:userland/arch/x86_64/or.S[OR]
* link:userland/arch/x86_64/xor.S[XOR] * link:userland/arch/x86_64/xor.S[XOR]
=== x86 control transfer instructions
<<intel-manual-1>> 5.1.7 "Control Transfer Instructions"
* link:userland/arch/x86_64/jmp.S[JMP]
** link:userland/arch/x86_64/jmp_indirect.S[JMP indirect]
=== x86 SIMD === x86 SIMD
History: History:

View File

@@ -0,0 +1,12 @@
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-jmp-instruction
*
* Unconditional branch, address relative to the current address.
*/
#include <lkmc.h>
LKMC_PROLOGUE
jmp after_fail
LKMC_ASSERT_FAIL
after_fail:
LKMC_EPILOGUE

View File

@@ -0,0 +1,22 @@
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-jmp-instruction
*
* Unconditional branch to an absolute address stored in memory on in a register.
*/
#include <lkmc.h>
LKMC_PROLOGUE
/* Address in memory. */
.section .rodata
label_address: .quad memory_label
.text
jmp *label_address
LKMC_ASSERT_FAIL
memory_label:
/* Address in register. */
lea register_label(%rip), %rax
jmp *%rax
LKMC_ASSERT_FAIL
register_label:
LKMC_EPILOGUE