diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2010-11-12 13:11:18 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2010-11-12 13:11:18 +0100 |
commit | c9c4555f8d38053ed2da4b0f81fd86301a14d8cb (patch) | |
tree | 59a32bee8ef753da2399650200473a93645bedbd /nios2.c | |
parent | e0330d9534d8cfeffff81f426df1d3277702b835 (diff) |
Implement more instructions
Diffstat (limited to 'nios2.c')
-rw-r--r-- | nios2.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -17,6 +17,22 @@ void nios2_cpu_reset(struct nios2 *cpu) { memset(cpu, 0x00, sizeof(struct nios2)); + cpu->mode = NIOS2_SUPERVISOR_MODE; +} + +bool nios2_in_user_mode(struct nios2 *cpu) +{ + if (!cpu->has_mmu) + return false; + else if (cpu->mode != NIOS2_USER_MODE) + return false; + else + return true; +} + +bool nios2_in_supervisor_mode(struct nios2 *cpu) +{ + return !nios2_in_user_mode(cpu); } uint32_t nios2_cpu_fetch_instr(struct nios2 *cpu, uint32_t *mem_base) |