aboutsummaryrefslogtreecommitdiff
path: root/include/semihosting
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2022-04-27 20:44:17 -0700
committerRichard Henderson <richard.henderson@linaro.org>2022-06-28 04:35:06 +0530
commit0a9221810ce08fd5b0c4cff6055e640d4bd6876d (patch)
tree558d8ab12a87e49a6e4c5327d6060883e4413d92 /include/semihosting
parent259739ce74300ae9e5df7c8c3a8a672341af5546 (diff)
semihosting: Move softmmu-uaccess.h functions out of line
Rather that static (and not even inline) functions within a header, move the functions to semihosting/uaccess.c. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/semihosting')
-rw-r--r--include/semihosting/softmmu-uaccess.h42
1 files changed, 5 insertions, 37 deletions
diff --git a/include/semihosting/softmmu-uaccess.h b/include/semihosting/softmmu-uaccess.h
index 5246a91570..03300376d3 100644
--- a/include/semihosting/softmmu-uaccess.h
+++ b/include/semihosting/softmmu-uaccess.h
@@ -42,47 +42,15 @@
#define put_user_ual(arg, p) put_user_u32(arg, p)
-static void *softmmu_lock_user(CPUArchState *env, target_ulong addr,
- target_ulong len, bool copy)
-{
- void *p = malloc(len);
- if (p && copy) {
- if (cpu_memory_rw_debug(env_cpu(env), addr, p, len, 0)) {
- free(p);
- p = NULL;
- }
- }
- return p;
-}
+void *softmmu_lock_user(CPUArchState *env, target_ulong addr,
+ target_ulong len, bool copy);
#define lock_user(type, p, len, copy) softmmu_lock_user(env, p, len, copy)
-static char *softmmu_lock_user_string(CPUArchState *env, target_ulong addr)
-{
- /* TODO: Make this something that isn't fixed size. */
- char *s = malloc(1024);
- size_t len = 0;
-
- if (!s) {
- return NULL;
- }
- do {
- if (cpu_memory_rw_debug(env_cpu(env), addr++, s + len, 1, 0)) {
- free(s);
- return NULL;
- }
- } while (s[len++]);
- return s;
-}
+char *softmmu_lock_user_string(CPUArchState *env, target_ulong addr);
#define lock_user_string(p) softmmu_lock_user_string(env, p)
-static void softmmu_unlock_user(CPUArchState *env, void *p, target_ulong addr,
- target_ulong len)
-{
- if (len) {
- cpu_memory_rw_debug(env_cpu(env), addr, p, len, 1);
- }
- free(p);
-}
+void softmmu_unlock_user(CPUArchState *env, void *p,
+ target_ulong addr, target_ulong len);
#define unlock_user(s, args, len) softmmu_unlock_user(env, s, args, len)
#endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */