sum;
pushl %ebp
pushl %edp
movl %esp,%ebp
movl 12(%edp),%eax
addl 8(%edp),%eax
addl %eax,accum
movl %edp,%esp
pop %ebp
ret
而我运行objdump -d prog
结果是
.prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
我想请问大家,这是因为什么,还有我看不懂这些指令的意思(刚刚开始弄),不知道那里能找到指令集的资料,谢谢!!!!!!
6 个解决方案
#1
pushl %ebp\\ push stack
pushl %edp\\push stack
movl %esp,%ebp \\= intel mov ebp,esp
addl 8(%edp),%eax \\= intel add eax,[edp+8]
addl %eax,accum \\= intel add accum,eax
movl %edp,%esp \\intel mov esp,edp
pop %ebp \\pop stack
ret \
pushl %edp\\push stack
movl %esp,%ebp \\= intel mov ebp,esp
addl 8(%edp),%eax \\= intel add eax,[edp+8]
addl %eax,accum \\= intel add accum,eax
movl %edp,%esp \\intel mov esp,edp
pop %ebp \\pop stack
ret \
#2
这是AT&T格式的指令,与intel格式不同
#3
.prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
这个是intel格式吗,那这个呢
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
我哪里去找gp 是什么,a0,t0
请高手不要不屑!!
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
这个是intel格式吗,那这个呢
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
我哪里去找gp 是什么,a0,t0
请高手不要不屑!!
#4
intel 格式有$0吗,我不明白?
#5
a0 t0 ...
代表了不同的寄存器类型
代表了不同的寄存器类型
#6
请问那里有
prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
中gp,a0,t1,v0的详细解释吗???????
prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
中gp,a0,t1,v0的详细解释吗???????
#1
pushl %ebp\\ push stack
pushl %edp\\push stack
movl %esp,%ebp \\= intel mov ebp,esp
addl 8(%edp),%eax \\= intel add eax,[edp+8]
addl %eax,accum \\= intel add accum,eax
movl %edp,%esp \\intel mov esp,edp
pop %ebp \\pop stack
ret \
pushl %edp\\push stack
movl %esp,%ebp \\= intel mov ebp,esp
addl 8(%edp),%eax \\= intel add eax,[edp+8]
addl %eax,accum \\= intel add accum,eax
movl %edp,%esp \\intel mov esp,edp
pop %ebp \\pop stack
ret \
#2
这是AT&T格式的指令,与intel格式不同
#3
.prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
这个是intel格式吗,那这个呢
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
我哪里去找gp 是什么,a0,t0
请高手不要不屑!!
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
这个是intel格式吗,那这个呢
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
我哪里去找gp 是什么,a0,t0
请高手不要不屑!!
#4
intel 格式有$0吗,我不明白?
#5
a0 t0 ...
代表了不同的寄存器类型
代表了不同的寄存器类型
#6
请问那里有
prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
中gp,a0,t1,v0的详细解释吗???????
prologue 1
addl $16,$17,$0
lda $2,accum
ldl $1,0($2)
addq $0,$1,$1
stl $1,0($2)
ret $31,($26),1
.end sum
0000000000000000 <sum>:
0: 01 00 bb 27 ldah gp,1(t12)
4: 40 80 bd 23 lda gp,-32704(gp)
8: 00 00 11 42 addl a0,a1,v0
c: 10 80 5d a4 ldq t1,-32752(gp)
10: 00 00 22 a0 ldl t0,0(t1)
14: 01 04 01 40 addq v0,t0,t0
18: 00 00 22 b0 stl t0,0(t1)
1c: 01 80 fa 6b ret
中gp,a0,t1,v0的详细解释吗???????