Skip to content

Commit

Permalink
Add test for store/loadCapPerm
Browse files Browse the repository at this point in the history
  • Loading branch information
Alix Trieu committed Feb 9, 2023
1 parent 1e4a460 commit 254827a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/scala/riscv/plugins/cheri/tests/LsuCap.S
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ RVTEST_CODE_BEGIN
EXPECT_EXCEPTION(CAUSE_SEAL_VIOLATION, 1, LC.cap ROOT, (c1))
EXPECT_EXCEPTION(CAUSE_SEAL_VIOLATION, 1, SC.cap ROOT, (c1))

TEST_CASE_FREE(16)
la t0, scratch
CSetAddr c1, ROOT, t0
SC.cap ROOT, (c1)
li t0, ~(1 << PERM_PERMIT_LOAD_CAPABILITY)
CAndPerm c1, c1, t0
EXPECT_EXCEPTION(CAUSE_PERMIT_LOAD_CAPABILITY_VIOLATION, 1, LC.cap c2, (c1))

TEST_CASE_FREE(17)
la t0, scratch
CSetAddr c1, ROOT, t0
li t0, ~(1 << PERM_PERMIT_STORE_CAPABILITY)
CAndPerm c1, c1, t0
EXPECT_EXCEPTION(CAUSE_PERMIT_STORE_CAPABILITY_VIOLATION, 1, SC.cap ROOT, (c1))

TEST_PASSFAIL

Expand Down

0 comments on commit 254827a

Please sign in to comment.