mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 21:14:27 +01:00
x86 asm: move binary arithmetic instructions from x86-assembly-cheat except cmp
This commit is contained in:
23
userland/arch/x86_64/sbb.S
Normal file
23
userland/arch/x86_64/sbb.S
Normal file
@@ -0,0 +1,23 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-binary-arithmetic-instructions
|
||||
*
|
||||
* Subtract with Borrow. Like ADC is for ADD, but for subtraction.
|
||||
*/
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
/* rax : rbx -= rcx : rdx
|
||||
* 1 : 0 -= 0 : 0x8000000000000000
|
||||
* 0 : 0x8000000000000000
|
||||
*/
|
||||
mov $0x1, %rax
|
||||
mov $0x0, %rbx
|
||||
mov $0x0, %rcx
|
||||
mov $0x8000000000000000, %rdx
|
||||
sub %rdx, %rbx
|
||||
sbb %rcx, %rax
|
||||
mov %rax, %r12
|
||||
mov %rbx, %r13
|
||||
LKMC_ASSERT_EQ(%r12, $0x0)
|
||||
LKMC_ASSERT_EQ(%r13, $0x8000000000000000)
|
||||
LKMC_EPILOGUE
|
||||
Reference in New Issue
Block a user