Skip to content

Instantly share code, notes, and snippets.

@theuni
Created December 16, 2016 18:58
Show Gist options
  • Save theuni/508b69da908be1e52bbdd0b7a135c318 to your computer and use it in GitHub Desktop.
Save theuni/508b69da908be1e52bbdd0b7a135c318 to your computer and use it in GitHub Desktop.
Linux:
$ objdump -dC bswapcomp.o
bswapcomp.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <systemswaps(unsigned long, unsigned int, unsigned short)>:
0: 48 0f cf bswap %rdi
3: 48 89 3d 00 00 00 00 mov %rdi,0x0(%rip) # a <systemswaps(unsigned long, unsigned int, unsigned short)+0xa>
a: 0f ce bswap %esi
c: 89 35 00 00 00 00 mov %esi,0x0(%rip) # 12 <systemswaps(unsigned long, unsigned int, unsigned short)+0x12>
12: 66 c1 c2 08 rol $0x8,%dx
16: 66 89 15 00 00 00 00 mov %dx,0x0(%rip) # 1d <systemswaps(unsigned long, unsigned int, unsigned short)+0x1d>
1d: c3 retq
1e: 66 90 xchg %ax,%ax
0000000000000020 <myswaps(unsigned long, unsigned int, unsigned short)>:
20: 48 0f cf bswap %rdi
23: 48 89 3d 00 00 00 00 mov %rdi,0x0(%rip) # 2a <myswaps(unsigned long, unsigned int, unsigned short)+0xa>
2a: 0f ce bswap %esi
2c: 89 35 00 00 00 00 mov %esi,0x0(%rip) # 32 <myswaps(unsigned long, unsigned int, unsigned short)+0x12>
32: 66 c1 c2 08 rol $0x8,%dx
36: 66 89 15 00 00 00 00 mov %dx,0x0(%rip) # 3d <myswaps(unsigned long, unsigned int, unsigned short)+0x1d>
3d: c3 retq
===
macOS:
$ otool -t -V bswapcomp.o | c++filt
bswapcomp.o:
(__TEXT,__text) section
systemswaps(unsigned long long, unsigned int, unsigned short):
0000000000000000 pushq %rbp
0000000000000001 movq %rsp, %rbp
0000000000000004 bswapq %rdi
0000000000000007 movq _out64(%rip), %rax
000000000000000e movq %rdi, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
0000000000000011 bswapl %esi
0000000000000013 movq _out32(%rip), %rax
000000000000001a movl %esi, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
000000000000001c rolw $0x8, %dx
0000000000000020 movq _out16(%rip), %rax
0000000000000027 movw %dx, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
000000000000002a popq %rbp
000000000000002b retq
000000000000002c nopl (%rax)
myswaps(unsigned long long, unsigned int, unsigned short):
0000000000000030 pushq %rbp
0000000000000031 movq %rsp, %rbp
0000000000000034 bswapq %rdi
0000000000000037 movq _out64(%rip), %rax
000000000000003e movq %rdi, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
0000000000000041 bswapl %esi
0000000000000043 movq _out32(%rip), %rax
000000000000004a movl %esi, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
000000000000004c rolw $0x8, %dx
0000000000000050 movq _out16(%rip), %rax
0000000000000057 movw %dx, systemswaps(unsigned long long, unsigned int, unsigned short)(%rax) ## systemswaps(unsigned long long, unsigned int, unsigned short)
000000000000005a popq %rbp
000000000000005b retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment