spapr_events: use QTAILQ_FOREACH_SAFE() in spapr_clear_pending_events()
[qemu.git] / trace / mem-internal.h
blobddda9342538040c4a7bc388396ef025dd73ae00f
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 static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
15 uint8_t res = op;
16 bool be = (op & MO_BSWAP) == MO_BE;
18 /* remove untraced fields */
19 res &= (1ULL << 4) - 1;
20 /* make endianness absolute */
21 res &= ~MO_BSWAP;
22 if (be) {
23 res |= 1ULL << 3;
25 /* add fields */
26 if (store) {
27 res |= 1ULL << 4;
30 return res;
33 static inline uint8_t trace_mem_build_info(
34 TCGMemOp size, bool sign_extend, TCGMemOp endianness, bool store)
36 uint8_t res = 0;
37 res |= size;
38 res |= (sign_extend << 2);
39 if (endianness == MO_BE) {
40 res |= (1ULL << 3);
42 res |= (store << 4);
43 return res;
46 #endif /* TRACE__MEM_INTERNAL_H */