* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+//#define DEBUG_OP
+
#include "config.h"
#include "exec.h"
-//#define DEBUG_OP
-
#define regs (env)
#define Ts0 (int32_t)T0
#define Ts1 (int32_t)T1
}
/* Generate exceptions */
-PPC_OP(queue_exception_err)
+PPC_OP(raise_exception_err)
{
- do_queue_exception_err(PARAM(1), PARAM(2));
+ do_raise_exception_err(PARAM(1), PARAM(2));
}
-PPC_OP(queue_exception)
+PPC_OP(raise_exception)
{
- do_queue_exception(PARAM(1));
+ do_raise_exception(PARAM(1));
}
-PPC_OP(process_exceptions)
+PPC_OP(update_nip)
{
env->nip = PARAM(1);
- if (env->exceptions != 0) {
- do_check_exception_state();
- }
+}
+
+PPC_OP(debug)
+{
+ env->nip = PARAM(1);
+#if defined (DEBUG_OP)
+ dump_state();
+#endif
+ do_raise_exception(EXCP_DEBUG);
+ RETURN();
}
/* Segment registers load and store with immediate index */
PPC_OP(store_srin)
{
-#if defined (DEBUG_OP)
- dump_store_sr(T1 >> 28);
-#endif
- regs->sr[T1 >> 28] = T0;
+ do_store_sr(T1 >> 28);
RETURN();
}
RETURN();
}
-/* Update time base */
-PPC_OP(update_tb)
+PPC_OP(load_tbl)
{
- T0 = regs->tb[0];
- T1 = T0;
- T0 += PARAM(1);
-#if defined (DEBUG_OP)
- dump_update_tb(PARAM(1));
-#endif
- if (T0 < T1) {
- T1 = regs->tb[1] + 1;
- regs->tb[1] = T1;
- }
- regs->tb[0] = T0;
+ T0 = cpu_ppc_load_tbl(regs);
RETURN();
}
-PPC_OP(load_tb)
+PPC_OP(load_tbu)
{
- T0 = regs->tb[PARAM(1)];
+ T0 = cpu_ppc_load_tbu(regs);
RETURN();
}
-PPC_OP(store_tb)
+PPC_OP(store_tbl)
{
- regs->tb[PARAM(1)] = T0;
-#if defined (DEBUG_OP)
- dump_store_tb(PARAM(1));
-#endif
+ cpu_ppc_store_tbl(regs, T0);
RETURN();
}
-/* Update decrementer */
-PPC_OP(update_decr)
+PPC_OP(store_tbu)
{
- T0 = regs->decr;
- T1 = T0;
- T0 -= PARAM(1);
- regs->decr = T0;
- if (PARAM(1) > T1) {
- do_queue_exception(EXCP_DECR);
- }
+ cpu_ppc_store_tbu(regs, T0);
RETURN();
}
-PPC_OP(store_decr)
+PPC_OP(load_decr)
{
- T1 = regs->decr;
- regs->decr = T0;
- if (Ts0 < 0 && Ts1 > 0) {
- do_queue_exception(EXCP_DECR);
+ T0 = cpu_ppc_load_decr(regs);
}
+
+PPC_OP(store_decr)
+{
+ cpu_ppc_store_decr(regs, T0);
RETURN();
}
PPC_OP(store_ibat)
{
-#if defined (DEBUG_OP)
- dump_store_ibat(PARAM(1), PARAM(2));
-#endif
- regs->IBAT[PARAM(1)][PARAM(2)] = T0;
+ do_store_ibat(PARAM(1), PARAM(2));
}
PPC_OP(load_dbat)
PPC_OP(store_dbat)
{
-#if defined (DEBUG_OP)
- dump_store_dbat(PARAM(1), PARAM(2));
-#endif
- regs->DBAT[PARAM(1)][PARAM(2)] = T0;
+ do_store_dbat(PARAM(1), PARAM(2));
}
/* FPSCR */
PPC_OP(test_ctr)
{
- T0 = (regs->ctr != 0);
+ T0 = regs->ctr;
}
PPC_OP(test_ctr_true)
PPC_OP(test_true)
{
- T0 = ((T0 & PARAM(1)) != 0);
+ T0 = (T0 & PARAM(1));
}
PPC_OP(test_false)
/* fnmadd - fnmadd. - fnmadds - fnmadds. */
PPC_OP(fnmadd)
{
- FT0 = -((FT0 * FT1) + FT2);
+ do_fnmadd();
RETURN();
}
/* fnmadds - fnmadds. */
PPC_OP(fnmadds)
{
- FTS0 = -((FTS0 * FTS1) + FTS2);
+ do_fnmadds();
RETURN();
}
/* fnmsub - fnmsub. */
PPC_OP(fnmsub)
{
- FT0 = -((FT0 * FT1) - FT2);
+ do_fnmsub();
RETURN();
}
/* fnmsubs - fnmsubs. */
PPC_OP(fnmsubs)
{
- FTS0 = -((FTS0 * FTS1) - FTS2);
+ do_fnmsubs();
RETURN();
}
}
/* Load and store */
-#if defined(CONFIG_USER_ONLY)
#define MEMSUFFIX _raw
#include "op_mem.h"
-#else
+#if !defined(CONFIG_USER_ONLY)
#define MEMSUFFIX _user
#include "op_mem.h"
#include "op_mem.h"
#endif
+/* Special op to check and maybe clear reservation */
+PPC_OP(check_reservation)
+{
+ do_check_reservation();
+ RETURN();
+}
+
/* Return from interrupt */
PPC_OP(rfi)
{
+ regs->nip = regs->spr[SRR0] & ~0x00000003;
+#if 1 // TRY
+ T0 = regs->spr[SRR1] & ~0xFFF00000;
+#else
T0 = regs->spr[SRR1] & ~0xFFFF0000;
+#endif
do_store_msr();
- do_tlbia();
+#if defined (DEBUG_OP)
dump_rfi();
- regs->nip = regs->spr[SRR0] & ~0x00000003;
- if (env->exceptions != 0) {
- do_check_exception_state();
- }
+#endif
+ // do_tlbia();
+ do_raise_exception(EXCP_RFI);
RETURN();
}
(Ts0 == Ts1 && (PARAM(1) & 0x04)) ||
(T0 < T1 && (PARAM(1) & 0x02)) ||
(T0 > T1 && (PARAM(1) & 0x01)))
- do_queue_exception_err(EXCP_PROGRAM, EXCP_TRAP);
+ do_raise_exception_err(EXCP_PROGRAM, EXCP_TRAP);
RETURN();
}
(Ts0 == SPARAM(1) && (PARAM(2) & 0x04)) ||
(T0 < (uint32_t)SPARAM(1) && (PARAM(2) & 0x02)) ||
(T0 > (uint32_t)SPARAM(1) && (PARAM(2) & 0x01)))
- do_queue_exception_err(EXCP_PROGRAM, EXCP_TRAP);
+ do_raise_exception_err(EXCP_PROGRAM, EXCP_TRAP);
RETURN();
}