Step 3 compiles now

Co-Authored-By: joevt <950609+joevt@users.noreply.github.com>
This commit is contained in:
dingusdev 2024-10-01 06:41:03 -07:00
parent ce122da984
commit e50a1a4d3e
9 changed files with 52 additions and 55 deletions

View File

@ -35,4 +35,4 @@ static inline uint32_t power_rot_mask(unsigned rot_mb, unsigned rot_me) {
}
#include "ppcopmacros.h"
#include "poweropcodes.include"
#include "poweropcodes.include"

View File

@ -1,6 +1,3 @@
#include "ppcopmacros.h"
#include "ppcemu.h"
POWEROPCODEOVREC (abs,
uint32_t ppc_result_d;
ppc_grab_regsda(instr);

View File

@ -425,21 +425,6 @@ extern MemCtrlBase* mem_ctrl_instance;
extern void add_ctx_sync_action(const std::function<void()> &);
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 */

View File

@ -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"
#include "ppcfpopcodes.include"

View File

@ -1,6 +1,3 @@
#include "ppcopmacros.h"
#include "ppcemu.h"
// Floating Point Arithmetic
OPCODEREC (fadd,
ppc_grab_regsfpdab(instr);

View File

@ -22,66 +22,82 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#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 <field_shift shift> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODESHIFTREC
# define OPCODESHIFTREC(op, ...) \
template <field_direction isleft, field_rc rec> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODECARRY
# define OPCODECARRY(op, ...) \
template <field_carry carry, field_rc rec, field_ov ov> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODEOVREC
# define OPCODEOVREC(op, ...) \
template <field_rc rec, field_ov ov> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODEEXTSIGN
# define OPCODEEXTSIGN(op, ...) \
template <class T, field_rc rec> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef POWEROPCODEOVREC
# define POWEROPCODEOVREC(op, ...) \
template <field_rc rec, field_ov ov> \
void power_##op(uint32_t instr)
void power_##op(uint32_t instr);
# undef OPCODEREC
# define OPCODEREC(op, ...) \
template <field_rc rec> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef POWEROPCODEREC
# define POWEROPCODEREC(op, ...) \
template <field_rc rec> \
void power_##op(uint32_t instr)
void power_##op(uint32_t instr);
# undef OPCODELOGIC
# define OPCODELOGIC(op, ...) \
template <logical_fun logical_op, field_rc rec> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODELKAA
# define OPCODELKAA(op, ...) \
template <field_lk l, field_aa a> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODEMEM
# define OPCODEMEM(op, ...) \
template <class T> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODE601REC
# define OPCODE601REC(op, ...) \
template <field_601 for601, field_rc rec> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODE601L
# define OPCODE601L(op, ...) \
template <field_lk l, field_601 for601> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
# undef OPCODEL
# define OPCODEL(op, ...) \
template <field_lk l> \
void ppc_##op(uint32_t instr)
void ppc_##op(uint32_t instr);
#endif /* PPCEMU_H */
#endif /* PPCEMU_H */

View File

@ -177,4 +177,4 @@ static void update_decrementer(uint32_t val) {
}
#include "ppcopmacros.h"
#include "ppcopcodes.include"
#include "ppcopcodes.include"

View File

@ -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,

View File

@ -52,9 +52,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
__VA_ARGS__ \
} \
template void dppc_interpreter::ppc_##op<RIGHT0, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LEFT1, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LEFT1, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<RIGHT0, RC1>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LEFT1, RC1>(uint32_t instr);
template void dppc_interpreter::ppc_##op<LEFT1, RC1>(uint32_t instr);
#undef OPCODECARRY
#define OPCODECARRY(op, ...) \
@ -91,7 +91,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
template void dppc_interpreter::ppc_##op<int8_t, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<int16_t, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<int8_t, RC1>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<int16_t, RC1>(uint32_t instr);
template void dppc_interpreter::ppc_##op<int16_t, RC1>(uint32_t instr);
#undef POWEROPCODEOVREC
#define POWEROPCODEOVREC(op, ...) \
@ -120,7 +120,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
__VA_ARGS__ \
} \
template void dppc_interpreter::power_##op<RC0>(uint32_t instr); \
template void dppc_interpreter::power_##op<RC1>(uint32_t instr);
template void dppc_interpreter::power_##op<RC1>(uint32_t instr);
#undef OPCODELOGIC
#define OPCODELOGIC(op, ...) \
@ -176,7 +176,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
template void dppc_interpreter::ppc_##op<IS601, RC0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<NOT601, RC1>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<IS601, RC1>(uint32_t instr); \
#undef OPCODE601L
#define OPCODE601L(op, ...) \
@ -188,7 +187,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
template void dppc_interpreter::ppc_##op<LK0, IS601>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LK1, NOT601>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LK1, IS601>(uint32_t instr); \
#undef OPCODEL
#define OPCODEL(op, ...) \
@ -199,4 +197,4 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
template void dppc_interpreter::ppc_##op<LK0>(uint32_t instr); \
template void dppc_interpreter::ppc_##op<LK1>(uint32_t instr);
#endif /* PPCEMU_H */
#endif /* PPCEMU_H */