comparison m68k_core.c @ 990:33a46d35b913

Implement privelege violation exceptions
author Michael Pavone <pavone@retrodev.com>
date Wed, 27 Apr 2016 23:11:24 -0700
parents d70000fdff0b
children 261995d06897
comparison
equal deleted inserted replaced
989:d70000fdff0b 990:33a46d35b913
348 jmp(code, opts->trap); 348 jmp(code, opts->trap);
349 } 349 }
350 350
351 void translate_m68k_move_usp(m68k_options *opts, m68kinst *inst) 351 void translate_m68k_move_usp(m68k_options *opts, m68kinst *inst)
352 { 352 {
353 m68k_trap_if_not_supervisor(opts, inst);
353 cycles(&opts->gen, BUS); 354 cycles(&opts->gen, BUS);
354 int8_t reg; 355 int8_t reg;
355 if (inst->src.addr_mode == MODE_UNUSED) { 356 if (inst->src.addr_mode == MODE_UNUSED) {
356 reg = native_reg(&inst->dst, opts); 357 reg = native_reg(&inst->dst, opts);
357 if (reg < 0) { 358 if (reg < 0) {
530 call_args(code, (code_ptr)print_regs_exit, 1, opts->gen.context_reg); 531 call_args(code, (code_ptr)print_regs_exit, 1, opts->gen.context_reg);
531 } 532 }
532 533
533 void translate_m68k_rte(m68k_options *opts, m68kinst *inst) 534 void translate_m68k_rte(m68k_options *opts, m68kinst *inst)
534 { 535 {
535 code_info *code = &opts->gen.code; 536 m68k_trap_if_not_supervisor(opts, inst);
536 //TODO: Trap if not in system mode 537
538 code_info *code = &opts->gen.code;
537 //Read saved SR 539 //Read saved SR
538 areg_to_native(opts, 7, opts->gen.scratch1); 540 areg_to_native(opts, 7, opts->gen.scratch1);
539 call(code, opts->read_16); 541 call(code, opts->read_16);
540 addi_areg(opts, 2, 7); 542 addi_areg(opts, 2, 7);
541 call(code, opts->set_sr); 543 call(code, opts->set_sr);