mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-29 21:14:27 +01:00
x86 asm: move rotation and bit instructoins in from x86-assembly-cheat
This commit is contained in:
42
userland/arch/x86_64/bt.S
Normal file
42
userland/arch/x86_64/bt.S
Normal file
@@ -0,0 +1,42 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-bit-and-byte-instructions */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
LKMC_PROLOGUE
|
||||
/* 0101 1010 */
|
||||
mov $0x5A, %r12
|
||||
|
||||
bt $0, %r12w
|
||||
LKMC_ASSERT(jnc)
|
||||
|
||||
bt $1, %r12w
|
||||
LKMC_ASSERT(jc)
|
||||
|
||||
bt $2, %r12w
|
||||
LKMC_ASSERT(jnc)
|
||||
|
||||
bt $3, %r12w
|
||||
LKMC_ASSERT(jc)
|
||||
|
||||
bt $4, %r12w
|
||||
LKMC_ASSERT(jc)
|
||||
|
||||
bt $5, %r12w
|
||||
LKMC_ASSERT(jnc)
|
||||
|
||||
bt $6, %r12w
|
||||
LKMC_ASSERT(jc)
|
||||
|
||||
bt $7, %r12w
|
||||
LKMC_ASSERT(jnc)
|
||||
|
||||
/* The register is unchanged. */
|
||||
LKMC_ASSERT_EQ(%r12, $0x5A)
|
||||
|
||||
#if 0
|
||||
/* There is no Byte decoding for bt:
|
||||
* Error: operand size mismatch for `bt'
|
||||
*/
|
||||
bt $0, %r12b
|
||||
#endif
|
||||
LKMC_EPILOGUE
|
||||
Reference in New Issue
Block a user