void sim_board_reset (SIM_DESC sd) { struct hw *hw_cpu; sim_cpu *cpu; const struct bfd_arch_info *arch; const char *cpu_type; cpu = STATE_CPU (sd, 0); arch = STATE_ARCHITECTURE (sd); /* hw_cpu = sim_hw_parse (sd, "/"); */ if (arch->arch == bfd_arch_m68hc11) { cpu->cpu_type = CPU_M6811; cpu_type = "/m68hc11"; } else { cpu->cpu_type = CPU_M6812; cpu_type = "/m68hc12"; } hw_cpu = sim_hw_parse (sd, cpu_type); if (hw_cpu == 0) { sim_io_eprintf (sd, "%s cpu not found in device tree.", cpu_type); return; } cpu_reset (cpu); hw_port_event (hw_cpu, 3, 0); cpu_restart (cpu); }
system_call_interrupt(cpu *processor, unsigned_word cia) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: os_emul_system_call(processor, cia); cpu_restart(processor, cia+4); case OPERATING_ENVIRONMENT: cia = perform_oea_interrupt(processor, cia+4, 0x00c00, 0, 0, 0, 0); cpu_restart(processor, cia); default: error("system_call_interrupt() - internal error\n"); } }
data_storage_interrupt(cpu *processor, unsigned_word cia, unsigned_word ea, storage_interrupt_reasons reason, int is_store) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: error("data_storage_interrupt() should not be called in VEA mode\n"); case OPERATING_ENVIRONMENT: { spreg direction = (is_store ? dsisr_store_operation : 0); switch (reason) { case direct_store_storage_interrupt: DSISR = dsisr_direct_store_error_exception | direction; break; case hash_table_miss_storage_interrupt: DSISR = dsisr_hash_table_or_dbat_miss | direction; break; case protection_violation_storage_interrupt: DSISR = dsisr_protection_violation | direction; break; case earwax_violation_storage_interrupt: DSISR = dsisr_earwax_violation | direction; break; case segment_table_miss_storage_interrupt: DSISR = dsisr_segment_table_miss | direction; break; case earwax_disabled_storage_interrupt: DSISR = dsisr_earwax_disabled | direction; break; default: error("data_storage_interrupt: unknown reason %d\n", reason); break; } DAR = (spreg)ea; cia = perform_oea_interrupt(processor, cia, 0x00300, 0, 0, 0, 0); cpu_restart(processor, cia); } default: error("data_storage_interrupt() - internal error\n"); } }
floating_point_assist_interrupt(cpu *processor, unsigned_word cia) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: error("%s - cia=0x%x - not implemented\n", "floating_point_assist_interrupt", cia); case OPERATING_ENVIRONMENT: cia = perform_oea_interrupt(processor, cia, 0x00e00, 0, 0, 0, 0); cpu_restart(processor, cia); default: error("floating_point_assist_interrupt() - internal error\n"); } }
machine_check_interrupt(cpu *processor, unsigned_word cia) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: error("%s - cia=0x%x\n", "machine_check_interrupt", cia); case OPERATING_ENVIRONMENT: cia = perform_oea_interrupt(processor, cia, 0x00200, 0, 0, 0, 0); cpu_restart(processor, cia); default: error("machine_check_interrupt() - internal error\n"); } }
program_interrupt(cpu *processor, unsigned_word cia, program_interrupt_reasons reason) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: switch (reason) { default: error("%s - cia=0x%x, reason=%d - not implemented\n", "program_interrupt", cia, reason); } case OPERATING_ENVIRONMENT: { msreg srr1_set; switch (reason) { case illegal_instruction_program_interrupt: srr1_set = srr1_illegal_instruction; break; case privileged_instruction_program_interrupt: srr1_set = srr1_priviliged_instruction; break; case trap_program_interrupt: srr1_set = srr1_trap; break; default: srr1_set = 0; error("program_interrupt - cia=0x%x, reason=%d(%s) - not implemented\n", cia, reason); } cia = perform_oea_interrupt(processor, cia, 0x00700, 0, 0, 0, srr1_set); cpu_restart(processor, cia); } default: error("program_interrupt() - internal error\n"); } }
instruction_storage_interrupt(cpu *processor, unsigned_word cia, storage_interrupt_reasons reason) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: error("instruction_storage_interrupt - cia=0x%x - not implemented\n", cia); case OPERATING_ENVIRONMENT: { msreg srr1_set; switch(reason) { case hash_table_miss_storage_interrupt: srr1_set = srr1_hash_table_or_ibat_miss; break; case direct_store_storage_interrupt: srr1_set = srr1_direct_store_error_exception; break; case protection_violation_storage_interrupt: srr1_set = srr1_protection_violation; break; case segment_table_miss_storage_interrupt: srr1_set = srr1_segment_table_miss; break; default: srr1_set = 0; error("instruction_storage_interrupt: unknown reason %d\n", reason); break; } cia = perform_oea_interrupt(processor, cia, 0x00400, 0, 0, 0, srr1_set); cpu_restart(processor, cia); } default: error("instruction_storage_interrupt() - internal error\n"); } }
alignment_interrupt(cpu *processor, unsigned_word cia, unsigned_word ra) { switch (CURRENT_ENVIRONMENT) { case USER_ENVIRONMENT: case VIRTUAL_ENVIRONMENT: error("%s - cia=0x%x, ra=0x%x\n", "alignment_interrupt", cia, ra); case OPERATING_ENVIRONMENT: DAR = (spreg)ra; DSISR = 0; /* FIXME */ cia = perform_oea_interrupt(processor, cia, 0x00600, 0, 0, 0, 0); cpu_restart(processor, cia); default: error("alignment_interrupt() - internal error\n"); } }