好的,我做到了,谢谢。以下是完整的解决方案:
装配代号:
1 .globl main
2 main:
3
4 pushq %rbp
5 movq %rsp, %rbp
6 subq $8, %rsp
7
8 movq $50, -8(%rbp)
9
10 leaq PrintHello(%rip), %rdi
11 movq $17, %rsi
12 leaq -8(%rbp), %rdx
13
14 callq dispatcher
15 callq wait
16
17 movq -8(%rbp), %rax
18 movq %rax, %rdi
19 callq print_int
20
21 addq $8, %rsp
22 movq $0, %rax
23 popq %rbp
24 retq
输出:
In dispatcher arg = 17
In wait
wrap_func: args_data.ret = 50
Hello World! It's me, thread # 17!
wrap_func: after assignment-> args_data.ret = 20
Exit from wait