2 * Helper routines to provide target memory access for semihosting
3 * syscalls in system emulation mode.
5 * Copyright (c) 2007 CodeSourcery.
7 * This code is licenced under the GPL
10 static inline uint32_t softmmu_tget32(CPUState
*env
, uint32_t addr
)
14 cpu_memory_rw_debug(env
, addr
, (uint8_t *)&val
, 4, 0);
17 static inline uint32_t softmmu_tget8(CPUState
*env
, uint32_t addr
)
21 cpu_memory_rw_debug(env
, addr
, &val
, 1, 0);
24 #define tget32(p) softmmu_tget32(env, p)
25 #define tget8(p) softmmu_tget8(env, p)
27 static inline void softmmu_tput32(CPUState
*env
, uint32_t addr
, uint32_t val
)
30 cpu_memory_rw_debug(env
, addr
, (uint8_t *)&val
, 4, 1);
32 #define tput32(p, val) softmmu_tput32(env, p, val)
34 static void *softmmu_lock_user(CPUState
*env
, uint32_t addr
, uint32_t len
,
38 /* TODO: Make this something that isn't fixed size. */
41 cpu_memory_rw_debug(env
, addr
, p
, len
, 0);
44 #define lock_user(p, len, copy) softmmu_lock_user(env, p, len, copy)
45 static char *softmmu_lock_user_string(CPUState
*env
, uint32_t addr
)
50 /* TODO: Make this something that isn't fixed size. */
53 cpu_memory_rw_debug(env
, addr
, &c
, 1, 0);
59 #define lock_user_string(p) softmmu_lock_user_string(env, p)
60 static void softmmu_unlock_user(CPUState
*env
, void *p
, target_ulong addr
,
64 cpu_memory_rw_debug(env
, addr
, p
, len
, 1);
67 #define unlock_user(s, args, len) softmmu_unlock_user(env, s, args, len)