qemu/trace/mem-internal.h
<<
>>
Prefs
   1/*
   2 * Helper functions for guest memory tracing
   3 *
   4 * Copyright (C) 2016 LluĂ­s Vilanova <vilanova@ac.upc.edu>
   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
  13static inline uint8_t trace_mem_get_info(TCGMemOp op, bool store)
  14{
  15    uint8_t res = op;
  16    bool be = (op & MO_BSWAP) == MO_BE;
  17
  18    /* remove untraced fields */
  19    res &= (1ULL << 4) - 1;
  20    /* make endianness absolute */
  21    res &= ~MO_BSWAP;
  22    if (be) {
  23        res |= 1ULL << 3;
  24    }
  25    /* add fields */
  26    if (store) {
  27        res |= 1ULL << 4;
  28    }
  29
  30    return res;
  31}
  32
  33static inline uint8_t trace_mem_build_info(
  34    TCGMemOp size, bool sign_extend, TCGMemOp endianness, bool store)
  35{
  36    uint8_t res = 0;
  37    res |= size;
  38    res |= (sign_extend << 2);
  39    if (endianness == MO_BE) {
  40        res |= (1ULL << 3);
  41    }
  42    res |= (store << 4);
  43    return res;
  44}
  45
  46#endif /* TRACE__MEM_INTERNAL_H */
  47