Skip to content

Commit 89f0573

Browse files
RaamyPien-sc
authored andcommitted
target/riscv: improve error messaging in case sbasize is zero
From: Sriram Shanmuga <[email protected]> RISC-V Debug Specification v1.0 [3.14.22. System Bus Access Control and Status (`sbcs`, at 0x38)] states in `sbasize` field description: > Width of system bus addresses in bits. (0 indicates there is no bus access support.) Before the patch, the error message did not include the information about `sbcs.sbasize` being zero wich made it quite undescriptive: ``` [riscv.cpu] Turning off memory sampling because it failed. ``` Fixes #1270 Change-Id: I5402dd57dc9a81f65ee4c67d24e11c366006427c Signed-off-by: Sriram Shanmuga <[email protected]> Signed-off-by: Evgeniy Naydanov <[email protected]>
1 parent 6f84e90 commit 89f0573

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/target/riscv/riscv-013.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2610,8 +2610,8 @@ static int sample_memory_bus_v1(struct target *target,
26102610
{
26112611
RISCV013_INFO(info);
26122612
unsigned int sbasize = get_field(info->sbcs, DM_SBCS_SBASIZE);
2613-
if (sbasize > 64) {
2614-
LOG_TARGET_ERROR(target, "Memory sampling is only implemented for sbasize <= 64.");
2613+
if (sbasize == 0 || sbasize > 64) {
2614+
LOG_TARGET_ERROR(target, "Memory sampling is only implemented for non-zero sbasize <= 64.");
26152615
return ERROR_NOT_IMPLEMENTED;
26162616
}
26172617

0 commit comments

Comments
 (0)