mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 04:54:27 +01:00
x86 asm: move rotation and bit instructoins in from x86-assembly-cheat
This commit is contained in:
26
userland/arch/x86_64/setcc.S
Normal file
26
userland/arch/x86_64/setcc.S
Normal file
@@ -0,0 +1,26 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-bit-and-byte-instructions */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
mov $0xFF, %r12
|
||||
|
||||
/* Set Carry flag. */
|
||||
stc
|
||||
/* Check for carry flag. */
|
||||
setc %r12b
|
||||
/* Carry flag was set, so set the r12b to 1. */
|
||||
LKMC_ASSERT_EQ(%r12, $1)
|
||||
|
||||
/* Clear carry flag. */
|
||||
clc
|
||||
setc %r12b
|
||||
LKMC_ASSERT_EQ(%r12, $0)
|
||||
|
||||
#if 0
|
||||
/* The operand size can only be one byte:
|
||||
* Error: operand size mismatch for `setc'
|
||||
*/
|
||||
setc %eax
|
||||
#endif
|
||||
LKMC_EPILOGUE
|
||||
Reference in New Issue
Block a user