gdbstub/build/kernel.dump

94 lines
3.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

build/kernel.elf: file format elf64-littleriscv
Disassembly of section .text:
0000000080000000 <_start>:
.section .text.entry
.global _start
_start:
# 初始化栈(使用链接脚本中定义的 stack_top
la sp, stack_top
80000000: 00000117 auipc sp,0x0
80000004: 0a010113 addi sp,sp,160 # 800000a0 <stack_top>
# 调用 main 函数
call main
80000008: 030000ef jal 80000038 <main>
000000008000000c <loop>:
# main 返回后进入死循环
loop:
j loop
8000000c: a001 j 8000000c <loop>
000000008000000e <add>:
int add(int a, int b) {
8000000e: 1101 addi sp,sp,-32
80000010: ec22 sd s0,24(sp)
80000012: 1000 addi s0,sp,32
80000014: 87aa mv a5,a0
80000016: 872e mv a4,a1
80000018: fef42623 sw a5,-20(s0)
8000001c: 87ba mv a5,a4
8000001e: fef42423 sw a5,-24(s0)
return a + b; // 待调试的函数
80000022: fec42783 lw a5,-20(s0)
80000026: 873e mv a4,a5
80000028: fe842783 lw a5,-24(s0)
8000002c: 9fb9 addw a5,a5,a4
8000002e: 2781 sext.w a5,a5
}
80000030: 853e mv a0,a5
80000032: 6462 ld s0,24(sp)
80000034: 6105 addi sp,sp,32
80000036: 8082 ret
0000000080000038 <main>:
int main() {
80000038: 7179 addi sp,sp,-48
8000003a: f406 sd ra,40(sp)
8000003c: f022 sd s0,32(sp)
8000003e: 1800 addi s0,sp,48
int x = 5;
80000040: 4795 li a5,5
80000042: fef42623 sw a5,-20(s0)
int y = 3;
80000046: 478d li a5,3
80000048: fef42423 sw a5,-24(s0)
int result = add(x, y);
8000004c: fe842703 lw a4,-24(s0)
80000050: fec42783 lw a5,-20(s0)
80000054: 85ba mv a1,a4
80000056: 853e mv a0,a5
80000058: fb7ff0ef jal 8000000e <add>
8000005c: 87aa mv a5,a0
8000005e: fef42223 sw a5,-28(s0)
volatile char *tohost_addr = (volatile char *)(0x80001000 - 4);
80000062: 200007b7 lui a5,0x20000
80000066: 3ff78793 addi a5,a5,1023 # 200003ff <_start-0x5ffffc01>
8000006a: 078a slli a5,a5,0x2
8000006c: fcf43c23 sd a5,-40(s0)
*tohost_addr = 0xff;
80000070: fd843783 ld a5,-40(s0)
80000074: 577d li a4,-1
80000076: 00e78023 sb a4,0(a5)
*tohost_addr = result;
8000007a: fe442783 lw a5,-28(s0)
8000007e: 0ff7f713 zext.b a4,a5
80000082: fd843783 ld a5,-40(s0)
80000086: 00e78023 sb a4,0(a5)
return 0;
8000008a: 4781 li a5,0
}
8000008c: 853e mv a0,a5
8000008e: 70a2 ld ra,40(sp)
80000090: 7402 ld s0,32(sp)
80000092: 6145 addi sp,sp,48
80000094: 8082 ret