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 0xf /* size shift mask */
14 #define TRACE_MEM_SE (1ULL << 4) /* sign extended (y/n) */
15 #define TRACE_MEM_BE (1ULL << 5) /* big endian (y/n) */
16 #define TRACE_MEM_ST (1ULL << 6) /* store (y/n) */
17 #define TRACE_MEM_MMU_SHIFT 8 /* mmu idx */
19 static inline uint16_t trace_mem_build_info(
20 int size_shift
, bool sign_extend
, MemOp endianness
,
21 bool store
, unsigned int mmu_idx
)
25 res
= size_shift
& TRACE_MEM_SZ_SHIFT_MASK
;
29 if (endianness
== MO_BE
) {
36 res
|= mmu_idx
<< TRACE_MEM_MMU_SHIFT
;
41 static inline uint16_t trace_mem_get_info(MemOp op
,
45 return trace_mem_build_info(op
& MO_SIZE
, !!(op
& MO_SIGN
),
50 #endif /* TRACE__MEM_INTERNAL_H */