diff --git a/cpu/ppc/poweropcodes.cpp b/cpu/ppc/poweropcodes.cpp index 287477c..b90c077 100644 --- a/cpu/ppc/poweropcodes.cpp +++ b/cpu/ppc/poweropcodes.cpp @@ -35,4 +35,4 @@ static inline uint32_t power_rot_mask(unsigned rot_mb, unsigned rot_me) { } #include "ppcopmacros.h" -#include "poweropcodes.include" \ No newline at end of file +#include "poweropcodes.include" diff --git a/cpu/ppc/poweropcodes.include b/cpu/ppc/poweropcodes.include index 1fb3b03..14ab365 100644 --- a/cpu/ppc/poweropcodes.include +++ b/cpu/ppc/poweropcodes.include @@ -1,6 +1,3 @@ -#include "ppcopmacros.h" -#include "ppcemu.h" - POWEROPCODEOVREC (abs, uint32_t ppc_result_d; ppc_grab_regsda(instr); diff --git a/cpu/ppc/ppcemu.h b/cpu/ppc/ppcemu.h index cf048a5..81dbfa6 100644 --- a/cpu/ppc/ppcemu.h +++ b/cpu/ppc/ppcemu.h @@ -425,21 +425,6 @@ extern MemCtrlBase* mem_ctrl_instance; extern void add_ctx_sync_action(const std::function &); extern void do_ctx_sync(void); -// The functions used by the PowerPC processor -#include "ppcmacros_prototypes.h" - -namespace dppc_interpreter { - #include "ppcopcodes.include" - #include "poweropcodes.include" - #include "ppcfpopcodes.include" - -// AltiVec instructions - -// 64-bit instructions - -// G5+ instructions -} // namespace dppc_interpreter - extern uint64_t get_virt_time_ns(void); extern void ppc_main_opcode(uint32_t instr); @@ -453,4 +438,13 @@ void print_fprs(void); /* print content of the floating-point uint64_t get_reg(std::string reg_name); /* get content of the register reg_name */ void set_reg(std::string reg_name, uint64_t val); /* set reg_name to val */ +// The functions used by the PowerPC processor +#include "ppcmacros_prototypes.h" + +namespace dppc_interpreter { +#include "ppcopcodes.include" +#include "poweropcodes.include" +#include "ppcfpopcodes.include" +} // namespace dppc_interpreter + #endif /* PPCEMU_H */ diff --git a/cpu/ppc/ppcfpopcodes.cpp b/cpu/ppc/ppcfpopcodes.cpp index 8a6f58c..d1b4761 100644 --- a/cpu/ppc/ppcfpopcodes.cpp +++ b/cpu/ppc/ppcfpopcodes.cpp @@ -212,4 +212,4 @@ inline static void round_to_int(uint32_t instr, const uint8_t mode, field_rc rec } #include "ppcopmacros.h" -#include "ppcfpopcodes.include" \ No newline at end of file +#include "ppcfpopcodes.include" diff --git a/cpu/ppc/ppcfpopcodes.include b/cpu/ppc/ppcfpopcodes.include index 9bbce70..a18a3d0 100644 --- a/cpu/ppc/ppcfpopcodes.include +++ b/cpu/ppc/ppcfpopcodes.include @@ -1,6 +1,3 @@ -#include "ppcopmacros.h" -#include "ppcemu.h" - // Floating Point Arithmetic OPCODEREC (fadd, ppc_grab_regsfpdab(instr); diff --git a/cpu/ppc/ppcmacros_prototypes.h b/cpu/ppc/ppcmacros_prototypes.h index 5a6b572..31b73a9 100644 --- a/cpu/ppc/ppcmacros_prototypes.h +++ b/cpu/ppc/ppcmacros_prototypes.h @@ -22,66 +22,82 @@ along with this program. If not, see . #ifndef PPCMACROS_PROTTYPES_H #define PPCMACROS_PROTTYPES_H +# undef OPCODE # define OPCODE(op, ...) \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef POWEROPCODE # define POWEROPCODE(op, ...) \ - void power_##op(uint32_t instr) + void power_##op(uint32_t instr); +# undef OPCODESHIFT # define OPCODESHIFT(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODESHIFTREC # define OPCODESHIFTREC(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODECARRY # define OPCODECARRY(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODEOVREC # define OPCODEOVREC(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODEEXTSIGN # define OPCODEEXTSIGN(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef POWEROPCODEOVREC # define POWEROPCODEOVREC(op, ...) \ template \ - void power_##op(uint32_t instr) + void power_##op(uint32_t instr); +# undef OPCODEREC # define OPCODEREC(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef POWEROPCODEREC # define POWEROPCODEREC(op, ...) \ template \ - void power_##op(uint32_t instr) + void power_##op(uint32_t instr); +# undef OPCODELOGIC # define OPCODELOGIC(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODELKAA # define OPCODELKAA(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODEMEM # define OPCODEMEM(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODE601REC # define OPCODE601REC(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODE601L # define OPCODE601L(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); +# undef OPCODEL # define OPCODEL(op, ...) \ template \ - void ppc_##op(uint32_t instr) + void ppc_##op(uint32_t instr); -#endif /* PPCEMU_H */ \ No newline at end of file +#endif /* PPCEMU_H */ diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index 7930d3c..547fcdb 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -177,4 +177,4 @@ static void update_decrementer(uint32_t val) { } #include "ppcopmacros.h" -#include "ppcopcodes.include" \ No newline at end of file +#include "ppcopcodes.include" diff --git a/cpu/ppc/ppcopcodes.include b/cpu/ppc/ppcopcodes.include index 5d105c1..983df23 100644 --- a/cpu/ppc/ppcopcodes.include +++ b/cpu/ppc/ppcopcodes.include @@ -1,14 +1,9 @@ -#include "ppcopmacros.h" -#include "ppcemu.h" - OPCODESHIFT (addi, ppc_grab_regsdasimm(instr); - if (shift){ + if (shift) ppc_state.gpr[reg_d] = (reg_a == 0) ? (simm << 16) : (ppc_result_a + (simm << 16)); - } - else{ + else ppc_state.gpr[reg_d] = (reg_a == 0) ? simm : (ppc_result_a + simm); - } ) OPCODEREC (addic, diff --git a/cpu/ppc/ppcopmacros.h b/cpu/ppc/ppcopmacros.h index ba98f3c..582adf2 100644 --- a/cpu/ppc/ppcopmacros.h +++ b/cpu/ppc/ppcopmacros.h @@ -52,9 +52,9 @@ along with this program. If not, see . __VA_ARGS__ \ } \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ - template void dppc_interpreter::ppc_##op(uint32_t instr); \ + template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ - template void dppc_interpreter::ppc_##op(uint32_t instr); + template void dppc_interpreter::ppc_##op(uint32_t instr); #undef OPCODECARRY #define OPCODECARRY(op, ...) \ @@ -91,7 +91,7 @@ along with this program. If not, see . template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ - template void dppc_interpreter::ppc_##op(uint32_t instr); + template void dppc_interpreter::ppc_##op(uint32_t instr); #undef POWEROPCODEOVREC #define POWEROPCODEOVREC(op, ...) \ @@ -120,7 +120,7 @@ along with this program. If not, see . __VA_ARGS__ \ } \ template void dppc_interpreter::power_##op(uint32_t instr); \ - template void dppc_interpreter::power_##op(uint32_t instr); + template void dppc_interpreter::power_##op(uint32_t instr); #undef OPCODELOGIC #define OPCODELOGIC(op, ...) \ @@ -176,7 +176,6 @@ along with this program. If not, see . template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ - #undef OPCODE601L #define OPCODE601L(op, ...) \ @@ -188,7 +187,6 @@ along with this program. If not, see . template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); \ - #undef OPCODEL #define OPCODEL(op, ...) \ @@ -199,4 +197,4 @@ along with this program. If not, see . template void dppc_interpreter::ppc_##op(uint32_t instr); \ template void dppc_interpreter::ppc_##op(uint32_t instr); -#endif /* PPCEMU_H */ \ No newline at end of file +#endif /* PPCEMU_H */