-
Notifications
You must be signed in to change notification settings - Fork 78
feat: add Zicfiss (shadow stack) CSR support #944
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
sudo-apt-abdullah
wants to merge
20
commits into
riscv-software-src:main
Choose a base branch
from
sudo-apt-abdullah:issues
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7baf0bf
docs(ssp): shadow stack pointer - issue #560
sudo-apt-abdullah 274f590
docs(ssp): improved it a bit
sudo-apt-abdullah 7687c4e
docs(ssp): addressed the concerns
sudo-apt-abdullah 0bf9bf3
docs(ssp): modified the file to increase readablity
sudo-apt-abdullah dc30397
docs(ssp): fixed the indentation
sudo-apt-abdullah cc23c1d
docs(ssp): fixed issue with CI check
sudo-apt-abdullah aacade9
fix: handle dynamic csr field locations when csr length is XLEN
dhower-qc 46c47ad
Merge branch 'main' into issues
sudo-apt-abdullah 076dce1
docs(ssp): added sse field in menvcfg csr
sudo-apt-abdullah 8267051
docs(ssp): merged aacade9
sudo-apt-abdullah 0b60f08
docs(ssp): added see field in senvcfg and henvcfg
sudo-apt-abdullah f676a67
Merge branch 'main' into issues
sudo-apt-abdullah f745105
docs(ssp): addressed the concerns so far
sudo-apt-abdullah 9e451f9
Merge branch 'main' into issues
sudo-apt-abdullah 0c5e4f8
Merge branch 'main' into issues
sudo-apt-abdullah 86cfc3e
docs(ssp): addressed the concerns so far
sudo-apt-abdullah 266196f
docs(ssp): added sw_write for xenvcfg.sse
sudo-apt-abdullah 1c6ce38
Merge branch 'main' into issues
sudo-apt-abdullah 33ea676
Merge branch 'main' into issues
sudo-apt-abdullah 756dc6d
docs(ssp): Used the exact suggested syntax for definedBy
sudo-apt-abdullah File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright (c) Katherine Hsu | ||
| # SPDX-License-Identifier: BSD-3-Clause-Clear | ||
|
|
||
| # yaml-language-server: $schema=../../../schemas/csr_schema.json | ||
|
|
||
| $schema: "csr_schema.json#" | ||
| kind: csr | ||
| name: ssp | ||
| long_name: Shadow Stack Pointer | ||
| address: 0x011 | ||
| description: | ||
| - id: csr-ssp-purpose | ||
| normative: true | ||
| text: | | ||
| The `ssp` CSR is an unprivileged read-write (URW) CSR that reads and writes | ||
| XLEN low order bits of the shadow stack pointer. The `ssp` is always as wide | ||
| as the XLEN of the current privilege mode. The bits 1:0 of ssp are read-only | ||
| zero. If the UXLEN or SXLEN may never be 32, then the bit 2 is also read-only | ||
| zero. | ||
| priv_mode: U | ||
| length: XLEN | ||
| definedBy: Zicfiss | ||
| fields: | ||
| VALUE: | ||
| location_rv64: 63-3 | ||
| location_rv32: 31-2 | ||
| description: | | ||
| The value in ssp points to the top of the shadow stack, which is the address | ||
| of the last element stored on the shadow stack. | ||
| type: RW | ||
| reset_value: UNDEFINED_LEGAL | ||
| sw_write(csr_value): | | ||
| if ((mode() < PrivilegeMode::M && CSR[menvcfg].SSE == 0) || | ||
| (mode() == PrivilegeMode::U && CSR[senvcfg].SSE == 0)) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
| } else if ((mode() == PrivilegeMode::VS && CSR[henvcfg].SSE == 0) || | ||
| (mode() == PrivilegeMode::VU && (CSR[henvcfg].SSE == 0 || CSR[senvcfg].SSE == 0)) { | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } else { | ||
| return csr_value.VALUE | ||
| } | ||
| sw_read(): | | ||
| if ((mode() < PrivilegeMode::M && CSR[menvcfg].SSE == 0) || | ||
| (mode() == PrivilegeMode::U && CSR[senvcfg].SSE == 0)) { | ||
| raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } else if ((mode() == PrivilegeMode::VS && CSR[henvcfg].SSE == 0) || | ||
| (mode() == PrivilegeMode::VU && (CSR[henvcfg].SSE == 0 || CSR[senvcfg].SSE == 0)) { | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| raise(ExceptionCode::VirtualInstruction, mode(), $encoding); | ||
ThinkOpenly marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
ThinkOpenly marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.