aboutsummaryrefslogtreecommitdiff
path: root/semihosting/arm-compat-semi.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-29 10:11:31 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-28 04:35:52 +0530
commit25a95da0beeb854570f974028b77cd35826433b7 (patch)
tree8b12fa9cce66bea6f18bdf8c64c35720c4fd54fd /semihosting/arm-compat-semi.c
parentd49e79b8e276b56817509114a86b036358246af8 (diff)
semihosting: Split out semihost_sys_rename
Split out the non-ARM specific portions of SYS_RENAME to a reusable function. Reviewed-by: Luc Michel <lmichel@kalray.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting/arm-compat-semi.c')
-rw-r--r--semihosting/arm-compat-semi.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index f4ce3851a4..14d37ac9da 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -492,26 +492,7 @@ void do_common_semihosting(CPUState *cs)
GET_ARG(1);
GET_ARG(2);
GET_ARG(3);
- if (use_gdb_syscalls()) {
- gdb_do_syscall(common_semi_cb, "rename,%s,%s",
- arg0, (int)arg1 + 1, arg2, (int)arg3 + 1);
- } else {
- char *s2;
-
- s = lock_user_string(arg0);
- if (!s) {
- goto do_fault;
- }
- s2 = lock_user_string(arg2);
- if (!s2) {
- unlock_user(s, arg0, 0);
- goto do_fault;
- }
- ret = rename(s, s2);
- unlock_user(s2, arg2, 0);
- unlock_user(s, arg0, 0);
- common_semi_cb(cs, ret, ret ? errno : 0);
- }
+ semihost_sys_rename(cs, common_semi_cb, arg0, arg1 + 1, arg2, arg3 + 1);
break;
case TARGET_SYS_CLOCK: