summaryrefslogtreecommitdiff
path: root/nios2.h
diff options
context:
space:
mode:
Diffstat (limited to 'nios2.h')
-rw-r--r--nios2.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/nios2.h b/nios2.h
index 15edbe8..eb13b95 100644
--- a/nios2.h
+++ b/nios2.h
@@ -25,9 +25,18 @@ struct nios2 {
uint32_t ctrl_regs[NIOS2_CTRL_REG_COUNT];
/* Program counter */
uint32_t pc;
+ /* User or Supervisor mode */
+ int mode;
+
+ /* Configurable processor features */
+ bool has_mul; /* mul, muli */
+ bool has_mulx; /* mulxss, mulxsu, mulxuu */
+ bool has_div; /* div, divu */
+
+ bool has_mmu; /* Memory Management Unit */
};
-/* Aliases for general-purpors registers */
+/* Aliases for general-purpose registers */
enum {
zero = 0,
at,
@@ -59,9 +68,17 @@ enum {
config,
mpubase,
mpuacc,
+};
+enum {
+ NIOS2_SUPERVISOR_MODE,
+ NIOS2_USER_MODE,
};
extern void nios2_cpu_reset(struct nios2 *cpu);
+extern bool nios2_in_user_mode(struct nios2 *cpu);
+extern bool nios2_in_supervisor_mode(struct nios2 *cpu);
+extern uint32_t nios2_cpu_fetch_instr(struct nios2 *cpu, uint32_t *mem_base);
+extern int nios2_cpu_execute_instr(struct nios2 *cpu, uint32_t instr);
#endif /* _NIOS2_H_ */