ppc/ppc4xx: Fix sdram trace events
[qemu/kevin.git] / include / semihosting / softmmu-uaccess.h
blob4f08dfc098656febe512d651de7effabd2a41804
1 /*
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
8 */
10 #ifndef SEMIHOSTING_SOFTMMU_UACCESS_H
11 #define SEMIHOSTING_SOFTMMU_UACCESS_H
13 #include "cpu.h"
15 #define get_user_u64(val, addr) \
16 ({ uint64_t val_ = 0; \
17 int ret_ = cpu_memory_rw_debug(env_cpu(env), (addr), \
18 &val_, sizeof(val_), 0); \
19 (val) = tswap64(val_); ret_; })
21 #define get_user_u32(val, addr) \
22 ({ uint32_t val_ = 0; \
23 int ret_ = cpu_memory_rw_debug(env_cpu(env), (addr), \
24 &val_, sizeof(val_), 0); \
25 (val) = tswap32(val_); ret_; })
27 #define get_user_u8(val, addr) \
28 ({ uint8_t val_ = 0; \
29 int ret_ = cpu_memory_rw_debug(env_cpu(env), (addr), \
30 &val_, sizeof(val_), 0); \
31 (val) = val_; ret_; })
33 #define get_user_ual(arg, p) get_user_u32(arg, p)
35 #define put_user_u64(val, addr) \
36 ({ uint64_t val_ = tswap64(val); \
37 cpu_memory_rw_debug(env_cpu(env), (addr), &val_, sizeof(val_), 1); })
39 #define put_user_u32(val, addr) \
40 ({ uint32_t val_ = tswap32(val); \
41 cpu_memory_rw_debug(env_cpu(env), (addr), &val_, sizeof(val_), 1); })
43 #define put_user_ual(arg, p) put_user_u32(arg, p)
45 void *softmmu_lock_user(CPUArchState *env, target_ulong addr,
46 target_ulong len, bool copy);
47 #define lock_user(type, p, len, copy) softmmu_lock_user(env, p, len, copy)
49 char *softmmu_lock_user_string(CPUArchState *env, target_ulong addr);
50 #define lock_user_string(p) softmmu_lock_user_string(env, p)
52 void softmmu_unlock_user(CPUArchState *env, void *p,
53 target_ulong addr, target_ulong len);
54 #define unlock_user(s, args, len) softmmu_unlock_user(env, s, args, len)
56 ssize_t softmmu_strlen_user(CPUArchState *env, target_ulong addr);
57 #define target_strlen(p) softmmu_strlen_user(env, p)
59 #endif /* SEMIHOSTING_SOFTMMU_UACCESS_H */