x86 asm: move rotation and bit instructoins in from x86-assembly-cheat

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-06-16 00:00:03 +00:00
parent 89084d2332
commit 658ac53d0f
10 changed files with 313 additions and 0 deletions

42
userland/arch/x86_64/bt.S Normal file
View 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