summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/ia64/ia64/db_interface.c11
-rw-r--r--sys/ia64/ia64/db_trace.c1
-rw-r--r--sys/ia64/ia64/machdep.c26
-rw-r--r--sys/ia64/include/db_machdep.h5
-rw-r--r--sys/ia64/include/inst.h10
5 files changed, 41 insertions, 12 deletions
diff --git a/sys/ia64/ia64/db_interface.c b/sys/ia64/ia64/db_interface.c
index 5e8fd54..8b138f1 100644
--- a/sys/ia64/ia64/db_interface.c
+++ b/sys/ia64/ia64/db_interface.c
@@ -50,11 +50,10 @@
#include <vm/vm.h>
+#include <machine/inst.h>
#include <machine/db_machdep.h>
#include <machine/mutex.h>
-#include <machine/inst.h>
-
#include <ddb/ddb.h>
#include <ddb/db_access.h>
@@ -487,10 +486,7 @@ db_read_bundle(db_addr_t addr, struct ia64_bundle *bp)
db_read_bytes(addr, 8, (caddr_t) &low);
db_read_bytes(addr+8, 8, (caddr_t) &high);
- bp->template = low & 0x1f;
- bp->slot[0] = (low >> 5) & ((1L<<41) - 1);
- bp->slot[1] = (low >> 46) | ((high & ((1L<<23) - 1)) << 18);
- bp->slot[2] = (high >> 23);
+ ia64_unpack_bundle(low, high, bp);
}
void
@@ -498,8 +494,7 @@ db_write_bundle(db_addr_t addr, struct ia64_bundle *bp)
{
u_int64_t low, high;
- low = bp->template | (bp->slot[0] << 5) | (bp->slot[1] << 46);
- high = (bp->slot[1] >> 18) | (bp->slot[2] << 23);
+ ia64_pack_bundle(&low, &high, bp);
db_write_bytes(addr, 8, (caddr_t) &low);
db_write_bytes(addr+8, 8, (caddr_t) &high);
diff --git a/sys/ia64/ia64/db_trace.c b/sys/ia64/ia64/db_trace.c
index cda8938..60be979 100644
--- a/sys/ia64/ia64/db_trace.c
+++ b/sys/ia64/ia64/db_trace.c
@@ -28,6 +28,7 @@
#include <sys/param.h>
#include <sys/proc.h>
+#include <machine/inst.h>
#include <machine/db_machdep.h>
#include <ddb/ddb.h>
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 2cd15c1..e2375ed 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -78,6 +78,7 @@
#include <fs/procfs/procfs.h>
#include <machine/sigframe.h>
#include <machine/efi.h>
+#include <machine/inst.h>
#ifdef SKI
extern void ia64_ski_init(void);
@@ -1470,3 +1471,28 @@ globaldata_init(struct globaldata *globaldata, int cpuid, size_t sz)
globaldata->gd_cpuid = cpuid;
globaldata_register(globaldata);
}
+
+/*
+ * Utility functions for manipulating instruction bundles.
+ */
+void
+ia64_unpack_bundle(u_int64_t low, u_int64_t high, struct ia64_bundle *bp)
+{
+ bp->template = low & 0x1f;
+ bp->slot[0] = (low >> 5) & ((1L<<41) - 1);
+ bp->slot[1] = (low >> 46) | ((high & ((1L<<23) - 1)) << 18);
+ bp->slot[2] = (high >> 23);
+}
+
+void
+ia64_pack_bundle(u_int64_t *lowp, u_int64_t *highp,
+ const struct ia64_bundle *bp)
+{
+ u_int64_t low, high;
+
+ low = bp->template | (bp->slot[0] << 5) | (bp->slot[1] << 46);
+ high = (bp->slot[1] >> 18) | (bp->slot[2] << 23);
+ *lowp = low;
+ *highp = high;
+}
+
diff --git a/sys/ia64/include/db_machdep.h b/sys/ia64/include/db_machdep.h
index c419092..caa0c40b 100644
--- a/sys/ia64/include/db_machdep.h
+++ b/sys/ia64/include/db_machdep.h
@@ -41,10 +41,7 @@
#define DB_NO_AOUT
-struct ia64_bundle {
- u_int64_t slot[3];
- int template;
-};
+struct ia64_bundle;
typedef vm_offset_t db_addr_t; /* address - unsigned */
typedef long db_expr_t; /* expression - signed */
diff --git a/sys/ia64/include/inst.h b/sys/ia64/include/inst.h
index 5abea43..60ab22f 100644
--- a/sys/ia64/include/inst.h
+++ b/sys/ia64/include/inst.h
@@ -1165,4 +1165,14 @@ union ia64_instruction {
u_int64_t ins;
};
+struct ia64_bundle {
+ u_int64_t slot[3];
+ int template;
+};
+
+extern void ia64_unpack_bundle(u_int64_t low, u_int64_t high,
+ struct ia64_bundle *bp);
+extern void ia64_pack_bundle(u_int64_t *lowp, u_int64_t *highp,
+ const struct ia64_bundle *bp);
+
#endif /* _MACHINE_INST_H_ */
OpenPOWER on IntegriCloud