-
Notifications
You must be signed in to change notification settings - Fork 365
necessary tests for progbufsize | Skip CSR read if insufficient progbuf in RISC-V targets #1300
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
Biancaa-R
wants to merge
2
commits into
riscv-collab:riscv
Choose a base branch
from
Biancaa-R:riscv-progbufsize-check
base: riscv
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1385,6 +1385,10 @@ static int fpr_read_progbuf(struct target *target, uint64_t *value, | |||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| assert(number >= GDB_REGNO_FPR0 && number <= GDB_REGNO_FPR31); | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
| LOG_TARGET_DEBUG("Skipping FPR read: insufficient progbuf (size=%u)", get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
|
|
||||||
| const unsigned int freg = number - GDB_REGNO_FPR0; | ||||||
|
|
||||||
|
|
@@ -1417,6 +1421,10 @@ static int csr_read_progbuf(struct target *target, uint64_t *value, | |||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| assert(number >= GDB_REGNO_CSR0 && number <= GDB_REGNO_CSR4095); | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
| LOG_TARGET_DEBUG("Skipping CSR read: insufficient progbuf (size=%u)", get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
|
|
||||||
| if (riscv013_reg_save(target, GDB_REGNO_S0) != ERROR_OK) | ||||||
| return ERROR_FAIL; | ||||||
|
|
@@ -1431,6 +1439,7 @@ static int csr_read_progbuf(struct target *target, uint64_t *value, | |||||
| return register_read_abstract(target, value, GDB_REGNO_S0) != ERROR_OK; | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
| /** | ||||||
| * This function reads a register by writing a program to program buffer and | ||||||
| * executing it. | ||||||
|
|
@@ -1484,6 +1493,10 @@ static int fpr_write_progbuf(struct target *target, enum gdb_regno number, | |||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| assert(number >= GDB_REGNO_FPR0 && number <= GDB_REGNO_FPR31); | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
| LOG_TARGET_DEBUG("Skipping FPR Write: insufficient progbuf (size=%u)",get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
| const unsigned int freg = number - GDB_REGNO_FPR0; | ||||||
|
|
||||||
| if (riscv013_reg_save(target, GDB_REGNO_S0) != ERROR_OK) | ||||||
|
|
@@ -1515,6 +1528,11 @@ static int fpr_write_progbuf(struct target *target, enum gdb_regno number, | |||||
| static int vtype_write_progbuf(struct target *target, riscv_reg_t value) | ||||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| /* Ensure program buffer is large enough for 2 instructions */ | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
| LOG_TARGET_DEBUG("Skipping vtype write: insufficient progbuf (size=%u)", get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
|
|
||||||
| if (riscv013_reg_save(target, GDB_REGNO_S0) != ERROR_OK) | ||||||
| return ERROR_FAIL; | ||||||
|
|
@@ -1536,6 +1554,11 @@ static int vtype_write_progbuf(struct target *target, riscv_reg_t value) | |||||
| static int vl_write_progbuf(struct target *target, riscv_reg_t value) | ||||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| /* Ensure program buffer is large enough for 2 instructions */ | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
The sequence is: |
||||||
| LOG_TARGET_DEBUG("Skipping vl write: insufficient progbuf (size=%u)", get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
|
|
||||||
| if (riscv013_reg_save(target, GDB_REGNO_S0) != ERROR_OK) | ||||||
| return ERROR_FAIL; | ||||||
|
|
@@ -1559,6 +1582,10 @@ static int csr_write_progbuf(struct target *target, enum gdb_regno number, | |||||
| { | ||||||
| assert(target->state == TARGET_HALTED); | ||||||
| assert(number >= GDB_REGNO_CSR0 && number <= GDB_REGNO_CSR4095); | ||||||
| if (!has_sufficient_progbuf(target, 2)) { | ||||||
| LOG_TARGET_DEBUG("Skipping CSR write: insufficient progbuf (size=%u)", get_info(target)->progbufsize); | ||||||
| return ERROR_FAIL; | ||||||
| } | ||||||
|
|
||||||
| if (riscv013_reg_save(target, GDB_REGNO_S0) != ERROR_OK) | ||||||
| return ERROR_FAIL; | ||||||
|
|
||||||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Same as for
vl.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh as For vector register (v1) or vector type (vtype) operations we need to see 3 instructions ,right !
Ill fix it .Thanks @en-sc