Skip to content

Commit fd5b62e

Browse files
committed
x86 asm: move bswap from x86-assembly-cheat
1 parent 0829014 commit fd5b62e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

README.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12397,6 +12397,7 @@ Bibliography:
1239712397
* Integer typecasts
1239812398
** link:userland/arch/x86_64/movzx.S[]: MOVZX
1239912399
** link:userland/arch/x86_64/movsx.S[]: MOVSX
12400+
* link:userland/arch/x86_64/bswap.S[]: BSWAP: convert between little endian and big endian
1240012401

1240112402
==== x86 CQTO and CLTQ instructions
1240212403

userland/arch/x86_64/bswap.S

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# # bswap
2+
3+
# Little endian <=> big endian.
4+
5+
#include <lkmc.h>
6+
7+
LKMC_PROLOGUE
8+
9+
mov $0x12345678, %eax
10+
bswapl %eax
11+
LKMC_ASSERT_EQ_32(%eax, $0x78563412)
12+
13+
LKMC_EPILOGUE

0 commit comments

Comments
 (0)