]>
git.proxmox.com Git - qemu.git/blob - softmmu-semi.h
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 licensed 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);
25 #define get_user_u32(arg, p) ({ arg = softmmu_tget32(env, p) ; 0; })
26 #define get_user_u8(arg, p) ({ arg = softmmu_tget8(env, p) ; 0; })
27 #define get_user_ual(arg, p) get_user_u32(arg, p)
29 static inline void softmmu_tput32(CPUState
*env
, uint32_t addr
, uint32_t val
)
32 cpu_memory_rw_debug(env
, addr
, (uint8_t *)&val
, 4, 1);
34 #define put_user_u32(arg, p) ({ softmmu_tput32(env, p, arg) ; 0; })
35 #define put_user_ual(arg, p) put_user_u32(arg, p)
37 static void *softmmu_lock_user(CPUState
*env
, uint32_t addr
, uint32_t len
,
41 /* TODO: Make this something that isn't fixed size. */
44 cpu_memory_rw_debug(env
, addr
, p
, len
, 0);
47 #define lock_user(type, p, len, copy) softmmu_lock_user(env, p, len, copy)
48 static char *softmmu_lock_user_string(CPUState
*env
, uint32_t addr
)
53 /* TODO: Make this something that isn't fixed size. */
56 cpu_memory_rw_debug(env
, addr
, &c
, 1, 0);
62 #define lock_user_string(p) softmmu_lock_user_string(env, p)
63 static void softmmu_unlock_user(CPUState
*env
, void *p
, target_ulong addr
,
67 cpu_memory_rw_debug(env
, addr
, p
, len
, 1);
70 #define unlock_user(s, args, len) softmmu_unlock_user(env, s, args, len)