aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-05-22Don't require software check exceptions be delegableHEADmasterAndrew Waterman1-3/+5
2024-05-20Merge branch 'mylai-mtk-zicfilp-upstream'Andrew Waterman4-18/+47
2024-05-20update encoding.hAndrew Waterman1-1264/+56
2024-05-20Use kassert in load_elf (#327)Zixian Cai1-3/+3
Signed-off-by: Zixian Cai <2891235+caizixian@users.noreply.github.com>
2024-05-20support emulation of misaligned vector loads/storesAndrew Waterman4-0/+156
2024-05-20Support emulation of misaligned FLH/FSHAndrew Waterman1-1/+8
2024-05-20Fix emulation of misaligned c.swsp/c.sdsp with rd=x0Andrew Waterman1-2/+2
2024-05-20Implementation of riscv_hwprobe syscall from Linux (#325)Wojciech Muła4-0/+55
See: https://www.kernel.org/doc/html/latest/arch/riscv/hwprobe.html
2024-05-20mprotect whole ELF segment, not just file portionAndrew Waterman1-3/+3
2024-05-20Don't mmap ELF segments with zero fileszAndrew Waterman1-2/+4
2024-05-20Add ELF header sanity checkAndrew Waterman1-0/+2
2024-05-20Implement syscall readlinkat and readv (#318)mylai-mtk2-0/+88
* Implement syscall readlinkat * Implement syscall readv by read syscalls Since pk lacks kernel-space dynamic memory management, we implement readv with normal read syscalls rather than forwarding it to spike
2024-05-20Remove "bbl loader" message (#313)Andrew Waterman1-1/+0
It was originally added as a temporary hack to hide a race condition in a prototype. It should've been removed long ago. Resolves #312
2024-05-17update encoding.hAndrew Waterman1-12672/+3149
2024-04-30Use kassert in load_elf (#327)Zixian Cai1-3/+3
Signed-off-by: Zixian Cai <2891235+caizixian@users.noreply.github.com>
2024-04-30support emulation of misaligned vector loads/storesAndrew Waterman4-0/+156
2024-04-30Support emulation of misaligned FLH/FSHAndrew Waterman1-1/+8
2024-04-25Fix emulation of misaligned c.swsp/c.sdsp with rd=x0Andrew Waterman1-2/+2
2024-04-23Implementation of riscv_hwprobe syscall from Linux (#325)Wojciech Muła4-0/+55
See: https://www.kernel.org/doc/html/latest/arch/riscv/hwprobe.html
2024-04-17mprotect whole ELF segment, not just file portionAndrew Waterman1-3/+3
2024-04-17Don't mmap ELF segments with zero fileszAndrew Waterman1-2/+4
2024-04-17Add ELF header sanity checkAndrew Waterman1-0/+2
2024-03-22Implement syscall readlinkat and readv (#318)mylai-mtk2-0/+88
* Implement syscall readlinkat * Implement syscall readv by read syscalls Since pk lacks kernel-space dynamic memory management, we implement readv with normal read syscalls rather than forwarding it to spike
2024-02-15Zicfilp: Handle software check exception -- landing pad faultMing-Yi Lai3-1/+21
2024-02-15Add index comments to machine trap table to enhance code readabilityMing-Yi Lai1-17/+17
2024-02-15Zicfilp: Support enabling userspace Zicfilp mechanismMing-Yi Lai1-0/+9
2024-02-15Zicfilp: Regenerate machine/encoding.hMing-Yi Lai1-12381/+4066
2024-01-28Remove "bbl loader" message (#313)Andrew Waterman1-1/+0
It was originally added as a temporary hack to hide a race condition in a prototype. It should've been removed long ago. Resolves #312
2023-11-17add support for "riscv-none-*" host name (#309)valentinThomazic1-1/+4
2023-05-16Revert "[GCC]: Fix fence.i bug (#296)"Andrew Waterman1-15/+4
This reverts commit 54de960a5e4c91734fcfd454fdc7e593c6ac571d. See #298 for explanation.
2023-05-02[GCC]: Fix fence.i bug (#296)Mark Goncharov1-4/+15
There are many issues: 260, 285, 287 has to be solved This workaround helps to add neccessary zicsr and zifencei for cssr and fence.i accordingly.
2023-05-01pk: fix __do_brk when new addr is not feasible (#295)xukl2-7/+3
Linux kernel simply return current brk when request brk addr is not feasible. The pk should probably do the same.
2023-03-27Revert "Revert "SBI emulation of reads and writes to perf counters and ↵Andrew Waterman1-0/+58
config (#98)"" This reverts commit 7ae86fb97b792586493255f935f2f12ff068b13f. This will continue to allow accesses to cycle/time via mcycle/mtime despite https://github.com/riscv-software-src/riscv-isa-sim/pull/1297. The hope is this will keep most people happy while doing the right thing with Spike.
2023-01-05Regenerated the configure file with autoconf 2.71 (#288)Kenneth Ostby1-1262/+2101
Regenerated the configure file using autoconf 2.71 to avoid the Syntax error problem when running on OSX/AArch64.
2022-08-05Specify text section in rest_of_boot_loader definitionAndrew Waterman1-1/+3
Fixes #282
2022-04-30Fix a file leak in function `at_kfd` (#276)MaxXing1-1/+3
2022-04-20Link -lgcc if it existsLucheng Zhang2-15/+130
2022-04-11Handle unimplemented syscalls gracefullyAndrew Waterman1-11/+1
We previously kernel-panicked because that made it more obvious when a syscall implementation was missing. These days, it's more common that the C library will do something sensible in response to returning -ENOSYS. Favor that approach to avoid frustrating users.
2022-04-08Stub out sysinfo syscallAndrew Waterman3-260/+10462
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
2022-02-08Fix local variable register usage for ra (#268)Fangrui Song2-3/+2
See https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables "Other than when invoking the Extended asm, the contents of the specified register are not guaranteed." Also revert 90191ad93eac47d61ab9cc89084050ad1541d160.
2022-02-07Eliminate Wuninitialized for Clang/LLVM (#266)Zenithal1-1/+1
2022-02-07Eliminate Wunknown-pragmas for Clang/LLVM (#265)Zenithal1-1/+1
2022-01-28Merge branch 'compnerd-virtualize'Andrew Waterman1-1/+2
2022-01-28pk: thwart an attempt from the compiler to optimizeSaleem Abdulrasool1-1/+2
The memory manager maintains the first free page as the page after the `_end` synthetic emitted by the linker. This value is stored in a translation unit local variable. This value is only ever written to from `init_early_alloc` which is static and only ever invoked from `pk_vm_init`. Furthermore, the value that `first_free_page` is ever set to is computed as a rounding of the _address_ of `_end`. Because the address of the symbol cannot change during execution of a normal program, this is effectively a constant, making the computed value a "constant" which can be re-materialized. Now, with the knowledge that the value is effectively a constant that can be re-materialized and the fact that the value is ever written to at a single position, we can simply re-materialize the value if it was ever changed in `free_page_addr`. This will allow the 8-byte value to be truncated to 1-byte. Now, we can inline `__early_pgalloc_align`, and because the combination of `__early_alloc` and `__early_pgalloc_align` is small, we can inline that again at the two sites locally. This changes the `__augment_page_freelist` to re-materialize the constant when needed for the allocation. The re-materialization however uses a pc-relative addressing, which now computes a different value than expected - the address has become a VA rather than a PA. This results in the address computed by `free_page_addr` (which is the result of the `__early_pgalloc_align`) to be a virtual address after the relocation, which then propagates through `__early_alloc` to the value in `__augment_page_freelist`, which is then consumed by `__page_alloc`, which will treat the now VA as a PA and perform an additional translation to a VA. Mark the value as `volatile` to indicate that the value must be read at all points to thwart the size optimization of the compiler resulting in a mis-compilation resulting in the eventual invalid memory access during the `memset` that follows the allocation. Thanks to @nzmichaelh for the help in tracking this down!
2022-01-09fix file leakAndrew Waterman1-1/+1
Eliminate excess reference count when associating fd with file. Fixes #258
2021-11-22Reduce tightness of mideleg register assertion (required for H-extension) (#256)Andreas Kuster1-1/+1
2021-09-20Fix fcsr save slot address calculationAndrew Waterman1-1/+1
h/t @jrtc27
2021-09-15Revert "SBI emulation of reads and writes to perf counters and config (#98)"Andrew Waterman1-58/+0
This reverts commit fd2ddce557a9085ccdba1a455eded4808e7466c6. The SBI took a different approach (explicit SBI call) to support writing the counters, rather than using traps.
2021-08-27pk: correct the handling of SYS_getcwd (#250)Saleem Abdulrasool1-1/+1
`SYS_getcwd` is different from `getcwd` in that the return value is < 0 on failure otherwise it is the length of the string. The proxy kernel was treating 0 as success and all other values as error. As a result, we would never return a valid value for `getcwd`. The following program now executes properly with the Proxy Kernel: ```c #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <linux/limits.h> int main(int argc, char **argv) { unsigned char buffer[PATH_MAX + 1] = {0}; if (getcwd(buffer, PATH_MAX)) printf("cwd: %s\n", buffer); return EXIT_SUCCESS; } ```