aboutsummaryrefslogtreecommitdiff
path: root/pk
AgeCommit message (Collapse)AuthorFilesLines
2021-05-18Add 2-stage translation (for debugging purposes only)remapAndrew Waterman5-0/+91
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-05replace `spbtr` with `satp` (#241)Saleem Abdulrasool1-1/+1
The LLVM IAS currently does not support the older spelling for the CSR. Update the references to the modern name.
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.
2021-04-28pk: Fix __clear_cache() compilation issue with recent compilers (#240)Christoph Müllner1-1/+2
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-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 Waterman1-0/+2
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-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-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-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-03-16Fix CPI calcualtion for -s option (#192)davidmetz1-1/+1
This attempt at rounding leads to wrong results, for example: 314689951 cycles 314690101 instructions 0.90 CPI With my change results in: 314689951 cycles 314690101 instructions 0.99 CPI I think this was supposed to be part of rounding behaviour but it doesn't work if only the final digit does it and there is no carry... Instead I changed it to truncate after the second digit
2020-01-13Enable vector unit if present (continuation of ↵Andrew Waterman1-1/+1
77a5df569451571d608650a34183d53df99790ec)
2019-10-23Add --help (#179)Luís Marques1-14/+35
2019-10-22Implement dup3 syscall (#162)Luís Marques4-0/+32
2019-10-22Make performance counters always 64 bits wide (#178)Luís Marques4-18/+77
This prevents the counters from easily overflowing for a 32-bit pk.
2019-10-01Only accept statically linked binaries (#176)Luís Marques2-0/+4
2019-06-11configure: Add option to set physical memory start addressGabriel L. Somlo1-1/+1
For systems where physical memory is mapped to a start address different from 0x80000000, allow the default to be overridden using the --with-mem-start argument to the configure script. Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2019-05-09Allow up to 2 KiB of argumentsAndrew Waterman1-1/+4
Closes #161
2019-03-24Fix build with newer newlibAndrew Waterman2-2/+3
2019-02-28Stub out madvise syscall (#145)Luís Marques2-0/+2
2019-01-04Implement clock_gettime syscall (#139)Luís Marques1-1/+10
2019-01-04Page-align the writable data sectionAndrew Waterman1-1/+2
For eventual PMP purposes
2019-01-04Clean up linker scripts a bitAndrew Waterman1-4/+1
2018-08-06Add some exception handling functions to s-mode to handle exception return ↵wxjstz1-0/+28
from m-mode. (#117)
2018-07-09Properly license all nontrivial filesAndrew Waterman7-0/+14
2018-04-24Enable FPU in PK, regardless of FPU presenceAndrew Waterman1-1/+1
Otherwise, the emulation code will refuse to emulate FP instructions.
2018-02-01Bump the Linux version PK claims to supportAndrew Waterman1-1/+1
This makes it more compatible with recent glibc.
2017-12-12Bump encoding.hAndrew Waterman1-1/+1
2017-11-03Remove the platform interfacePalmer Dabbelt2-1/+1
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-0/+1
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-10-19Order __page_alloc before writing vmrsAndrew Waterman1-2/+6
2017-08-29Stub out sys_prlimit64Andrew Waterman2-0/+2
2017-08-02Add a platform interfacePalmer Dabbelt1-0/+1
SiFive's pk fork is the second one I've had to maintain, and it's a huge pain because people keep just leaving changes all over the tree. I want to introduce an interface that the platform-specific details can live behind so I don't have to keep doing these painful merges.
2017-04-18Increase PK stack size to 3% of memory, up to 8 MiBAndrew Waterman1-1/+1