summaryrefslogtreecommitdiff
path: root/usr.bin/oemu/include
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/oemu/include')
-rw-r--r--usr.bin/oemu/include/oemu/cpu.h13
-rw-r--r--usr.bin/oemu/include/oemu/osmx64.h15
-rw-r--r--usr.bin/oemu/include/oemu/types.h3
3 files changed, 25 insertions, 6 deletions
diff --git a/usr.bin/oemu/include/oemu/cpu.h b/usr.bin/oemu/include/oemu/cpu.h
index 78b92da..882fe93 100644
--- a/usr.bin/oemu/include/oemu/cpu.h
+++ b/usr.bin/oemu/include/oemu/cpu.h
@@ -31,6 +31,7 @@
#define _OEMU_CPU_H_
#include <sys/types.h>
+#include <sys/param.h>
#include <stdint.h>
#include <stddef.h>
#include <oemu/types.h>
@@ -38,6 +39,12 @@
#define MEMORY_SIZE 512
/*
+ * Processor state register
+ */
+#define CPU_SRS_SV BIT(1) /* Supervisor flag */
+#define CPU_SRS_CARRY BIT(2) /* Carry flag */
+
+/*
* System memory
*
* @mem: Data
@@ -53,10 +60,16 @@ struct sysmem {
*
* @xreg: X<n>
* @ip: Instruction pointer
+ * @sr_state: Processor state register
+ * @blr: Branch link register
+ * @ilr: Interrupt link register
*/
struct cpu_regs {
reg_t xreg[16];
reg_t ip;
+ reg_t sr_state;
+ reg_t blr;
+ reg_t ilr;
};
struct oemu_cpu {
diff --git a/usr.bin/oemu/include/oemu/osmx64.h b/usr.bin/oemu/include/oemu/osmx64.h
index e9baae0..ffd6156 100644
--- a/usr.bin/oemu/include/oemu/osmx64.h
+++ b/usr.bin/oemu/include/oemu/osmx64.h
@@ -43,11 +43,16 @@
#define INST_OR 0x07 /* Bitwise OR operation */
#define INST_XOR 0x08 /* Bitwise XOR operation */
#define INST_AND 0x09 /* Bitwise AND operation */
-#define INST_NOT 0x10 /* Bitwise NOT operation */
-#define INST_SLL 0x11 /* Shift left logical operation */
-#define INST_SRL 0x12 /* Shift right logical operation */
-#define INST_MOV_IMM 0x13 /* Data move operation from IMM */
-#define INST_HLT 0x14 /* Halt */
+#define INST_NOT 0x0A /* Bitwise NOT operation */
+#define INST_SLL 0x0B /* Shift left logical operation */
+#define INST_SRL 0x0C /* Shift right logical operation */
+#define INST_MOV_IMM 0x0D /* Data move operation from IMM */
+#define INST_HLT 0x0E /* Halt */
+#define INST_BR 0x0F /* Branch */
+#define INST_MROB 0x10 /* Mask register over byte */
+#define INST_MROW 0x11 /* Mask register over word */
+#define INST_MROD 0x12 /* Mask register over dword */
+#define INST_MROQ 0x13 /* Mask register over qword */
/* Registers */
#define REG_X0 0x00
diff --git a/usr.bin/oemu/include/oemu/types.h b/usr.bin/oemu/include/oemu/types.h
index 0769c84..caf6e9b 100644
--- a/usr.bin/oemu/include/oemu/types.h
+++ b/usr.bin/oemu/include/oemu/types.h
@@ -33,7 +33,8 @@
#include <sys/types.h>
typedef uint64_t reg_t;
-typedef uintptr_t paddr_t;
+typedef uintptr_t addr_t;
typedef uint16_t imm_t;
+typedef addr_t paddr_t;
#endif /* !_OEMU_TYPES_H_ */