Skip to content

Commit

Permalink
Merge pull request #187 from allenjbaum/master
Browse files Browse the repository at this point in the history
issue107 fix
  • Loading branch information
neelgala authored Apr 21, 2021
2 parents b6b7b67 + 24b27a0 commit b436dd0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## [2.4.2] - 2021-04-20
- changed all occurances of SPTBR to the new name SATP

## [2.4.1] - 2021-04-01
- updated issue number in TestFormatSpec to be consistent with doc history
- adding a contribution guideline
Expand Down
10 changes: 5 additions & 5 deletions riscv-test-env/p/riscv_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
.align 2; \
1:

#define INIT_SPTBR \
#define INIT_SATP \
la t0, 1f; \
csrw mtvec, t0; \
csrwi sptbr, 0; \
csrwi satp, 0; \
.align 2; \
1:

Expand Down Expand Up @@ -108,8 +108,8 @@
//
#if defined(PRIV_MISA_S)
# if (PRIV_MISA_S==0)
# undef INIT_SPTBR
# define INIT_SPTBR
# undef INIT_SATP
# define INIT_SATP
# undef INIT_PMP
# define INIT_PMP
# undef DELEGATE_NO_TRAPS
Expand Down Expand Up @@ -165,7 +165,7 @@ handle_exception: \
j write_tohost; \
reset_vector: \
RISCV_MULTICORE_DISABLE; \
INIT_SPTBR; \
INIT_SATP; \
INIT_PMP; \
DELEGATE_NO_TRAPS; \
li TESTNUM, 0; \
Expand Down
8 changes: 4 additions & 4 deletions riscv-test-env/v/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ void vm_boot(uintptr_t test_addr)
l1pt[PTES_PER_PT-1] = ((pte_t)kernel_l2pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
kernel_l2pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D;
user_l2pt[0] = ((pte_t)user_l3pt >> PGSHIFT << PTE_PPN_SHIFT) | PTE_V;
uintptr_t vm_choice = SPTBR_MODE_SV39;
uintptr_t vm_choice = SATP_MODE_SV39;
#else
l1pt[PTES_PER_PT-1] = (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_R | PTE_W | PTE_X | PTE_A | PTE_D;
uintptr_t vm_choice = SPTBR_MODE_SV32;
uintptr_t vm_choice = SATP_MODE_SV32;
#endif
write_csr(sptbr, ((uintptr_t)l1pt >> PGSHIFT) |
(vm_choice * (SPTBR_MODE & ~(SPTBR_MODE<<1))));
write_csr(satp, ((uintptr_t)l1pt >> PGSHIFT) |
(vm_choice * (SATP_MODE & ~(SATP_MODE<<1))));

// Set up PMPs if present, ignoring illegal instruction trap if not.
uintptr_t pmpc = PMP_NAPOT | PMP_R | PMP_W | PMP_X;
Expand Down

0 comments on commit b436dd0

Please sign in to comment.