Skip to content

Commit

Permalink
trace: Fold mem-internal.h into mem.h
Browse files Browse the repository at this point in the history
Since the last thing that mem.h does is include mem-internal.h,
the symbols are not actually private.

Tested-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jul 21, 2021
1 parent a754f7f commit 785ea71
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 60 deletions.
2 changes: 1 addition & 1 deletion plugins/core.c
Expand Up @@ -27,7 +27,7 @@
#include "exec/helper-proto.h"
#include "tcg/tcg.h"
#include "tcg/tcg-op.h"
#include "trace/mem-internal.h" /* mem_info macros */
#include "trace/mem.h" /* mem_info macros */
#include "plugin.h"
#include "qemu/compiler.h"

Expand Down
50 changes: 0 additions & 50 deletions trace/mem-internal.h

This file was deleted.

46 changes: 37 additions & 9 deletions trace/mem.h
Expand Up @@ -12,24 +12,52 @@

#include "tcg/tcg.h"

#define TRACE_MEM_SZ_SHIFT_MASK 0xf /* size shift mask */
#define TRACE_MEM_SE (1ULL << 4) /* sign extended (y/n) */
#define TRACE_MEM_BE (1ULL << 5) /* big endian (y/n) */
#define TRACE_MEM_ST (1ULL << 6) /* store (y/n) */
#define TRACE_MEM_MMU_SHIFT 8 /* mmu idx */

/**
* trace_mem_get_info:
* trace_mem_build_info:
*
* Return a value for the 'info' argument in guest memory access traces.
*/
static uint16_t trace_mem_get_info(MemOp op, unsigned int mmu_idx, bool store);
static inline uint16_t trace_mem_build_info(int size_shift, bool sign_extend,
MemOp endianness, bool store,
unsigned int mmu_idx)
{
uint16_t res;

res = size_shift & TRACE_MEM_SZ_SHIFT_MASK;
if (sign_extend) {
res |= TRACE_MEM_SE;
}
if (endianness == MO_BE) {
res |= TRACE_MEM_BE;
}
if (store) {
res |= TRACE_MEM_ST;
}
#ifdef CONFIG_SOFTMMU
res |= mmu_idx << TRACE_MEM_MMU_SHIFT;
#endif
return res;
}


/**
* trace_mem_build_info:
* trace_mem_get_info:
*
* Return a value for the 'info' argument in guest memory access traces.
*/
static uint16_t trace_mem_build_info(int size_shift, bool sign_extend,
MemOp endianness, bool store,
unsigned int mmuidx);


#include "trace/mem-internal.h"
static inline uint16_t trace_mem_get_info(MemOp op,
unsigned int mmu_idx,
bool store)
{
return trace_mem_build_info(op & MO_SIZE, !!(op & MO_SIGN),
op & MO_BSWAP, store,
mmu_idx);
}

#endif /* TRACE__MEM_H */

0 comments on commit 785ea71

Please sign in to comment.