aboutsummaryrefslogtreecommitdiff
path: root/machine/mtrap.c
AgeCommit message (Collapse)AuthorFilesLines
2022-02-17Fix sbi_console_getchar return value if no UART is presentAndrew Waterman1-1/+1
The UART drivers all return -1 if no character is present, and so that's what we should do if there's no UART at all. See discussion on https://github.com/riscv-non-isa/riscv-sbi-doc/issues/82
2021-05-05machine: replace `mbadaddr` with `mtval` (#242)Saleem Abdulrasool1-2/+2
The LLVM IAS does not support the older name for the `mtval` CSR. This updates the name to the current spelling, which is required to build with the LLVM IAS. This remains compatible with binutils as well.
2021-05-05replace `sbadaddr` with `stval` (#243)Saleem Abdulrasool1-1/+1
This replaces use of the old `sbadaddr` CSR name with the current `stval` name. The old spelling is not supported by the LLVM IAS, however, the modern spelling is supported by both LLVM and binutils.
2020-12-15Add support for the UART interface on the LiteX SoC (#230)gsomlo1-0/+5
Tested using the RocketChip CPU option. (see https://github.com/enjoy-digital/litex) Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2019-07-05Report correct scause when faulting while fetching emulated instructionAndrew Waterman1-3/+19
2018-07-09Properly license all nontrivial filesAndrew Waterman1-0/+2
2018-03-05mtrap: add a halt IPI used for poweroff (#86)Wesley W. Terpstra1-11/+12
Otherwise, linux complains the moment an interrupt arrives and wakes up one of the not-looping cores.
2018-01-22mtrap: loop forever, reallyWesley W. Terpstra1-1/+1
gcc sometimes takes liberties with optimizing away our important halt function!
2017-12-12Add a 16550 UART driver to back the SBI consolePalmer Dabbelt1-0/+5
QEMU currently provides the console via HTIF and the SBI. That's a bit messy because BBL polls for serial input, which means that typing too quickly loses characters. While QEMU has a standard 16550 device model, there's no way to have two consoles share the console in QEMU (as they'd step all over each other) so that means we can't have both the HTIF console and the 16550 console. With this patch, QEMU can be changed to use a 16650 instead of the HTIF for serial output. Linux will use the SBI for early printk support (which is fine, polling for output is stable) and then swap over as soon as it detects the UART. When Linux swaps it prints out the whole history, but there's probably a way to get around that. There's a few lines that are output to both, but it appears the Linux driver is close enough to ours that nothing catastrophic happens -- there's not much to the device, so hopefully that pans out on real hardware too. Once Linux swaps over to natively using the driver we get reliable console input. If you don't have the in-kernel driver then Linux never swaps over and keeps using the SBI console just like before.
2017-11-03Remove the platform interfacePalmer Dabbelt1-4/+3
We now automatically detect everything that the platform interface used to be used for, so it's now obsolete!
2017-11-02Detect harts that can't boot Linux instead of hard-coding themPalmer Dabbelt1-1/+2
This checks to see if a hart can't boot Linux by looking for a compatible "mmu-type" field. If the hart can't boot Linux, then bbl masks it off.
2017-08-14finisher: support terminating sifive devices simulation (#61)Wesley W. Terpstra1-2/+5
2017-08-03Add the '--enable-print-device-tree' argumentPalmer Dabbelt1-4/+8
I'm trying to debug some device tree problems while booting Linux and figured it would be really nice to have access to the device tree while trying to debug these problems. I think this might be useful for lots of people, so I went ahead and cleaned up the code enough that it should actaully work in most cases.
2017-08-02Move DISABLED_HART_MASK to the platformPalmer Dabbelt1-1/+1
Some platforms can't boot Linux on all the harts. This commit allows platforms to define the set of harts that should be prevented from booting past BBL. This is essentially just a new mechanism for defining the DISABLED_HART_MASK.
2017-08-02Allow the platform to disable HTIFPalmer Dabbelt1-3/+10
2017-04-11Always write sbadaddr on trap redirectionAndrew Waterman1-4/+4
2017-04-05Remove num_harts; use hart_mask exclusivelyAndrew Waterman1-1/+2
2017-04-05Rename HART_MASK to DISABLED_HART_MASK to clarify polarityAndrew Waterman1-1/+1
2017-04-05bbl: prevent named cores from bootingWesley W. Terpstra1-0/+1
2017-03-27uart: add physical device driverWesley W. Terpstra1-2/+11
2017-03-27Separate page faults from physical memory access exceptionsAndrew Waterman1-2/+10
2017-03-16Simplify interrupt-stack disciplineAndrew Waterman1-2/+2
https://github.com/riscv/riscv-isa-manual/commit/f2ed45b1791bb602657adc2ea9ab5fc409c62542
2017-02-20WIP on SBIAndrew Waterman1-43/+35
2017-02-19Handle IPIs and timer interrupts more quicklyAndrew Waterman1-52/+23
2017-02-17WIP towards ECALL interface for SBIAndrew Waterman1-8/+0
2017-02-15Cleanly separate HTIF code; don't poll keyboard on timer interruptAndrew Waterman1-83/+6
2017-02-15Incorporate sptbr/sfence.vma changesAndrew Waterman1-1/+3
2016-12-06avoid non-standard predefined macrosAndrew Waterman1-1/+1
2016-11-04Acquire lock before attempting tohost/fromhost sequencesAndrew Waterman1-12/+23
2016-08-16add htif section in linker script, with ALIGNs to prevent MMIO and data from ↵Sagar Karandikar1-2/+2
being placed on same page (#32)
2016-07-16Improve trap redirection codeAndrew Waterman1-7/+6
2016-06-01Clear IPIs using MMIO, not mip CSRAndrew Waterman1-1/+1
2016-05-05Poll HTIF console on timer interruptAndrew Waterman1-2/+15
2016-05-03Find IPI address in configuration stringAndrew Waterman1-2/+1
2016-05-02Don't use tohost/fromhost registers; communicate with host via memoryAndrew Waterman1-13/+18
2016-04-29Remove mtime/mtimecmpAndrew Waterman1-7/+3
2016-03-10Remove dead codeAndrew Waterman1-2/+0
2016-03-10Set time comparator correctly on RV32Andrew Waterman1-4/+9
The old code truncated the upper 32 bits, and even if it got that right, it would have generated spurious interrupts.
2016-03-09Refactor pk, bbl, machine into separate librariesAndrew Waterman1-0/+287
Yuck.