$ make run Press Ctrl-A and then X to exit QEMU ------------------------------------ Hello, RVOS!
但是如果我们把 bnez t0, park 注释掉,就会发生错误:
1 2 3 4 5 6 7 8 9 10 11
$ make run Press Ctrl-A and then X to exit QEMU ------------------------------------ Hello, RVOS! HelloeHell, RVOS! llo, RVOS! llo, RVOS! Hello, RVOS! o, RVOS! Hello, RVOS! ello, RVOS!
$ make debug Press Ctrl-C and then input 'quit' to exit GDB and QEMU ------------------------------------------------------- Reading symbols from out/os.elf... Breakpoint 1 at 0x80000000: file start.S, line 11. 0x00001000 in ?? () => 0x00001000: 97 02 00 00 auipc t0,0x0
Thread 1 hit Breakpoint 1, _start () at start.S:11 11 csrr t0, mhartid # read current hart id => 0x80000000 <_start+0>: f3 22 40 f1 csrr t0,mhartid (gdb) si 12 mv tp, t0 # keep CPU's hartid in its tp for later usage. => 0x80000004 <_start+4>: 13 82 02 00 mv tp,t0 (gdb) si [Switching to Thread 1.3]
Thread 3 hit Breakpoint 1, _start () at start.S:11 11 csrr t0, mhartid # read current hart id => 0x80000000 <_start+0>: f3 22 40 f1 csrr t0,mhartid (gdb) si 12 mv tp, t0 # keep CPU's hartid in its tp for later usage. => 0x80000004 <_start+4>: 13 82 02 00 mv tp,t0 (gdb) si [Switching to Thread 1.8]
Thread 8 hit Breakpoint 1, _start () at start.S:11 11 csrr t0, mhartid # read current hart id => 0x80000000 <_start+0>: f3 22 40 f1 csrr t0,mhartid (gdb)
上面的例子就说明这样的事实。
uart
可以看到上面的 kernel 打印出了字符。事实上,qemu 不仅仅提供了 cpu 和内存,它还提供了一系列设备,其中就包括 uart 设备。