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.
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
)
23 res
= size_shift
& TRACE_MEM_SZ_SHIFT_MASK
;
27 if (endianness
== MO_BE
) {
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
);
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
);
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 */