aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2021-08-12Fix build break from recent merge conflictAndrew Waterman1-1/+1
Resolves #249
2021-08-04Use __builtin_frame_address() instead of "sp" directly.John Baldwin1-3/+3
Also use pointer arithmetic on char * instead of void *.
2021-08-04Revert "machine: fix a case of undefined behaviour with SP handling (#245)"Andrew Waterman1-8/+3
This reverts commit 5450c2f731f16abe3a4f244c383c55f559c97359.
2021-08-04Revert "Revert "Use a global 'tp' register.""Andrew Waterman1-5/+7
This reverts commit 717702ceec053afd424a41ef6a4078d3cbd755b8.
2021-08-04Revert "Use __builtin_frame_address() instead of "sp" directly."Andrew Waterman1-4/+9
This reverts commit 17bec41e9bd44c43901938b784680661b9b28a76.
2021-08-04Use __builtin_frame_address() instead of "sp" directly.John Baldwin1-9/+4
Also use pointer arithmetic on char * instead of void *.
2021-08-04Revert "Use a global 'tp' register."Andrew Waterman1-7/+5
This reverts commit 0d1fdc2e24b7b6247a55d24c13ae85dca7f45695.
2021-08-04Use a global 'tp' register.John Baldwin1-5/+7
clang only supports register variables if they are declared globally.
2021-08-04Revert "machine: correct some additional cases of UB (#246)"Andrew Waterman1-18/+4
This reverts commit e8d15a489fa76612707ff9e99feb0fb36acc9f14.
2021-06-16Set desired endianness at boot time (#247)Marcus Comstedt2-0/+27
2021-05-18Add __early_pgalloc_align; refactor __early_alloc to use itAndrew Waterman1-3/+11
2021-05-18Fix range checkAndrew Waterman1-2/+3
2021-05-07pk: make breakpoints fatalAndrew Waterman1-2/+1
Resolves #216
2021-05-07machine: correct some additional cases of UB (#246)Saleem Abdulrasool1-4/+18
Use of asm aliased register variables in local scope can only be used for extended assembly parameters. This changes the few instances of this in the floating point emulation to use the GNU extended assembly syntax to access the `tp` register. This ensures that we do not rely on undefined behaviour. This was uncovered when building the Proxy kernel with clang and LLVM.
2021-05-07machine: fix a case of undefined behaviour with SP handling (#245)Saleem Abdulrasool1-3/+8
The use of `asm` for register aliasing is supported in two different contexts: - local variables (including GNU expression statements) where it may only be used for specifying registers for input and output operands to extended `asm` syntax. c.f. https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables - global variables where it may be used to observe the contents of a register. c.f. https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html#Global-Register-Variables The two options here is to either to hoist the variable out into a global variable, but then it should not be in a header due to fears of ODR in case the optimizer does not inline it away, and thus becomes a bit more tricky. The alternative that this change actually adopts is to explicitly use a move to copy the value out via the GNU extended assembly syntax. With this change, it is now possible to build the Proxy Kernel completely with clang/LLVM and link with LLD. The generated kernel also runs under SPIKE and behaves as expected in a simple smoke test (without any executable prints the expected message, and runs a trivial RVV example).
2021-05-06machine: manually perform assembler relaxation (#244)Saleem Abdulrasool1-1/+3
This is an equivalent rewrite of the existing code. When building with gas, the `bltu` would implicitly get relaxed to the `bgeu` + `j`. This relaxation is required as the `init_other_hart` is not guaranteed to be addressable in 12-bits. When building with the LLVM IAS instead of gas we fail to link as the branch is not relaxed. This change enables LLVM to build and link this code with the LLVM IAS and lld.
2021-05-05replace `spbtr` with `satp` (#241)Saleem Abdulrasool2-2/+2
The LLVM IAS currently does not support the older spelling for the CSR. Update the references to the modern name.
2021-05-05machine: replace `mbadaddr` with `mtval` (#242)Saleem Abdulrasool4-6/+6
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 Abdulrasool2-2/+2
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.
2021-04-28pk: Fix __clear_cache() compilation issue with recent compilers (#240)Christoph Müllner2-1/+10
Using recent compilers we get the following error message: ../pk/pk.c: In function 'run_loaded_program.constprop': ../pk/pk.c:177:3: error: both arguments to '__builtin___clear_cache' must be pointers 177 | __clear_cache(0, 0); | ^~~~~~~~~~~~~~~~~~~ Let's use the existing function __riscv_flush_icache(), give it a header with a prototype and use it to emits the FENCE.I instruction directly. See #239 Suggested-by: Andrew Waterman <andrew@sifive.com> Signed-off-by: Christoph Muellner <cmuellner@linux.com>
2021-04-05LiteX UART: fix compatible property name (#237)gsomlo1-1/+2
The upstream LiteX project defaults to "litex,liteuart" as the value for the "compatible" property of the UART DT node, so let's add it to the current list of accepted strings. Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2021-03-29pk: vm cleanups; use narrower TLB flushesAndrew Waterman1-9/+15
2021-03-29pk: remove vestigial trapframe_t::insn fieldAndrew Waterman4-14/+1
This assumes that stval is populated with the opcode on illegal instruction exceptions. But since we're only using the opcode for error reporting, it's OK if this assumption is violated.
2021-03-29M-mode code doesn't need access to pk's page tableAndrew Waterman3-2/+2
2021-03-29update encoding.hAndrew Waterman1-267/+1145
2021-03-29pk: correctly restore sstatus.SUM in strcpy_from_userAndrew Waterman1-3/+7
2021-03-26pk: support printk before file initAndrew Waterman2-4/+3
2021-03-26pk: don't init files until VM setup is completeAndrew Waterman1-2/+2
2021-03-25pk: refactor vm free list managementAndrew Waterman4-61/+115
2021-03-25pk: support >2 GiB of user memory for RV64Andrew Waterman7-34/+76
Previously, the pk would always run from virtual address MEM_START. Instead, remap it into the negative virtual addresses, allowing user processes to expand beyond MEM_START.
2021-03-25Add some missing syscall stubsAndrew Waterman2-0/+10
2021-03-25pk: avoid assertion failures on brk syscallsAndrew Waterman1-3/+5
Return the old brk if mmap fails, rather than just asserting out
2021-03-25pk: avoid out-of-memory errorsAndrew Waterman2-50/+107
Estimate available memory and return -1 from mmap if not enough is available, rather than assert-failing.
2021-03-25pk: remove linear VA mapping constraintAndrew Waterman1-46/+83
This will improve flexibility going forward.
2021-03-25pk: only access user memory through explicit accessorsAndrew Waterman9-77/+278
Enforced with sstatus.SUM.
2021-03-25Add `statx` syscall (#234)huaixv3-0/+23
2020-12-15Add support for the UART interface on the LiteX SoC (#230)gsomlo5-1/+101
Tested using the RocketChip CPU option. (see https://github.com/enjoy-digital/litex) Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2020-11-29Remove unused file_stat, copy_stat functionsAndrew Waterman4-28/+0
2020-11-29Remove use of copy_stat() from sys_fstat and sys_lstat (#228)Marcus Comstedt1-2/+4
2020-11-23use MEM_START, not DRAM_BASE, for pk mappingsAndrew Waterman2-3/+3
2020-11-23Fix emulation of misaligned access on big endian target (#224)Marcus Comstedt2-3/+32
2020-11-16Merge pull request #222 from zeldin/stat-struct-formatAndrew Waterman1-1/+1
Remove use of copy_stat() from sys_fstatat
2020-11-17Remove use of copy_stat() from sys_fstatatMarcus Comstedt1-1/+1
The system call should return the stat struct in kernel format, not libc format.
2020-11-12Merge pull request #220 from zeldin/big-endianAndrew Waterman2-3/+8
Big endian
2020-11-11pk: Fix pushing of argc to match linux kernel behaviourMarcus Comstedt1-3/+3
The linux kernel pushes argc as an int, not an uintptr_t. (The offset to the next element is still sizeof(uintptr_t).)
2020-11-11fdt: Skip byteorder swap on big endianMarcus Comstedt1-0/+5
2020-10-31Disable device tree filter when load a dts from file (#219)Yan7-1/+60
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter * Remove *.dtb dependence, when the --with-dts option is not used
2020-10-30Revert "Disable device tree filter when load a dts from file (#217)"Andrew Waterman7-54/+1
This reverts commit a161e6f3ef31004e47a5b94b85c2e84b764f8637. Resolves #218
2020-10-29Disable device tree filter when load a dts from file (#217)Yan7-1/+54
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter
2020-08-07make htif_poweroff thread-safe (#211)Howard Mao1-2/+3