Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save haraldschilly/66397f35919aed654976bf6e064a250c to your computer and use it in GitHub Desktop.
Save haraldschilly/66397f35919aed654976bf6e064a250c to your computer and use it in GitHub Desktop.
vmlinux-4.10.0-35-generic / memmove
$ gdb -batch -ex 'file vmlinux-4.10.0-35-generic' -ex 'disassemble /r memmove' > /tmp/vmlinux-4.10.0-35-generic-memmove.txt
$ cat /tmp/vmlinux-4.10.0-35-generic-memmove.txt
Dump of assembler code for function memmove:
0xffffffff814585d0 <+0>: 48 89 f8 mov %rdi,%rax
0xffffffff814585d3 <+3>: 48 83 fa 20 cmp $0x20,%rdx
0xffffffff814585d7 <+7>: 0f 82 03 01 00 00 jb 0xffffffff814586e0 <memmove+272>
0xffffffff814585dd <+13>: 48 39 fe cmp %rdi,%rsi
0xffffffff814585e0 <+16>: 7d 0f jge 0xffffffff814585f1 <memmove+33>
0xffffffff814585e2 <+18>: 49 89 f0 mov %rsi,%r8
0xffffffff814585e5 <+21>: 49 01 d0 add %rdx,%r8
0xffffffff814585e8 <+24>: 49 39 f8 cmp %rdi,%r8
0xffffffff814585eb <+27>: 0f 8f 9f 00 00 00 jg 0xffffffff81458690 <memmove+192>
0xffffffff814585f1 <+33>: 90 nop
0xffffffff814585f2 <+34>: 90 nop
0xffffffff814585f3 <+35>: 90 nop
0xffffffff814585f4 <+36>: 90 nop
0xffffffff814585f5 <+37>: 90 nop
0xffffffff814585f6 <+38>: 90 nop
0xffffffff814585f7 <+39>: 48 81 fa a8 02 00 00 cmp $0x2a8,%rdx
0xffffffff814585fe <+46>: 72 05 jb 0xffffffff81458605 <memmove+53>
0xffffffff81458600 <+48>: 40 38 fe cmp %dil,%sil
0xffffffff81458603 <+51>: 74 3b je 0xffffffff81458640 <memmove+112>
0xffffffff81458605 <+53>: 48 83 ea 20 sub $0x20,%rdx
0xffffffff81458609 <+57>: 48 83 ea 20 sub $0x20,%rdx
0xffffffff8145860d <+61>: 4c 8b 1e mov (%rsi),%r11
0xffffffff81458610 <+64>: 4c 8b 56 08 mov 0x8(%rsi),%r10
0xffffffff81458614 <+68>: 4c 8b 4e 10 mov 0x10(%rsi),%r9
0xffffffff81458618 <+72>: 4c 8b 46 18 mov 0x18(%rsi),%r8
0xffffffff8145861c <+76>: 48 8d 76 20 lea 0x20(%rsi),%rsi
0xffffffff81458620 <+80>: 4c 89 1f mov %r11,(%rdi)
0xffffffff81458623 <+83>: 4c 89 57 08 mov %r10,0x8(%rdi)
0xffffffff81458627 <+87>: 4c 89 4f 10 mov %r9,0x10(%rdi)
0xffffffff8145862b <+91>: 4c 89 47 18 mov %r8,0x18(%rdi)
0xffffffff8145862f <+95>: 48 8d 7f 20 lea 0x20(%rdi),%rdi
0xffffffff81458633 <+99>: 73 d4 jae 0xffffffff81458609 <memmove+57>
0xffffffff81458635 <+101>: 48 83 c2 20 add $0x20,%rdx
0xffffffff81458639 <+105>: e9 a2 00 00 00 jmpq 0xffffffff814586e0 <memmove+272>
0xffffffff8145863e <+110>: 66 90 xchg %ax,%ax
0xffffffff81458640 <+112>: 48 89 d1 mov %rdx,%rcx
0xffffffff81458643 <+115>: 4c 8b 5c 16 f8 mov -0x8(%rsi,%rdx,1),%r11
0xffffffff81458648 <+120>: 4c 8d 54 17 f8 lea -0x8(%rdi,%rdx,1),%r10
0xffffffff8145864d <+125>: 48 c1 e9 03 shr $0x3,%rcx
0xffffffff81458651 <+129>: f3 48 a5 rep movsq %ds:(%rsi),%es:(%rdi)
0xffffffff81458654 <+132>: 4d 89 1a mov %r11,(%r10)
0xffffffff81458657 <+135>: e9 0c 01 00 00 jmpq 0xffffffff81458768 <memmove+408>
0xffffffff8145865c <+140>: 0f 1f 40 00 nopl 0x0(%rax)
0xffffffff81458660 <+144>: 48 89 d1 mov %rdx,%rcx
0xffffffff81458663 <+147>: 4c 8b 1e mov (%rsi),%r11
0xffffffff81458666 <+150>: 49 89 fa mov %rdi,%r10
0xffffffff81458669 <+153>: 48 8d 74 16 f8 lea -0x8(%rsi,%rdx,1),%rsi
0xffffffff8145866e <+158>: 48 8d 7c 17 f8 lea -0x8(%rdi,%rdx,1),%rdi
0xffffffff81458673 <+163>: 48 c1 e9 03 shr $0x3,%rcx
0xffffffff81458677 <+167>: fd std
0xffffffff81458678 <+168>: f3 48 a5 rep movsq %ds:(%rsi),%es:(%rdi)
0xffffffff8145867b <+171>: fc cld
0xffffffff8145867c <+172>: 4d 89 1a mov %r11,(%r10)
0xffffffff8145867f <+175>: e9 e4 00 00 00 jmpq 0xffffffff81458768 <memmove+408>
0xffffffff81458684 <+180>: 66 90 xchg %ax,%ax
0xffffffff81458686 <+182>: 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:0x0(%rax,%rax,1)
0xffffffff81458690 <+192>: 48 81 fa a8 02 00 00 cmp $0x2a8,%rdx
0xffffffff81458697 <+199>: 72 05 jb 0xffffffff8145869e <memmove+206>
0xffffffff81458699 <+201>: 40 38 fe cmp %dil,%sil
0xffffffff8145869c <+204>: 74 c2 je 0xffffffff81458660 <memmove+144>
0xffffffff8145869e <+206>: 48 01 d6 add %rdx,%rsi
0xffffffff814586a1 <+209>: 48 01 d7 add %rdx,%rdi
0xffffffff814586a4 <+212>: 48 83 ea 20 sub $0x20,%rdx
0xffffffff814586a8 <+216>: 48 83 ea 20 sub $0x20,%rdx
0xffffffff814586ac <+220>: 4c 8b 5e f8 mov -0x8(%rsi),%r11
0xffffffff814586b0 <+224>: 4c 8b 56 f0 mov -0x10(%rsi),%r10
0xffffffff814586b4 <+228>: 4c 8b 4e e8 mov -0x18(%rsi),%r9
0xffffffff814586b8 <+232>: 4c 8b 46 e0 mov -0x20(%rsi),%r8
0xffffffff814586bc <+236>: 48 8d 76 e0 lea -0x20(%rsi),%rsi
0xffffffff814586c0 <+240>: 4c 89 5f f8 mov %r11,-0x8(%rdi)
0xffffffff814586c4 <+244>: 4c 89 57 f0 mov %r10,-0x10(%rdi)
0xffffffff814586c8 <+248>: 4c 89 4f e8 mov %r9,-0x18(%rdi)
0xffffffff814586cc <+252>: 4c 89 47 e0 mov %r8,-0x20(%rdi)
0xffffffff814586d0 <+256>: 48 8d 7f e0 lea -0x20(%rdi),%rdi
0xffffffff814586d4 <+260>: 73 d2 jae 0xffffffff814586a8 <memmove+216>
0xffffffff814586d6 <+262>: 48 83 c2 20 add $0x20,%rdx
0xffffffff814586da <+266>: 48 29 d6 sub %rdx,%rsi
0xffffffff814586dd <+269>: 48 29 d7 sub %rdx,%rdi
0xffffffff814586e0 <+272>: 48 83 fa 10 cmp $0x10,%rdx
0xffffffff814586e4 <+276>: 72 2a jb 0xffffffff81458710 <memmove+320>
0xffffffff814586e6 <+278>: 4c 8b 1e mov (%rsi),%r11
0xffffffff814586e9 <+281>: 4c 8b 56 08 mov 0x8(%rsi),%r10
0xffffffff814586ed <+285>: 4c 8b 4c 16 f0 mov -0x10(%rsi,%rdx,1),%r9
0xffffffff814586f2 <+290>: 4c 8b 44 16 f8 mov -0x8(%rsi,%rdx,1),%r8
0xffffffff814586f7 <+295>: 4c 89 1f mov %r11,(%rdi)
0xffffffff814586fa <+298>: 4c 89 57 08 mov %r10,0x8(%rdi)
0xffffffff814586fe <+302>: 4c 89 4c 17 f0 mov %r9,-0x10(%rdi,%rdx,1)
0xffffffff81458703 <+307>: 4c 89 44 17 f8 mov %r8,-0x8(%rdi,%rdx,1)
0xffffffff81458708 <+312>: eb 5e jmp 0xffffffff81458768 <memmove+408>
0xffffffff8145870a <+314>: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1)
0xffffffff81458710 <+320>: 48 83 fa 08 cmp $0x8,%rdx
0xffffffff81458714 <+324>: 72 12 jb 0xffffffff81458728 <memmove+344>
0xffffffff81458716 <+326>: 4c 8b 1e mov (%rsi),%r11
0xffffffff81458719 <+329>: 4c 8b 54 16 f8 mov -0x8(%rsi,%rdx,1),%r10
0xffffffff8145871e <+334>: 4c 89 1f mov %r11,(%rdi)
0xffffffff81458721 <+337>: 4c 89 54 17 f8 mov %r10,-0x8(%rdi,%rdx,1)
0xffffffff81458726 <+342>: eb 40 jmp 0xffffffff81458768 <memmove+408>
0xffffffff81458728 <+344>: 48 83 fa 04 cmp $0x4,%rdx
0xffffffff8145872c <+348>: 72 12 jb 0xffffffff81458740 <memmove+368>
0xffffffff8145872e <+350>: 44 8b 1e mov (%rsi),%r11d
0xffffffff81458731 <+353>: 44 8b 54 16 fc mov -0x4(%rsi,%rdx,1),%r10d
0xffffffff81458736 <+358>: 44 89 1f mov %r11d,(%rdi)
0xffffffff81458739 <+361>: 44 89 54 17 fc mov %r10d,-0x4(%rdi,%rdx,1)
0xffffffff8145873e <+366>: eb 28 jmp 0xffffffff81458768 <memmove+408>
0xffffffff81458740 <+368>: 48 83 fa 02 cmp $0x2,%rdx
0xffffffff81458744 <+372>: 72 16 jb 0xffffffff8145875c <memmove+396>
0xffffffff81458746 <+374>: 66 44 8b 1e mov (%rsi),%r11w
0xffffffff8145874a <+378>: 66 44 8b 54 16 fe mov -0x2(%rsi,%rdx,1),%r10w
0xffffffff81458750 <+384>: 66 44 89 1f mov %r11w,(%rdi)
0xffffffff81458754 <+388>: 66 44 89 54 17 fe mov %r10w,-0x2(%rdi,%rdx,1)
0xffffffff8145875a <+394>: eb 0c jmp 0xffffffff81458768 <memmove+408>
0xffffffff8145875c <+396>: 48 83 fa 01 cmp $0x1,%rdx
0xffffffff81458760 <+400>: 72 06 jb 0xffffffff81458768 <memmove+408>
0xffffffff81458762 <+402>: 44 8a 1e mov (%rsi),%r11b
0xffffffff81458765 <+405>: 44 88 1f mov %r11b,(%rdi)
0xffffffff81458768 <+408>: c3 retq
End of assembler dump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment