mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.58k stars 2.38k forks source link

added a timerhalt() function #176

Open meighti opened 1 year ago

meighti commented 1 year ago

The virt QEMU board integrates a "test finisher" device. Writing FINISHER_PASS(=0x5555) to its address which is VIRT_TEST(=0x100000), will halt virt machine.

Since this should be done in machine mode, a new flag is set by timerhalt() in supervisor mode. Later timervec() will check this flag, which is at the end of timer scratch area. If the halt flag is not zero, it will branch to halt.

It can be used to halt when kernel panics in printf.c It can be triggered in user mode by killing init process, using the following command at shell: kill 1

Related to issue #60