Skip to content

Address trigger has higher priority than alignment #387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions isa/rv64mi/breakpoint.S
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,51 @@ RVTEST_CODE_BEGIN
lw a2, (a2)
bnez a2, fail

2:
# Test that address breakpoints have higher priority than unaligned loads.
li TESTNUM, 12
li a0, (2 << (__riscv_xlen - 4)) | MCONTROL_M | MCONTROL_LOAD | MCONTROL_STORE
csrw tdata1, a0
# Skip if breakpoint type is unsupported.
csrr a1, tdata1
bne a0, a1, 2f
la a2, data1 + 1
la a3, data3
csrw tdata2, a2

# Slow path because CSR was *just* written. (This is spike-specific.)
lw a2, (a2)
beqz a2, fail

# Normal aligned load, so that the next time we'll hit the fast path.
li TESTNUM, 13
lw a0, (a3)

# Fast path
li TESTNUM, 14
lw a2, (a2)
beqz a2, fail

# Test that address breakpoints have higher priority than unaligned stores.
li TESTNUM, 16

la a2, data1 + 1
csrw tdata2, a2

# Slow path because CSR was *just* written. (This is spike-specific.)
sw x0, (a2)
beqz a2, fail
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this branch should be removed since the store can't possibly write x2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Definitely a cut and paste issue. I just removed the checks, since if the trigger didn't match then you end up with an unaligned exception which will cause the test to fail.


# Normal aligned store, so that the next time we'll hit the fast path.
li TESTNUM, 17
sw x0, (a3)

# Fast path
li TESTNUM, 18
sw x0, (a2)
beqz a2, fail
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Or I guess if you're trying to make sure the store didn't write memory, you'd need to store a nonzero value and lb a byte of it back to see if it's still zero.



2:
TEST_PASSFAIL

Expand Down Expand Up @@ -125,5 +170,6 @@ RVTEST_DATA_BEGIN

data1: .word 0
data2: .word 0
data3: .word 0

RVTEST_DATA_END