riscv-pk | V Proxy Kernel , pk , is a lightweight application
kandi X-RAY | riscv-pk Summary
kandi X-RAY | riscv-pk Summary
RISC-V Proxy Kernel and Boot Loader.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of riscv-pk
riscv-pk Key Features
riscv-pk Examples and Code Snippets
def __init__(self):
self.velocityX=4
self.velocityY=4
self.X=random.randint(0,768)
self.Y=random.randint(0,350)
@GetMapping("/teapot")
@ResponseStatus(HttpStatus.I_AM_A_TEAPOT)
public void teaPot() {
}
public void setNumberOfCarsInPark(Integer numberOfCarsInPark) {
this.numberOfCarsInPark = numberOfCarsInPark;
}
Community Discussions
Trending Discussions on riscv-pk
QUESTION
I would like to instrument a program to access hardware performance counters.
I have compiled a basic Rocketchip (freechips.rocketchip.system-DefaultConfig
) and am using riscv-pk
to run a binary. I am running a simulation of the core in Verilator, having compiled it all with largely defaults in the UCB Chipyard project.
The C for the binary is as follows:
...ANSWER
Answered 2020-Feb-08 at 18:41Yes, pk runs binaries in user mode, thus it's expected that accessing a machine-level register from user space yields a illegal instruction exception:
Attempts to access a CSR without appropriate privilege level or to write a read-only register also raise illegal instruction exceptions.
(RISC-V Privileged spec 1.12-draft 2020-01-13, Section 2.1 CSR Address Mapping Conventions)
The hpmcounter*
registers are accessible from user-mode (cf. Table 2.2 Currently allocated RISC-V user-level CSR addresses, RISC-V privileged spec), if and only if they are enabled in the next higher mode:
If S-mode is implemented, the same bit positions in the scounteren register analogously control access to these registers while executing in U-mode. If S-mode is permitted to access a counter register and the corresponding bit is set in scounteren, then U-mode is also permitted to access that register.
The pk snippet that enables them looks sound. The 'S' and 'U' misa
bits are defined in the RISC-V privileged spec:
The “U” and “S” bits will be set if there is support for user and supervisor modes respectively.
But note that the RISC-V privileged spec also specifies (emphasis mine):
Registers mcounteren and scounteren are WARL registers that must be implemented if U-mode and S-mode are implemented. Any of the bits may contain a hardwired value of zero, indicating reads to the corresponding counter will cause an illegal instruction exception when executing in a less-privileged mode.
Perhaps your CPU doesn't implement hpmcounter3
and has it hardwired to zero?
To troubleshoot this further you can add a breakpoint inside pk, i.e. right before write_csr(scounteren, -1)
and single step assembler instructions to see if the writes actually happen. If they happened you can inspect the registers to check if hpmcounter3
is hardwired to zero or not.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install riscv-pk
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page