Skip to content

Commit 10f1659

Browse files
committed
target/riscv: fix bug in scratch_reserve
This commit fixes comparison in scratch_reserve function Change-Id: If994b333282bf706736b953227a9739e52f08139 Signed-off-by: Farid Khaydari <[email protected]>
1 parent 608ba43 commit 10f1659

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
@@ -1208,7 +1208,7 @@ static int scratch_reserve(struct target *target,
12081208
/* Align. */
12091209
scratch->hart_address = (scratch->hart_address + alignment - 1) & ~(alignment - 1);
12101210

1211-
if ((size_bytes + scratch->hart_address - info->dataaddr + 3) / 4 >=
1211+
if ((size_bytes + scratch->hart_address - info->dataaddr + 3) / 4 <=
12121212
info->datasize) {
12131213
scratch->memory_space = SPACE_DM_DATA;
12141214
scratch->debug_address = (scratch->hart_address - info->dataaddr) / 4;
@@ -1225,7 +1225,7 @@ static int scratch_reserve(struct target *target,
12251225
scratch->hart_address = (info->progbuf_address + program_size + alignment - 1) &
12261226
~(alignment - 1);
12271227
if ((info->progbuf_writable == YNM_YES) &&
1228-
((size_bytes + scratch->hart_address - info->progbuf_address + 3) / 4 >=
1228+
((size_bytes + scratch->hart_address - info->progbuf_address + 3) / 4 <=
12291229
info->progbufsize)) {
12301230
scratch->memory_space = SPACE_DMI_PROGBUF;
12311231
scratch->debug_address = (scratch->hart_address - info->progbuf_address) / 4;

0 commit comments

Comments
 (0)