slirp: remove slirp_ prefix for socket wrappers
[qemu/ar7.git] / trace / mem-internal.h
blobf6efaf6d6b70e685a9b50d88a2984cabe5729f91
1 /*
2 * Helper functions for guest memory tracing
4 * Copyright (C) 2016 LluĂ­s Vilanova <vilanova@ac.upc.edu>
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #ifndef TRACE__MEM_INTERNAL_H
11 #define TRACE__MEM_INTERNAL_H
13 #define TRACE_MEM_SZ_SHIFT_MASK 0x7 /* size shift mask */
14 #define TRACE_MEM_SE (1ULL << 3) /* sign extended (y/n) */
15 #define TRACE_MEM_BE (1ULL << 4) /* big endian (y/n) */
16 #define TRACE_MEM_ST (1ULL << 5) /* store (y/n) */
18 static inline uint8_t trace_mem_build_info(
19 int size_shift, bool sign_extend, TCGMemOp endianness, bool store)
21 uint8_t res;
23 res = size_shift & TRACE_MEM_SZ_SHIFT_MASK;
24 if (sign_extend) {
25 res |= TRACE_MEM_SE;
27 if (endianness == MO_BE) {
28 res |= TRACE_MEM_BE;
30 if (store) {
31 res |= TRACE_MEM_ST;
33 return res;
36 static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
38 return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN),
39 op & MO_BSWAP, store);
42 static inline
43 uint8_t trace_mem_build_info_no_se_be(int size_shift, bool store)
45 return trace_mem_build_info(size_shift, false, MO_BE, store);
48 static inline
49 uint8_t trace_mem_build_info_no_se_le(int size_shift, bool store)
51 return trace_mem_build_info(size_shift, false, MO_LE, store);
54 #endif /* TRACE__MEM_INTERNAL_H */