aboutsummaryrefslogtreecommitdiff
path: root/semihosting/guestfd.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-28 09:22:18 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-28 04:35:52 +0530
commit5eadbbfca6232710036ccb9f5cf1481be537c0e7 (patch)
tree3ba27eedd3c34826c8e778ab1955fcc0fc601f33 /semihosting/guestfd.c
parent5b3f39cb04fda32226e84502f858bab06d83e5c1 (diff)
semihosting: Split out semihost_sys_close
Split out the non-ARM specific portions of SYS_CLOSE to a reusable function. This handles all GuestFD. Note that gdb_do_syscall %x reads target_ulong, not int. Reviewed-by: Luc Michel <lmichel@kalray.eu> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting/guestfd.c')
-rw-r--r--semihosting/guestfd.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/semihosting/guestfd.c b/semihosting/guestfd.c
index 7ac2e147a8..e3122ebba9 100644
--- a/semihosting/guestfd.c
+++ b/semihosting/guestfd.c
@@ -49,6 +49,11 @@ int alloc_guestfd(void)
return i;
}
+static void do_dealloc_guestfd(GuestFD *gf)
+{
+ gf->type = GuestFDUnused;
+}
+
/*
* Look up the guestfd in the data structure; return NULL
* for out of bounds, but don't check whether the slot is unused.
@@ -119,5 +124,5 @@ void dealloc_guestfd(int guestfd)
GuestFD *gf = do_get_guestfd(guestfd);
assert(gf);
- gf->type = GuestFDUnused;
+ do_dealloc_guestfd(gf);
}