mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
x86 asm: start moving in binary arithmetic instructions
This commit is contained in:
9
userland/arch/x86_64/dec.S
Normal file
9
userland/arch/x86_64/dec.S
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Decrement: i--. */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
mov $3, %rax
|
||||
dec %rax
|
||||
LKMC_ASSERT_EQ_32(%rax, $2)
|
||||
LKMC_EPILOGUE
|
||||
9
userland/arch/x86_64/inc.S
Normal file
9
userland/arch/x86_64/inc.S
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Increment: i++. */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
mov $2, %eax
|
||||
inc %eax
|
||||
LKMC_ASSERT_EQ_32(%eax, $3)
|
||||
LKMC_EPILOGUE
|
||||
9
userland/arch/x86_64/sub.S
Normal file
9
userland/arch/x86_64/sub.S
Normal file
@@ -0,0 +1,9 @@
|
||||
/* Subtraction. */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
mov $3, %rax
|
||||
sub $2, %rax
|
||||
LKMC_ASSERT_EQ(%rax, $1)
|
||||
LKMC_EPILOGUE
|
||||
Reference in New Issue
Block a user