This is an automated email from Gerrit.

"Marek Vrbka <marek.vr...@codasip.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7729

-- gerrit

commit 84aba5cca780957c818c0e023801eab703e85cc2
Author: Marek Vrbka <marek.vr...@codasip.com>
Date:   Mon Jun 5 08:35:09 2023 +0200

    riscv/semihosting: Fix ebreak skip on fileio mode
    
    This patch fixes skipping the semihosting sequence if
    the fileio mode is enabled on riscv. This change was
    tested by me and is in the riscv-openocd fork for a year now.
    
    Original merge request:
    https://github.com/riscv/riscv-openocd/pull/699
    
    Original author: Wu Zhigang zhigang...@starfivetech.com
    https://github.com/wzgpeter
    
    Change-Id: Iadaa0a48d1f82d3a7ca168f8a6b656ff6ab78e03
    Signed-off-by: Marek Vrbka <marek.vr...@codasip.com>

diff --git a/src/target/riscv/riscv_semihosting.c 
b/src/target/riscv/riscv_semihosting.c
index 1bc4e1a166..da237ef337 100644
--- a/src/target/riscv/riscv_semihosting.c
+++ b/src/target/riscv/riscv_semihosting.c
@@ -141,16 +141,16 @@ enum semihosting_result riscv_semihosting(struct target 
*target, int *retval)
                }
        }
 
+       /* Resume right after the EBREAK 4 bytes instruction. */
+       *retval = riscv_set_register(target, GDB_REGNO_PC, pc + 4);
+       if (*retval != ERROR_OK)
+               return SEMIHOSTING_ERROR;
+
        /*
         * Resume target if we are not waiting on a fileio
         * operation to complete.
         */
        if (semihosting->is_resumable && !semihosting->hit_fileio) {
-               /* Resume right after the EBREAK 4 bytes instruction. */
-               *retval = riscv_set_register(target, GDB_REGNO_PC, pc + 4);
-               if (*retval != ERROR_OK)
-                       return SEMIHOSTING_ERROR;
-
                LOG_DEBUG("   -> HANDLED");
                return SEMIHOSTING_HANDLED;
        }

-- 

Reply via email to