mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
x86 asm: move jmp from x86-assembly-cheat
This commit is contained in:
@@ -12375,6 +12375,13 @@ Bibliography:
|
||||
* link:userland/arch/x86_64/or.S[OR]
|
||||
* 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
|
||||
|
||||
History:
|
||||
|
||||
12
userland/arch/x86_64/jmp.S
Normal file
12
userland/arch/x86_64/jmp.S
Normal 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
|
||||
22
userland/arch/x86_64/jmp_indirect.S
Normal file
22
userland/arch/x86_64/jmp_indirect.S
Normal 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
|
||||
Reference in New Issue
Block a user