]> Git Repo - qemu.git/blob - trace/mem-internal.h
tricore: sync ctx.hflags with tb->flags
[qemu.git] / trace / mem-internal.h
1 /*
2  * Helper functions for guest memory tracing
3  *
4  * Copyright (C) 2016 LluĂ­s Vilanova <[email protected]>
5  *
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  */
9
10 #ifndef TRACE__MEM_INTERNAL_H
11 #define TRACE__MEM_INTERNAL_H
12
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) */
17
18 static inline uint8_t trace_mem_build_info(
19     int size_shift, bool sign_extend, TCGMemOp endianness, bool store)
20 {
21     uint8_t res;
22
23     res = size_shift & TRACE_MEM_SZ_SHIFT_MASK;
24     if (sign_extend) {
25         res |= TRACE_MEM_SE;
26     }
27     if (endianness == MO_BE) {
28         res |= TRACE_MEM_BE;
29     }
30     if (store) {
31         res |= TRACE_MEM_ST;
32     }
33     return res;
34 }
35
36 static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
37 {
38     return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN),
39                                 op & MO_BSWAP, store);
40 }
41
42 static inline
43 uint8_t trace_mem_build_info_no_se_be(int size_shift, bool store)
44 {
45     return trace_mem_build_info(size_shift, false, MO_BE, store);
46 }
47
48 static inline
49 uint8_t trace_mem_build_info_no_se_le(int size_shift, bool store)
50 {
51     return trace_mem_build_info(size_shift, false, MO_LE, store);
52 }
53
54 #endif /* TRACE__MEM_INTERNAL_H */
This page took 0.026019 seconds and 4 git commands to generate.