The following kernel_main function calls another function, but the red line jump I found that it only jumps to the previous line of instruction set, why is this? Shouldn't you jump to the position of func1?
C语言代码如下:
```c
int add_c(int a,int b)
{
return a+b;
}
int func1(void)
{
int a=1;
int b=2;
return add_c(a,b);
}
void main(void)
{
func1();
}
The other two functions are disassembled as follows :
0000000000000000 <add_c>:
0: 1101 add sp,sp,-32
2: ec22 sd s0,24(sp)
4: 1000 add s0,sp,32
6: 87aa mv a5,a0
8: 872e mv a4,a1
a: fef42623 sw a5,-20(s0)
e: 87ba mv a5,a4
10: fef42423 sw a5,-24(s0)
14: fec42783 lw a5,-20(s0)
18: 873e mv a4,a5
1a: fe842783 lw a5,-24(s0)
1e: 9fb9 addw a5,a5,a4
20: 2781 sext.w a5,a5
22: 853e mv a0,a5
24: 6462 ld s0,24(sp)
26: 6105 add sp,sp,32
28: 8082 ret
000000000000002a <func1>:
2a: 1101 add sp,sp,-32
2c: ec06 sd ra,24(sp)
2e: e822 sd s0,16(sp)
30: 1000 add s0,sp,32
32: 4785 li a5,1
34: fef42623 sw a5,-20(s0)
38: 4789 li a5,2
3a: fef42423 sw a5,-24(s0)
3e: fe842703 lw a4,-24(s0)
42: fec42783 lw a5,-20(s0)
46: 85ba mv a1,a4
48: 853e mv a0,a5
4a: 00000097 auipc ra,0x0
4e: 000080e7 jalr ra # 4a <func1+0x20>
52: 87aa mv a5,a0
54: 853e mv a0,a5
56: 60e2 ld ra,24(sp)
58: 6442 ld s0,16(sp)
5a: 6105 add sp,sp,32
5c: 8082 ret
0 Answer
No answer yet
这家伙很懒,什么都没留下...