Skip to content

Instantly share code, notes, and snippets.

View diodesign's full-sized avatar

Chris Williams diodesign

View GitHub Profile
@diodesign
diodesign / RISCV-SV39-Page-walker
Created September 5, 2020 06:33
RISC-V SV39 page table walking code
/* I wrote a RISC-V SV39 page walker algorithm with PMP checker
* in Rust to turn supervisor virtual addresses into machine physical
* addresses when trapping illegal insgtructions and emulating them.
* The fault address is an S-mode address that needs translating
* to fetch and decode the illegal instruction, hence this page walk
*
* But turns out, I don't need that as I can use MPRV in mstatus to
* perform a fetch as the previous mode (S-Mode in this case).
* Rather than throw away the code, I've saved it here.
*

Keybase proof

I hereby claim:

  • I am diodesign on github.
  • I am diodesign (https://keybase.io/diodesign) on keybase.
  • I have a public key whose fingerprint is DFE4 461C E661 F66A 5235 8FA6 A698 6F5C AED8 CEDF

To claim this, I am signing this object: