summaryrefslogtreecommitdiff
path: root/inc/utils.h
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-28 18:10:14 -0400
committerbd <bdunahu@operationnull.com>2025-03-28 18:10:14 -0400
commit136417edd709f0e2d30931d222b658ff7dd9a5a8 (patch)
tree7ecf0837278e46146360134bb43252357acfe494 /inc/utils.h
parentab6d02361b04a18b7823aef0ff1cb0ff2a215ec2 (diff)
add get_instr_fields func to parse instruction fields from raw bits
Diffstat (limited to 'inc/utils.h')
-rw-r--r--inc/utils.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/inc/utils.h b/inc/utils.h
index df8d374..7fed157 100644
--- a/inc/utils.h
+++ b/inc/utils.h
@@ -10,7 +10,25 @@
* @param the resulting index
* @param the resulting offset
*/
-void get_bit_fields(int address, int *tag, int *index, int *offset);
+void get_cache_fields(int address, int *tag, int *index, int *offset);
+
+/**
+ * Parse an instruction into a type, opcode, and fields. If the type is invalid,
+ * only the type field will be set.
+ * @param the resulting first field, which varies per type. To call this
+ * function properly, this field must contain the full instruction bytes on
+ * function entry.
+ * @param the resulting second field, which varies per type.
+ * @param the resulting third field, which varies per type.
+ * @param the resulting type.
+ * @param the resulting opcode.
+ */
+void get_instr_fields(
+ signed int &s1,
+ signed int &s2,
+ signed int &s3,
+ unsigned int &type,
+ unsigned int &opcode);
/**
* Formats a string using snprintf.