Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sbi-con: do not panic on keypresses during boot (and remove useless l…
…ock) If you hit a key during boot before the line "console [sbi_console0] enabled", enjoy: [ 0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000018 [ 0.000000] Oops [#1] [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 4.6.2-g2afb779-dirty riscvarchive#9 [ 0.000000] task: ffffffff80624410 ti: ffffffff80620000 task.ti: ffffffff80620000 [ 0.000000] sepc: ffffffff802837f0 ra : ffffffff802837dc sp : ffffffff80621ca8 [ 0.000000] gp : ffffffff80646ec0 tp : ffffffff80624410 t0 : ffffffff8064bff0 [ 0.000000] t1 : 000000000000001e t2 : 0000000000008000 s0 : ffffffff80621cd8 [ 0.000000] s1 : 000000000000006a a0 : 0000000000000008 a1 : ffffffff8064b3b8 [ 0.000000] a2 : 000000000000001e a3 : 0000000000000017 a4 : 0000000000000000 [ 0.000000] a5 : ffffffff8064a000 a6 : 0000000000000001 a7 : 0000000000000000 [ 0.000000] s2 : ffffffff8064a000 s3 : 0000000000000000 s4 : 8000000000000001 [ 0.000000] s5 : 00000000024000c0 s6 : 00000000024000c0 s7 : 0000000000000020 [ 0.000000] s8 : 0000000000000010 s9 : 00000000000000c0 s10: ffffffff8f499c80 [ 0.000000] s11: ffffffff8f003300 t3 : 0000000000000001 t4 : 0000000000000002 [ 0.000000] t5 : 000000000000001e t6 : ffffffff8064b3cf [ 0.000000] sstatus: 0000000000040100 sbadaddr: 0000000000000018 scause: 0000000000000005 [ 0.010000] ---[ end trace cb88537fdc8fa200 ]--- [ 0.010000] Kernel panic - not syncing: Fatal exception in interrupt [ 0.010000] ---[ end Kernel panic - not syncing: Fatal exception in interrupt We cannot just turn off software interrupts; we still want timer events. So, while booting, simply discard keypresses until the tty is initialized. The lock was removed since it guards against nothing. It is safe to put characters into an initialized tty from any thread.
- Loading branch information