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.h14
-rw-r--r--usr.bin/oemu/include/oemu/osmx64.h2
-rw-r--r--usr.bin/oemu/include/oemu/types.h3
3 files changed, 18 insertions, 1 deletions
diff --git a/usr.bin/oemu/include/oemu/cpu.h b/usr.bin/oemu/include/oemu/cpu.h
index df4cc80..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,16 +60,23 @@ 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 {
struct cpu_regs regs;
};
+void cpu_regdump(struct oemu_cpu *cpu);
void cpu_reset(struct oemu_cpu *cpu);
void cpu_kick(struct oemu_cpu *cpu, struct sysmem *mem);
diff --git a/usr.bin/oemu/include/oemu/osmx64.h b/usr.bin/oemu/include/oemu/osmx64.h
index d7ea8b1..b1df5d3 100644
--- a/usr.bin/oemu/include/oemu/osmx64.h
+++ b/usr.bin/oemu/include/oemu/osmx64.h
@@ -47,6 +47,8 @@
#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_BR 0x15 /* Branch */
/* 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_ */