linux-user/syscall: Fix RF-kill errno (typo in ERFKILL)
[qemu/ar7.git] / trace / mem-internal.h
blob8b72b678fa728dd48f1e66189c59b3d651ee1984
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 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)
23 uint16_t res;
25 res = size_shift & TRACE_MEM_SZ_SHIFT_MASK;
26 if (sign_extend) {
27 res |= TRACE_MEM_SE;
29 if (endianness == MO_BE) {
30 res |= TRACE_MEM_BE;
32 if (store) {
33 res |= TRACE_MEM_ST;
35 #ifdef CONFIG_SOFTMMU
36 res |= mmu_idx << TRACE_MEM_MMU_SHIFT;
37 #endif
38 return res;
41 static inline uint16_t trace_mem_get_info(MemOp op,
42 unsigned int mmu_idx,
43 bool store)
45 return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN),
46 op & MO_BSWAP, store,
47 mmu_idx);
50 #endif /* TRACE__MEM_INTERNAL_H */