From 2c1d8fa18a8251c6627a654efcea3d9d99d0d5f8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 29 Apr 2019 19:06:10 -0400 Subject: [PATCH] Adds a check for instruction privilege violation, albeit that I think I need different bus steps. --- .../68000/Implementation/68000Implementation.hpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Processors/68000/Implementation/68000Implementation.hpp b/Processors/68000/Implementation/68000Implementation.hpp index 2b5cc3fd0..a69941654 100644 --- a/Processors/68000/Implementation/68000Implementation.hpp +++ b/Processors/68000/Implementation/68000Implementation.hpp @@ -150,8 +150,18 @@ template void Proces } if(instructions[decoded_instruction_].micro_operations) { - active_program_ = &instructions[decoded_instruction_]; - active_micro_op_ = active_program_->micro_operations; + // Check for a privilege violation. + if(instructions[decoded_instruction_].requires_supervisor && !is_supervisor_) { + // TODO: this isn't the correct set of bus steps; this exception should + // push more informatio to the stack. + active_program_ = nullptr; + active_micro_op_ = exception_micro_ops_; + populate_trap_steps(8, get_status()); + } else { + // Standard instruction dispatch. + active_program_ = &instructions[decoded_instruction_]; + active_micro_op_ = active_program_->micro_operations; + } } else { active_program_ = nullptr; active_micro_op_ = exception_micro_ops_;