CSAPP
chapter 2
整型数值表示
浮点型数值表示
chapter 3
//mstore.c
long mult2(long, long);
void multstore(long x, long y, long *dest) {
long t = mult2(x, y);
*dest = t;
}Last updated
//mstore.c
long mult2(long, long);
void multstore(long x, long y, long *dest) {
long t = mult2(x, y);
*dest = t;
}Last updated
$ gcc -Og -S mstore.c
$ gcc -c -Og -o mstore.o mstore.c$ gdb mstore.o
(gdb) x/14xb multstore # 显示机器码0x0 <multstore>: 0x53 0x48 0x89 0xd3 0xe8 0x00 0x00 0x00
0x8 <multstore+8>: 0x00 0x48 0x89 0x03 0x5b 0xc3//mstore.s
.file "mstore.c"
.text
.globl multstore
.type multstore, @function
multstore:
.LFB0:
.cfi_startproc
pushq %rbx
.cfi_def_cfa_offset 16
.cfi_offset 3, -16
movq %rdx, %rbx
call mult2
movq %rax, (%rbx)
popq %rbx
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size multstore, .-multstore
.ident "GCC: (GNU) 5.2.0"
.section .note.GNU-stack,"",@progbits$ objdump -d mstore.o
mstore.o: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <multstore>:
0: 53 push %rbx
1: 48 89 d3 mov %rdx,%rbx
4: e8 00 00 00 00 callq 9 <multstore+0x9>
9: 48 89 03 mov %rax,(%rbx)
c: 5b pop %rbx
d: c3 retq