mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-30 21:34:27 +01:00
x86 asm: move x87 FPU instructions from x86-assembly-cheat
This commit is contained in:
45
userland/arch/x86_64/fxch.S
Normal file
45
userland/arch/x86_64/fxch.S
Normal file
@@ -0,0 +1,45 @@
|
||||
/* https://github.com/cirosantilli/linux-kernel-module-cheat#x86-x87-fpu-instructions */
|
||||
|
||||
#include <lkmc.h>
|
||||
|
||||
.data
|
||||
double_0_0: .double 0.0
|
||||
double_1_0: .double 1.0
|
||||
LKMC_PROLOGUE
|
||||
fldz
|
||||
# ST0 = 0.0
|
||||
|
||||
fld1
|
||||
# ST0 = 1.0
|
||||
# ST1 = 0.0
|
||||
|
||||
# Swap ST0 and ST1.
|
||||
fxch %st(1)
|
||||
# ST0 = 0.0
|
||||
# ST1 = 1.0
|
||||
|
||||
fldz
|
||||
# ST0 = 0.0
|
||||
# ST1 = 0.0
|
||||
# ST2 = 1.0
|
||||
|
||||
fcomip %st(1)
|
||||
# ST0 = 0.0
|
||||
# ST1 = 1.0
|
||||
LKMC_ASSERT(je)
|
||||
|
||||
# Swap ST0 and ST1.
|
||||
fxch %st(1)
|
||||
# ST0 = 1.0
|
||||
# ST1 = 0.0
|
||||
|
||||
fld1
|
||||
# ST0 = 1.0
|
||||
# ST1 = 1.0
|
||||
# ST2 = 0.0
|
||||
|
||||
fcomip %st(1)
|
||||
# ST0 = 1.0
|
||||
# ST1 = 0.0
|
||||
LKMC_ASSERT(je)
|
||||
LKMC_EPILOGUE
|
||||
Reference in New Issue
Block a user