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.
15 #define TRACE_MEM_SZ_SHIFT_MASK 0xf /* size shift mask */
16 #define TRACE_MEM_SE (1ULL << 4) /* sign extended (y/n) */
17 #define TRACE_MEM_BE (1ULL << 5) /* big endian (y/n) */
18 #define TRACE_MEM_ST (1ULL << 6) /* store (y/n) */
19 #define TRACE_MEM_MMU_SHIFT 8 /* mmu idx */
22 * trace_mem_build_info:
24 * Return a value for the 'info' argument in guest memory access traces.
26 static inline uint16_t trace_mem_build_info(int size_shift
, bool sign_extend
,
27 MemOp endianness
, bool store
,
32 res
= size_shift
& TRACE_MEM_SZ_SHIFT_MASK
;
36 if (endianness
== MO_BE
) {
43 res
|= mmu_idx
<< TRACE_MEM_MMU_SHIFT
;
52 * Return a value for the 'info' argument in guest memory access traces.
54 static inline uint16_t trace_mem_get_info(MemOp op
,
58 return trace_mem_build_info(op
& MO_SIZE
, !!(op
& MO_SIGN
),
63 #endif /* TRACE__MEM_H */