aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch/aarch64-insn.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/arch/aarch64-insn.h')
-rw-r--r--gdb/arch/aarch64-insn.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/arch/aarch64-insn.h b/gdb/arch/aarch64-insn.h
index 6a63ce9..5ce46c1 100644
--- a/gdb/arch/aarch64-insn.h
+++ b/gdb/arch/aarch64-insn.h
@@ -21,6 +21,22 @@
extern bool aarch64_debug;
+/* Support routines for instruction parsing. */
+
+/* Create a mask of X bits. */
+#define submask(x) ((1L << ((x) + 1)) - 1)
+
+/* Extract the bitfield from OBJ starting at bit ST and ending at bit FN. */
+#define bits(obj,st,fn) (((obj) >> (st)) & submask ((fn) - (st)))
+
+/* Extract bit ST from OBJ. */
+#define bit(obj,st) (((obj) >> (st)) & 1)
+
+/* Extract the signed bitfield from OBJ starting at bit ST and ending at
+ bit FN. The result is sign-extended. */
+#define sbits(obj,st,fn) \
+ ((long) (bits(obj,st,fn) | ((long) bit(obj,fn) * ~ submask (fn - st))))
+
/* List of opcodes that we need for building the jump pad and relocating
an instruction. */