From fd5b62edfefca95ae2dfe9bd477a8f64271cd2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Sat, 22 Jun 2019 00:00:02 +0000 Subject: [PATCH] x86 asm: move bswap from x86-assembly-cheat --- README.adoc | 1 + userland/arch/x86_64/bswap.S | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 userland/arch/x86_64/bswap.S diff --git a/README.adoc b/README.adoc index 85e2652..7eaa00b 100644 --- a/README.adoc +++ b/README.adoc @@ -12397,6 +12397,7 @@ Bibliography: * Integer typecasts ** link:userland/arch/x86_64/movzx.S[]: MOVZX ** link:userland/arch/x86_64/movsx.S[]: MOVSX +* link:userland/arch/x86_64/bswap.S[]: BSWAP: convert between little endian and big endian ==== x86 CQTO and CLTQ instructions diff --git a/userland/arch/x86_64/bswap.S b/userland/arch/x86_64/bswap.S new file mode 100644 index 0000000..c6e56fa --- /dev/null +++ b/userland/arch/x86_64/bswap.S @@ -0,0 +1,13 @@ +# # bswap + + # Little endian <=> big endian. + +#include + +LKMC_PROLOGUE + + mov $0x12345678, %eax + bswapl %eax + LKMC_ASSERT_EQ_32(%eax, $0x78563412) + +LKMC_EPILOGUE