hw/arm/virt: Consolidate GIC finalize logic
[qemu.git] / include / exec / memopidx.h
blobeb7f1591a37642e651a1c5e7030b38abb92bc43f
1 /*
2 * Combine the MemOp and mmu_idx parameters into a single value.
4 * Authors:
5 * Richard Henderson <rth@twiddle.net>
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
9 */
11 #ifndef EXEC_MEMOPIDX_H
12 #define EXEC_MEMOPIDX_H
14 #include "exec/memop.h"
16 typedef uint32_t MemOpIdx;
18 /**
19 * make_memop_idx
20 * @op: memory operation
21 * @idx: mmu index
23 * Encode these values into a single parameter.
25 static inline MemOpIdx make_memop_idx(MemOp op, unsigned idx)
27 #ifdef CONFIG_DEBUG_TCG
28 assert(idx <= 15);
29 #endif
30 return (op << 4) | idx;
33 /**
34 * get_memop
35 * @oi: combined op/idx parameter
37 * Extract the memory operation from the combined value.
39 static inline MemOp get_memop(MemOpIdx oi)
41 return oi >> 4;
44 /**
45 * get_mmuidx
46 * @oi: combined op/idx parameter
48 * Extract the mmu index from the combined value.
50 static inline unsigned get_mmuidx(MemOpIdx oi)
52 return oi & 15;
55 #endif