2003-11-23 17:55:54 +03:00
|
|
|
/*
|
2005-07-03 00:59:34 +04:00
|
|
|
* PowerPC emulation for qemu: main translation routines.
|
2007-09-17 01:08:06 +04:00
|
|
|
*
|
2007-03-07 11:32:30 +03:00
|
|
|
* Copyright (c) 2003-2007 Jocelyn Mayer
|
2003-11-23 17:55:54 +03:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2004-05-20 17:10:49 +04:00
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
#include "cpu.h"
|
2004-05-20 17:10:49 +04:00
|
|
|
#include "exec-all.h"
|
2003-11-23 17:55:54 +03:00
|
|
|
#include "disas.h"
|
2008-08-29 01:01:45 +04:00
|
|
|
#include "helper.h"
|
2008-02-01 13:50:11 +03:00
|
|
|
#include "tcg-op.h"
|
2008-04-12 01:35:42 +04:00
|
|
|
#include "qemu-common.h"
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2008-05-11 03:28:14 +04:00
|
|
|
#define CPU_SINGLE_STEP 0x1
|
|
|
|
#define CPU_BRANCH_STEP 0x2
|
|
|
|
#define GDBSTUB_SINGLE_STEP 0x4
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* Include definitions for instructions classes and implementations flags */
|
2003-11-23 17:55:54 +03:00
|
|
|
//#define DO_SINGLE_STEP
|
2004-05-21 16:59:32 +04:00
|
|
|
//#define PPC_DEBUG_DISAS
|
2007-04-16 11:10:48 +04:00
|
|
|
//#define DEBUG_MEMORY_ACCESSES
|
2007-03-07 11:32:30 +03:00
|
|
|
//#define DO_PPC_STATISTICS
|
2007-10-27 21:54:30 +04:00
|
|
|
//#define OPTIMIZE_FPRF_UPDATE
|
2003-11-23 17:55:54 +03:00
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* Code translation helpers */
|
2005-10-31 00:39:19 +03:00
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
/* global register indexes */
|
|
|
|
static TCGv cpu_env;
|
2008-09-04 18:43:45 +04:00
|
|
|
static char cpu_reg_names[10*3 + 22*4 /* GPR */
|
2008-09-04 09:25:47 +04:00
|
|
|
#if !defined(TARGET_PPC64)
|
2008-09-04 18:43:45 +04:00
|
|
|
+ 10*4 + 22*5 /* SPE GPRh */
|
2008-09-04 09:25:47 +04:00
|
|
|
#endif
|
2008-09-04 18:43:54 +04:00
|
|
|
+ 10*4 + 22*5 /* FPR */
|
2008-09-04 21:06:47 +04:00
|
|
|
+ 2*(10*6 + 22*7) /* AVRh, AVRl */
|
|
|
|
+ 8*5 /* CRF */];
|
2008-09-04 09:25:47 +04:00
|
|
|
static TCGv cpu_gpr[32];
|
|
|
|
#if !defined(TARGET_PPC64)
|
|
|
|
static TCGv cpu_gprh[32];
|
|
|
|
#endif
|
2008-09-04 18:43:54 +04:00
|
|
|
static TCGv cpu_fpr[32];
|
2008-09-04 18:43:45 +04:00
|
|
|
static TCGv cpu_avrh[32], cpu_avrl[32];
|
2008-09-04 21:06:47 +04:00
|
|
|
static TCGv cpu_crf[8];
|
2008-09-04 22:06:03 +04:00
|
|
|
static TCGv cpu_nip;
|
2008-09-04 09:25:47 +04:00
|
|
|
|
|
|
|
/* dyngen register indexes */
|
|
|
|
static TCGv cpu_T[3];
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define cpu_T64 cpu_T
|
|
|
|
#else
|
|
|
|
static TCGv cpu_T64[3];
|
|
|
|
#endif
|
2008-09-04 18:43:54 +04:00
|
|
|
static TCGv cpu_FT[3];
|
2008-09-04 18:43:45 +04:00
|
|
|
static TCGv cpu_AVRh[3], cpu_AVRl[3];
|
2008-06-29 05:03:05 +04:00
|
|
|
|
|
|
|
#include "gen-icount.h"
|
|
|
|
|
|
|
|
void ppc_translate_init(void)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
int i;
|
|
|
|
char* p;
|
2008-06-29 16:29:56 +04:00
|
|
|
static int done_init = 0;
|
2008-09-04 09:25:47 +04:00
|
|
|
|
2008-06-29 05:03:05 +04:00
|
|
|
if (done_init)
|
|
|
|
return;
|
2008-09-04 09:25:47 +04:00
|
|
|
|
2008-06-29 05:03:05 +04:00
|
|
|
cpu_env = tcg_global_reg_new(TCG_TYPE_PTR, TCG_AREG0, "env");
|
2008-08-29 01:01:36 +04:00
|
|
|
#if TARGET_LONG_BITS > HOST_LONG_BITS
|
|
|
|
cpu_T[0] = tcg_global_mem_new(TCG_TYPE_TL,
|
|
|
|
TCG_AREG0, offsetof(CPUState, t0), "T0");
|
|
|
|
cpu_T[1] = tcg_global_mem_new(TCG_TYPE_TL,
|
|
|
|
TCG_AREG0, offsetof(CPUState, t1), "T1");
|
|
|
|
cpu_T[2] = tcg_global_mem_new(TCG_TYPE_TL,
|
|
|
|
TCG_AREG0, offsetof(CPUState, t2), "T2");
|
|
|
|
#else
|
|
|
|
cpu_T[0] = tcg_global_reg_new(TCG_TYPE_TL, TCG_AREG1, "T0");
|
|
|
|
cpu_T[1] = tcg_global_reg_new(TCG_TYPE_TL, TCG_AREG2, "T1");
|
|
|
|
cpu_T[2] = tcg_global_reg_new(TCG_TYPE_TL, TCG_AREG3, "T2");
|
|
|
|
#endif
|
2008-09-04 09:25:47 +04:00
|
|
|
#if !defined(TARGET_PPC64)
|
|
|
|
cpu_T64[0] = tcg_global_mem_new(TCG_TYPE_I64,
|
2008-09-04 09:26:09 +04:00
|
|
|
TCG_AREG0, offsetof(CPUState, t0_64),
|
2008-09-04 09:25:47 +04:00
|
|
|
"T0_64");
|
|
|
|
cpu_T64[1] = tcg_global_mem_new(TCG_TYPE_I64,
|
2008-09-04 09:26:09 +04:00
|
|
|
TCG_AREG0, offsetof(CPUState, t1_64),
|
2008-09-04 09:25:47 +04:00
|
|
|
"T1_64");
|
|
|
|
cpu_T64[2] = tcg_global_mem_new(TCG_TYPE_I64,
|
2008-09-04 09:26:09 +04:00
|
|
|
TCG_AREG0, offsetof(CPUState, t2_64),
|
2008-09-04 09:25:47 +04:00
|
|
|
"T2_64");
|
|
|
|
#endif
|
2008-09-04 18:43:54 +04:00
|
|
|
|
|
|
|
cpu_FT[0] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, ft0), "FT0");
|
|
|
|
cpu_FT[1] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, ft1), "FT1");
|
|
|
|
cpu_FT[2] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, ft2), "FT2");
|
|
|
|
|
2008-09-04 18:43:45 +04:00
|
|
|
cpu_AVRh[0] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr0.u64[0]), "AVR0H");
|
|
|
|
cpu_AVRl[0] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr0.u64[1]), "AVR0L");
|
|
|
|
cpu_AVRh[1] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr1.u64[0]), "AVR1H");
|
|
|
|
cpu_AVRl[1] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr1.u64[1]), "AVR1L");
|
|
|
|
cpu_AVRh[2] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr2.u64[0]), "AVR2H");
|
|
|
|
cpu_AVRl[2] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr2.u64[1]), "AVR2L");
|
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
p = cpu_reg_names;
|
2008-09-04 21:06:47 +04:00
|
|
|
|
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
sprintf(p, "crf%d", i);
|
|
|
|
cpu_crf[i] = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0,
|
|
|
|
offsetof(CPUState, crf[i]), p);
|
|
|
|
p += 5;
|
|
|
|
}
|
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
sprintf(p, "r%d", i);
|
|
|
|
cpu_gpr[i] = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0,
|
|
|
|
offsetof(CPUState, gpr[i]), p);
|
|
|
|
p += (i < 10) ? 3 : 4;
|
|
|
|
#if !defined(TARGET_PPC64)
|
|
|
|
sprintf(p, "r%dH", i);
|
|
|
|
cpu_gprh[i] = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0,
|
|
|
|
offsetof(CPUState, gprh[i]), p);
|
|
|
|
p += (i < 10) ? 4 : 5;
|
|
|
|
#endif
|
2008-09-04 18:43:45 +04:00
|
|
|
|
2008-09-04 18:43:54 +04:00
|
|
|
sprintf(p, "fp%d", i);
|
|
|
|
cpu_fpr[i] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, fpr[i]), p);
|
2008-09-04 19:49:12 +04:00
|
|
|
p += (i < 10) ? 4 : 5;
|
2008-09-04 18:43:54 +04:00
|
|
|
|
2008-09-04 18:43:45 +04:00
|
|
|
sprintf(p, "avr%dH", i);
|
|
|
|
cpu_avrh[i] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr[i].u64[0]), p);
|
|
|
|
p += (i < 10) ? 6 : 7;
|
2008-09-04 19:49:12 +04:00
|
|
|
|
2008-09-04 18:43:45 +04:00
|
|
|
sprintf(p, "avr%dL", i);
|
|
|
|
cpu_avrl[i] = tcg_global_mem_new(TCG_TYPE_I64, TCG_AREG0,
|
|
|
|
offsetof(CPUState, avr[i].u64[1]), p);
|
|
|
|
p += (i < 10) ? 6 : 7;
|
2008-09-04 09:25:47 +04:00
|
|
|
}
|
2008-08-29 01:01:45 +04:00
|
|
|
|
2008-09-04 22:06:03 +04:00
|
|
|
cpu_nip = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0,
|
|
|
|
offsetof(CPUState, nip), "nip");
|
|
|
|
|
2008-08-29 01:01:45 +04:00
|
|
|
/* register helpers */
|
|
|
|
#undef DEF_HELPER
|
|
|
|
#define DEF_HELPER(ret, name, params) tcg_register_helper(name, #name);
|
|
|
|
#include "helper.h"
|
|
|
|
|
2008-06-29 05:03:05 +04:00
|
|
|
done_init = 1;
|
|
|
|
}
|
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#if defined(OPTIMIZE_FPRF_UPDATE)
|
|
|
|
static uint16_t *gen_fprf_buf[OPC_BUF_SIZE];
|
|
|
|
static uint16_t **gen_fprf_ptr;
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* internal defines */
|
|
|
|
typedef struct DisasContext {
|
|
|
|
struct TranslationBlock *tb;
|
2005-01-04 02:43:32 +03:00
|
|
|
target_ulong nip;
|
2003-11-23 17:55:54 +03:00
|
|
|
uint32_t opcode;
|
2004-01-05 01:58:38 +03:00
|
|
|
uint32_t exception;
|
2005-02-16 02:06:19 +03:00
|
|
|
/* Routine used to access memory */
|
|
|
|
int mem_idx;
|
|
|
|
/* Translation flags */
|
2004-01-05 01:58:38 +03:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2003-11-23 17:55:54 +03:00
|
|
|
int supervisor;
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
int sf_mode;
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2005-02-16 02:06:19 +03:00
|
|
|
int fpu_enabled;
|
2007-10-07 22:19:26 +04:00
|
|
|
int altivec_enabled;
|
2007-03-21 01:11:31 +03:00
|
|
|
int spe_enabled;
|
2005-07-03 00:59:34 +04:00
|
|
|
ppc_spr_t *spr_cb; /* Needed to check rights for mfspr/mtspr */
|
2006-05-23 01:50:20 +04:00
|
|
|
int singlestep_enabled;
|
2007-10-04 04:51:58 +04:00
|
|
|
int dcache_line_size;
|
2003-11-23 17:55:54 +03:00
|
|
|
} DisasContext;
|
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
struct opc_handler_t {
|
2003-11-23 17:55:54 +03:00
|
|
|
/* invalid bits */
|
|
|
|
uint32_t inval;
|
2004-01-05 01:58:38 +03:00
|
|
|
/* instruction type */
|
2007-03-21 01:11:31 +03:00
|
|
|
uint64_t type;
|
2003-11-23 17:55:54 +03:00
|
|
|
/* handler */
|
|
|
|
void (*handler)(DisasContext *ctx);
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#if defined(DO_PPC_STATISTICS) || defined(PPC_DUMP_CPU)
|
2007-03-07 11:32:30 +03:00
|
|
|
const unsigned char *oname;
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#endif
|
|
|
|
#if defined(DO_PPC_STATISTICS)
|
2007-03-07 11:32:30 +03:00
|
|
|
uint64_t count;
|
|
|
|
#endif
|
2005-07-03 00:59:34 +04:00
|
|
|
};
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_set_Rc0 (DisasContext *ctx)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_cmpi_64(0);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_cmpi(0);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_set_Rc0();
|
|
|
|
}
|
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
static always_inline void gen_reset_fpstatus (void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_SOFTFLOAT
|
|
|
|
gen_op_reset_fpstatus();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static always_inline void gen_compute_fprf (int set_fprf, int set_rc)
|
|
|
|
{
|
|
|
|
if (set_fprf != 0) {
|
|
|
|
/* This case might be optimized later */
|
|
|
|
#if defined(OPTIMIZE_FPRF_UPDATE)
|
|
|
|
*gen_fprf_ptr++ = gen_opc_ptr;
|
|
|
|
#endif
|
|
|
|
gen_op_compute_fprf(1);
|
|
|
|
if (unlikely(set_rc))
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[1], cpu_T[0], 0xf);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_op_float_check_status();
|
|
|
|
} else if (unlikely(set_rc)) {
|
|
|
|
/* We always need to compute fpcc */
|
|
|
|
gen_op_compute_fprf(0);
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[1], cpu_T[0], 0xf);
|
2007-10-27 21:54:30 +04:00
|
|
|
if (set_fprf)
|
|
|
|
gen_op_float_check_status();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static always_inline void gen_optimize_fprf (void)
|
|
|
|
{
|
|
|
|
#if defined(OPTIMIZE_FPRF_UPDATE)
|
|
|
|
uint16_t **ptr;
|
|
|
|
|
|
|
|
for (ptr = gen_fprf_buf; ptr != (gen_fprf_ptr - 1); ptr++)
|
|
|
|
*ptr = INDEX_op_nop1;
|
|
|
|
gen_fprf_ptr = gen_fprf_buf;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_update_nip (DisasContext *ctx, target_ulong nip)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_movi_tl(cpu_nip, nip);
|
2007-03-17 17:02:15 +03:00
|
|
|
else
|
|
|
|
#endif
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_movi_tl(cpu_nip, (uint32_t)nip);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
|
2007-09-29 17:06:16 +04:00
|
|
|
#define GEN_EXCP(ctx, excp, error) \
|
2003-11-23 17:55:54 +03:00
|
|
|
do { \
|
2007-09-29 17:06:16 +04:00
|
|
|
if ((ctx)->exception == POWERPC_EXCP_NONE) { \
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, (ctx)->nip); \
|
2004-05-21 16:59:32 +04:00
|
|
|
} \
|
|
|
|
gen_op_raise_exception_err((excp), (error)); \
|
|
|
|
ctx->exception = (excp); \
|
2003-11-23 17:55:54 +03:00
|
|
|
} while (0)
|
|
|
|
|
2007-09-29 17:06:16 +04:00
|
|
|
#define GEN_EXCP_INVAL(ctx) \
|
|
|
|
GEN_EXCP((ctx), POWERPC_EXCP_PROGRAM, \
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL)
|
2004-05-21 16:59:32 +04:00
|
|
|
|
2007-09-29 17:06:16 +04:00
|
|
|
#define GEN_EXCP_PRIVOPC(ctx) \
|
|
|
|
GEN_EXCP((ctx), POWERPC_EXCP_PROGRAM, \
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_PRIV_OPC)
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-09-29 17:06:16 +04:00
|
|
|
#define GEN_EXCP_PRIVREG(ctx) \
|
|
|
|
GEN_EXCP((ctx), POWERPC_EXCP_PROGRAM, \
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_PRIV_REG)
|
|
|
|
|
|
|
|
#define GEN_EXCP_NO_FP(ctx) \
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_FPU, 0)
|
|
|
|
|
|
|
|
#define GEN_EXCP_NO_AP(ctx) \
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_APU, 0)
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-10-07 22:19:26 +04:00
|
|
|
#define GEN_EXCP_NO_VR(ctx) \
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_VPU, 0)
|
|
|
|
|
2005-11-24 00:36:30 +03:00
|
|
|
/* Stop translation */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void GEN_STOP (DisasContext *ctx)
|
2005-07-03 00:59:34 +04:00
|
|
|
{
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2007-09-29 17:06:16 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_STOP;
|
2005-07-03 00:59:34 +04:00
|
|
|
}
|
|
|
|
|
2005-11-24 00:36:30 +03:00
|
|
|
/* No need to update nip here, as execution flow will change */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void GEN_SYNC (DisasContext *ctx)
|
2005-07-03 02:09:27 +04:00
|
|
|
{
|
2007-09-29 17:06:16 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_SYNC;
|
2005-07-03 02:09:27 +04:00
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
#define GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
static void gen_##name (DisasContext *ctx); \
|
|
|
|
GEN_OPCODE(name, opc1, opc2, opc3, inval, type); \
|
|
|
|
static void gen_##name (DisasContext *ctx)
|
|
|
|
|
2007-10-26 04:46:07 +04:00
|
|
|
#define GEN_HANDLER2(name, onam, opc1, opc2, opc3, inval, type) \
|
|
|
|
static void gen_##name (DisasContext *ctx); \
|
|
|
|
GEN_OPCODE2(name, onam, opc1, opc2, opc3, inval, type); \
|
|
|
|
static void gen_##name (DisasContext *ctx)
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
typedef struct opcode_t {
|
|
|
|
unsigned char opc1, opc2, opc3;
|
2008-06-03 23:51:57 +04:00
|
|
|
#if HOST_LONG_BITS == 64 /* Explicitly align to 64 bits */
|
2005-02-09 00:24:36 +03:00
|
|
|
unsigned char pad[5];
|
|
|
|
#else
|
|
|
|
unsigned char pad[1];
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
opc_handler_t handler;
|
2005-07-03 00:59:34 +04:00
|
|
|
const unsigned char *oname;
|
2003-11-23 17:55:54 +03:00
|
|
|
} opcode_t;
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/*****************************************************************************/
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Instruction decoding ***/
|
|
|
|
#define EXTRACT_HELPER(name, shift, nb) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline uint32_t name (uint32_t opcode) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
|
|
|
return (opcode >> (shift)) & ((1 << (nb)) - 1); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define EXTRACT_SHELPER(name, shift, nb) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline int32_t name (uint32_t opcode) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2005-02-09 00:24:36 +03:00
|
|
|
return (int16_t)((opcode >> (shift)) & ((1 << (nb)) - 1)); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Opcode part 1 */
|
|
|
|
EXTRACT_HELPER(opc1, 26, 6);
|
|
|
|
/* Opcode part 2 */
|
|
|
|
EXTRACT_HELPER(opc2, 1, 5);
|
|
|
|
/* Opcode part 3 */
|
|
|
|
EXTRACT_HELPER(opc3, 6, 5);
|
|
|
|
/* Update Cr0 flags */
|
|
|
|
EXTRACT_HELPER(Rc, 0, 1);
|
|
|
|
/* Destination */
|
|
|
|
EXTRACT_HELPER(rD, 21, 5);
|
|
|
|
/* Source */
|
|
|
|
EXTRACT_HELPER(rS, 21, 5);
|
|
|
|
/* First operand */
|
|
|
|
EXTRACT_HELPER(rA, 16, 5);
|
|
|
|
/* Second operand */
|
|
|
|
EXTRACT_HELPER(rB, 11, 5);
|
|
|
|
/* Third operand */
|
|
|
|
EXTRACT_HELPER(rC, 6, 5);
|
|
|
|
/*** Get CRn ***/
|
|
|
|
EXTRACT_HELPER(crfD, 23, 3);
|
|
|
|
EXTRACT_HELPER(crfS, 18, 3);
|
|
|
|
EXTRACT_HELPER(crbD, 21, 5);
|
|
|
|
EXTRACT_HELPER(crbA, 16, 5);
|
|
|
|
EXTRACT_HELPER(crbB, 11, 5);
|
|
|
|
/* SPR / TBL */
|
2005-07-03 00:59:34 +04:00
|
|
|
EXTRACT_HELPER(_SPR, 11, 10);
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline uint32_t SPR (uint32_t opcode)
|
2005-07-03 00:59:34 +04:00
|
|
|
{
|
|
|
|
uint32_t sprn = _SPR(opcode);
|
|
|
|
|
|
|
|
return ((sprn >> 5) & 0x1F) | ((sprn & 0x1F) << 5);
|
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Get constants ***/
|
|
|
|
EXTRACT_HELPER(IMM, 12, 8);
|
|
|
|
/* 16 bits signed immediate value */
|
|
|
|
EXTRACT_SHELPER(SIMM, 0, 16);
|
|
|
|
/* 16 bits unsigned immediate value */
|
|
|
|
EXTRACT_HELPER(UIMM, 0, 16);
|
|
|
|
/* Bit count */
|
|
|
|
EXTRACT_HELPER(NB, 11, 5);
|
|
|
|
/* Shift count */
|
|
|
|
EXTRACT_HELPER(SH, 11, 5);
|
|
|
|
/* Mask start */
|
|
|
|
EXTRACT_HELPER(MB, 6, 5);
|
|
|
|
/* Mask end */
|
|
|
|
EXTRACT_HELPER(ME, 1, 5);
|
2004-01-04 17:57:11 +03:00
|
|
|
/* Trap operand */
|
|
|
|
EXTRACT_HELPER(TO, 21, 5);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
EXTRACT_HELPER(CRM, 12, 8);
|
|
|
|
EXTRACT_HELPER(FM, 17, 8);
|
|
|
|
EXTRACT_HELPER(SR, 16, 4);
|
2008-06-19 02:10:12 +04:00
|
|
|
EXTRACT_HELPER(FPIMM, 12, 4);
|
2004-01-04 17:57:11 +03:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Jump target decoding ***/
|
|
|
|
/* Displacement */
|
|
|
|
EXTRACT_SHELPER(d, 0, 16);
|
|
|
|
/* Immediate address */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline target_ulong LI (uint32_t opcode)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
|
|
|
return (opcode >> 0) & 0x03FFFFFC;
|
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline uint32_t BD (uint32_t opcode)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
|
|
|
return (opcode >> 0) & 0xFFFC;
|
|
|
|
}
|
|
|
|
|
|
|
|
EXTRACT_HELPER(BO, 21, 5);
|
|
|
|
EXTRACT_HELPER(BI, 16, 5);
|
|
|
|
/* Absolute/relative address */
|
|
|
|
EXTRACT_HELPER(AA, 1, 1);
|
|
|
|
/* Link */
|
|
|
|
EXTRACT_HELPER(LK, 0, 1);
|
|
|
|
|
|
|
|
/* Create a mask between <start> and <end> bits */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline target_ulong MASK (uint32_t start, uint32_t end)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong ret;
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (likely(start == 0)) {
|
2007-11-12 03:04:48 +03:00
|
|
|
ret = UINT64_MAX << (63 - end);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else if (likely(end == 63)) {
|
2007-11-12 03:04:48 +03:00
|
|
|
ret = UINT64_MAX >> start;
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (likely(start == 0)) {
|
2007-11-12 03:04:48 +03:00
|
|
|
ret = UINT32_MAX << (31 - end);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else if (likely(end == 31)) {
|
2007-11-12 03:04:48 +03:00
|
|
|
ret = UINT32_MAX >> start;
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else {
|
|
|
|
ret = (((target_ulong)(-1ULL)) >> (start)) ^
|
|
|
|
(((target_ulong)(-1ULL) >> (end)) >> 1);
|
|
|
|
if (unlikely(start > end))
|
|
|
|
return ~ret;
|
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* PowerPC Instructions types definitions */
|
|
|
|
enum {
|
2007-11-14 04:08:45 +03:00
|
|
|
PPC_NONE = 0x0000000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC base instructions set */
|
2007-11-14 04:08:45 +03:00
|
|
|
PPC_INSNS_BASE = 0x0000000000000001ULL,
|
|
|
|
/* integer operations instructions */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define PPC_INTEGER PPC_INSNS_BASE
|
2007-11-14 04:08:45 +03:00
|
|
|
/* flow control instructions */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define PPC_FLOW PPC_INSNS_BASE
|
2007-11-14 04:08:45 +03:00
|
|
|
/* virtual memory instructions */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define PPC_MEM PPC_INSNS_BASE
|
2007-11-14 04:08:45 +03:00
|
|
|
/* ld/st with reservation instructions */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define PPC_RES PPC_INSNS_BASE
|
2007-11-14 04:08:45 +03:00
|
|
|
/* spr/msr access instructions */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define PPC_MISC PPC_INSNS_BASE
|
2007-11-14 04:08:45 +03:00
|
|
|
/* Deprecated instruction sets */
|
|
|
|
/* Original POWER instruction set */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_POWER = 0x0000000000000002ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* POWER2 instruction set extension */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_POWER2 = 0x0000000000000004ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* Power RTC support */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_POWER_RTC = 0x0000000000000008ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* Power-to-PowerPC bridge (601) */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_POWER_BR = 0x0000000000000010ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* 64 bits PowerPC instruction set */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_64B = 0x0000000000000020ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* New 64 bits extensions (PowerPC 2.0x) */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_64BX = 0x0000000000000040ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* 64 bits hypervisor extensions */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_64H = 0x0000000000000080ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* New wait instruction (PowerPC 2.0x) */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_WAIT = 0x0000000000000100ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* Time base mftb instruction */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_MFTB = 0x0000000000000200ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
|
|
|
|
/* Fixed-point unit extensions */
|
|
|
|
/* PowerPC 602 specific */
|
2007-11-17 15:01:45 +03:00
|
|
|
PPC_602_SPEC = 0x0000000000000400ULL,
|
2007-11-18 01:26:51 +03:00
|
|
|
/* isel instruction */
|
|
|
|
PPC_ISEL = 0x0000000000000800ULL,
|
|
|
|
/* popcntb instruction */
|
|
|
|
PPC_POPCNTB = 0x0000000000001000ULL,
|
|
|
|
/* string load / store */
|
|
|
|
PPC_STRING = 0x0000000000002000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
|
|
|
|
/* Floating-point unit extensions */
|
|
|
|
/* Optional floating point instructions */
|
|
|
|
PPC_FLOAT = 0x0000000000010000ULL,
|
|
|
|
/* New floating-point extensions (PowerPC 2.0x) */
|
|
|
|
PPC_FLOAT_EXT = 0x0000000000020000ULL,
|
|
|
|
PPC_FLOAT_FSQRT = 0x0000000000040000ULL,
|
|
|
|
PPC_FLOAT_FRES = 0x0000000000080000ULL,
|
|
|
|
PPC_FLOAT_FRSQRTE = 0x0000000000100000ULL,
|
|
|
|
PPC_FLOAT_FRSQRTES = 0x0000000000200000ULL,
|
|
|
|
PPC_FLOAT_FSEL = 0x0000000000400000ULL,
|
|
|
|
PPC_FLOAT_STFIWX = 0x0000000000800000ULL,
|
|
|
|
|
|
|
|
/* Vector/SIMD extensions */
|
|
|
|
/* Altivec support */
|
|
|
|
PPC_ALTIVEC = 0x0000000001000000ULL,
|
|
|
|
/* PowerPC 2.03 SPE extension */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_SPE = 0x0000000002000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* PowerPC 2.03 SPE floating-point extension */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_SPEFPU = 0x0000000004000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
|
2007-10-06 02:06:02 +04:00
|
|
|
/* Optional memory control instructions */
|
2007-11-14 04:08:45 +03:00
|
|
|
PPC_MEM_TLBIA = 0x0000000010000000ULL,
|
|
|
|
PPC_MEM_TLBIE = 0x0000000020000000ULL,
|
|
|
|
PPC_MEM_TLBSYNC = 0x0000000040000000ULL,
|
|
|
|
/* sync instruction */
|
|
|
|
PPC_MEM_SYNC = 0x0000000080000000ULL,
|
|
|
|
/* eieio instruction */
|
|
|
|
PPC_MEM_EIEIO = 0x0000000100000000ULL,
|
|
|
|
|
|
|
|
/* Cache control instructions */
|
2007-11-19 04:48:51 +03:00
|
|
|
PPC_CACHE = 0x0000000200000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* icbi instruction */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_CACHE_ICBI = 0x0000000400000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* dcbz instruction with fixed cache line size */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_CACHE_DCBZ = 0x0000000800000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* dcbz instruction with tunable cache line size */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_CACHE_DCBZT = 0x0000001000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* dcba instruction */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_CACHE_DCBA = 0x0000002000000000ULL,
|
|
|
|
/* Freescale cache locking instructions */
|
|
|
|
PPC_CACHE_LOCK = 0x0000004000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
|
|
|
|
/* MMU related extensions */
|
|
|
|
/* external control instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_EXTERN = 0x0000010000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* segment register access instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_SEGMENT = 0x0000020000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* PowerPC 6xx TLB management instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_6xx_TLB = 0x0000040000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* PowerPC 74xx TLB management instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_74xx_TLB = 0x0000080000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* PowerPC 40x TLB management instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_40x_TLB = 0x0000100000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* segment register access instructions for PowerPC 64 "bridge" */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_SEGMENT_64B = 0x0000200000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
/* SLB management */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_SLBI = 0x0000400000000000ULL,
|
2007-11-14 04:08:45 +03:00
|
|
|
|
2007-10-06 02:06:02 +04:00
|
|
|
/* Embedded PowerPC dedicated instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_WRTEE = 0x0001000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC 40x exception model */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_40x_EXCP = 0x0002000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC 405 Mac instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_405_MAC = 0x0004000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC 440 specific instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_440_SPEC = 0x0008000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* BookE (embedded) PowerPC specification */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_BOOKE = 0x0010000000000000ULL,
|
|
|
|
/* mfapidi instruction */
|
|
|
|
PPC_MFAPIDI = 0x0020000000000000ULL,
|
|
|
|
/* tlbiva instruction */
|
|
|
|
PPC_TLBIVA = 0x0040000000000000ULL,
|
|
|
|
/* tlbivax instruction */
|
|
|
|
PPC_TLBIVAX = 0x0080000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC 4xx dedicated instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_4xx_COMMON = 0x0100000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* PowerPC 40x ibct instructions */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_40x_ICBT = 0x0200000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* rfmci is not implemented in all BookE PowerPC */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_RFMCI = 0x0400000000000000ULL,
|
|
|
|
/* rfdi instruction */
|
|
|
|
PPC_RFDI = 0x0800000000000000ULL,
|
|
|
|
/* DCR accesses */
|
|
|
|
PPC_DCR = 0x1000000000000000ULL,
|
|
|
|
/* DCR extended accesse */
|
|
|
|
PPC_DCRX = 0x2000000000000000ULL,
|
2007-10-06 02:06:02 +04:00
|
|
|
/* user-mode DCR access, implemented in PowerPC 460 */
|
2007-11-18 01:26:51 +03:00
|
|
|
PPC_DCRUX = 0x4000000000000000ULL,
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* PowerPC instructions table */
|
2005-07-03 00:59:34 +04:00
|
|
|
#if HOST_LONG_BITS == 64
|
|
|
|
#define OPC_ALIGN 8
|
|
|
|
#else
|
|
|
|
#define OPC_ALIGN 4
|
|
|
|
#endif
|
2004-07-12 22:39:45 +04:00
|
|
|
#if defined(__APPLE__)
|
2007-03-17 17:02:15 +03:00
|
|
|
#define OPCODES_SECTION \
|
2005-07-03 00:59:34 +04:00
|
|
|
__attribute__ ((section("__TEXT,__opcodes"), unused, aligned (OPC_ALIGN) ))
|
2004-07-10 19:33:29 +04:00
|
|
|
#else
|
2007-03-17 17:02:15 +03:00
|
|
|
#define OPCODES_SECTION \
|
2005-07-03 00:59:34 +04:00
|
|
|
__attribute__ ((section(".opcodes"), unused, aligned (OPC_ALIGN) ))
|
2004-07-10 19:33:29 +04:00
|
|
|
#endif
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(DO_PPC_STATISTICS)
|
2003-11-23 17:55:54 +03:00
|
|
|
#define GEN_OPCODE(name, op1, op2, op3, invl, _typ) \
|
2005-02-09 00:24:36 +03:00
|
|
|
OPCODES_SECTION opcode_t opc_##name = { \
|
2003-11-23 17:55:54 +03:00
|
|
|
.opc1 = op1, \
|
|
|
|
.opc2 = op2, \
|
|
|
|
.opc3 = op3, \
|
2005-02-09 00:24:36 +03:00
|
|
|
.pad = { 0, }, \
|
2003-11-23 17:55:54 +03:00
|
|
|
.handler = { \
|
|
|
|
.inval = invl, \
|
2004-01-05 01:58:38 +03:00
|
|
|
.type = _typ, \
|
2003-11-23 17:55:54 +03:00
|
|
|
.handler = &gen_##name, \
|
2007-03-07 11:32:30 +03:00
|
|
|
.oname = stringify(name), \
|
2003-11-23 17:55:54 +03:00
|
|
|
}, \
|
2005-07-03 00:59:34 +04:00
|
|
|
.oname = stringify(name), \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
#define GEN_OPCODE2(name, onam, op1, op2, op3, invl, _typ) \
|
|
|
|
OPCODES_SECTION opcode_t opc_##name = { \
|
|
|
|
.opc1 = op1, \
|
|
|
|
.opc2 = op2, \
|
|
|
|
.opc3 = op3, \
|
|
|
|
.pad = { 0, }, \
|
|
|
|
.handler = { \
|
|
|
|
.inval = invl, \
|
|
|
|
.type = _typ, \
|
|
|
|
.handler = &gen_##name, \
|
|
|
|
.oname = onam, \
|
|
|
|
}, \
|
|
|
|
.oname = onam, \
|
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
#define GEN_OPCODE(name, op1, op2, op3, invl, _typ) \
|
|
|
|
OPCODES_SECTION opcode_t opc_##name = { \
|
|
|
|
.opc1 = op1, \
|
|
|
|
.opc2 = op2, \
|
|
|
|
.opc3 = op3, \
|
|
|
|
.pad = { 0, }, \
|
|
|
|
.handler = { \
|
|
|
|
.inval = invl, \
|
|
|
|
.type = _typ, \
|
|
|
|
.handler = &gen_##name, \
|
|
|
|
}, \
|
|
|
|
.oname = stringify(name), \
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
#define GEN_OPCODE2(name, onam, op1, op2, op3, invl, _typ) \
|
|
|
|
OPCODES_SECTION opcode_t opc_##name = { \
|
|
|
|
.opc1 = op1, \
|
|
|
|
.opc2 = op2, \
|
|
|
|
.opc3 = op3, \
|
|
|
|
.pad = { 0, }, \
|
|
|
|
.handler = { \
|
|
|
|
.inval = invl, \
|
|
|
|
.type = _typ, \
|
|
|
|
.handler = &gen_##name, \
|
|
|
|
}, \
|
|
|
|
.oname = onam, \
|
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
#define GEN_OPCODE_MARK(name) \
|
2005-02-09 00:24:36 +03:00
|
|
|
OPCODES_SECTION opcode_t opc_##name = { \
|
2003-11-23 17:55:54 +03:00
|
|
|
.opc1 = 0xFF, \
|
|
|
|
.opc2 = 0xFF, \
|
|
|
|
.opc3 = 0xFF, \
|
2005-02-09 00:24:36 +03:00
|
|
|
.pad = { 0, }, \
|
2003-11-23 17:55:54 +03:00
|
|
|
.handler = { \
|
|
|
|
.inval = 0x00000000, \
|
2004-01-05 01:58:38 +03:00
|
|
|
.type = 0x00, \
|
2003-11-23 17:55:54 +03:00
|
|
|
.handler = NULL, \
|
|
|
|
}, \
|
2005-07-03 00:59:34 +04:00
|
|
|
.oname = stringify(name), \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Start opcode list */
|
|
|
|
GEN_OPCODE_MARK(start);
|
|
|
|
|
|
|
|
/* Invalid instruction */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(invalid, 0x00, 0x00, 0x00, 0xFFFFFFFF, PPC_NONE)
|
|
|
|
{
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
static opc_handler_t invalid_handler = {
|
|
|
|
.inval = 0xFFFFFFFF,
|
2004-01-05 01:58:38 +03:00
|
|
|
.type = PPC_NONE,
|
2003-11-23 17:55:54 +03:00
|
|
|
.handler = gen_invalid,
|
|
|
|
};
|
|
|
|
|
|
|
|
/*** Integer arithmetic ***/
|
2007-03-17 17:02:15 +03:00
|
|
|
#define __GEN_INT_ARITH2(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define __GEN_INT_ARITH2_O(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define __GEN_INT_ARITH1(name, opc1, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
#define __GEN_INT_ARITH1_O(name, opc1, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Two operands arithmetic functions */
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_INT_ARITH2(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH2(name, opc1, opc2, opc3, 0x00000000, type) \
|
|
|
|
__GEN_INT_ARITH2_O(name##o, opc1, opc2, opc3 | 0x10, 0x00000000, type)
|
|
|
|
|
|
|
|
/* Two operands arithmetic functions with no overflow allowed */
|
|
|
|
#define GEN_INT_ARITHN(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH2(name, opc1, opc2, opc3, 0x00000400, type)
|
|
|
|
|
|
|
|
/* One operand arithmetic functions */
|
|
|
|
#define GEN_INT_ARITH1(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH1(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH1_O(name##o, opc1, opc2, opc3 | 0x10, type)
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define __GEN_INT_ARITH2_64(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->sf_mode) \
|
|
|
|
gen_op_##name##_64(); \
|
|
|
|
else \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define __GEN_INT_ARITH2_O_64(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, inval, type) \
|
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->sf_mode) \
|
|
|
|
gen_op_##name##_64(); \
|
|
|
|
else \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define __GEN_INT_ARITH1_64(name, opc1, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \
|
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->sf_mode) \
|
|
|
|
gen_op_##name##_64(); \
|
|
|
|
else \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
|
|
|
}
|
|
|
|
#define __GEN_INT_ARITH1_O_64(name, opc1, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(name, opc1, opc2, opc3, 0x0000F800, type) \
|
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->sf_mode) \
|
|
|
|
gen_op_##name##_64(); \
|
|
|
|
else \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]); \
|
2007-03-17 17:02:15 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Two operands arithmetic functions */
|
|
|
|
#define GEN_INT_ARITH2_64(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH2_64(name, opc1, opc2, opc3, 0x00000000, type) \
|
|
|
|
__GEN_INT_ARITH2_O_64(name##o, opc1, opc2, opc3 | 0x10, 0x00000000, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* Two operands arithmetic functions with no overflow allowed */
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_INT_ARITHN_64(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH2_64(name, opc1, opc2, opc3, 0x00000400, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* One operand arithmetic functions */
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_INT_ARITH1_64(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH1_64(name, opc1, opc2, opc3, type) \
|
|
|
|
__GEN_INT_ARITH1_O_64(name##o, opc1, opc2, opc3 | 0x10, type)
|
|
|
|
#else
|
|
|
|
#define GEN_INT_ARITH2_64 GEN_INT_ARITH2
|
|
|
|
#define GEN_INT_ARITHN_64 GEN_INT_ARITHN
|
|
|
|
#define GEN_INT_ARITH1_64 GEN_INT_ARITH1
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* add add. addo addo. */
|
2008-09-05 18:19:43 +04:00
|
|
|
static always_inline void gen_op_add (void)
|
|
|
|
{
|
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addo (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addo();
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define gen_op_add_64 gen_op_add
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addo_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addo_64();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (add, 0x1F, 0x0A, 0x08, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* addc addc. addco addco. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addc (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addc();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addco (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addc();
|
|
|
|
gen_op_check_addo();
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addc_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addc_64();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addco_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_check_addc_64();
|
|
|
|
gen_op_check_addo_64();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (addc, 0x1F, 0x0A, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* adde adde. addeo addeo. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addeo (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_adde();
|
|
|
|
gen_op_check_addo();
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addeo_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_adde_64();
|
|
|
|
gen_op_check_addo_64();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (adde, 0x1F, 0x0A, 0x04, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* addme addme. addmeo addmeo. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addme (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_me();
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addme_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_me_64();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH1_64 (addme, 0x1F, 0x0A, 0x07, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* addze addze. addzeo addzeo. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addze (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_ze();
|
|
|
|
gen_op_check_addc();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addzeo (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_ze();
|
|
|
|
gen_op_check_addc();
|
|
|
|
gen_op_check_addo();
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addze_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_ze();
|
|
|
|
gen_op_check_addc_64();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_addzeo_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_add_ze();
|
|
|
|
gen_op_check_addc_64();
|
|
|
|
gen_op_check_addo_64();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH1_64 (addze, 0x1F, 0x0A, 0x06, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* divw divw. divwo divwo. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH2 (divw, 0x1F, 0x0B, 0x0F, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* divwu divwu. divwuo divwuo. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH2 (divwu, 0x1F, 0x0B, 0x0E, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* mulhw mulhw. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITHN (mulhw, 0x1F, 0x0B, 0x02, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* mulhwu mulhwu. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITHN (mulhwu, 0x1F, 0x0B, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* mullw mullw. mullwo mullwo. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH2 (mullw, 0x1F, 0x0B, 0x07, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* neg neg. nego nego. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH1_64 (neg, 0x1F, 0x08, 0x03, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* subf subf. subfo subfo. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfo (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subf();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define gen_op_subf_64 gen_op_subf
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfo_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_i64(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subf();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo_64();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (subf, 0x1F, 0x08, 0x01, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* subfc subfc. subfco subfco. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfc (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
gen_op_subf();
|
|
|
|
gen_op_check_subfc();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfco (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subf();
|
|
|
|
gen_op_check_subfc();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfc_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
gen_op_subf();
|
|
|
|
gen_op_check_subfc_64();
|
|
|
|
}
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfco_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_i64(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subf();
|
|
|
|
gen_op_check_subfc_64();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo_64();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (subfc, 0x1F, 0x08, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* subfe subfe. subfeo subfeo. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfeo (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_tl(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subfe();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define gen_op_subfe_64 gen_op_subfe
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_subfeo_64 (void)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-03 03:26:40 +04:00
|
|
|
tcg_gen_not_i64(cpu_T[2], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_subfe_64();
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo_64();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
GEN_INT_ARITH2_64 (subfe, 0x1F, 0x08, 0x04, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* subfme subfme. subfmeo subfmeo. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH1_64 (subfme, 0x1F, 0x08, 0x07, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* subfze subfze. subfzeo subfzeo. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_INT_ARITH1_64 (subfze, 0x1F, 0x08, 0x06, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* addi */
|
|
|
|
GEN_HANDLER(addi, 0x0E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_long simm = SIMM(ctx->opcode);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2007-03-07 11:32:30 +03:00
|
|
|
/* li case */
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], simm);
|
2003-11-23 17:55:54 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(simm != 0))
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* addic */
|
|
|
|
GEN_HANDLER(addic, 0x0C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_long simm = SIMM(ctx->opcode);
|
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (likely(simm != 0)) {
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_check_addc_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_check_addc();
|
2007-03-23 01:17:08 +03:00
|
|
|
} else {
|
|
|
|
gen_op_clear_xer_ca();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* addic. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(addic_, "addic.", 0x0D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_long simm = SIMM(ctx->opcode);
|
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (likely(simm != 0)) {
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_T[0]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_check_addc_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_check_addc();
|
2007-09-17 13:51:40 +04:00
|
|
|
} else {
|
|
|
|
gen_op_clear_xer_ca();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* addis */
|
|
|
|
GEN_HANDLER(addis, 0x0F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_long simm = SIMM(ctx->opcode);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2007-03-07 11:32:30 +03:00
|
|
|
/* lis case */
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], simm << 16);
|
2003-11-23 17:55:54 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(simm != 0))
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm << 16);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* mulli */
|
|
|
|
GEN_HANDLER(mulli, 0x07, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_mulli(SIMM(ctx->opcode));
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* subfic */
|
|
|
|
GEN_HANDLER(subfic, 0x08, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_subfic_64(SIMM(ctx->opcode));
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_subfic(SIMM(ctx->opcode));
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* mulhd mulhd. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_INT_ARITHN (mulhd, 0x1F, 0x09, 0x02, PPC_64B);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* mulhdu mulhdu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_INT_ARITHN (mulhdu, 0x1F, 0x09, 0x00, PPC_64B);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* mulld mulld. mulldo mulldo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_INT_ARITH2 (mulld, 0x1F, 0x09, 0x07, PPC_64B);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* divd divd. divdo divdo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_INT_ARITH2 (divd, 0x1F, 0x09, 0x0F, PPC_64B);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* divdu divdu. divduo divduo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_INT_ARITH2 (divdu, 0x1F, 0x09, 0x0E, PPC_64B);
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Integer comparison ***/
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define GEN_CMP(name, opc, type) \
|
|
|
|
GEN_HANDLER(name, 0x1F, 0x00, opc, 0x00400000, type) \
|
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2007-09-27 08:47:25 +04:00
|
|
|
if (ctx->sf_mode && (ctx->opcode & 0x00200000)) \
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_##name##_64(); \
|
|
|
|
else \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define GEN_CMP(name, opc, type) \
|
|
|
|
GEN_HANDLER(name, 0x1F, 0x00, opc, 0x00400000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* cmp */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_CMP(cmp, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* cmpi */
|
|
|
|
GEN_HANDLER(cmpi, 0x0B, 0xFF, 0xFF, 0x00400000, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-09-27 08:47:25 +04:00
|
|
|
if (ctx->sf_mode && (ctx->opcode & 0x00200000))
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_cmpi_64(SIMM(ctx->opcode));
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_cmpi(SIMM(ctx->opcode));
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* cmpl */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_CMP(cmpl, 0x01, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* cmpli */
|
|
|
|
GEN_HANDLER(cmpli, 0x0A, 0xFF, 0xFF, 0x00400000, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-09-27 08:47:25 +04:00
|
|
|
if (ctx->sf_mode && (ctx->opcode & 0x00200000))
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_cmpli_64(UIMM(ctx->opcode));
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_cmpli(UIMM(ctx->opcode));
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* isel (PowerPC 2.03 specification) */
|
2008-05-06 01:27:18 +04:00
|
|
|
GEN_HANDLER(isel, 0x1F, 0x0F, 0xFF, 0x00000001, PPC_ISEL)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
uint32_t bi = rC(ctx->opcode);
|
|
|
|
uint32_t mask;
|
|
|
|
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], 0);
|
2007-03-17 17:02:15 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
mask = 1 << (3 - (bi & 0x03));
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[0], cpu_crf[bi >> 2]);
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_test_true(mask);
|
|
|
|
gen_op_isel();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Integer logical ***/
|
2007-03-17 17:02:15 +03:00
|
|
|
#define __GEN_LOGICAL2(name, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(name, 0x1F, opc2, opc3, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LOGICAL2(name, opc, type) \
|
|
|
|
__GEN_LOGICAL2(name, 0x1C, opc, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LOGICAL1(name, opc, type) \
|
|
|
|
GEN_HANDLER(name, 0x1F, 0x1A, opc, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) \
|
|
|
|
gen_set_Rc0(ctx); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* and & and. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(and, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* andc & andc. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(andc, 0x01, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* andi. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(andi_, "andi.", 0x1C, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_andi_T0(UIMM(ctx->opcode));
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* andis. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(andis_, "andis.", 0x1D, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_andi_T0(UIMM(ctx->opcode) << 16);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* cntlzw */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL1(cntlzw, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* eqv & eqv. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(eqv, 0x08, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* extsb & extsb. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL1(extsb, 0x1D, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* extsh & extsh. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL1(extsh, 0x1C, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* nand & nand. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(nand, 0x0E, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* nor & nor. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(nor, 0x03, PPC_INTEGER);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* or & or. */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(or, 0x1F, 0x1C, 0x0D, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
int rs, ra, rb;
|
|
|
|
|
|
|
|
rs = rS(ctx->opcode);
|
|
|
|
ra = rA(ctx->opcode);
|
|
|
|
rb = rB(ctx->opcode);
|
|
|
|
/* Optimisation for mr. ri case */
|
|
|
|
if (rs != ra || rs != rb) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rs]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (rs != rb) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rb]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_or();
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
} else if (unlikely(Rc(ctx->opcode) != 0)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rs]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_set_Rc0(ctx);
|
2007-09-30 05:18:26 +04:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
} else {
|
|
|
|
switch (rs) {
|
|
|
|
case 1:
|
|
|
|
/* Set process priority to low */
|
|
|
|
gen_op_store_pri(2);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
/* Set process priority to medium-low */
|
|
|
|
gen_op_store_pri(3);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
/* Set process priority to normal */
|
|
|
|
gen_op_store_pri(4);
|
|
|
|
break;
|
2007-09-30 17:03:23 +04:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
case 31:
|
|
|
|
if (ctx->supervisor > 0) {
|
|
|
|
/* Set process priority to very low */
|
|
|
|
gen_op_store_pri(1);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
if (ctx->supervisor > 0) {
|
|
|
|
/* Set process priority to medium-hight */
|
|
|
|
gen_op_store_pri(5);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
if (ctx->supervisor > 0) {
|
|
|
|
/* Set process priority to high */
|
|
|
|
gen_op_store_pri(6);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
if (ctx->supervisor > 1) {
|
|
|
|
/* Set process priority to very high */
|
|
|
|
gen_op_store_pri(7);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
#endif
|
2007-09-30 05:18:26 +04:00
|
|
|
default:
|
|
|
|
/* nop */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* orc & orc. */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LOGICAL2(orc, 0x0C, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* xor & xor. */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(xor, 0x1F, 0x1C, 0x09, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2004-01-05 01:58:38 +03:00
|
|
|
/* Optimisation for "set to zero" case */
|
|
|
|
if (rS(ctx->opcode) != rB(ctx->opcode)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_xor();
|
|
|
|
} else {
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], 0);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
/* ori */
|
|
|
|
GEN_HANDLER(ori, 0x18, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong uimm = UIMM(ctx->opcode);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) {
|
|
|
|
/* NOP */
|
2007-03-07 11:32:30 +03:00
|
|
|
/* XXX: should handle special NOPs for POWER series */
|
2004-01-05 01:58:38 +03:00
|
|
|
return;
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(uimm != 0))
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_ori(uimm);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* oris */
|
|
|
|
GEN_HANDLER(oris, 0x19, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong uimm = UIMM(ctx->opcode);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) {
|
|
|
|
/* NOP */
|
|
|
|
return;
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(uimm != 0))
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_ori(uimm << 16);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* xori */
|
|
|
|
GEN_HANDLER(xori, 0x1A, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong uimm = UIMM(ctx->opcode);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
|
|
|
if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) {
|
|
|
|
/* NOP */
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(uimm != 0))
|
|
|
|
gen_op_xori(uimm);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* xoris */
|
|
|
|
GEN_HANDLER(xoris, 0x1B, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong uimm = UIMM(ctx->opcode);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
|
|
|
if (rS(ctx->opcode) == rA(ctx->opcode) && uimm == 0) {
|
|
|
|
/* NOP */
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(uimm != 0))
|
|
|
|
gen_op_xori(uimm << 16);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* popcntb : PowerPC 2.03 specification */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(popcntb, 0x1F, 0x03, 0x03, 0x0000F801, PPC_POPCNTB)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_popcntb_64();
|
2007-03-17 17:02:15 +03:00
|
|
|
else
|
|
|
|
#endif
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_popcntb();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* extsw & extsw. */
|
|
|
|
GEN_LOGICAL1(extsw, 0x1E, PPC_64B);
|
|
|
|
/* cntlzd */
|
|
|
|
GEN_LOGICAL1(cntlzd, 0x01, PPC_64B);
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Integer rotate ***/
|
|
|
|
/* rlwimi & rlwimi. */
|
|
|
|
GEN_HANDLER(rlwimi, 0x14, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong mask;
|
|
|
|
uint32_t mb, me, sh;
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
mb = MB(ctx->opcode);
|
|
|
|
me = ME(ctx->opcode);
|
2007-03-07 11:32:30 +03:00
|
|
|
sh = SH(ctx->opcode);
|
|
|
|
if (likely(sh == 0)) {
|
|
|
|
if (likely(mb == 0 && me == 31)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
goto do_store;
|
|
|
|
} else if (likely(mb == 31 && me == 0)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
goto do_store;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
goto do_mask;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_rotli32_T0(SH(ctx->opcode));
|
|
|
|
do_mask:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
mb += 32;
|
|
|
|
me += 32;
|
|
|
|
#endif
|
|
|
|
mask = MASK(mb, me);
|
|
|
|
gen_op_andi_T0(mask);
|
|
|
|
gen_op_andi_T1(~mask);
|
|
|
|
gen_op_or();
|
|
|
|
do_store:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* rlwinm & rlwinm. */
|
|
|
|
GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
|
|
|
uint32_t mb, me, sh;
|
2007-09-17 12:09:54 +04:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
sh = SH(ctx->opcode);
|
|
|
|
mb = MB(ctx->opcode);
|
|
|
|
me = ME(ctx->opcode);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(sh == 0)) {
|
|
|
|
goto do_mask;
|
|
|
|
}
|
|
|
|
if (likely(mb == 0)) {
|
|
|
|
if (likely(me == 31)) {
|
|
|
|
gen_op_rotli32_T0(sh);
|
|
|
|
goto do_store;
|
|
|
|
} else if (likely(me == (31 - sh))) {
|
|
|
|
gen_op_sli_T0(sh);
|
|
|
|
goto do_store;
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
} else if (likely(me == 31)) {
|
|
|
|
if (likely(sh == (32 - mb))) {
|
|
|
|
gen_op_srli_T0(mb);
|
|
|
|
goto do_store;
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_rotli32_T0(sh);
|
|
|
|
do_mask:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
mb += 32;
|
|
|
|
me += 32;
|
|
|
|
#endif
|
|
|
|
gen_op_andi_T0(MASK(mb, me));
|
|
|
|
do_store:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* rlwnm & rlwnm. */
|
|
|
|
GEN_HANDLER(rlwnm, 0x17, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
|
|
|
uint32_t mb, me;
|
|
|
|
|
|
|
|
mb = MB(ctx->opcode);
|
|
|
|
me = ME(ctx->opcode);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_rotl32_T0_T1();
|
|
|
|
if (unlikely(mb != 0 || me != 31)) {
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
mb += 32;
|
|
|
|
me += 32;
|
|
|
|
#endif
|
|
|
|
gen_op_andi_T0(MASK(mb, me));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define GEN_PPC64_R2(name, opc1, opc2) \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##0, stringify(name), opc1, opc2, 0xFF, 0x00000000, PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 0); \
|
|
|
|
} \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##1, stringify(name), opc1, opc2 | 0x10, 0xFF, 0x00000000, \
|
|
|
|
PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 1); \
|
|
|
|
}
|
|
|
|
#define GEN_PPC64_R4(name, opc1, opc2) \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##0, stringify(name), opc1, opc2, 0xFF, 0x00000000, PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 0, 0); \
|
|
|
|
} \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##1, stringify(name), opc1, opc2 | 0x01, 0xFF, 0x00000000, \
|
|
|
|
PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 0, 1); \
|
|
|
|
} \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##2, stringify(name), opc1, opc2 | 0x10, 0xFF, 0x00000000, \
|
|
|
|
PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 1, 0); \
|
|
|
|
} \
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(name##3, stringify(name), opc1, opc2 | 0x11, 0xFF, 0x00000000, \
|
|
|
|
PPC_64B) \
|
2007-03-17 17:02:15 +03:00
|
|
|
{ \
|
|
|
|
gen_##name(ctx, 1, 1); \
|
|
|
|
}
|
2007-03-23 01:41:50 +03:00
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_andi_T0_64 (DisasContext *ctx, uint64_t mask)
|
2007-09-27 05:32:19 +04:00
|
|
|
{
|
|
|
|
if (mask >> 32)
|
|
|
|
gen_op_andi_T0_64(mask >> 32, mask & 0xFFFFFFFF);
|
|
|
|
else
|
|
|
|
gen_op_andi_T0(mask);
|
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_andi_T1_64 (DisasContext *ctx, uint64_t mask)
|
2007-09-27 05:32:19 +04:00
|
|
|
{
|
|
|
|
if (mask >> 32)
|
|
|
|
gen_op_andi_T1_64(mask >> 32, mask & 0xFFFFFFFF);
|
|
|
|
else
|
|
|
|
gen_op_andi_T1(mask);
|
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldinm (DisasContext *ctx, uint32_t mb,
|
|
|
|
uint32_t me, uint32_t sh)
|
2007-03-23 01:41:50 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-23 01:41:50 +03:00
|
|
|
if (likely(sh == 0)) {
|
|
|
|
goto do_mask;
|
|
|
|
}
|
|
|
|
if (likely(mb == 0)) {
|
|
|
|
if (likely(me == 63)) {
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_op_rotli64_T0(sh);
|
2007-03-23 01:41:50 +03:00
|
|
|
goto do_store;
|
|
|
|
} else if (likely(me == (63 - sh))) {
|
|
|
|
gen_op_sli_T0(sh);
|
|
|
|
goto do_store;
|
|
|
|
}
|
|
|
|
} else if (likely(me == 63)) {
|
|
|
|
if (likely(sh == (64 - mb))) {
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_op_srli_T0_64(mb);
|
2007-03-23 01:41:50 +03:00
|
|
|
goto do_store;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gen_op_rotli64_T0(sh);
|
|
|
|
do_mask:
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_andi_T0_64(ctx, MASK(mb, me));
|
2007-03-23 01:41:50 +03:00
|
|
|
do_store:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-23 01:41:50 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldicl - rldicl. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldicl (DisasContext *ctx, int mbn, int shn)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint32_t sh, mb;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
sh = SH(ctx->opcode) | (shn << 5);
|
|
|
|
mb = MB(ctx->opcode) | (mbn << 5);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_rldinm(ctx, mb, 63, sh);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-03-23 01:41:50 +03:00
|
|
|
GEN_PPC64_R4(rldicl, 0x1E, 0x00);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldicr - rldicr. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldicr (DisasContext *ctx, int men, int shn)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint32_t sh, me;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
sh = SH(ctx->opcode) | (shn << 5);
|
|
|
|
me = MB(ctx->opcode) | (men << 5);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_rldinm(ctx, 0, me, sh);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-03-23 01:41:50 +03:00
|
|
|
GEN_PPC64_R4(rldicr, 0x1E, 0x02);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldic - rldic. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldic (DisasContext *ctx, int mbn, int shn)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint32_t sh, mb;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
sh = SH(ctx->opcode) | (shn << 5);
|
|
|
|
mb = MB(ctx->opcode) | (mbn << 5);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_rldinm(ctx, mb, 63 - sh, sh);
|
|
|
|
}
|
|
|
|
GEN_PPC64_R4(rldic, 0x1E, 0x04);
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldnm (DisasContext *ctx, uint32_t mb,
|
|
|
|
uint32_t me)
|
2007-03-23 01:41:50 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_op_rotl64_T0_T1();
|
|
|
|
if (unlikely(mb != 0 || me != 63)) {
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_andi_T0_64(ctx, MASK(mb, me));
|
2007-03-23 01:41:50 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-23 01:41:50 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-03-23 01:41:50 +03:00
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldcl - rldcl. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldcl (DisasContext *ctx, int mbn)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint32_t mb;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
mb = MB(ctx->opcode) | (mbn << 5);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_rldnm(ctx, mb, 63);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-09-17 12:21:54 +04:00
|
|
|
GEN_PPC64_R2(rldcl, 0x1E, 0x08);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldcr - rldcr. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldcr (DisasContext *ctx, int men)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint32_t me;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
me = MB(ctx->opcode) | (men << 5);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_rldnm(ctx, 0, me);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-09-17 12:21:54 +04:00
|
|
|
GEN_PPC64_R2(rldcr, 0x1E, 0x09);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* rldimi - rldimi. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_rldimi (DisasContext *ctx, int mbn, int shn)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-23 01:41:50 +03:00
|
|
|
uint64_t mask;
|
2007-11-14 08:26:46 +03:00
|
|
|
uint32_t sh, mb, me;
|
2007-03-17 17:02:15 +03:00
|
|
|
|
2007-04-06 11:59:47 +04:00
|
|
|
sh = SH(ctx->opcode) | (shn << 5);
|
|
|
|
mb = MB(ctx->opcode) | (mbn << 5);
|
2007-11-14 08:26:46 +03:00
|
|
|
me = 63 - sh;
|
2007-03-23 01:41:50 +03:00
|
|
|
if (likely(sh == 0)) {
|
|
|
|
if (likely(mb == 0)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-23 01:41:50 +03:00
|
|
|
goto do_store;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-23 01:41:50 +03:00
|
|
|
goto do_mask;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_op_rotli64_T0(sh);
|
2007-03-23 01:41:50 +03:00
|
|
|
do_mask:
|
2007-11-14 08:26:46 +03:00
|
|
|
mask = MASK(mb, me);
|
2007-09-27 05:32:19 +04:00
|
|
|
gen_andi_T0_64(ctx, mask);
|
|
|
|
gen_andi_T1_64(ctx, ~mask);
|
2007-03-23 01:41:50 +03:00
|
|
|
gen_op_or();
|
|
|
|
do_store:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-23 01:41:50 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-09-17 12:21:54 +04:00
|
|
|
GEN_PPC64_R4(rldimi, 0x1E, 0x06);
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Integer shift ***/
|
|
|
|
/* slw & slw. */
|
2007-03-17 17:02:15 +03:00
|
|
|
__GEN_LOGICAL2(slw, 0x18, 0x00, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* sraw & sraw. */
|
2007-03-17 17:02:15 +03:00
|
|
|
__GEN_LOGICAL2(sraw, 0x18, 0x18, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* srawi & srawi. */
|
|
|
|
GEN_HANDLER(srawi, 0x1F, 0x18, 0x19, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-17 17:02:15 +03:00
|
|
|
int mb, me;
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (SH(ctx->opcode) != 0) {
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
mb = 32 - SH(ctx->opcode);
|
|
|
|
me = 31;
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
mb += 32;
|
|
|
|
me += 32;
|
|
|
|
#endif
|
|
|
|
gen_op_srawi(SH(ctx->opcode), MASK(mb, me));
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
/* srw & srw. */
|
2007-03-17 17:02:15 +03:00
|
|
|
__GEN_LOGICAL2(srw, 0x18, 0x10, PPC_INTEGER);
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* sld & sld. */
|
|
|
|
__GEN_LOGICAL2(sld, 0x1B, 0x00, PPC_64B);
|
|
|
|
/* srad & srad. */
|
|
|
|
__GEN_LOGICAL2(srad, 0x1A, 0x18, PPC_64B);
|
|
|
|
/* sradi & sradi. */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_sradi (DisasContext *ctx, int n)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
uint64_t mask;
|
|
|
|
int sh, mb, me;
|
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
sh = SH(ctx->opcode) + (n << 5);
|
|
|
|
if (sh != 0) {
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
mb = 64 - SH(ctx->opcode);
|
|
|
|
me = 63;
|
|
|
|
mask = MASK(mb, me);
|
|
|
|
gen_op_sradi(sh, mask >> 32, mask);
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(sradi0, "sradi", 0x1F, 0x1A, 0x19, 0x00000000, PPC_64B)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
gen_sradi(ctx, 0);
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(sradi1, "sradi", 0x1F, 0x1B, 0x19, 0x00000000, PPC_64B)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
|
|
|
gen_sradi(ctx, 1);
|
|
|
|
}
|
|
|
|
/* srd & srd. */
|
|
|
|
__GEN_LOGICAL2(srd, 0x1B, 0x10, PPC_64B);
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Floating-Point arithmetic ***/
|
2007-10-27 21:54:30 +04:00
|
|
|
#define _GEN_FLOAT_ACB(name, op, op1, op2, isfloat, set_fprf, type) \
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(f##name, op1, op2, 0xFF, 0x00000000, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-02-16 02:06:19 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rC(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_i64(cpu_FT[2], cpu_fpr[rB(ctx->opcode)]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus(); \
|
2005-03-13 20:01:22 +03:00
|
|
|
gen_op_f##op(); \
|
|
|
|
if (isfloat) { \
|
|
|
|
gen_op_frsp(); \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(set_fprf, Rc(ctx->opcode) != 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#define GEN_FLOAT_ACB(name, op2, set_fprf, type) \
|
|
|
|
_GEN_FLOAT_ACB(name, name, 0x3F, op2, 0, set_fprf, type); \
|
|
|
|
_GEN_FLOAT_ACB(name##s, name, 0x3B, op2, 1, set_fprf, type);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#define _GEN_FLOAT_AB(name, op, op1, op2, inval, isfloat, set_fprf, type) \
|
|
|
|
GEN_HANDLER(f##name, op1, op2, 0xFF, inval, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-02-16 02:06:19 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus(); \
|
2005-03-13 20:01:22 +03:00
|
|
|
gen_op_f##op(); \
|
|
|
|
if (isfloat) { \
|
|
|
|
gen_op_frsp(); \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(set_fprf, Rc(ctx->opcode) != 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
#define GEN_FLOAT_AB(name, op2, inval, set_fprf, type) \
|
|
|
|
_GEN_FLOAT_AB(name, name, 0x3F, op2, inval, 0, set_fprf, type); \
|
|
|
|
_GEN_FLOAT_AB(name##s, name, 0x3B, op2, inval, 1, set_fprf, type);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#define _GEN_FLOAT_AC(name, op, op1, op2, inval, isfloat, set_fprf, type) \
|
|
|
|
GEN_HANDLER(f##name, op1, op2, 0xFF, inval, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-02-16 02:06:19 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]); \
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rC(ctx->opcode)]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus(); \
|
2005-03-13 20:01:22 +03:00
|
|
|
gen_op_f##op(); \
|
|
|
|
if (isfloat) { \
|
|
|
|
gen_op_frsp(); \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(set_fprf, Rc(ctx->opcode) != 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
#define GEN_FLOAT_AC(name, op2, inval, set_fprf, type) \
|
|
|
|
_GEN_FLOAT_AC(name, name, 0x3F, op2, inval, 0, set_fprf, type); \
|
|
|
|
_GEN_FLOAT_AC(name##s, name, 0x3B, op2, inval, 1, set_fprf, type);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#define GEN_FLOAT_B(name, op2, op3, set_fprf, type) \
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(f##name, 0x3F, op2, op3, 0x001F0000, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-02-16 02:06:19 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus(); \
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_f##name(); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(set_fprf, Rc(ctx->opcode) != 0); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-10-27 21:54:30 +04:00
|
|
|
#define GEN_FLOAT_BS(name, op1, op2, set_fprf, type) \
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(f##name, op1, op2, 0xFF, 0x001F07C0, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-02-16 02:06:19 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus(); \
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_f##name(); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(set_fprf, Rc(ctx->opcode) != 0); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
/* fadd - fadds */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_AB(add, 0x15, 0x000007C0, 1, PPC_FLOAT);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fdiv - fdivs */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_AB(div, 0x12, 0x000007C0, 1, PPC_FLOAT);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fmul - fmuls */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_AC(mul, 0x19, 0x0000F800, 1, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2007-09-30 05:11:48 +04:00
|
|
|
/* fre */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_BS(re, 0x3F, 0x18, 1, PPC_FLOAT_EXT);
|
2007-09-30 05:11:48 +04:00
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* fres */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_BS(res, 0x3B, 0x18, 1, PPC_FLOAT_FRES);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* frsqrte */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_BS(rsqrte, 0x3F, 0x1A, 1, PPC_FLOAT_FRSQRTE);
|
|
|
|
|
|
|
|
/* frsqrtes */
|
|
|
|
static always_inline void gen_op_frsqrtes (void)
|
|
|
|
{
|
|
|
|
gen_op_frsqrte();
|
|
|
|
gen_op_frsp();
|
|
|
|
}
|
2007-11-14 04:08:45 +03:00
|
|
|
GEN_FLOAT_BS(rsqrtes, 0x3B, 0x1A, 1, PPC_FLOAT_FRSQRTES);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* fsel */
|
2007-10-27 21:54:30 +04:00
|
|
|
_GEN_FLOAT_ACB(sel, sel, 0x3F, 0x17, 0, 0, PPC_FLOAT_FSEL);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fsub - fsubs */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_AB(sub, 0x14, 0x000007C0, 1, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* Optional: */
|
|
|
|
/* fsqrt */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(fsqrt, 0x3F, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT)
|
2005-04-23 22:05:46 +04:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-04-23 22:05:46 +04:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
2005-04-23 22:05:46 +04:00
|
|
|
gen_op_fsqrt();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(1, Rc(ctx->opcode) != 0);
|
2005-04-23 22:05:46 +04:00
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(fsqrts, 0x3B, 0x16, 0xFF, 0x001F07C0, PPC_FLOAT_FSQRT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
2005-03-13 20:01:22 +03:00
|
|
|
gen_op_fsqrt();
|
|
|
|
gen_op_frsp();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(1, Rc(ctx->opcode) != 0);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Floating-Point multiply-and-add ***/
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fmadd - fmadds */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_ACB(madd, 0x1D, 1, PPC_FLOAT);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fmsub - fmsubs */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_ACB(msub, 0x1C, 1, PPC_FLOAT);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fnmadd - fnmadds */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_ACB(nmadd, 0x1F, 1, PPC_FLOAT);
|
2005-03-13 20:01:22 +03:00
|
|
|
/* fnmsub - fnmsubs */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_ACB(nmsub, 0x1E, 1, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Floating-Point round & convert ***/
|
|
|
|
/* fctiw */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(ctiw, 0x0E, 0x00, 0, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* fctiwz */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(ctiwz, 0x0F, 0x00, 0, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* frsp */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(rsp, 0x0C, 0x00, 1, PPC_FLOAT);
|
2007-03-23 12:45:27 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* fcfid */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(cfid, 0x0E, 0x1A, 1, PPC_64B);
|
2007-03-23 12:45:27 +03:00
|
|
|
/* fctid */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(ctid, 0x0E, 0x19, 0, PPC_64B);
|
2007-03-23 12:45:27 +03:00
|
|
|
/* fctidz */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(ctidz, 0x0F, 0x19, 0, PPC_64B);
|
2007-03-23 12:45:27 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2007-09-30 05:11:48 +04:00
|
|
|
/* frin */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(rin, 0x08, 0x0C, 1, PPC_FLOAT_EXT);
|
2007-09-30 05:11:48 +04:00
|
|
|
/* friz */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(riz, 0x08, 0x0D, 1, PPC_FLOAT_EXT);
|
2007-09-30 05:11:48 +04:00
|
|
|
/* frip */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(rip, 0x08, 0x0E, 1, PPC_FLOAT_EXT);
|
2007-09-30 05:11:48 +04:00
|
|
|
/* frim */
|
2007-10-27 21:54:30 +04:00
|
|
|
GEN_FLOAT_B(rim, 0x08, 0x0F, 1, PPC_FLOAT_EXT);
|
2007-09-30 05:11:48 +04:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Floating-Point compare ***/
|
|
|
|
/* fcmpo */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(fcmpo, 0x3F, 0x00, 0x01, 0x00600001, PPC_FLOAT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_fcmpo();
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_op_float_check_status();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* fcmpu */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(fcmpu, 0x3F, 0x00, 0x00, 0x00600001, PPC_FLOAT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_fcmpu();
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_op_float_check_status();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
/*** Floating-point move ***/
|
|
|
|
/* fabs */
|
2007-10-27 21:54:30 +04:00
|
|
|
/* XXX: beware that fabs never checks for NaNs nor update FPSCR */
|
|
|
|
GEN_FLOAT_B(abs, 0x08, 0x08, 0, PPC_FLOAT);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
|
|
|
/* fmr - fmr. */
|
2007-10-27 21:54:30 +04:00
|
|
|
/* XXX: beware that fmr never checks for NaNs nor update FPSCR */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(fmr, 0x3F, 0x08, 0x02, 0x001F0000, PPC_FLOAT)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(0, Rc(ctx->opcode) != 0);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* fnabs */
|
2007-10-27 21:54:30 +04:00
|
|
|
/* XXX: beware that fnabs never checks for NaNs nor update FPSCR */
|
|
|
|
GEN_FLOAT_B(nabs, 0x08, 0x04, 0, PPC_FLOAT);
|
2004-01-05 01:58:38 +03:00
|
|
|
/* fneg */
|
2007-10-27 21:54:30 +04:00
|
|
|
/* XXX: beware that fneg never checks for NaNs nor update FPSCR */
|
|
|
|
GEN_FLOAT_B(neg, 0x08, 0x01, 0, PPC_FLOAT);
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Floating-Point status & ctrl register ***/
|
|
|
|
/* mcrfs */
|
|
|
|
GEN_HANDLER(mcrfs, 0x3F, 0x00, 0x02, 0x0063F801, PPC_FLOAT)
|
|
|
|
{
|
2007-10-27 21:54:30 +04:00
|
|
|
int bfa;
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_optimize_fprf();
|
|
|
|
bfa = 4 * (7 - crfS(ctx->opcode));
|
|
|
|
gen_op_load_fpscr_T0(bfa);
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_op_fpscr_resetbit(~(0xF << bfa));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mffs */
|
|
|
|
GEN_HANDLER(mffs, 0x3F, 0x07, 0x12, 0x001FF800, PPC_FLOAT)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_optimize_fprf();
|
|
|
|
gen_reset_fpstatus();
|
|
|
|
gen_op_load_fpscr_FT0();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_compute_fprf(0, Rc(ctx->opcode) != 0);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtfsb0 */
|
|
|
|
GEN_HANDLER(mtfsb0, 0x3F, 0x06, 0x02, 0x001FF800, PPC_FLOAT)
|
|
|
|
{
|
2004-01-04 17:57:11 +03:00
|
|
|
uint8_t crb;
|
2007-09-17 12:09:54 +04:00
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
crb = 32 - (crbD(ctx->opcode) >> 2);
|
|
|
|
gen_optimize_fprf();
|
|
|
|
gen_reset_fpstatus();
|
|
|
|
if (likely(crb != 30 && crb != 29))
|
|
|
|
gen_op_fpscr_resetbit(~(1 << crb));
|
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) {
|
|
|
|
gen_op_load_fpcc();
|
|
|
|
gen_op_set_Rc0();
|
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtfsb1 */
|
|
|
|
GEN_HANDLER(mtfsb1, 0x3F, 0x06, 0x01, 0x001FF800, PPC_FLOAT)
|
|
|
|
{
|
2004-01-04 17:57:11 +03:00
|
|
|
uint8_t crb;
|
2007-09-17 12:09:54 +04:00
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
crb = 32 - (crbD(ctx->opcode) >> 2);
|
|
|
|
gen_optimize_fprf();
|
|
|
|
gen_reset_fpstatus();
|
|
|
|
/* XXX: we pretend we can only do IEEE floating-point computations */
|
|
|
|
if (likely(crb != FPSCR_FEX && crb != FPSCR_VX && crb != FPSCR_NI))
|
|
|
|
gen_op_fpscr_setbit(crb);
|
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) {
|
|
|
|
gen_op_load_fpcc();
|
|
|
|
gen_op_set_Rc0();
|
|
|
|
}
|
|
|
|
/* We can raise a differed exception */
|
|
|
|
gen_op_float_check_status();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtfsf */
|
|
|
|
GEN_HANDLER(mtfsf, 0x3F, 0x07, 0x16, 0x02010000, PPC_FLOAT)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_optimize_fprf();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rB(ctx->opcode)]);
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
2003-11-23 19:58:08 +03:00
|
|
|
gen_op_store_fpscr(FM(ctx->opcode));
|
2007-10-27 21:54:30 +04:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) {
|
|
|
|
gen_op_load_fpcc();
|
|
|
|
gen_op_set_Rc0();
|
|
|
|
}
|
|
|
|
/* We can raise a differed exception */
|
|
|
|
gen_op_float_check_status();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtfsfi */
|
|
|
|
GEN_HANDLER(mtfsfi, 0x3F, 0x06, 0x04, 0x006f0800, PPC_FLOAT)
|
|
|
|
{
|
2007-10-27 21:54:30 +04:00
|
|
|
int bf, sh;
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx);
|
2005-02-16 02:06:19 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-10-27 21:54:30 +04:00
|
|
|
bf = crbD(ctx->opcode) >> 2;
|
|
|
|
sh = 7 - bf;
|
|
|
|
gen_optimize_fprf();
|
2008-09-05 00:34:31 +04:00
|
|
|
tcg_gen_movi_i64(cpu_FT[0], FPIMM(ctx->opcode) << (4 * sh));
|
2007-10-27 21:54:30 +04:00
|
|
|
gen_reset_fpstatus();
|
|
|
|
gen_op_store_fpscr(1 << sh);
|
|
|
|
if (unlikely(Rc(ctx->opcode) != 0)) {
|
|
|
|
gen_op_load_fpcc();
|
|
|
|
gen_op_set_Rc0();
|
|
|
|
}
|
|
|
|
/* We can raise a differed exception */
|
|
|
|
gen_op_float_check_status();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/*** Addressing modes ***/
|
|
|
|
/* Register indirect with immediate index : EA = (rA|0) + SIMM */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_addr_imm_index (DisasContext *ctx,
|
|
|
|
target_long maskl)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
target_long simm = SIMM(ctx->opcode);
|
|
|
|
|
2007-09-30 17:03:23 +04:00
|
|
|
simm &= ~maskl;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (rA(ctx->opcode) == 0) {
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], simm);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(simm != 0))
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-04-16 11:10:48 +04:00
|
|
|
#ifdef DEBUG_MEMORY_ACCESSES
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_print_mem_EA();
|
2007-04-16 11:10:48 +04:00
|
|
|
#endif
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_addr_reg_index (DisasContext *ctx)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_add_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-04-16 11:10:48 +04:00
|
|
|
#ifdef DEBUG_MEMORY_ACCESSES
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_print_mem_EA();
|
2007-04-16 11:10:48 +04:00
|
|
|
#endif
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_addr_register (DisasContext *ctx)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], 0);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-04-16 11:10:48 +04:00
|
|
|
#ifdef DEBUG_MEMORY_ACCESSES
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_print_mem_EA();
|
2007-04-16 11:10:48 +04:00
|
|
|
#endif
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
2007-11-16 17:11:28 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define _GEN_MEM_FUNCS(name, mode) \
|
|
|
|
&gen_op_##name##_##mode, \
|
|
|
|
&gen_op_##name##_le_##mode, \
|
|
|
|
&gen_op_##name##_64_##mode, \
|
|
|
|
&gen_op_##name##_le_64_##mode
|
|
|
|
#else
|
|
|
|
#define _GEN_MEM_FUNCS(name, mode) \
|
|
|
|
&gen_op_##name##_##mode, \
|
|
|
|
&gen_op_##name##_le_##mode
|
|
|
|
#endif
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-11-16 17:11:28 +03:00
|
|
|
#define NB_MEM_FUNCS 4
|
2007-03-17 17:02:15 +03:00
|
|
|
#else
|
2007-11-16 17:11:28 +03:00
|
|
|
#define NB_MEM_FUNCS 2
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2007-11-16 17:11:28 +03:00
|
|
|
#define GEN_MEM_FUNCS(name) \
|
|
|
|
_GEN_MEM_FUNCS(name, raw)
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-11-16 17:11:28 +03:00
|
|
|
#define NB_MEM_FUNCS 12
|
2007-10-02 14:11:50 +04:00
|
|
|
#else
|
2007-11-16 17:11:28 +03:00
|
|
|
#define NB_MEM_FUNCS 6
|
2007-10-02 14:11:50 +04:00
|
|
|
#endif
|
2007-11-16 17:11:28 +03:00
|
|
|
#define GEN_MEM_FUNCS(name) \
|
|
|
|
_GEN_MEM_FUNCS(name, user), \
|
|
|
|
_GEN_MEM_FUNCS(name, kernel), \
|
|
|
|
_GEN_MEM_FUNCS(name, hypv)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*** Integer load ***/
|
|
|
|
#define op_ldst(name) (*gen_op_##name[ctx->mem_idx])()
|
2005-04-23 22:16:07 +04:00
|
|
|
/* Byte access routine are endian safe */
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_lbz_le_raw gen_op_lbz_raw
|
|
|
|
#define gen_op_lbz_le_user gen_op_lbz_user
|
|
|
|
#define gen_op_lbz_le_kernel gen_op_lbz_kernel
|
|
|
|
#define gen_op_lbz_le_hypv gen_op_lbz_hypv
|
|
|
|
#define gen_op_lbz_le_64_raw gen_op_lbz_64_raw
|
2007-10-02 14:11:50 +04:00
|
|
|
#define gen_op_lbz_le_64_user gen_op_lbz_64_user
|
2007-03-17 17:02:15 +03:00
|
|
|
#define gen_op_lbz_le_64_kernel gen_op_lbz_64_kernel
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_lbz_le_64_hypv gen_op_lbz_64_hypv
|
|
|
|
#define gen_op_stb_le_raw gen_op_stb_raw
|
|
|
|
#define gen_op_stb_le_user gen_op_stb_user
|
|
|
|
#define gen_op_stb_le_kernel gen_op_stb_kernel
|
|
|
|
#define gen_op_stb_le_hypv gen_op_stb_hypv
|
|
|
|
#define gen_op_stb_le_64_raw gen_op_stb_64_raw
|
|
|
|
#define gen_op_stb_le_64_user gen_op_stb_64_user
|
|
|
|
#define gen_op_stb_le_64_kernel gen_op_stb_64_kernel
|
|
|
|
#define gen_op_stb_le_64_hypv gen_op_stb_64_hypv
|
2007-03-17 17:02:15 +03:00
|
|
|
#define OP_LD_TABLE(width) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_l##width[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(l##width), \
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
|
|
|
#define OP_ST_TABLE(width) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_st##width[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(st##width), \
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LD(width, opc, type) \
|
|
|
|
GEN_HANDLER(l##width, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LDU(width, opc, type) \
|
|
|
|
GEN_HANDLER(l##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0 || \
|
|
|
|
rA(ctx->opcode) == rD(ctx->opcode))) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
if (type == PPC_64B) \
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_addr_imm_index(ctx, 0x03); \
|
2007-04-06 11:59:47 +04:00
|
|
|
else \
|
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
|
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LDUX(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(l##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0 || \
|
|
|
|
rA(ctx->opcode) == rD(ctx->opcode))) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
|
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LDX(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(l##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_LDS(width, op, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_LD_TABLE(width); \
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LD(width, op | 0x20, type); \
|
|
|
|
GEN_LDU(width, op | 0x21, type); \
|
|
|
|
GEN_LDUX(width, 0x17, op | 0x01, type); \
|
|
|
|
GEN_LDX(width, 0x17, op | 0x00, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* lbz lbzu lbzux lbzx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDS(bz, 0x02, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lha lhau lhaux lhax */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDS(ha, 0x0A, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lhz lhzu lhzux lhzx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDS(hz, 0x08, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lwz lwzu lwzux lwzx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDS(wz, 0x00, PPC_INTEGER);
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
OP_LD_TABLE(wa);
|
|
|
|
OP_LD_TABLE(d);
|
|
|
|
/* lwaux */
|
|
|
|
GEN_LDUX(wa, 0x15, 0x0B, PPC_64B);
|
|
|
|
/* lwax */
|
|
|
|
GEN_LDX(wa, 0x15, 0x0A, PPC_64B);
|
|
|
|
/* ldux */
|
|
|
|
GEN_LDUX(d, 0x15, 0x01, PPC_64B);
|
|
|
|
/* ldx */
|
|
|
|
GEN_LDX(d, 0x15, 0x00, PPC_64B);
|
|
|
|
GEN_HANDLER(ld, 0x3A, 0xFF, 0xFF, 0x00000000, PPC_64B)
|
|
|
|
{
|
|
|
|
if (Rc(ctx->opcode)) {
|
|
|
|
if (unlikely(rA(ctx->opcode) == 0 ||
|
|
|
|
rA(ctx->opcode) == rD(ctx->opcode))) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-17 17:02:15 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_addr_imm_index(ctx, 0x03);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->opcode & 0x02) {
|
|
|
|
/* lwa (lwau is undefined) */
|
|
|
|
op_ldst(lwa);
|
|
|
|
} else {
|
|
|
|
/* ld - ldu */
|
|
|
|
op_ldst(ld);
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (Rc(ctx->opcode))
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2007-09-30 17:03:23 +04:00
|
|
|
/* lq */
|
|
|
|
GEN_HANDLER(lq, 0x38, 0xFF, 0xFF, 0x00000000, PPC_64BX)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
#else
|
|
|
|
int ra, rd;
|
|
|
|
|
|
|
|
/* Restore CPU state */
|
|
|
|
if (unlikely(ctx->supervisor == 0)) {
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ra = rA(ctx->opcode);
|
|
|
|
rd = rD(ctx->opcode);
|
|
|
|
if (unlikely((rd & 1) || rd == ra)) {
|
|
|
|
GEN_EXCP_INVAL(ctx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (unlikely(ctx->mem_idx & 1)) {
|
|
|
|
/* Little-endian mode is not handled */
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_imm_index(ctx, 0x0F);
|
|
|
|
op_ldst(ld);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rd], cpu_T[1]);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], 8);
|
2007-09-30 17:03:23 +04:00
|
|
|
op_ldst(ld);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rd + 1], cpu_T[1]);
|
2007-09-30 17:03:23 +04:00
|
|
|
#endif
|
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Integer store ***/
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_ST(width, opc, type) \
|
|
|
|
GEN_HANDLER(st##width, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_STU(width, opc, type) \
|
|
|
|
GEN_HANDLER(st##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
if (type == PPC_64B) \
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_addr_imm_index(ctx, 0x03); \
|
2007-04-06 11:59:47 +04:00
|
|
|
else \
|
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_STUX(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(st##width##ux, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_STX(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(st##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#define GEN_STS(width, op, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_ST_TABLE(width); \
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_ST(width, op | 0x20, type); \
|
|
|
|
GEN_STU(width, op | 0x21, type); \
|
|
|
|
GEN_STUX(width, 0x17, op | 0x01, type); \
|
|
|
|
GEN_STX(width, 0x17, op | 0x00, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* stb stbu stbux stbx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_STS(b, 0x06, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* sth sthu sthux sthx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_STS(h, 0x0C, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* stw stwu stwux stwx */
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_STS(w, 0x04, PPC_INTEGER);
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
OP_ST_TABLE(d);
|
2007-03-23 12:45:27 +03:00
|
|
|
GEN_STUX(d, 0x15, 0x05, PPC_64B);
|
|
|
|
GEN_STX(d, 0x15, 0x04, PPC_64B);
|
2007-09-30 17:03:23 +04:00
|
|
|
GEN_HANDLER(std, 0x3E, 0xFF, 0xFF, 0x00000000, PPC_64B)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-09-30 17:03:23 +04:00
|
|
|
int rs;
|
|
|
|
|
|
|
|
rs = rS(ctx->opcode);
|
|
|
|
if ((ctx->opcode & 0x3) == 0x2) {
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
#else
|
|
|
|
/* stq */
|
|
|
|
if (unlikely(ctx->supervisor == 0)) {
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (unlikely(rs & 1)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-17 17:02:15 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-09-30 17:03:23 +04:00
|
|
|
if (unlikely(ctx->mem_idx & 1)) {
|
|
|
|
/* Little-endian mode is not handled */
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_imm_index(ctx, 0x03);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rs]);
|
2007-09-30 17:03:23 +04:00
|
|
|
op_ldst(std);
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], 8);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rs + 1]);
|
2007-09-30 17:03:23 +04:00
|
|
|
op_ldst(std);
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
/* std / stdu */
|
|
|
|
if (Rc(ctx->opcode)) {
|
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) {
|
|
|
|
GEN_EXCP_INVAL(ctx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gen_addr_imm_index(ctx, 0x03);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rs]);
|
2007-09-30 17:03:23 +04:00
|
|
|
op_ldst(std);
|
|
|
|
if (Rc(ctx->opcode))
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Integer load and store with byte reverse ***/
|
|
|
|
/* lhbrx */
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_LD_TABLE(hbr);
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDX(hbr, 0x16, 0x18, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lwbrx */
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_LD_TABLE(wbr);
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_LDX(wbr, 0x16, 0x10, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* sthbrx */
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_ST_TABLE(hbr);
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_STX(hbr, 0x16, 0x1C, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* stwbrx */
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_ST_TABLE(wbr);
|
2007-03-17 17:02:15 +03:00
|
|
|
GEN_STX(wbr, 0x16, 0x14, PPC_INTEGER);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Integer load and store multiple ***/
|
2005-04-23 22:16:07 +04:00
|
|
|
#define op_ldstm(name, reg) (*gen_op_##name[ctx->mem_idx])(reg)
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc1 *gen_op_lmw[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(lmw),
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc1 *gen_op_stmw[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(stmw),
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lmw */
|
|
|
|
GEN_HANDLER(lmw, 0x2E, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldstm(lmw, rD(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stmw */
|
|
|
|
GEN_HANDLER(stmw, 0x2F, 0xFF, 0xFF, 0x00000000, PPC_INTEGER)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldstm(stmw, rS(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Integer load and store strings ***/
|
2004-01-05 01:58:38 +03:00
|
|
|
#define op_ldsts(name, start) (*gen_op_##name[ctx->mem_idx])(start)
|
|
|
|
#define op_ldstsx(name, rd, ra, rb) (*gen_op_##name[ctx->mem_idx])(rd, ra, rb)
|
2007-11-22 14:00:46 +03:00
|
|
|
/* string load & stores are by definition endian-safe */
|
|
|
|
#define gen_op_lswi_le_raw gen_op_lswi_raw
|
|
|
|
#define gen_op_lswi_le_user gen_op_lswi_user
|
|
|
|
#define gen_op_lswi_le_kernel gen_op_lswi_kernel
|
|
|
|
#define gen_op_lswi_le_hypv gen_op_lswi_hypv
|
|
|
|
#define gen_op_lswi_le_64_raw gen_op_lswi_raw
|
|
|
|
#define gen_op_lswi_le_64_user gen_op_lswi_user
|
|
|
|
#define gen_op_lswi_le_64_kernel gen_op_lswi_kernel
|
|
|
|
#define gen_op_lswi_le_64_hypv gen_op_lswi_hypv
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc1 *gen_op_lswi[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(lswi),
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
2007-11-22 14:00:46 +03:00
|
|
|
#define gen_op_lswx_le_raw gen_op_lswx_raw
|
|
|
|
#define gen_op_lswx_le_user gen_op_lswx_user
|
|
|
|
#define gen_op_lswx_le_kernel gen_op_lswx_kernel
|
|
|
|
#define gen_op_lswx_le_hypv gen_op_lswx_hypv
|
|
|
|
#define gen_op_lswx_le_64_raw gen_op_lswx_raw
|
|
|
|
#define gen_op_lswx_le_64_user gen_op_lswx_user
|
|
|
|
#define gen_op_lswx_le_64_kernel gen_op_lswx_kernel
|
|
|
|
#define gen_op_lswx_le_64_hypv gen_op_lswx_hypv
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc3 *gen_op_lswx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(lswx),
|
2007-03-17 17:02:15 +03:00
|
|
|
};
|
2007-11-22 14:00:46 +03:00
|
|
|
#define gen_op_stsw_le_raw gen_op_stsw_raw
|
|
|
|
#define gen_op_stsw_le_user gen_op_stsw_user
|
|
|
|
#define gen_op_stsw_le_kernel gen_op_stsw_kernel
|
|
|
|
#define gen_op_stsw_le_hypv gen_op_stsw_hypv
|
|
|
|
#define gen_op_stsw_le_64_raw gen_op_stsw_raw
|
|
|
|
#define gen_op_stsw_le_64_user gen_op_stsw_user
|
|
|
|
#define gen_op_stsw_le_64_kernel gen_op_stsw_kernel
|
|
|
|
#define gen_op_stsw_le_64_hypv gen_op_stsw_hypv
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc1 *gen_op_stsw[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(stsw),
|
2004-01-05 01:58:38 +03:00
|
|
|
};
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lswi */
|
2005-07-03 00:59:34 +04:00
|
|
|
/* PowerPC32 specification says we must generate an exception if
|
2004-01-05 01:58:38 +03:00
|
|
|
* rA is in the range of registers to be loaded.
|
|
|
|
* In an other hand, IBM says this is valid, but rA won't be loaded.
|
|
|
|
* For now, I'll follow the spec...
|
|
|
|
*/
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(lswi, 0x1F, 0x15, 0x12, 0x00000001, PPC_STRING)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
|
|
|
int nb = NB(ctx->opcode);
|
|
|
|
int start = rD(ctx->opcode);
|
2004-01-05 01:58:38 +03:00
|
|
|
int ra = rA(ctx->opcode);
|
2003-11-23 17:55:54 +03:00
|
|
|
int nr;
|
|
|
|
|
|
|
|
if (nb == 0)
|
|
|
|
nb = 32;
|
|
|
|
nr = nb / 4;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(((start + nr) > 32 &&
|
|
|
|
start <= ra && (start + nr - 32) > ra) ||
|
|
|
|
((start + nr) <= 32 && start <= ra && (start + nr) > ra))) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_LSWX);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-02-21 17:11:27 +03:00
|
|
|
}
|
2005-06-05 02:22:27 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_register(ctx);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], nb);
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldsts(lswi, start);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* lswx */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(lswx, 0x1F, 0x15, 0x10, 0x00000001, PPC_STRING)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
int rb = rB(ctx->opcode);
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
if (ra == 0) {
|
|
|
|
ra = rb;
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_load_xer_bc();
|
|
|
|
op_ldstsx(lswx, rD(ctx->opcode), ra, rb);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stswi */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(stswi, 0x1F, 0x15, 0x16, 0x00000001, PPC_STRING)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-05-24 02:18:12 +04:00
|
|
|
int nb = NB(ctx->opcode);
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_register(ctx);
|
2004-05-24 02:18:12 +04:00
|
|
|
if (nb == 0)
|
|
|
|
nb = 32;
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], nb);
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldsts(stsw, rS(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stswx */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(stswx, 0x1F, 0x15, 0x14, 0x00000001, PPC_STRING)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2005-06-05 02:22:27 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-09-17 01:08:06 +04:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
gen_op_load_xer_bc();
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldsts(stsw, rS(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Memory synchronisation ***/
|
|
|
|
/* eieio */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(eieio, 0x1F, 0x16, 0x1A, 0x03FFF801, PPC_MEM_EIEIO)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* isync */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(isync, 0x13, 0x16, 0x04, 0x03FFF801, PPC_MEM)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_STOP(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2005-04-23 22:16:07 +04:00
|
|
|
#define op_lwarx() (*gen_op_lwarx[ctx->mem_idx])()
|
|
|
|
#define op_stwcx() (*gen_op_stwcx[ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_lwarx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(lwarx),
|
2005-04-23 22:16:07 +04:00
|
|
|
};
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_stwcx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(stwcx),
|
2004-01-19 01:49:57 +03:00
|
|
|
};
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2005-04-23 22:16:07 +04:00
|
|
|
/* lwarx */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(lwarx, 0x1F, 0x14, 0x00, 0x00000001, PPC_RES)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-10-01 09:22:17 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2004-01-19 01:49:57 +03:00
|
|
|
op_lwarx();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stwcx. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(stwcx_, "stwcx.", 0x1F, 0x16, 0x04, 0x00000000, PPC_RES)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-10-01 09:22:17 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2004-01-05 01:58:38 +03:00
|
|
|
op_stwcx();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-23 12:45:27 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define op_ldarx() (*gen_op_ldarx[ctx->mem_idx])()
|
|
|
|
#define op_stdcx() (*gen_op_stdcx[ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_ldarx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(ldarx),
|
2007-03-23 12:45:27 +03:00
|
|
|
};
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_stdcx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(stdcx),
|
2007-03-23 12:45:27 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ldarx */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(ldarx, 0x1F, 0x14, 0x02, 0x00000001, PPC_64B)
|
2007-03-23 12:45:27 +03:00
|
|
|
{
|
2007-10-01 09:22:17 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-23 12:45:27 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
op_ldarx();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[1]);
|
2007-03-23 12:45:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stdcx. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(stdcx_, "stdcx.", 0x1F, 0x16, 0x06, 0x00000000, PPC_64B)
|
2007-03-23 12:45:27 +03:00
|
|
|
{
|
2007-10-01 09:22:17 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-23 12:45:27 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-23 12:45:27 +03:00
|
|
|
op_stdcx();
|
|
|
|
}
|
|
|
|
#endif /* defined(TARGET_PPC64) */
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* sync */
|
2007-09-30 19:21:15 +04:00
|
|
|
GEN_HANDLER(sync, 0x1F, 0x16, 0x12, 0x039FF801, PPC_MEM_SYNC)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-30 07:46:38 +04:00
|
|
|
/* wait */
|
|
|
|
GEN_HANDLER(wait, 0x1F, 0x1E, 0x01, 0x03FFF801, PPC_WAIT)
|
|
|
|
{
|
|
|
|
/* Stop translation, as the CPU is supposed to sleep from now */
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_op_wait();
|
|
|
|
GEN_EXCP(ctx, EXCP_HLT, 1);
|
2007-09-30 07:46:38 +04:00
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Floating-point load ***/
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_LDF(width, opc, type) \
|
|
|
|
GEN_HANDLER(l##width, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_LDUF(width, opc, type) \
|
|
|
|
GEN_HANDLER(l##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_LDUXF(width, opc, type) \
|
|
|
|
GEN_HANDLER(l##width##ux, 0x1F, 0x17, opc, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_LDXF(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(l##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(l##width); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_LDFS(width, op, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_LD_TABLE(width); \
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_LDF(width, op | 0x20, type); \
|
|
|
|
GEN_LDUF(width, op | 0x21, type); \
|
|
|
|
GEN_LDUXF(width, op | 0x01, type); \
|
|
|
|
GEN_LDXF(width, 0x17, op | 0x00, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* lfd lfdu lfdux lfdx */
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_LDFS(fd, 0x12, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* lfs lfsu lfsux lfsx */
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_LDFS(fs, 0x10, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Floating-point store ***/
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_STF(width, opc, type) \
|
|
|
|
GEN_HANDLER(st##width, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_STUF(width, opc, type) \
|
|
|
|
GEN_HANDLER(st##width##u, opc, 0xFF, 0xFF, 0x00000000, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_STUXF(width, opc, type) \
|
|
|
|
GEN_HANDLER(st##width##ux, 0x1F, 0x17, opc, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(rA(ctx->opcode) == 0)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx); \
|
2004-05-21 16:59:32 +04:00
|
|
|
return; \
|
2004-01-05 01:58:38 +03:00
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_STXF(width, opc2, opc3, type) \
|
|
|
|
GEN_HANDLER(st##width##x, 0x1F, opc2, opc3, 0x00000001, type) \
|
2003-11-23 17:55:54 +03:00
|
|
|
{ \
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->fpu_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_FP(ctx); \
|
2005-03-13 20:01:22 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]); \
|
2004-01-05 01:58:38 +03:00
|
|
|
op_ldst(st##width); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-09-30 05:01:08 +04:00
|
|
|
#define GEN_STFS(width, op, type) \
|
2004-01-05 01:58:38 +03:00
|
|
|
OP_ST_TABLE(width); \
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_STF(width, op | 0x20, type); \
|
|
|
|
GEN_STUF(width, op | 0x21, type); \
|
|
|
|
GEN_STUXF(width, op | 0x01, type); \
|
|
|
|
GEN_STXF(width, 0x17, op | 0x00, type)
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* stfd stfdu stfdux stfdx */
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_STFS(fd, 0x16, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* stfs stfsu stfsux stfsx */
|
2007-09-30 05:01:08 +04:00
|
|
|
GEN_STFS(fs, 0x14, PPC_FLOAT);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/* Optional: */
|
|
|
|
/* stfiwx */
|
2007-11-19 14:39:29 +03:00
|
|
|
OP_ST_TABLE(fiw);
|
|
|
|
GEN_STXF(fiw, 0x17, 0x1E, PPC_FLOAT_STFIWX);
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Branch ***/
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_goto_tb (DisasContext *ctx, int n,
|
|
|
|
target_ulong dest)
|
2005-11-20 13:31:08 +03:00
|
|
|
{
|
|
|
|
TranslationBlock *tb;
|
|
|
|
tb = ctx->tb;
|
2008-02-01 13:50:11 +03:00
|
|
|
if ((tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) &&
|
2008-05-11 03:28:14 +04:00
|
|
|
likely(!ctx->singlestep_enabled)) {
|
2008-02-01 13:50:11 +03:00
|
|
|
tcg_gen_goto_tb(n);
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], dest);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], ~3);
|
2007-03-17 17:02:15 +03:00
|
|
|
else
|
|
|
|
#endif
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], (uint32_t)~3);
|
2008-02-01 13:50:11 +03:00
|
|
|
tcg_gen_exit_tb((long)tb + n);
|
2005-11-20 13:31:08 +03:00
|
|
|
} else {
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], dest);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], ~3);
|
2007-03-17 17:02:15 +03:00
|
|
|
else
|
|
|
|
#endif
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], (uint32_t)~3);
|
2008-05-11 03:28:14 +04:00
|
|
|
if (unlikely(ctx->singlestep_enabled)) {
|
|
|
|
if ((ctx->singlestep_enabled &
|
|
|
|
(CPU_BRANCH_STEP | CPU_SINGLE_STEP)) &&
|
|
|
|
ctx->exception == POWERPC_EXCP_BRANCH) {
|
|
|
|
target_ulong tmp = ctx->nip;
|
|
|
|
ctx->nip = dest;
|
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_TRACE, 0);
|
|
|
|
ctx->nip = tmp;
|
|
|
|
}
|
|
|
|
if (ctx->singlestep_enabled & GDBSTUB_SINGLE_STEP) {
|
|
|
|
gen_update_nip(ctx, dest);
|
|
|
|
gen_op_debug();
|
|
|
|
}
|
|
|
|
}
|
2008-02-01 13:50:11 +03:00
|
|
|
tcg_gen_exit_tb(0);
|
2005-11-20 13:31:08 +03:00
|
|
|
}
|
2005-10-31 00:39:19 +03:00
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_setlr (DisasContext *ctx, target_ulong nip)
|
2007-09-29 17:06:16 +04:00
|
|
|
{
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode != 0 && (nip >> 32))
|
|
|
|
gen_op_setlr_64(ctx->nip >> 32, ctx->nip);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_setlr(ctx->nip);
|
|
|
|
}
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* b ba bl bla */
|
|
|
|
GEN_HANDLER(b, 0x12, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
|
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong li, target;
|
2004-07-08 02:06:01 +04:00
|
|
|
|
2008-05-11 03:28:14 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_BRANCH;
|
2004-07-08 02:06:01 +04:00
|
|
|
/* sign extend LI */
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-03-17 17:02:15 +03:00
|
|
|
if (ctx->sf_mode)
|
|
|
|
li = ((int64_t)LI(ctx->opcode) << 38) >> 38;
|
|
|
|
else
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
2007-03-17 17:02:15 +03:00
|
|
|
li = ((int32_t)LI(ctx->opcode) << 6) >> 6;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(AA(ctx->opcode) == 0))
|
2004-04-26 01:15:35 +04:00
|
|
|
target = ctx->nip + li - 4;
|
2003-11-23 17:55:54 +03:00
|
|
|
else
|
2004-01-05 01:58:38 +03:00
|
|
|
target = li;
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-09-29 17:06:16 +04:00
|
|
|
if (!ctx->sf_mode)
|
|
|
|
target = (uint32_t)target;
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2007-09-29 17:06:16 +04:00
|
|
|
if (LK(ctx->opcode))
|
|
|
|
gen_setlr(ctx, ctx->nip);
|
2005-11-20 13:31:08 +03:00
|
|
|
gen_goto_tb(ctx, 0, target);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2004-02-21 18:35:00 +03:00
|
|
|
#define BCOND_IM 0
|
|
|
|
#define BCOND_LR 1
|
|
|
|
#define BCOND_CTR 2
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_bcond (DisasContext *ctx, int type)
|
2007-03-17 17:02:15 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
target_ulong target = 0;
|
|
|
|
target_ulong li;
|
2007-03-17 17:02:15 +03:00
|
|
|
uint32_t bo = BO(ctx->opcode);
|
|
|
|
uint32_t bi = BI(ctx->opcode);
|
|
|
|
uint32_t mask;
|
2004-02-21 18:35:00 +03:00
|
|
|
|
2008-05-11 03:28:14 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_BRANCH;
|
2004-02-21 18:35:00 +03:00
|
|
|
if ((bo & 0x4) == 0)
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_op_dec_ctr();
|
2004-02-21 18:35:00 +03:00
|
|
|
switch(type) {
|
|
|
|
case BCOND_IM:
|
2007-03-07 11:32:30 +03:00
|
|
|
li = (target_long)((int16_t)(BD(ctx->opcode)));
|
|
|
|
if (likely(AA(ctx->opcode) == 0)) {
|
2004-04-26 01:15:35 +04:00
|
|
|
target = ctx->nip + li - 4;
|
2004-02-21 18:35:00 +03:00
|
|
|
} else {
|
|
|
|
target = li;
|
|
|
|
}
|
2007-09-29 17:06:16 +04:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (!ctx->sf_mode)
|
|
|
|
target = (uint32_t)target;
|
|
|
|
#endif
|
2004-02-21 18:35:00 +03:00
|
|
|
break;
|
|
|
|
case BCOND_CTR:
|
|
|
|
gen_op_movl_T1_ctr();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case BCOND_LR:
|
|
|
|
gen_op_movl_T1_lr();
|
|
|
|
break;
|
|
|
|
}
|
2007-09-29 17:06:16 +04:00
|
|
|
if (LK(ctx->opcode))
|
|
|
|
gen_setlr(ctx, ctx->nip);
|
2004-02-21 18:35:00 +03:00
|
|
|
if (bo & 0x10) {
|
2007-03-17 17:02:15 +03:00
|
|
|
/* No CR condition */
|
|
|
|
switch (bo & 0x6) {
|
|
|
|
case 0:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctr_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctr();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctrz_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctrz();
|
2004-02-21 18:35:00 +03:00
|
|
|
break;
|
|
|
|
default:
|
2007-03-17 17:02:15 +03:00
|
|
|
case 4:
|
|
|
|
case 6:
|
2004-02-21 18:35:00 +03:00
|
|
|
if (type == BCOND_IM) {
|
2005-11-20 13:31:08 +03:00
|
|
|
gen_goto_tb(ctx, 0, target);
|
2008-05-11 03:28:14 +04:00
|
|
|
return;
|
2004-02-21 18:35:00 +03:00
|
|
|
} else {
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], ~3);
|
2007-03-17 17:02:15 +03:00
|
|
|
else
|
|
|
|
#endif
|
2008-09-04 22:06:03 +04:00
|
|
|
tcg_gen_andi_tl(cpu_nip, cpu_T[1], (uint32_t)~3);
|
2007-10-01 07:03:51 +04:00
|
|
|
goto no_test;
|
2004-02-21 18:35:00 +03:00
|
|
|
}
|
2007-10-01 07:03:51 +04:00
|
|
|
break;
|
2004-02-21 18:35:00 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
} else {
|
|
|
|
mask = 1 << (3 - (bi & 0x03));
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[0], cpu_crf[bi >> 2]);
|
2007-03-17 17:02:15 +03:00
|
|
|
if (bo & 0x8) {
|
|
|
|
switch (bo & 0x6) {
|
|
|
|
case 0:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctr_true_64(mask);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctr_true(mask);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctrz_true_64(mask);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctrz_true(mask);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
case 4:
|
|
|
|
case 6:
|
2004-02-21 18:35:00 +03:00
|
|
|
gen_op_test_true(mask);
|
2007-03-17 17:02:15 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch (bo & 0x6) {
|
|
|
|
case 0:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctr_false_64(mask);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctr_false(mask);
|
2007-09-17 12:09:54 +04:00
|
|
|
break;
|
2007-03-17 17:02:15 +03:00
|
|
|
case 2:
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_test_ctrz_false_64(mask);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_test_ctrz_false(mask);
|
|
|
|
break;
|
2004-02-21 18:35:00 +03:00
|
|
|
default:
|
2007-03-17 17:02:15 +03:00
|
|
|
case 4:
|
|
|
|
case 6:
|
2004-02-21 18:35:00 +03:00
|
|
|
gen_op_test_false(mask);
|
2007-03-17 17:02:15 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-02-21 18:35:00 +03:00
|
|
|
if (type == BCOND_IM) {
|
2005-10-31 00:39:19 +03:00
|
|
|
int l1 = gen_new_label();
|
|
|
|
gen_op_jz_T0(l1);
|
2005-11-20 13:31:08 +03:00
|
|
|
gen_goto_tb(ctx, 0, target);
|
2005-10-31 00:39:19 +03:00
|
|
|
gen_set_label(l1);
|
2005-11-20 13:31:08 +03:00
|
|
|
gen_goto_tb(ctx, 1, ctx->nip);
|
2004-02-21 18:35:00 +03:00
|
|
|
} else {
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_btest_T1_64(ctx->nip >> 32, ctx->nip);
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_btest_T1(ctx->nip);
|
2007-09-17 12:21:54 +04:00
|
|
|
no_test:
|
2008-05-11 03:28:14 +04:00
|
|
|
if (ctx->singlestep_enabled & GDBSTUB_SINGLE_STEP) {
|
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2007-04-16 11:18:42 +04:00
|
|
|
gen_op_debug();
|
2008-05-11 03:28:14 +04:00
|
|
|
}
|
2008-02-01 13:50:11 +03:00
|
|
|
tcg_gen_exit_tb(0);
|
2007-04-16 11:18:42 +04:00
|
|
|
}
|
2004-02-21 18:35:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(bc, 0x10, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
|
2007-09-17 12:09:54 +04:00
|
|
|
{
|
2004-02-21 18:35:00 +03:00
|
|
|
gen_bcond(ctx, BCOND_IM);
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(bcctr, 0x13, 0x10, 0x10, 0x00000000, PPC_FLOW)
|
2007-09-17 12:09:54 +04:00
|
|
|
{
|
2004-02-21 18:35:00 +03:00
|
|
|
gen_bcond(ctx, BCOND_CTR);
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(bclr, 0x13, 0x10, 0x00, 0x00000000, PPC_FLOW)
|
2007-09-17 12:09:54 +04:00
|
|
|
{
|
2004-02-21 18:35:00 +03:00
|
|
|
gen_bcond(ctx, BCOND_LR);
|
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
/*** Condition register logical ***/
|
|
|
|
#define GEN_CRLOGIC(op, opc) \
|
|
|
|
GEN_HANDLER(cr##op, 0x13, 0x01, opc, 0x00000001, PPC_INTEGER) \
|
|
|
|
{ \
|
2007-11-01 01:02:17 +03:00
|
|
|
uint8_t bitmask; \
|
|
|
|
int sh; \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[0], cpu_crf[crbA(ctx->opcode) >> 2]); \
|
2007-11-01 01:02:17 +03:00
|
|
|
sh = (crbD(ctx->opcode) & 0x03) - (crbA(ctx->opcode) & 0x03); \
|
|
|
|
if (sh > 0) \
|
|
|
|
gen_op_srli_T0(sh); \
|
|
|
|
else if (sh < 0) \
|
|
|
|
gen_op_sli_T0(-sh); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[1], cpu_crf[crbB(ctx->opcode) >> 2]); \
|
2007-11-01 01:02:17 +03:00
|
|
|
sh = (crbD(ctx->opcode) & 0x03) - (crbB(ctx->opcode) & 0x03); \
|
|
|
|
if (sh > 0) \
|
|
|
|
gen_op_srli_T1(sh); \
|
|
|
|
else if (sh < 0) \
|
|
|
|
gen_op_sli_T1(-sh); \
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_op_##op(); \
|
2007-11-01 01:02:17 +03:00
|
|
|
bitmask = 1 << (3 - (crbD(ctx->opcode) & 0x03)); \
|
|
|
|
gen_op_andi_T0(bitmask); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_T[1], cpu_crf[crbD(ctx->opcode) >> 2], ~bitmask); \
|
2007-11-01 01:02:17 +03:00
|
|
|
gen_op_or(); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crbD(ctx->opcode) >> 2], cpu_T[0], 0xf); \
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* crand */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(and, 0x08);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* crandc */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(andc, 0x04);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* creqv */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(eqv, 0x09);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* crnand */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(nand, 0x07);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* crnor */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(nor, 0x01);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* cror */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(or, 0x0E);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* crorc */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(orc, 0x0D);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* crxor */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_CRLOGIC(xor, 0x06);
|
2003-11-23 17:55:54 +03:00
|
|
|
/* mcrf */
|
|
|
|
GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_INTEGER)
|
|
|
|
{
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfS(ctx->opcode)]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** System linkage ***/
|
|
|
|
/* rfi (supervisor only) */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(rfi, 0x13, 0x12, 0x01, 0x03FF8001, PPC_FLOW)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
|
|
|
/* Restore CPU state */
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_rfi();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-23 12:45:27 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(rfid, 0x13, 0x12, 0x00, 0x03FF8001, PPC_64B)
|
2007-03-23 12:45:27 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
#else
|
|
|
|
/* Restore CPU state */
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
return;
|
|
|
|
}
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_rfid();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-11-19 14:39:29 +03:00
|
|
|
GEN_HANDLER(hrfid, 0x13, 0x12, 0x08, 0x03FF8001, PPC_64H)
|
2007-09-30 17:03:23 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
#else
|
|
|
|
/* Restore CPU state */
|
|
|
|
if (unlikely(ctx->supervisor <= 1)) {
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_op_hrfid();
|
|
|
|
GEN_SYNC(ctx);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* sc */
|
2007-10-08 03:10:08 +04:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL_USER
|
|
|
|
#else
|
|
|
|
#define POWERPC_SYSCALL POWERPC_EXCP_SYSCALL
|
|
|
|
#endif
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_HANDLER(sc, 0x11, 0xFF, 0xFF, 0x03FFF01D, PPC_FLOW)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-09-29 17:06:16 +04:00
|
|
|
uint32_t lev;
|
|
|
|
|
|
|
|
lev = (ctx->opcode >> 5) & 0x7F;
|
2007-10-08 03:10:08 +04:00
|
|
|
GEN_EXCP(ctx, POWERPC_SYSCALL, lev);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Trap ***/
|
|
|
|
/* tw */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(tw, 0x1F, 0x04, 0x00, 0x00000001, PPC_FLOW)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-01-05 19:54:16 +03:00
|
|
|
/* Update the nip since this might generate a trap exception */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2004-01-05 01:58:38 +03:00
|
|
|
gen_op_tw(TO(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* twi */
|
|
|
|
GEN_HANDLER(twi, 0x03, 0xFF, 0xFF, 0x00000000, PPC_FLOW)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SIMM(ctx->opcode));
|
2007-03-17 17:02:15 +03:00
|
|
|
/* Update the nip since this might generate a trap exception */
|
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_tw(TO(ctx->opcode));
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* td */
|
|
|
|
GEN_HANDLER(td, 0x1F, 0x04, 0x02, 0x00000001, PPC_64B)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
/* Update the nip since this might generate a trap exception */
|
|
|
|
gen_update_nip(ctx, ctx->nip);
|
|
|
|
gen_op_td(TO(ctx->opcode));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tdi */
|
|
|
|
GEN_HANDLER(tdi, 0x02, 0xFF, 0xFF, 0x00000000, PPC_64B)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SIMM(ctx->opcode));
|
2007-03-17 17:02:15 +03:00
|
|
|
/* Update the nip since this might generate a trap exception */
|
|
|
|
gen_update_nip(ctx, ctx->nip);
|
|
|
|
gen_op_td(TO(ctx->opcode));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Processor control ***/
|
|
|
|
/* mcrxr */
|
|
|
|
GEN_HANDLER(mcrxr, 0x1F, 0x00, 0x10, 0x007FF801, PPC_MISC)
|
|
|
|
{
|
|
|
|
gen_op_load_xer_cr();
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
|
2007-03-23 01:17:08 +03:00
|
|
|
gen_op_clear_xer_ov();
|
|
|
|
gen_op_clear_xer_ca();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mfcr */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(mfcr, 0x1F, 0x13, 0x00, 0x00000801, PPC_MISC)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
uint32_t crm, crn;
|
2007-09-17 12:09:54 +04:00
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(ctx->opcode & 0x00100000)) {
|
|
|
|
crm = CRM(ctx->opcode);
|
|
|
|
if (likely((crm ^ (crm - 1)) == 0)) {
|
|
|
|
crn = ffs(crm);
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[0], cpu_crf[7 - crn]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
} else {
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_load_cr();
|
2007-03-17 17:02:15 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mfmsr */
|
|
|
|
GEN_HANDLER(mfmsr, 0x1F, 0x13, 0x02, 0x001FF801, PPC_MISC)
|
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_load_msr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-10-28 03:55:05 +03:00
|
|
|
#if 1
|
2007-11-12 03:04:48 +03:00
|
|
|
#define SPR_NOACCESS ((void *)(-1UL))
|
2005-07-03 00:59:34 +04:00
|
|
|
#else
|
|
|
|
static void spr_noaccess (void *opaque, int sprn)
|
|
|
|
{
|
|
|
|
sprn = ((sprn >> 5) & 0x1F) | ((sprn & 0x1F) << 5);
|
|
|
|
printf("ERROR: try to access SPR %d !\n", sprn);
|
|
|
|
}
|
|
|
|
#define SPR_NOACCESS (&spr_noaccess)
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* mfspr */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_mfspr (DisasContext *ctx)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2005-07-03 00:59:34 +04:00
|
|
|
void (*read_cb)(void *opaque, int sprn);
|
2003-11-23 17:55:54 +03:00
|
|
|
uint32_t sprn = SPR(ctx->opcode);
|
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-09-30 17:03:23 +04:00
|
|
|
if (ctx->supervisor == 2)
|
|
|
|
read_cb = ctx->spr_cb[sprn].hea_read;
|
2007-11-16 17:11:28 +03:00
|
|
|
else if (ctx->supervisor)
|
2005-07-03 00:59:34 +04:00
|
|
|
read_cb = ctx->spr_cb[sprn].oea_read;
|
|
|
|
else
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2005-07-03 00:59:34 +04:00
|
|
|
read_cb = ctx->spr_cb[sprn].uea_read;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(read_cb != NULL)) {
|
|
|
|
if (likely(read_cb != SPR_NOACCESS)) {
|
2005-07-03 00:59:34 +04:00
|
|
|
(*read_cb)(ctx, sprn);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2005-07-03 00:59:34 +04:00
|
|
|
} else {
|
|
|
|
/* Privilege exception */
|
2007-11-03 01:47:50 +03:00
|
|
|
/* This is a hack to avoid warnings when running Linux:
|
|
|
|
* this OS breaks the PowerPC virtualisation model,
|
|
|
|
* allowing userland application to read the PVR
|
|
|
|
*/
|
|
|
|
if (sprn != SPR_PVR) {
|
|
|
|
if (loglevel != 0) {
|
2007-11-24 05:03:55 +03:00
|
|
|
fprintf(logfile, "Trying to read privileged spr %d %03x at "
|
2007-11-04 04:57:29 +03:00
|
|
|
ADDRX "\n", sprn, sprn, ctx->nip);
|
2007-11-03 01:47:50 +03:00
|
|
|
}
|
2007-11-04 04:57:29 +03:00
|
|
|
printf("Trying to read privileged spr %d %03x at " ADDRX "\n",
|
|
|
|
sprn, sprn, ctx->nip);
|
2005-11-24 00:36:30 +03:00
|
|
|
}
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2005-07-03 00:59:34 +04:00
|
|
|
} else {
|
|
|
|
/* Not defined */
|
2007-04-19 12:42:21 +04:00
|
|
|
if (loglevel != 0) {
|
2007-11-04 04:57:29 +03:00
|
|
|
fprintf(logfile, "Trying to read invalid spr %d %03x at "
|
|
|
|
ADDRX "\n", sprn, sprn, ctx->nip);
|
2005-11-24 00:36:30 +03:00
|
|
|
}
|
2007-11-04 04:57:29 +03:00
|
|
|
printf("Trying to read invalid spr %d %03x at " ADDRX "\n",
|
|
|
|
sprn, sprn, ctx->nip);
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
GEN_HANDLER(mfspr, 0x1F, 0x13, 0x0A, 0x00000001, PPC_MISC)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2005-07-03 00:59:34 +04:00
|
|
|
gen_op_mfspr(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2005-07-03 00:59:34 +04:00
|
|
|
|
|
|
|
/* mftb */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(mftb, 0x1F, 0x13, 0x0B, 0x00000001, PPC_MFTB)
|
2005-07-03 00:59:34 +04:00
|
|
|
{
|
|
|
|
gen_op_mfspr(ctx);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtcrf */
|
2005-06-05 02:22:27 +04:00
|
|
|
GEN_HANDLER(mtcrf, 0x1F, 0x10, 0x04, 0x00000801, PPC_MISC)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
uint32_t crm, crn;
|
2007-09-17 12:09:54 +04:00
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
crm = CRM(ctx->opcode);
|
|
|
|
if (likely((ctx->opcode & 0x00100000) || (crm ^ (crm - 1)) == 0)) {
|
|
|
|
crn = ffs(crm);
|
|
|
|
gen_op_srli_T0(crn * 4);
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[7 - crn], cpu_T[0], 0xf);
|
2007-03-07 11:32:30 +03:00
|
|
|
} else {
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_store_cr(crm);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtmsr */
|
2007-03-23 12:45:27 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-09-30 17:03:23 +04:00
|
|
|
GEN_HANDLER(mtmsrd, 0x1F, 0x12, 0x05, 0x001EF801, PPC_64B)
|
2007-03-23 12:45:27 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-09-30 17:03:23 +04:00
|
|
|
if (ctx->opcode & 0x00010000) {
|
|
|
|
/* Special form that does not need any synchronisation */
|
|
|
|
gen_op_update_riee();
|
|
|
|
} else {
|
2007-10-01 07:03:51 +04:00
|
|
|
/* XXX: we need to update nip before the store
|
|
|
|
* if we enter power saving mode, we will exit the loop
|
|
|
|
* directly from ppc_store_msr
|
|
|
|
*/
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_store_msr();
|
2007-09-30 17:03:23 +04:00
|
|
|
/* Must stop the translation as machine state (may have) changed */
|
|
|
|
/* Note that mtmsr is not always defined as context-synchronizing */
|
2007-10-01 07:03:51 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_STOP;
|
2007-09-30 17:03:23 +04:00
|
|
|
}
|
2007-03-23 12:45:27 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
GEN_HANDLER(mtmsr, 0x1F, 0x12, 0x04, 0x001FF801, PPC_MISC)
|
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2007-09-30 17:03:23 +04:00
|
|
|
if (ctx->opcode & 0x00010000) {
|
|
|
|
/* Special form that does not need any synchronisation */
|
|
|
|
gen_op_update_riee();
|
|
|
|
} else {
|
2007-10-01 07:03:51 +04:00
|
|
|
/* XXX: we need to update nip before the store
|
|
|
|
* if we enter power saving mode, we will exit the loop
|
|
|
|
* directly from ppc_store_msr
|
|
|
|
*/
|
2007-09-30 17:03:23 +04:00
|
|
|
gen_update_nip(ctx, ctx->nip);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
2007-09-30 17:03:23 +04:00
|
|
|
if (!ctx->sf_mode)
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_store_msr_32();
|
2007-09-30 17:03:23 +04:00
|
|
|
else
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2008-08-25 03:16:35 +04:00
|
|
|
gen_op_store_msr();
|
2007-09-30 17:03:23 +04:00
|
|
|
/* Must stop the translation as machine state (may have) changed */
|
|
|
|
/* Note that mtmsrd is not always defined as context-synchronizing */
|
2007-10-01 07:03:51 +04:00
|
|
|
ctx->exception = POWERPC_EXCP_STOP;
|
2007-09-30 17:03:23 +04:00
|
|
|
}
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtspr */
|
|
|
|
GEN_HANDLER(mtspr, 0x1F, 0x13, 0x0E, 0x00000001, PPC_MISC)
|
|
|
|
{
|
2005-07-03 00:59:34 +04:00
|
|
|
void (*write_cb)(void *opaque, int sprn);
|
2003-11-23 17:55:54 +03:00
|
|
|
uint32_t sprn = SPR(ctx->opcode);
|
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-09-30 17:03:23 +04:00
|
|
|
if (ctx->supervisor == 2)
|
|
|
|
write_cb = ctx->spr_cb[sprn].hea_write;
|
2007-11-16 17:11:28 +03:00
|
|
|
else if (ctx->supervisor)
|
2005-07-03 00:59:34 +04:00
|
|
|
write_cb = ctx->spr_cb[sprn].oea_write;
|
|
|
|
else
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2005-07-03 00:59:34 +04:00
|
|
|
write_cb = ctx->spr_cb[sprn].uea_write;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (likely(write_cb != NULL)) {
|
|
|
|
if (likely(write_cb != SPR_NOACCESS)) {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2005-07-03 00:59:34 +04:00
|
|
|
(*write_cb)(ctx, sprn);
|
|
|
|
} else {
|
|
|
|
/* Privilege exception */
|
2007-04-19 12:42:21 +04:00
|
|
|
if (loglevel != 0) {
|
2007-11-04 04:57:29 +03:00
|
|
|
fprintf(logfile, "Trying to write privileged spr %d %03x at "
|
|
|
|
ADDRX "\n", sprn, sprn, ctx->nip);
|
2005-11-24 00:36:30 +03:00
|
|
|
}
|
2007-11-04 04:57:29 +03:00
|
|
|
printf("Trying to write privileged spr %d %03x at " ADDRX "\n",
|
|
|
|
sprn, sprn, ctx->nip);
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2005-07-03 00:59:34 +04:00
|
|
|
} else {
|
|
|
|
/* Not defined */
|
2007-04-19 12:42:21 +04:00
|
|
|
if (loglevel != 0) {
|
2007-11-04 04:57:29 +03:00
|
|
|
fprintf(logfile, "Trying to write invalid spr %d %03x at "
|
|
|
|
ADDRX "\n", sprn, sprn, ctx->nip);
|
2005-11-24 00:36:30 +03:00
|
|
|
}
|
2007-11-04 04:57:29 +03:00
|
|
|
printf("Trying to write invalid spr %d %03x at " ADDRX "\n",
|
|
|
|
sprn, sprn, ctx->nip);
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP(ctx, POWERPC_EXCP_PROGRAM,
|
|
|
|
POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_SPR);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** Cache management ***/
|
|
|
|
/* dcbf */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(dcbf, 0x1F, 0x16, 0x02, 0x03C00001, PPC_CACHE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-10-26 04:48:00 +04:00
|
|
|
/* XXX: specification says this is treated as a load by the MMU */
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2004-04-13 00:39:29 +04:00
|
|
|
op_ldst(lbz);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dcbi (Supervisor only) */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(dcbi, 0x1F, 0x16, 0x0E, 0x03E00001, PPC_CACHE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-04-13 00:39:29 +04:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-04-13 00:39:29 +04:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
/* XXX: specification says this should be treated as a store by the MMU */
|
2007-10-26 04:48:00 +04:00
|
|
|
op_ldst(lbz);
|
2004-04-13 00:39:29 +04:00
|
|
|
op_ldst(stb);
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dcdst */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(dcbst, 0x1F, 0x16, 0x01, 0x03E00001, PPC_CACHE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
/* XXX: specification say this is treated as a load by the MMU */
|
|
|
|
gen_addr_reg_index(ctx);
|
2004-04-13 00:39:29 +04:00
|
|
|
op_ldst(lbz);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dcbt */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(dcbt, 0x1F, 0x16, 0x08, 0x02000001, PPC_CACHE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-09-30 07:46:38 +04:00
|
|
|
/* interpreted as no-op */
|
2007-03-07 11:32:30 +03:00
|
|
|
/* XXX: specification say this is treated as a load by the MMU
|
|
|
|
* but does not generate any exception
|
|
|
|
*/
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dcbtst */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(dcbtst, 0x1F, 0x16, 0x07, 0x02000001, PPC_CACHE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-09-30 07:46:38 +04:00
|
|
|
/* interpreted as no-op */
|
2007-03-07 11:32:30 +03:00
|
|
|
/* XXX: specification say this is treated as a load by the MMU
|
|
|
|
* but does not generate any exception
|
|
|
|
*/
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dcbz */
|
2007-10-04 04:51:58 +04:00
|
|
|
#define op_dcbz(n) (*gen_op_dcbz[n][ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_dcbz[4][NB_MEM_FUNCS] = {
|
|
|
|
/* 32 bytes cache line size */
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_dcbz_l32_le_raw gen_op_dcbz_l32_raw
|
|
|
|
#define gen_op_dcbz_l32_le_user gen_op_dcbz_l32_user
|
|
|
|
#define gen_op_dcbz_l32_le_kernel gen_op_dcbz_l32_kernel
|
|
|
|
#define gen_op_dcbz_l32_le_hypv gen_op_dcbz_l32_hypv
|
|
|
|
#define gen_op_dcbz_l32_le_64_raw gen_op_dcbz_l32_64_raw
|
|
|
|
#define gen_op_dcbz_l32_le_64_user gen_op_dcbz_l32_64_user
|
|
|
|
#define gen_op_dcbz_l32_le_64_kernel gen_op_dcbz_l32_64_kernel
|
|
|
|
#define gen_op_dcbz_l32_le_64_hypv gen_op_dcbz_l32_64_hypv
|
|
|
|
GEN_MEM_FUNCS(dcbz_l32),
|
2007-10-04 04:51:58 +04:00
|
|
|
},
|
2007-11-16 17:11:28 +03:00
|
|
|
/* 64 bytes cache line size */
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_dcbz_l64_le_raw gen_op_dcbz_l64_raw
|
|
|
|
#define gen_op_dcbz_l64_le_user gen_op_dcbz_l64_user
|
|
|
|
#define gen_op_dcbz_l64_le_kernel gen_op_dcbz_l64_kernel
|
|
|
|
#define gen_op_dcbz_l64_le_hypv gen_op_dcbz_l64_hypv
|
|
|
|
#define gen_op_dcbz_l64_le_64_raw gen_op_dcbz_l64_64_raw
|
|
|
|
#define gen_op_dcbz_l64_le_64_user gen_op_dcbz_l64_64_user
|
|
|
|
#define gen_op_dcbz_l64_le_64_kernel gen_op_dcbz_l64_64_kernel
|
|
|
|
#define gen_op_dcbz_l64_le_64_hypv gen_op_dcbz_l64_64_hypv
|
|
|
|
GEN_MEM_FUNCS(dcbz_l64),
|
2007-10-04 04:51:58 +04:00
|
|
|
},
|
2007-11-16 17:11:28 +03:00
|
|
|
/* 128 bytes cache line size */
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_dcbz_l128_le_raw gen_op_dcbz_l128_raw
|
|
|
|
#define gen_op_dcbz_l128_le_user gen_op_dcbz_l128_user
|
|
|
|
#define gen_op_dcbz_l128_le_kernel gen_op_dcbz_l128_kernel
|
|
|
|
#define gen_op_dcbz_l128_le_hypv gen_op_dcbz_l128_hypv
|
|
|
|
#define gen_op_dcbz_l128_le_64_raw gen_op_dcbz_l128_64_raw
|
|
|
|
#define gen_op_dcbz_l128_le_64_user gen_op_dcbz_l128_64_user
|
|
|
|
#define gen_op_dcbz_l128_le_64_kernel gen_op_dcbz_l128_64_kernel
|
|
|
|
#define gen_op_dcbz_l128_le_64_hypv gen_op_dcbz_l128_64_hypv
|
|
|
|
GEN_MEM_FUNCS(dcbz_l128),
|
2007-10-04 04:51:58 +04:00
|
|
|
},
|
2007-11-16 17:11:28 +03:00
|
|
|
/* tunable cache line size */
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_dcbz_le_raw gen_op_dcbz_raw
|
|
|
|
#define gen_op_dcbz_le_user gen_op_dcbz_user
|
|
|
|
#define gen_op_dcbz_le_kernel gen_op_dcbz_kernel
|
|
|
|
#define gen_op_dcbz_le_hypv gen_op_dcbz_hypv
|
|
|
|
#define gen_op_dcbz_le_64_raw gen_op_dcbz_64_raw
|
|
|
|
#define gen_op_dcbz_le_64_user gen_op_dcbz_64_user
|
|
|
|
#define gen_op_dcbz_le_64_kernel gen_op_dcbz_64_kernel
|
|
|
|
#define gen_op_dcbz_le_64_hypv gen_op_dcbz_64_hypv
|
|
|
|
GEN_MEM_FUNCS(dcbz),
|
2007-10-04 04:51:58 +04:00
|
|
|
},
|
2007-03-07 11:32:30 +03:00
|
|
|
};
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void handler_dcbz (DisasContext *ctx,
|
|
|
|
int dcache_line_size)
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
switch (dcache_line_size) {
|
|
|
|
case 32:
|
|
|
|
n = 0;
|
|
|
|
break;
|
|
|
|
case 64:
|
|
|
|
n = 1;
|
|
|
|
break;
|
|
|
|
case 128:
|
|
|
|
n = 2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
n = 3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
op_dcbz(n);
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(dcbz, 0x1F, 0x16, 0x1F, 0x03E00001, PPC_CACHE_DCBZ)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2007-10-04 04:51:58 +04:00
|
|
|
handler_dcbz(ctx, ctx->dcache_line_size);
|
|
|
|
gen_op_check_reservation();
|
|
|
|
}
|
|
|
|
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(dcbz_970, "dcbz", 0x1F, 0x16, 0x1F, 0x03C00001, PPC_CACHE_DCBZT)
|
2007-10-04 04:51:58 +04:00
|
|
|
{
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
if (ctx->opcode & 0x00200000)
|
|
|
|
handler_dcbz(ctx, ctx->dcache_line_size);
|
|
|
|
else
|
|
|
|
handler_dcbz(ctx, -1);
|
2004-05-24 02:18:12 +04:00
|
|
|
gen_op_check_reservation();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* icbi */
|
2007-03-18 11:47:10 +03:00
|
|
|
#define op_icbi() (*gen_op_icbi[ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_icbi_le_raw gen_op_icbi_raw
|
|
|
|
#define gen_op_icbi_le_user gen_op_icbi_user
|
|
|
|
#define gen_op_icbi_le_kernel gen_op_icbi_kernel
|
|
|
|
#define gen_op_icbi_le_hypv gen_op_icbi_hypv
|
|
|
|
#define gen_op_icbi_le_64_raw gen_op_icbi_64_raw
|
|
|
|
#define gen_op_icbi_le_64_user gen_op_icbi_64_user
|
|
|
|
#define gen_op_icbi_le_64_kernel gen_op_icbi_64_kernel
|
|
|
|
#define gen_op_icbi_le_64_hypv gen_op_icbi_64_hypv
|
|
|
|
static GenOpFunc *gen_op_icbi[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(icbi),
|
2007-03-18 11:47:10 +03:00
|
|
|
};
|
2007-09-29 17:06:16 +04:00
|
|
|
|
2007-11-14 04:08:45 +03:00
|
|
|
GEN_HANDLER(icbi, 0x1F, 0x16, 0x1E, 0x03E00001, PPC_CACHE_ICBI)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-10-01 09:22:17 +04:00
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2007-03-18 11:47:10 +03:00
|
|
|
op_icbi();
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Optional: */
|
|
|
|
/* dcba */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(dcba, 0x1F, 0x16, 0x17, 0x03E00001, PPC_CACHE_DCBA)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-09-30 07:46:38 +04:00
|
|
|
/* interpreted as no-op */
|
|
|
|
/* XXX: specification say this is treated as a store by the MMU
|
|
|
|
* but does not generate any exception
|
|
|
|
*/
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** Segment register manipulation ***/
|
|
|
|
/* Supervisor only: */
|
|
|
|
/* mfsr */
|
|
|
|
GEN_HANDLER(mfsr, 0x1F, 0x13, 0x12, 0x0010F801, PPC_SEGMENT)
|
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SR(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_load_sr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mfsrin */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(mfsrin, 0x1F, 0x13, 0x14, 0x001F0001, PPC_SEGMENT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_srli_T1(28);
|
|
|
|
gen_op_load_sr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtsr */
|
2004-05-18 01:05:06 +04:00
|
|
|
GEN_HANDLER(mtsr, 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SR(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_store_sr();
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mtsrin */
|
2004-01-05 01:58:38 +03:00
|
|
|
GEN_HANDLER(mtsrin, 0x1F, 0x12, 0x07, 0x001F0001, PPC_SEGMENT)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_srli_T1(28);
|
|
|
|
gen_op_store_sr();
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-10-06 02:06:02 +04:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* Specific implementation for PowerPC 64 "bridge" emulation using SLB */
|
|
|
|
/* mfsr */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(mfsr_64b, "mfsr", 0x1F, 0x13, 0x12, 0x0010F801, PPC_SEGMENT_64B)
|
2007-10-06 02:06:02 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SR(ctx->opcode));
|
2007-10-06 02:06:02 +04:00
|
|
|
gen_op_load_slb();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-10-06 02:06:02 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mfsrin */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(mfsrin_64b, "mfsrin", 0x1F, 0x13, 0x14, 0x001F0001,
|
|
|
|
PPC_SEGMENT_64B)
|
2007-10-06 02:06:02 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-10-06 02:06:02 +04:00
|
|
|
gen_op_srli_T1(28);
|
|
|
|
gen_op_load_slb();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-10-06 02:06:02 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mtsr */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(mtsr_64b, "mtsr", 0x1F, 0x12, 0x06, 0x0010F801, PPC_SEGMENT_64B)
|
2007-10-06 02:06:02 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SR(ctx->opcode));
|
2007-10-06 02:06:02 +04:00
|
|
|
gen_op_store_slb();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mtsrin */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(mtsrin_64b, "mtsrin", 0x1F, 0x12, 0x07, 0x001F0001,
|
|
|
|
PPC_SEGMENT_64B)
|
2007-10-06 02:06:02 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-10-06 02:06:02 +04:00
|
|
|
gen_op_srli_T1(28);
|
|
|
|
gen_op_store_slb();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif /* defined(TARGET_PPC64) */
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** Lookaside buffer management ***/
|
|
|
|
/* Optional & supervisor only: */
|
|
|
|
/* tlbia */
|
2005-07-03 00:59:34 +04:00
|
|
|
GEN_HANDLER(tlbia, 0x1F, 0x12, 0x0B, 0x03FFFC01, PPC_MEM_TLBIA)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
gen_op_tlbia();
|
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbie */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(tlbie, 0x1F, 0x12, 0x09, 0x03FF0001, PPC_MEM_TLBIE)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_tlbie_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_tlbie();
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbsync */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(tlbsync, 0x1F, 0x16, 0x11, 0x03FFF801, PPC_MEM_TLBSYNC)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#else
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2004-05-21 16:59:32 +04:00
|
|
|
return;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
/* This has no effect: it should ensure that all previous
|
|
|
|
* tlbie have completed
|
|
|
|
*/
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_STOP(ctx);
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-23 12:45:27 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* slbia */
|
|
|
|
GEN_HANDLER(slbia, 0x1F, 0x12, 0x0F, 0x03FFFC01, PPC_SLBI)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_op_slbia();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* slbie */
|
|
|
|
GEN_HANDLER(slbie, 0x1F, 0x12, 0x0D, 0x03FF0001, PPC_SLBI)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-23 12:45:27 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-23 12:45:27 +03:00
|
|
|
gen_op_slbie();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/*** External control ***/
|
|
|
|
/* Optional: */
|
2004-01-05 01:58:38 +03:00
|
|
|
#define op_eciwx() (*gen_op_eciwx[ctx->mem_idx])()
|
|
|
|
#define op_ecowx() (*gen_op_ecowx[ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_eciwx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(eciwx),
|
2005-04-23 22:16:07 +04:00
|
|
|
};
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_ecowx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(ecowx),
|
2005-04-23 22:16:07 +04:00
|
|
|
};
|
2004-01-05 01:58:38 +03:00
|
|
|
|
2005-04-23 22:16:07 +04:00
|
|
|
/* eciwx */
|
2003-11-23 17:55:54 +03:00
|
|
|
GEN_HANDLER(eciwx, 0x1F, 0x16, 0x0D, 0x00000001, PPC_EXTERN)
|
|
|
|
{
|
2004-01-05 01:58:38 +03:00
|
|
|
/* Should check EAR[E] & alignment ! */
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
op_eciwx();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ecowx */
|
|
|
|
GEN_HANDLER(ecowx, 0x1F, 0x16, 0x09, 0x00000001, PPC_EXTERN)
|
|
|
|
{
|
|
|
|
/* Should check EAR[E] & alignment ! */
|
|
|
|
gen_addr_reg_index(ctx);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_ecowx();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PowerPC 601 specific instructions */
|
|
|
|
/* abs - abs. */
|
|
|
|
GEN_HANDLER(abs, 0x1F, 0x08, 0x0B, 0x0000F800, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_abs();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* abso - abso. */
|
|
|
|
GEN_HANDLER(abso, 0x1F, 0x08, 0x1B, 0x0000F800, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_abso();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* clcs */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(clcs, 0x1F, 0x10, 0x13, 0x0000F800, PPC_POWER_BR)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_clcs();
|
2007-10-26 04:46:07 +04:00
|
|
|
/* Rc=1 sets CR0 to an undefined state */
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* div - div. */
|
|
|
|
GEN_HANDLER(div, 0x1F, 0x0B, 0x0A, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_div();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* divo - divo. */
|
|
|
|
GEN_HANDLER(divo, 0x1F, 0x0B, 0x1A, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_divo();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* divs - divs. */
|
|
|
|
GEN_HANDLER(divs, 0x1F, 0x0B, 0x0B, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_divs();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* divso - divso. */
|
|
|
|
GEN_HANDLER(divso, 0x1F, 0x0B, 0x1B, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_divso();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* doz - doz. */
|
|
|
|
GEN_HANDLER(doz, 0x1F, 0x08, 0x08, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_doz();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dozo - dozo. */
|
|
|
|
GEN_HANDLER(dozo, 0x1F, 0x08, 0x18, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_dozo();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dozi */
|
|
|
|
GEN_HANDLER(dozi, 0x09, 0xFF, 0xFF, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SIMM(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_doz();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
2007-11-16 17:11:28 +03:00
|
|
|
/* As lscbx load from memory byte after byte, it's always endian safe.
|
|
|
|
* Original POWER is 32 bits only, define 64 bits ops as 32 bits ones
|
|
|
|
*/
|
2007-10-02 14:11:50 +04:00
|
|
|
#define op_POWER_lscbx(start, ra, rb) \
|
2007-03-07 11:32:30 +03:00
|
|
|
(*gen_op_POWER_lscbx[ctx->mem_idx])(start, ra, rb)
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_POWER_lscbx_64_raw gen_op_POWER_lscbx_raw
|
|
|
|
#define gen_op_POWER_lscbx_64_user gen_op_POWER_lscbx_user
|
|
|
|
#define gen_op_POWER_lscbx_64_kernel gen_op_POWER_lscbx_kernel
|
|
|
|
#define gen_op_POWER_lscbx_64_hypv gen_op_POWER_lscbx_hypv
|
|
|
|
#define gen_op_POWER_lscbx_le_raw gen_op_POWER_lscbx_raw
|
|
|
|
#define gen_op_POWER_lscbx_le_user gen_op_POWER_lscbx_user
|
|
|
|
#define gen_op_POWER_lscbx_le_kernel gen_op_POWER_lscbx_kernel
|
|
|
|
#define gen_op_POWER_lscbx_le_hypv gen_op_POWER_lscbx_hypv
|
|
|
|
#define gen_op_POWER_lscbx_le_64_raw gen_op_POWER_lscbx_raw
|
|
|
|
#define gen_op_POWER_lscbx_le_64_user gen_op_POWER_lscbx_user
|
|
|
|
#define gen_op_POWER_lscbx_le_64_kernel gen_op_POWER_lscbx_kernel
|
|
|
|
#define gen_op_POWER_lscbx_le_64_hypv gen_op_POWER_lscbx_hypv
|
|
|
|
static GenOpFunc3 *gen_op_POWER_lscbx[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(POWER_lscbx),
|
2007-03-07 11:32:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* lscbx - lscbx. */
|
|
|
|
GEN_HANDLER(lscbx, 0x1F, 0x15, 0x08, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
int rb = rB(ctx->opcode);
|
|
|
|
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
if (ra == 0) {
|
|
|
|
ra = rb;
|
|
|
|
}
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_load_xer_bc();
|
|
|
|
gen_op_load_xer_cmp();
|
|
|
|
op_POWER_lscbx(rD(ctx->opcode), ra, rb);
|
|
|
|
gen_op_store_xer_bc();
|
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* maskg - maskg. */
|
|
|
|
GEN_HANDLER(maskg, 0x1F, 0x1D, 0x00, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_maskg();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* maskir - maskir. */
|
|
|
|
GEN_HANDLER(maskir, 0x1F, 0x1D, 0x10, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_maskir();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mul - mul. */
|
|
|
|
GEN_HANDLER(mul, 0x1F, 0x0B, 0x03, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_mul();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mulo - mulo. */
|
|
|
|
GEN_HANDLER(mulo, 0x1F, 0x0B, 0x13, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_mulo();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nabs - nabs. */
|
|
|
|
GEN_HANDLER(nabs, 0x1F, 0x08, 0x0F, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_nabs();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nabso - nabso. */
|
|
|
|
GEN_HANDLER(nabso, 0x1F, 0x08, 0x1F, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_nabso();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rlmi - rlmi. */
|
|
|
|
GEN_HANDLER(rlmi, 0x16, 0xFF, 0xFF, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
|
|
|
uint32_t mb, me;
|
|
|
|
|
|
|
|
mb = MB(ctx->opcode);
|
|
|
|
me = ME(ctx->opcode);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_rlmi(MASK(mb, me), ~MASK(mb, me));
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rrib - rrib. */
|
|
|
|
GEN_HANDLER(rrib, 0x1F, 0x19, 0x10, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_rrib();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sle - sle. */
|
|
|
|
GEN_HANDLER(sle, 0x1F, 0x19, 0x04, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sle();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sleq - sleq. */
|
|
|
|
GEN_HANDLER(sleq, 0x1F, 0x19, 0x06, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sleq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sliq - sliq. */
|
|
|
|
GEN_HANDLER(sliq, 0x1F, 0x18, 0x05, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SH(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sle();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* slliq - slliq. */
|
|
|
|
GEN_HANDLER(slliq, 0x1F, 0x18, 0x07, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SH(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sleq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sllq - sllq. */
|
|
|
|
GEN_HANDLER(sllq, 0x1F, 0x18, 0x06, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sllq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* slq - slq. */
|
|
|
|
GEN_HANDLER(slq, 0x1F, 0x18, 0x04, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_slq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* sraiq - sraiq. */
|
2007-03-07 11:32:30 +03:00
|
|
|
GEN_HANDLER(sraiq, 0x1F, 0x18, 0x1D, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SH(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sraq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sraq - sraq. */
|
|
|
|
GEN_HANDLER(sraq, 0x1F, 0x18, 0x1C, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sraq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sre - sre. */
|
|
|
|
GEN_HANDLER(sre, 0x1F, 0x19, 0x14, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sre();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* srea - srea. */
|
|
|
|
GEN_HANDLER(srea, 0x1F, 0x19, 0x1C, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_srea();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sreq */
|
|
|
|
GEN_HANDLER(sreq, 0x1F, 0x19, 0x16, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_sreq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* sriq */
|
|
|
|
GEN_HANDLER(sriq, 0x1F, 0x18, 0x15, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SH(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_srq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* srliq */
|
|
|
|
GEN_HANDLER(srliq, 0x1F, 0x18, 0x17, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[1], SH(ctx->opcode));
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_srlq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* srlq */
|
|
|
|
GEN_HANDLER(srlq, 0x1F, 0x18, 0x16, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_srlq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* srq */
|
|
|
|
GEN_HANDLER(srq, 0x1F, 0x18, 0x14, 0x00000000, PPC_POWER_BR)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_POWER_srq();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc(ctx->opcode) != 0))
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PowerPC 602 specific instructions */
|
|
|
|
/* dsa */
|
|
|
|
GEN_HANDLER(dsa, 0x1F, 0x14, 0x13, 0x03FFF801, PPC_602_SPEC)
|
|
|
|
{
|
|
|
|
/* XXX: TODO */
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* esa */
|
|
|
|
GEN_HANDLER(esa, 0x1F, 0x14, 0x12, 0x03FFF801, PPC_602_SPEC)
|
|
|
|
{
|
|
|
|
/* XXX: TODO */
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* mfrom */
|
|
|
|
GEN_HANDLER(mfrom, 0x1F, 0x09, 0x08, 0x03E0F801, PPC_602_SPEC)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_602_mfrom();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 602 - 603 - G2 TLB management */
|
|
|
|
/* tlbld */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbld_6xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_6xx_TLB)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_6xx_tlbld();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbli */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbli_6xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_6xx_TLB)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_6xx_tlbli();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-10-01 09:16:57 +04:00
|
|
|
/* 74xx TLB management */
|
|
|
|
/* tlbld */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbld_74xx, "tlbld", 0x1F, 0x12, 0x1E, 0x03FF0001, PPC_74xx_TLB)
|
2007-10-01 09:16:57 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-10-01 09:16:57 +04:00
|
|
|
gen_op_74xx_tlbld();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbli */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbli_74xx, "tlbli", 0x1F, 0x12, 0x1F, 0x03FF0001, PPC_74xx_TLB)
|
2007-10-01 09:16:57 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rB(ctx->opcode)]);
|
2007-10-01 09:16:57 +04:00
|
|
|
gen_op_74xx_tlbli();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* POWER instructions not in PowerPC 601 */
|
|
|
|
/* clf */
|
|
|
|
GEN_HANDLER(clf, 0x1F, 0x16, 0x03, 0x03E00000, PPC_POWER)
|
|
|
|
{
|
|
|
|
/* Cache line flush: implemented as no-op */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* cli */
|
|
|
|
GEN_HANDLER(cli, 0x1F, 0x16, 0x0F, 0x03E00000, PPC_POWER)
|
|
|
|
{
|
2007-05-27 23:39:27 +04:00
|
|
|
/* Cache line invalidate: privileged and treated as no-op */
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dclst */
|
|
|
|
GEN_HANDLER(dclst, 0x1F, 0x16, 0x13, 0x03E00000, PPC_POWER)
|
|
|
|
{
|
|
|
|
/* Data cache line store: treated as no-op */
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(mfsri, 0x1F, 0x13, 0x13, 0x00000001, PPC_POWER)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
int rd = rD(ctx->opcode);
|
|
|
|
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
gen_op_POWER_mfsri();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rd], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (ra != 0 && ra != rd)
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(rac, 0x1F, 0x12, 0x19, 0x00000001, PPC_POWER)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
gen_op_POWER_rac();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(rfsvc, 0x13, 0x12, 0x02, 0x03FFF0001, PPC_POWER)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_op_POWER_rfsvc();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* svc is not implemented for now */
|
|
|
|
|
|
|
|
/* POWER2 specific instructions */
|
|
|
|
/* Quad manipulation (load/store two floats at a time) */
|
2007-11-16 17:11:28 +03:00
|
|
|
/* Original POWER2 is 32 bits only, define 64 bits ops as 32 bits ones */
|
2007-03-07 11:32:30 +03:00
|
|
|
#define op_POWER2_lfq() (*gen_op_POWER2_lfq[ctx->mem_idx])()
|
|
|
|
#define op_POWER2_stfq() (*gen_op_POWER2_stfq[ctx->mem_idx])()
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_POWER2_lfq_64_raw gen_op_POWER2_lfq_raw
|
|
|
|
#define gen_op_POWER2_lfq_64_user gen_op_POWER2_lfq_user
|
|
|
|
#define gen_op_POWER2_lfq_64_kernel gen_op_POWER2_lfq_kernel
|
|
|
|
#define gen_op_POWER2_lfq_64_hypv gen_op_POWER2_lfq_hypv
|
|
|
|
#define gen_op_POWER2_lfq_le_64_raw gen_op_POWER2_lfq_le_raw
|
|
|
|
#define gen_op_POWER2_lfq_le_64_user gen_op_POWER2_lfq_le_user
|
|
|
|
#define gen_op_POWER2_lfq_le_64_kernel gen_op_POWER2_lfq_le_kernel
|
|
|
|
#define gen_op_POWER2_lfq_le_64_hypv gen_op_POWER2_lfq_le_hypv
|
|
|
|
#define gen_op_POWER2_stfq_64_raw gen_op_POWER2_stfq_raw
|
|
|
|
#define gen_op_POWER2_stfq_64_user gen_op_POWER2_stfq_user
|
|
|
|
#define gen_op_POWER2_stfq_64_kernel gen_op_POWER2_stfq_kernel
|
|
|
|
#define gen_op_POWER2_stfq_64_hypv gen_op_POWER2_stfq_hypv
|
|
|
|
#define gen_op_POWER2_stfq_le_64_raw gen_op_POWER2_stfq_le_raw
|
|
|
|
#define gen_op_POWER2_stfq_le_64_user gen_op_POWER2_stfq_le_user
|
|
|
|
#define gen_op_POWER2_stfq_le_64_kernel gen_op_POWER2_stfq_le_kernel
|
|
|
|
#define gen_op_POWER2_stfq_le_64_hypv gen_op_POWER2_stfq_le_hypv
|
|
|
|
static GenOpFunc *gen_op_POWER2_lfq[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(POWER2_lfq),
|
2007-03-07 11:32:30 +03:00
|
|
|
};
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_POWER2_stfq[NB_MEM_FUNCS] = {
|
|
|
|
GEN_MEM_FUNCS(POWER2_stfq),
|
2007-03-07 11:32:30 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* lfq */
|
|
|
|
GEN_HANDLER(lfq, 0x38, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
|
|
|
|
{
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_lfq();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* lfqu */
|
|
|
|
GEN_HANDLER(lfqu, 0x39, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
|
|
|
|
{
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_lfq();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (ra != 0)
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* lfqux */
|
|
|
|
GEN_HANDLER(lfqux, 0x1F, 0x17, 0x19, 0x00000001, PPC_POWER2)
|
|
|
|
{
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
op_POWER2_lfq();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (ra != 0)
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* lfqx */
|
|
|
|
GEN_HANDLER(lfqx, 0x1F, 0x17, 0x18, 0x00000001, PPC_POWER2)
|
|
|
|
{
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
op_POWER2_lfq();
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode)], cpu_FT[0]);
|
|
|
|
tcg_gen_mov_i64(cpu_fpr[rD(ctx->opcode) + 1], cpu_FT[1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stfq */
|
|
|
|
GEN_HANDLER(stfq, 0x3C, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
|
|
|
|
{
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_stfq();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* stfqu */
|
|
|
|
GEN_HANDLER(stfqu, 0x3D, 0xFF, 0xFF, 0x00000003, PPC_POWER2)
|
|
|
|
{
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-04-06 11:59:47 +04:00
|
|
|
gen_addr_imm_index(ctx, 0);
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_stfq();
|
|
|
|
if (ra != 0)
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stfqux */
|
|
|
|
GEN_HANDLER(stfqux, 0x1F, 0x17, 0x1D, 0x00000001, PPC_POWER2)
|
|
|
|
{
|
|
|
|
int ra = rA(ctx->opcode);
|
|
|
|
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_stfq();
|
|
|
|
if (ra != 0)
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[ra], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* stfqx */
|
|
|
|
GEN_HANDLER(stfqx, 0x1F, 0x17, 0x1C, 0x00000001, PPC_POWER2)
|
|
|
|
{
|
|
|
|
/* NIP cannot be restored if the memory exception comes from an helper */
|
2007-03-17 17:02:15 +03:00
|
|
|
gen_update_nip(ctx, ctx->nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_addr_reg_index(ctx);
|
2008-09-04 18:43:54 +04:00
|
|
|
tcg_gen_mov_i64(cpu_FT[0], cpu_fpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rS(ctx->opcode) + 1]);
|
2007-03-07 11:32:30 +03:00
|
|
|
op_POWER2_stfq();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* BookE specific instructions */
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(mfapidi, 0x1F, 0x13, 0x08, 0x0000F801, PPC_MFAPIDI)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
/* XXX: TODO */
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(tlbiva, 0x1F, 0x12, 0x18, 0x03FFF801, PPC_TLBIVA)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
/* Use the same micro-ops as for tlbie */
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
if (ctx->sf_mode)
|
|
|
|
gen_op_tlbie_64();
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
gen_op_tlbie();
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* All 405 MAC instructions are translated here */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_405_mulladd_insn (DisasContext *ctx,
|
|
|
|
int opc2, int opc3,
|
|
|
|
int ra, int rb, int rt, int Rc)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[ra]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rb]);
|
2007-03-07 11:32:30 +03:00
|
|
|
switch (opc3 & 0x0D) {
|
|
|
|
case 0x05:
|
|
|
|
/* macchw - macchw. - macchwo - macchwo. */
|
|
|
|
/* macchws - macchws. - macchwso - macchwso. */
|
|
|
|
/* nmacchw - nmacchw. - nmacchwo - nmacchwo. */
|
|
|
|
/* nmacchws - nmacchws. - nmacchwso - nmacchwso. */
|
|
|
|
/* mulchw - mulchw. */
|
|
|
|
gen_op_405_mulchw();
|
|
|
|
break;
|
|
|
|
case 0x04:
|
|
|
|
/* macchwu - macchwu. - macchwuo - macchwuo. */
|
|
|
|
/* macchwsu - macchwsu. - macchwsuo - macchwsuo. */
|
|
|
|
/* mulchwu - mulchwu. */
|
|
|
|
gen_op_405_mulchwu();
|
|
|
|
break;
|
|
|
|
case 0x01:
|
|
|
|
/* machhw - machhw. - machhwo - machhwo. */
|
|
|
|
/* machhws - machhws. - machhwso - machhwso. */
|
|
|
|
/* nmachhw - nmachhw. - nmachhwo - nmachhwo. */
|
|
|
|
/* nmachhws - nmachhws. - nmachhwso - nmachhwso. */
|
|
|
|
/* mulhhw - mulhhw. */
|
|
|
|
gen_op_405_mulhhw();
|
|
|
|
break;
|
|
|
|
case 0x00:
|
|
|
|
/* machhwu - machhwu. - machhwuo - machhwuo. */
|
|
|
|
/* machhwsu - machhwsu. - machhwsuo - machhwsuo. */
|
|
|
|
/* mulhhwu - mulhhwu. */
|
|
|
|
gen_op_405_mulhhwu();
|
|
|
|
break;
|
|
|
|
case 0x0D:
|
|
|
|
/* maclhw - maclhw. - maclhwo - maclhwo. */
|
|
|
|
/* maclhws - maclhws. - maclhwso - maclhwso. */
|
|
|
|
/* nmaclhw - nmaclhw. - nmaclhwo - nmaclhwo. */
|
|
|
|
/* nmaclhws - nmaclhws. - nmaclhwso - nmaclhwso. */
|
|
|
|
/* mullhw - mullhw. */
|
|
|
|
gen_op_405_mullhw();
|
|
|
|
break;
|
|
|
|
case 0x0C:
|
|
|
|
/* maclhwu - maclhwu. - maclhwuo - maclhwuo. */
|
|
|
|
/* maclhwsu - maclhwsu. - maclhwsuo - maclhwsuo. */
|
|
|
|
/* mullhwu - mullhwu. */
|
|
|
|
gen_op_405_mullhwu();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (opc2 & 0x02) {
|
|
|
|
/* nmultiply-and-accumulate (0x0E) */
|
|
|
|
gen_op_neg();
|
|
|
|
}
|
|
|
|
if (opc2 & 0x04) {
|
|
|
|
/* (n)multiply-and-accumulate (0x0C - 0x0E) */
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rt]);
|
2008-09-02 20:19:05 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_405_add_T0_T2();
|
|
|
|
}
|
|
|
|
if (opc3 & 0x10) {
|
|
|
|
/* Check overflow */
|
|
|
|
if (opc3 & 0x01)
|
2007-11-11 03:18:34 +03:00
|
|
|
gen_op_check_addo();
|
2007-03-07 11:32:30 +03:00
|
|
|
else
|
|
|
|
gen_op_405_check_ovu();
|
|
|
|
}
|
|
|
|
if (opc3 & 0x02) {
|
|
|
|
/* Saturate */
|
|
|
|
if (opc3 & 0x01)
|
|
|
|
gen_op_405_check_sat();
|
|
|
|
else
|
|
|
|
gen_op_405_check_satu();
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rt], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(Rc) != 0) {
|
|
|
|
/* Update Rc0 */
|
|
|
|
gen_set_Rc0(ctx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
#define GEN_MAC_HANDLER(name, opc2, opc3) \
|
|
|
|
GEN_HANDLER(name, 0x04, opc2, opc3, 0x00000000, PPC_405_MAC) \
|
2007-03-07 11:32:30 +03:00
|
|
|
{ \
|
|
|
|
gen_405_mulladd_insn(ctx, opc2, opc3, rA(ctx->opcode), rB(ctx->opcode), \
|
|
|
|
rD(ctx->opcode), Rc(ctx->opcode)); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* macchw - macchw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchw, 0x0C, 0x05);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwo - macchwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwo, 0x0C, 0x15);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchws - macchws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchws, 0x0C, 0x07);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwso - macchwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwso, 0x0C, 0x17);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwsu - macchwsu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwsu, 0x0C, 0x06);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwsuo - macchwsuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwsuo, 0x0C, 0x16);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwu - macchwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwu, 0x0C, 0x04);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* macchwuo - macchwuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(macchwuo, 0x0C, 0x14);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhw - machhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhw, 0x0C, 0x01);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwo - machhwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwo, 0x0C, 0x11);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhws - machhws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhws, 0x0C, 0x03);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwso - machhwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwso, 0x0C, 0x13);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwsu - machhwsu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwsu, 0x0C, 0x02);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwsuo - machhwsuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwsuo, 0x0C, 0x12);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwu - machhwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwu, 0x0C, 0x00);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* machhwuo - machhwuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(machhwuo, 0x0C, 0x10);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhw - maclhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhw, 0x0C, 0x0D);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwo - maclhwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwo, 0x0C, 0x1D);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhws - maclhws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhws, 0x0C, 0x0F);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwso - maclhwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwso, 0x0C, 0x1F);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwu - maclhwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwu, 0x0C, 0x0C);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwuo - maclhwuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwuo, 0x0C, 0x1C);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwsu - maclhwsu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwsu, 0x0C, 0x0E);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* maclhwsuo - maclhwsuo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(maclhwsuo, 0x0C, 0x1E);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmacchw - nmacchw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmacchw, 0x0E, 0x05);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmacchwo - nmacchwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmacchwo, 0x0E, 0x15);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmacchws - nmacchws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmacchws, 0x0E, 0x07);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmacchwso - nmacchwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmacchwso, 0x0E, 0x17);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmachhw - nmachhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmachhw, 0x0E, 0x01);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmachhwo - nmachhwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmachhwo, 0x0E, 0x11);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmachhws - nmachhws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmachhws, 0x0E, 0x03);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmachhwso - nmachhwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmachhwso, 0x0E, 0x13);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmaclhw - nmaclhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmaclhw, 0x0E, 0x0D);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmaclhwo - nmaclhwo. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmaclhwo, 0x0E, 0x1D);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmaclhws - nmaclhws. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmaclhws, 0x0E, 0x0F);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* nmaclhwso - nmaclhwso. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(nmaclhwso, 0x0E, 0x1F);
|
2007-03-07 11:32:30 +03:00
|
|
|
|
|
|
|
/* mulchw - mulchw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mulchw, 0x08, 0x05);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* mulchwu - mulchwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mulchwu, 0x08, 0x04);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* mulhhw - mulhhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mulhhw, 0x08, 0x01);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* mulhhwu - mulhhwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mulhhwu, 0x08, 0x00);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* mullhw - mullhw. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mullhw, 0x08, 0x0D);
|
2007-03-07 11:32:30 +03:00
|
|
|
/* mullhwu - mullhwu. */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_MAC_HANDLER(mullhwu, 0x08, 0x0C);
|
2007-03-07 11:32:30 +03:00
|
|
|
|
|
|
|
/* mfdcr */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(mfdcr, 0x1F, 0x03, 0x0A, 0x00000001, PPC_DCR)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
uint32_t dcrn = SPR(ctx->opcode);
|
|
|
|
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], dcrn);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_load_dcr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mtdcr */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(mtdcr, 0x1F, 0x03, 0x0E, 0x00000001, PPC_DCR)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
uint32_t dcrn = SPR(ctx->opcode);
|
|
|
|
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], dcrn);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_store_dcr();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mfdcrx */
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(mfdcrx, 0x1F, 0x03, 0x08, 0x00000000, PPC_DCRX)
|
2007-03-30 14:22:46 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_load_dcr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* Note: Rc update flag set leads to undefined state of Rc0 */
|
2007-03-30 14:22:46 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mtdcrx */
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(mtdcrx, 0x1F, 0x03, 0x0C, 0x00000000, PPC_DCRX)
|
2007-03-30 14:22:46 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVREG(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_store_dcr();
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* Note: Rc update flag set leads to undefined state of Rc0 */
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* mfdcrux (PPC 460) : user-mode access to DCR */
|
|
|
|
GEN_HANDLER(mfdcrux, 0x1F, 0x03, 0x09, 0x00000000, PPC_DCRUX)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
gen_op_load_dcr();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
/* Note: Rc update flag set leads to undefined state of Rc0 */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mtdcrux (PPC 460) : user-mode access to DCR */
|
|
|
|
GEN_HANDLER(mtdcrux, 0x1F, 0x03, 0x0D, 0x00000000, PPC_DCRUX)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
gen_op_store_dcr();
|
|
|
|
/* Note: Rc update flag set leads to undefined state of Rc0 */
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* dccci */
|
|
|
|
GEN_HANDLER(dccci, 0x1F, 0x06, 0x0E, 0x03E00001, PPC_4xx_COMMON)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* interpreted as no-op */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* dcread */
|
|
|
|
GEN_HANDLER(dcread, 0x1F, 0x06, 0x0F, 0x00000001, PPC_4xx_COMMON)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_reg_index(ctx);
|
|
|
|
op_ldst(lwz);
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* icbt */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(icbt_40x, "icbt", 0x1F, 0x06, 0x08, 0x03E00001, PPC_40x_ICBT)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
/* interpreted as no-op */
|
|
|
|
/* XXX: specification say this is treated as a load by the MMU
|
|
|
|
* but does not generate any exception
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
/* iccci */
|
|
|
|
GEN_HANDLER(iccci, 0x1F, 0x06, 0x1E, 0x00000001, PPC_4xx_COMMON)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* interpreted as no-op */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* icread */
|
|
|
|
GEN_HANDLER(icread, 0x1F, 0x06, 0x1F, 0x03E00001, PPC_4xx_COMMON)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* interpreted as no-op */
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rfci (supervisor only) */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(rfci_40x, "rfci", 0x13, 0x13, 0x01, 0x03FF8001, PPC_40x_EXCP)
|
2007-03-30 14:22:46 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Restore CPU state */
|
|
|
|
gen_op_40x_rfci();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN_HANDLER(rfci, 0x13, 0x13, 0x01, 0x03FF8001, PPC_BOOKE)
|
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Restore CPU state */
|
|
|
|
gen_op_rfci();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* BookE specific */
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(rfdi, 0x13, 0x07, 0x01, 0x03FF8001, PPC_RFDI)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Restore CPU state */
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_rfdi();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-09-21 09:50:37 +04:00
|
|
|
/* XXX: not implemented on 440 ? */
|
Great rework and cleanups to ease PowerPC implementations definitions.
* cleanup cpu.h, removing definitions used only in translate.c/translate_init.c
* add new flags to define instructions sets more precisely
* various changes in MMU models definitions
* add definitions for PowerPC 440/460 support (insns and SPRs).
* add definitions for PowerPC 401/403 and 620 input pins model
* Fix definitions for most PowerPC 401, 403, 405, 440, 601, 602, 603 and 7x0
* Preliminary support for PowerPC 74xx (aka G4) without altivec.
* Code provision for other PowerPC support (7x5, 970, ...).
* New SPR and PVR defined, from PowerPC 2.04 specification and other sources
* Misc code bugs, error messages and styles fixes.
* Update status files for PowerPC cores support.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3244 c046a42c-6fe2-441c-8c8c-71466251a162
2007-09-27 03:54:22 +04:00
|
|
|
GEN_HANDLER(rfmci, 0x13, 0x06, 0x01, 0x03FF8001, PPC_RFMCI)
|
2007-03-30 14:22:46 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Restore CPU state */
|
|
|
|
gen_op_rfmci();
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_SYNC(ctx);
|
2007-03-30 14:22:46 +04:00
|
|
|
#endif
|
|
|
|
}
|
2007-09-19 09:44:04 +04:00
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* TLB management - PowerPC 405 implementation */
|
2007-03-07 11:32:30 +03:00
|
|
|
/* tlbre */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbre_40x, "tlbre", 0x1F, 0x12, 0x1D, 0x00000001, PPC_40x_TLB)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (rB(ctx->opcode)) {
|
|
|
|
case 0:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_4xx_tlbre_hi();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
break;
|
|
|
|
case 1:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_4xx_tlbre_lo();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
break;
|
|
|
|
default:
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
break;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-03-17 17:02:15 +03:00
|
|
|
/* tlbsx - tlbsx. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbsx_40x, "tlbsx", 0x1F, 0x12, 0x1C, 0x00000000, PPC_40x_TLB)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_reg_index(ctx);
|
2007-10-01 05:51:12 +04:00
|
|
|
gen_op_4xx_tlbsx();
|
2007-03-07 11:32:30 +03:00
|
|
|
if (Rc(ctx->opcode))
|
2007-10-01 05:51:12 +04:00
|
|
|
gen_op_4xx_tlbsx_check();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* tlbwe */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbwe_40x, "tlbwe", 0x1F, 0x12, 0x1E, 0x00000001, PPC_40x_TLB)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (rB(ctx->opcode)) {
|
|
|
|
case 0:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_4xx_tlbwe_hi();
|
|
|
|
break;
|
|
|
|
case 1:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_4xx_tlbwe_lo();
|
|
|
|
break;
|
|
|
|
default:
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
break;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-09-21 09:28:33 +04:00
|
|
|
/* TLB management - PowerPC 440 implementation */
|
2007-09-19 09:44:04 +04:00
|
|
|
/* tlbre */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbre_440, "tlbre", 0x1F, 0x12, 0x1D, 0x00000001, PPC_BOOKE)
|
2007-09-19 09:44:04 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (rB(ctx->opcode)) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-09-21 09:28:33 +04:00
|
|
|
gen_op_440_tlbre(rB(ctx->opcode));
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-09-19 09:44:04 +04:00
|
|
|
break;
|
|
|
|
default:
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbsx - tlbsx. */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbsx_440, "tlbsx", 0x1F, 0x12, 0x1C, 0x00000000, PPC_BOOKE)
|
2007-09-19 09:44:04 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
gen_addr_reg_index(ctx);
|
2007-10-01 05:51:12 +04:00
|
|
|
gen_op_440_tlbsx();
|
2007-09-19 09:44:04 +04:00
|
|
|
if (Rc(ctx->opcode))
|
2007-10-01 05:51:12 +04:00
|
|
|
gen_op_4xx_tlbsx_check();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-09-19 09:44:04 +04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tlbwe */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(tlbwe_440, "tlbwe", 0x1F, 0x12, 0x1E, 0x00000001, PPC_BOOKE)
|
2007-09-19 09:44:04 +04:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (rB(ctx->opcode)) {
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rS(ctx->opcode)]);
|
2007-09-21 09:28:33 +04:00
|
|
|
gen_op_440_tlbwe(rB(ctx->opcode));
|
2007-09-19 09:44:04 +04:00
|
|
|
break;
|
|
|
|
default:
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-09-19 09:44:04 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
/* wrtee */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(wrtee, 0x1F, 0x03, 0x04, 0x000FFC01, PPC_WRTEE)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rD(ctx->opcode)]);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_wrte();
|
2007-09-29 19:02:38 +04:00
|
|
|
/* Stop translation to have a chance to raise an exception
|
|
|
|
* if we just set msr_ee to 1
|
|
|
|
*/
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_STOP(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* wrteei */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#else
|
|
|
|
if (unlikely(!ctx->supervisor)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_PRIVOPC(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-03 03:26:32 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], ctx->opcode & 0x00010000);
|
2007-03-30 14:22:46 +04:00
|
|
|
gen_op_wrte();
|
2007-09-29 19:02:38 +04:00
|
|
|
/* Stop translation to have a chance to raise an exception
|
|
|
|
* if we just set msr_ee to 1
|
|
|
|
*/
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_STOP(ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-04-16 11:18:42 +04:00
|
|
|
/* PowerPC 440 specific instructions */
|
2007-03-07 11:32:30 +03:00
|
|
|
/* dlmzb */
|
|
|
|
GEN_HANDLER(dlmzb, 0x1F, 0x0E, 0x02, 0x00000000, PPC_440_SPEC)
|
|
|
|
{
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rS(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_440_dlmzb();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], cpu_T[0]);
|
2007-03-07 11:32:30 +03:00
|
|
|
gen_op_store_xer_bc();
|
|
|
|
if (Rc(ctx->opcode)) {
|
|
|
|
gen_op_440_dlmzb_update_Rc();
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[0], cpu_T[0], 0xf);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mbar replaces eieio on 440 */
|
|
|
|
GEN_HANDLER(mbar, 0x1F, 0x16, 0x13, 0x001FF801, PPC_BOOKE)
|
|
|
|
{
|
|
|
|
/* interpreted as no-op */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* msync replaces sync on 440 */
|
2007-09-30 07:46:38 +04:00
|
|
|
GEN_HANDLER(msync, 0x1F, 0x16, 0x12, 0x03FFF801, PPC_BOOKE)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
/* interpreted as no-op */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* icbt */
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(icbt_440, "icbt", 0x1F, 0x16, 0x00, 0x03E00001, PPC_BOOKE)
|
2007-03-07 11:32:30 +03:00
|
|
|
{
|
|
|
|
/* interpreted as no-op */
|
|
|
|
/* XXX: specification say this is treated as a load by the MMU
|
|
|
|
* but does not generate any exception
|
|
|
|
*/
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-10-07 22:19:26 +04:00
|
|
|
/*** Altivec vector extension ***/
|
|
|
|
/* Altivec registers moves */
|
|
|
|
|
2008-09-04 18:43:45 +04:00
|
|
|
static always_inline void gen_load_avr(int t, int reg) {
|
|
|
|
tcg_gen_mov_i64(cpu_AVRh[t], cpu_avrh[reg]);
|
|
|
|
tcg_gen_mov_i64(cpu_AVRl[t], cpu_avrl[reg]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static always_inline void gen_store_avr(int reg, int t) {
|
|
|
|
tcg_gen_mov_i64(cpu_avrh[reg], cpu_AVRh[t]);
|
|
|
|
tcg_gen_mov_i64(cpu_avrl[reg], cpu_AVRl[t]);
|
|
|
|
}
|
2007-10-07 22:19:26 +04:00
|
|
|
|
|
|
|
#define op_vr_ldst(name) (*gen_op_##name[ctx->mem_idx])()
|
|
|
|
#define OP_VR_LD_TABLE(name) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_vr_l##name[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(vr_l##name), \
|
2007-10-07 22:19:26 +04:00
|
|
|
};
|
|
|
|
#define OP_VR_ST_TABLE(name) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_vr_st##name[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(vr_st##name), \
|
2007-10-07 22:19:26 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define GEN_VR_LDX(name, opc2, opc3) \
|
|
|
|
GEN_HANDLER(l##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC) \
|
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->altivec_enabled)) { \
|
|
|
|
GEN_EXCP_NO_VR(ctx); \
|
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_reg_index(ctx); \
|
|
|
|
op_vr_ldst(vr_l##name); \
|
2008-09-04 18:43:45 +04:00
|
|
|
gen_store_avr(rD(ctx->opcode), 0); \
|
2007-10-07 22:19:26 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_VR_STX(name, opc2, opc3) \
|
|
|
|
GEN_HANDLER(st##name, 0x1F, opc2, opc3, 0x00000001, PPC_ALTIVEC) \
|
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->altivec_enabled)) { \
|
|
|
|
GEN_EXCP_NO_VR(ctx); \
|
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 18:43:45 +04:00
|
|
|
gen_load_avr(0, rS(ctx->opcode)); \
|
2007-10-07 22:19:26 +04:00
|
|
|
op_vr_ldst(vr_st##name); \
|
|
|
|
}
|
|
|
|
|
|
|
|
OP_VR_LD_TABLE(vx);
|
|
|
|
GEN_VR_LDX(vx, 0x07, 0x03);
|
|
|
|
/* As we don't emulate the cache, lvxl is stricly equivalent to lvx */
|
|
|
|
#define gen_op_vr_lvxl gen_op_vr_lvx
|
|
|
|
GEN_VR_LDX(vxl, 0x07, 0x0B);
|
|
|
|
|
|
|
|
OP_VR_ST_TABLE(vx);
|
|
|
|
GEN_VR_STX(vx, 0x07, 0x07);
|
|
|
|
/* As we don't emulate the cache, stvxl is stricly equivalent to stvx */
|
|
|
|
#define gen_op_vr_stvxl gen_op_vr_stvx
|
|
|
|
GEN_VR_STX(vxl, 0x07, 0x0F);
|
|
|
|
|
2007-03-21 01:11:31 +03:00
|
|
|
/*** SPE extension ***/
|
|
|
|
/* Register moves */
|
2007-11-12 04:56:18 +03:00
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
static always_inline void gen_load_gpr64(TCGv t, int reg) {
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
tcg_gen_mov_i64(t, cpu_gpr[reg]);
|
|
|
|
#else
|
|
|
|
tcg_gen_extu_i32_i64(t, cpu_gprh[reg]);
|
|
|
|
tcg_gen_shli_i64(t, t, 32);
|
|
|
|
TCGv tmp = tcg_temp_local_new(TCG_TYPE_I64);
|
|
|
|
tcg_gen_extu_i32_i64(tmp, cpu_gpr[reg]);
|
|
|
|
tcg_gen_or_i64(t, t, tmp);
|
|
|
|
tcg_temp_free(tmp);
|
2007-11-12 04:56:18 +03:00
|
|
|
#endif
|
2008-09-04 09:25:47 +04:00
|
|
|
}
|
2007-11-12 04:56:18 +03:00
|
|
|
|
2008-09-04 09:25:47 +04:00
|
|
|
static always_inline void gen_store_gpr64(int reg, TCGv t) {
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
tcg_gen_mov_i64(cpu_gpr[reg], t);
|
|
|
|
#else
|
|
|
|
tcg_gen_trunc_i64_i32(cpu_gpr[reg], t);
|
|
|
|
TCGv tmp = tcg_temp_local_new(TCG_TYPE_I64);
|
|
|
|
tcg_gen_shri_i64(tmp, t, 32);
|
|
|
|
tcg_gen_trunc_i64_i32(cpu_gprh[reg], tmp);
|
|
|
|
tcg_temp_free(tmp);
|
2007-11-12 04:56:18 +03:00
|
|
|
#endif
|
2008-09-04 09:25:47 +04:00
|
|
|
}
|
2007-11-12 04:56:18 +03:00
|
|
|
|
2007-03-21 01:11:31 +03:00
|
|
|
#define GEN_SPE(name0, name1, opc2, opc3, inval, type) \
|
|
|
|
GEN_HANDLER(name0##_##name1, 0x04, opc2, opc3, inval, type) \
|
|
|
|
{ \
|
|
|
|
if (Rc(ctx->opcode)) \
|
|
|
|
gen_##name1(ctx); \
|
|
|
|
else \
|
|
|
|
gen_##name0(ctx); \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handler for undefined SPE opcodes */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_speundef (DisasContext *ctx)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctx);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* SPE load and stores */
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_addr_spe_imm_index (DisasContext *ctx, int sh)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
target_long simm = rB(ctx->opcode);
|
|
|
|
|
|
|
|
if (rA(ctx->opcode) == 0) {
|
2008-09-02 20:18:55 +04:00
|
|
|
tcg_gen_movi_tl(cpu_T[0], simm << sh);
|
2007-03-21 01:11:31 +03:00
|
|
|
} else {
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
2007-03-21 01:11:31 +03:00
|
|
|
if (likely(simm != 0))
|
2008-09-05 18:19:43 +04:00
|
|
|
tcg_gen_addi_tl(cpu_T[0], cpu_T[0], simm << sh);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define op_spe_ldst(name) (*gen_op_##name[ctx->mem_idx])()
|
|
|
|
#define OP_SPE_LD_TABLE(name) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_spe_l##name[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(spe_l##name), \
|
2007-03-21 01:11:31 +03:00
|
|
|
};
|
|
|
|
#define OP_SPE_ST_TABLE(name) \
|
2007-11-16 17:11:28 +03:00
|
|
|
static GenOpFunc *gen_op_spe_st##name[NB_MEM_FUNCS] = { \
|
|
|
|
GEN_MEM_FUNCS(spe_st##name), \
|
2007-10-02 14:11:50 +04:00
|
|
|
};
|
2007-03-21 01:11:31 +03:00
|
|
|
|
|
|
|
#define GEN_SPE_LD(name, sh) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evl##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_spe_imm_index(ctx, sh); \
|
|
|
|
op_spe_ldst(spe_l##name); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[1]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPE_LDX(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evl##name##x (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_reg_index(ctx); \
|
|
|
|
op_spe_ldst(spe_l##name); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[1]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_LD(name, sh) \
|
|
|
|
OP_SPE_LD_TABLE(name); \
|
|
|
|
GEN_SPE_LD(name, sh); \
|
|
|
|
GEN_SPE_LDX(name)
|
|
|
|
|
|
|
|
#define GEN_SPE_ST(name, sh) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evst##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_spe_imm_index(ctx, sh); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[1], rS(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
op_spe_ldst(spe_st##name); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPE_STX(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evst##name##x (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
|
|
|
gen_addr_reg_index(ctx); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[1], rS(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
op_spe_ldst(spe_st##name); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_ST(name, sh) \
|
|
|
|
OP_SPE_ST_TABLE(name); \
|
|
|
|
GEN_SPE_ST(name, sh); \
|
|
|
|
GEN_SPE_STX(name)
|
|
|
|
|
|
|
|
#define GEN_SPEOP_LDST(name, sh) \
|
|
|
|
GEN_SPEOP_LD(name, sh); \
|
|
|
|
GEN_SPEOP_ST(name, sh)
|
|
|
|
|
|
|
|
/* SPE arithmetic and logic */
|
|
|
|
#define GEN_SPEOP_ARITH2(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode)); \
|
|
|
|
gen_load_gpr64(cpu_T64[1], rB(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_ARITH1(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_COMP(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode)); \
|
|
|
|
gen_load_gpr64(cpu_T64[1], rB(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Logical */
|
|
|
|
GEN_SPEOP_ARITH2(evand);
|
|
|
|
GEN_SPEOP_ARITH2(evandc);
|
|
|
|
GEN_SPEOP_ARITH2(evxor);
|
|
|
|
GEN_SPEOP_ARITH2(evor);
|
|
|
|
GEN_SPEOP_ARITH2(evnor);
|
|
|
|
GEN_SPEOP_ARITH2(eveqv);
|
|
|
|
GEN_SPEOP_ARITH2(evorc);
|
|
|
|
GEN_SPEOP_ARITH2(evnand);
|
|
|
|
GEN_SPEOP_ARITH2(evsrwu);
|
|
|
|
GEN_SPEOP_ARITH2(evsrws);
|
|
|
|
GEN_SPEOP_ARITH2(evslw);
|
|
|
|
GEN_SPEOP_ARITH2(evrlw);
|
|
|
|
GEN_SPEOP_ARITH2(evmergehi);
|
|
|
|
GEN_SPEOP_ARITH2(evmergelo);
|
|
|
|
GEN_SPEOP_ARITH2(evmergehilo);
|
|
|
|
GEN_SPEOP_ARITH2(evmergelohi);
|
|
|
|
|
|
|
|
/* Arithmetic */
|
|
|
|
GEN_SPEOP_ARITH2(evaddw);
|
|
|
|
GEN_SPEOP_ARITH2(evsubfw);
|
|
|
|
GEN_SPEOP_ARITH1(evabs);
|
|
|
|
GEN_SPEOP_ARITH1(evneg);
|
|
|
|
GEN_SPEOP_ARITH1(evextsb);
|
|
|
|
GEN_SPEOP_ARITH1(evextsh);
|
|
|
|
GEN_SPEOP_ARITH1(evrndw);
|
|
|
|
GEN_SPEOP_ARITH1(evcntlzw);
|
|
|
|
GEN_SPEOP_ARITH1(evcntlsw);
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_brinc (DisasContext *ctx)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
/* Note: brinc is usable even if SPE is disabled */
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]);
|
|
|
|
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]);
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_brinc();
|
2008-09-04 09:25:47 +04:00
|
|
|
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_ARITH_IMM2(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name##i (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rB(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_splatwi_T1_64(rA(ctx->opcode)); \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_SPEOP_LOGIC_IMM2(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name##i (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
if (unlikely(!ctx->spe_enabled)) { \
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx); \
|
2007-03-21 01:11:31 +03:00
|
|
|
return; \
|
|
|
|
} \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_splatwi_T1_64(rB(ctx->opcode)); \
|
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
GEN_SPEOP_ARITH_IMM2(evaddw);
|
|
|
|
#define gen_evaddiw gen_evaddwi
|
|
|
|
GEN_SPEOP_ARITH_IMM2(evsubfw);
|
|
|
|
#define gen_evsubifw gen_evsubfwi
|
|
|
|
GEN_SPEOP_LOGIC_IMM2(evslw);
|
|
|
|
GEN_SPEOP_LOGIC_IMM2(evsrwu);
|
|
|
|
#define gen_evsrwis gen_evsrwsi
|
|
|
|
GEN_SPEOP_LOGIC_IMM2(evsrws);
|
|
|
|
#define gen_evsrwiu gen_evsrwui
|
|
|
|
GEN_SPEOP_LOGIC_IMM2(evrlw);
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evsplati (DisasContext *ctx)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
int32_t imm = (int32_t)(rA(ctx->opcode) << 27) >> 27;
|
|
|
|
|
|
|
|
gen_op_splatwi_T0_64(imm);
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evsplatfi (DisasContext *ctx)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
uint32_t imm = rA(ctx->opcode) << 27;
|
|
|
|
|
|
|
|
gen_op_splatwi_T0_64(imm);
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Comparison */
|
|
|
|
GEN_SPEOP_COMP(evcmpgtu);
|
|
|
|
GEN_SPEOP_COMP(evcmpgts);
|
|
|
|
GEN_SPEOP_COMP(evcmpltu);
|
|
|
|
GEN_SPEOP_COMP(evcmplts);
|
|
|
|
GEN_SPEOP_COMP(evcmpeq);
|
|
|
|
|
|
|
|
GEN_SPE(evaddw, speundef, 0x00, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evaddiw, speundef, 0x01, 0x08, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evsubfw, speundef, 0x02, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evsubifw, speundef, 0x03, 0x08, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evabs, evneg, 0x04, 0x08, 0x0000F800, PPC_SPE); ////
|
|
|
|
GEN_SPE(evextsb, evextsh, 0x05, 0x08, 0x0000F800, PPC_SPE); ////
|
|
|
|
GEN_SPE(evrndw, evcntlzw, 0x06, 0x08, 0x0000F800, PPC_SPE); ////
|
|
|
|
GEN_SPE(evcntlsw, brinc, 0x07, 0x08, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(speundef, evand, 0x08, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evandc, speundef, 0x09, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evxor, evor, 0x0B, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evnor, eveqv, 0x0C, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(speundef, evorc, 0x0D, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evnand, speundef, 0x0F, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evsrwu, evsrws, 0x10, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evsrwiu, evsrwis, 0x11, 0x08, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evslw, speundef, 0x12, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evslwi, speundef, 0x13, 0x08, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evrlw, evsplati, 0x14, 0x08, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evrlwi, evsplatfi, 0x15, 0x08, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmergehi, evmergelo, 0x16, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evmergehilo, evmergelohi, 0x17, 0x08, 0x00000000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evcmpgtu, evcmpgts, 0x18, 0x08, 0x00600000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evcmpltu, evcmplts, 0x19, 0x08, 0x00600000, PPC_SPE); ////
|
|
|
|
GEN_SPE(evcmpeq, speundef, 0x1A, 0x08, 0x00600000, PPC_SPE); ////
|
|
|
|
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_evsel (DisasContext *ctx)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
if (unlikely(!ctx->spe_enabled)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_NO_AP(ctx);
|
2007-03-21 01:11:31 +03:00
|
|
|
return;
|
|
|
|
}
|
2008-09-04 21:06:47 +04:00
|
|
|
tcg_gen_mov_i32(cpu_T[0], cpu_crf[ctx->opcode & 0x7]);
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode));
|
|
|
|
gen_load_gpr64(cpu_T64[1], rB(ctx->opcode));
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_evsel();
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]);
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(evsel0, "evsel", 0x04, 0x1c, 0x09, 0x00000000, PPC_SPE)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
gen_evsel(ctx);
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(evsel1, "evsel", 0x04, 0x1d, 0x09, 0x00000000, PPC_SPE)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
gen_evsel(ctx);
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(evsel2, "evsel", 0x04, 0x1e, 0x09, 0x00000000, PPC_SPE)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
gen_evsel(ctx);
|
|
|
|
}
|
2007-10-26 04:46:07 +04:00
|
|
|
GEN_HANDLER2(evsel3, "evsel", 0x04, 0x1f, 0x09, 0x00000000, PPC_SPE)
|
2007-03-21 01:11:31 +03:00
|
|
|
{
|
|
|
|
gen_evsel(ctx);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load and stores */
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* In that case, we already have 64 bits load & stores
|
|
|
|
* so, spe_ldd is equivalent to ld and spe_std is equivalent to std
|
|
|
|
*/
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_spe_ldd_raw gen_op_ld_raw
|
|
|
|
#define gen_op_spe_ldd_user gen_op_ld_user
|
|
|
|
#define gen_op_spe_ldd_kernel gen_op_ld_kernel
|
|
|
|
#define gen_op_spe_ldd_hypv gen_op_ld_hypv
|
|
|
|
#define gen_op_spe_ldd_64_raw gen_op_ld_64_raw
|
|
|
|
#define gen_op_spe_ldd_64_user gen_op_ld_64_user
|
|
|
|
#define gen_op_spe_ldd_64_kernel gen_op_ld_64_kernel
|
|
|
|
#define gen_op_spe_ldd_64_hypv gen_op_ld_64_hypv
|
|
|
|
#define gen_op_spe_ldd_le_raw gen_op_ld_le_raw
|
|
|
|
#define gen_op_spe_ldd_le_user gen_op_ld_le_user
|
|
|
|
#define gen_op_spe_ldd_le_kernel gen_op_ld_le_kernel
|
|
|
|
#define gen_op_spe_ldd_le_hypv gen_op_ld_le_hypv
|
|
|
|
#define gen_op_spe_ldd_le_64_raw gen_op_ld_le_64_raw
|
|
|
|
#define gen_op_spe_ldd_le_64_user gen_op_ld_le_64_user
|
|
|
|
#define gen_op_spe_ldd_le_64_kernel gen_op_ld_le_64_kernel
|
|
|
|
#define gen_op_spe_ldd_le_64_hypv gen_op_ld_le_64_hypv
|
|
|
|
#define gen_op_spe_stdd_raw gen_op_std_raw
|
|
|
|
#define gen_op_spe_stdd_user gen_op_std_user
|
|
|
|
#define gen_op_spe_stdd_kernel gen_op_std_kernel
|
|
|
|
#define gen_op_spe_stdd_hypv gen_op_std_hypv
|
|
|
|
#define gen_op_spe_stdd_64_raw gen_op_std_64_raw
|
|
|
|
#define gen_op_spe_stdd_64_user gen_op_std_64_user
|
|
|
|
#define gen_op_spe_stdd_64_kernel gen_op_std_64_kernel
|
|
|
|
#define gen_op_spe_stdd_64_hypv gen_op_std_64_hypv
|
|
|
|
#define gen_op_spe_stdd_le_raw gen_op_std_le_raw
|
|
|
|
#define gen_op_spe_stdd_le_user gen_op_std_le_user
|
|
|
|
#define gen_op_spe_stdd_le_kernel gen_op_std_le_kernel
|
|
|
|
#define gen_op_spe_stdd_le_hypv gen_op_std_le_hypv
|
|
|
|
#define gen_op_spe_stdd_le_64_raw gen_op_std_le_64_raw
|
|
|
|
#define gen_op_spe_stdd_le_64_user gen_op_std_le_64_user
|
|
|
|
#define gen_op_spe_stdd_le_64_kernel gen_op_std_le_64_kernel
|
|
|
|
#define gen_op_spe_stdd_le_64_hypv gen_op_std_le_64_hypv
|
2007-03-21 01:11:31 +03:00
|
|
|
#endif /* defined(TARGET_PPC64) */
|
|
|
|
GEN_SPEOP_LDST(dd, 3);
|
|
|
|
GEN_SPEOP_LDST(dw, 3);
|
|
|
|
GEN_SPEOP_LDST(dh, 3);
|
|
|
|
GEN_SPEOP_LDST(whe, 2);
|
|
|
|
GEN_SPEOP_LD(whou, 2);
|
|
|
|
GEN_SPEOP_LD(whos, 2);
|
|
|
|
GEN_SPEOP_ST(who, 2);
|
|
|
|
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
/* In that case, spe_stwwo is equivalent to stw */
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_spe_stwwo_raw gen_op_stw_raw
|
|
|
|
#define gen_op_spe_stwwo_user gen_op_stw_user
|
|
|
|
#define gen_op_spe_stwwo_kernel gen_op_stw_kernel
|
|
|
|
#define gen_op_spe_stwwo_hypv gen_op_stw_hypv
|
|
|
|
#define gen_op_spe_stwwo_le_raw gen_op_stw_le_raw
|
|
|
|
#define gen_op_spe_stwwo_le_user gen_op_stw_le_user
|
|
|
|
#define gen_op_spe_stwwo_le_kernel gen_op_stw_le_kernel
|
|
|
|
#define gen_op_spe_stwwo_le_hypv gen_op_stw_le_hypv
|
|
|
|
#define gen_op_spe_stwwo_64_raw gen_op_stw_64_raw
|
|
|
|
#define gen_op_spe_stwwo_64_user gen_op_stw_64_user
|
|
|
|
#define gen_op_spe_stwwo_64_kernel gen_op_stw_64_kernel
|
|
|
|
#define gen_op_spe_stwwo_64_hypv gen_op_stw_64_hypv
|
|
|
|
#define gen_op_spe_stwwo_le_64_raw gen_op_stw_le_64_raw
|
|
|
|
#define gen_op_spe_stwwo_le_64_user gen_op_stw_le_64_user
|
2007-03-21 01:11:31 +03:00
|
|
|
#define gen_op_spe_stwwo_le_64_kernel gen_op_stw_le_64_kernel
|
2007-11-16 17:11:28 +03:00
|
|
|
#define gen_op_spe_stwwo_le_64_hypv gen_op_stw_le_64_hypv
|
2007-03-21 01:11:31 +03:00
|
|
|
#endif
|
|
|
|
#define _GEN_OP_SPE_STWWE(suffix) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_stwwe_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_srli32_T1_64(); \
|
|
|
|
gen_op_spe_stwwo_##suffix(); \
|
|
|
|
}
|
|
|
|
#define _GEN_OP_SPE_STWWE_LE(suffix) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_stwwe_le_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_srli32_T1_64(); \
|
|
|
|
gen_op_spe_stwwo_le_##suffix(); \
|
|
|
|
}
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
#define GEN_OP_SPE_STWWE(suffix) \
|
|
|
|
_GEN_OP_SPE_STWWE(suffix); \
|
|
|
|
_GEN_OP_SPE_STWWE_LE(suffix); \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_stwwe_64_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_srli32_T1_64(); \
|
|
|
|
gen_op_spe_stwwo_64_##suffix(); \
|
|
|
|
} \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_stwwe_le_64_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_srli32_T1_64(); \
|
|
|
|
gen_op_spe_stwwo_le_64_##suffix(); \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define GEN_OP_SPE_STWWE(suffix) \
|
|
|
|
_GEN_OP_SPE_STWWE(suffix); \
|
|
|
|
_GEN_OP_SPE_STWWE_LE(suffix)
|
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_OP_SPE_STWWE(raw);
|
|
|
|
#else /* defined(CONFIG_USER_ONLY) */
|
|
|
|
GEN_OP_SPE_STWWE(user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_STWWE(kernel);
|
|
|
|
GEN_OP_SPE_STWWE(hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
#endif /* defined(CONFIG_USER_ONLY) */
|
|
|
|
GEN_SPEOP_ST(wwe, 2);
|
|
|
|
GEN_SPEOP_ST(wwo, 2);
|
|
|
|
|
|
|
|
#define GEN_SPE_LDSPLAT(name, op, suffix) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_l##name##_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_##op##_##suffix(); \
|
|
|
|
gen_op_splatw_T1_64(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_OP_SPE_LHE(suffix) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_lhe_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_spe_lh_##suffix(); \
|
|
|
|
gen_op_sli16_T1_64(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GEN_OP_SPE_LHX(suffix) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_op_spe_lhx_##suffix (void) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
|
|
|
gen_op_spe_lh_##suffix(); \
|
|
|
|
gen_op_extsh_T1_64(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
GEN_OP_SPE_LHE(raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, raw);
|
|
|
|
GEN_OP_SPE_LHE(le_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_raw);
|
|
|
|
GEN_OP_SPE_LHX(raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, raw);
|
|
|
|
GEN_OP_SPE_LHX(le_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_raw);
|
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
GEN_OP_SPE_LHE(64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_raw);
|
|
|
|
GEN_OP_SPE_LHE(le_64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_raw);
|
|
|
|
GEN_OP_SPE_LHX(64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_raw);
|
|
|
|
GEN_OP_SPE_LHX(le_64_raw);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_raw);
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
GEN_OP_SPE_LHE(user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHE(kernel);
|
|
|
|
GEN_OP_SPE_LHE(hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHE(le_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHE(le_kernel);
|
|
|
|
GEN_OP_SPE_LHE(le_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHX(user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHX(kernel);
|
|
|
|
GEN_OP_SPE_LHX(hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHX(le_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHX(le_kernel);
|
|
|
|
GEN_OP_SPE_LHX(le_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
GEN_OP_SPE_LHE(64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHE(64_kernel);
|
|
|
|
GEN_OP_SPE_LHE(64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, 64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHE(le_64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHE(le_64_kernel);
|
|
|
|
GEN_OP_SPE_LHE(le_64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhesplat, spe_lhe, le_64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, 64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhousplat, spe_lh, le_64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHX(64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHX(64_kernel);
|
|
|
|
GEN_OP_SPE_LHX(64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, 64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_OP_SPE_LHX(le_64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_OP_SPE_LHX(le_64_kernel);
|
|
|
|
GEN_OP_SPE_LHX(le_64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_user);
|
2007-11-16 17:11:28 +03:00
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_kernel);
|
|
|
|
GEN_SPE_LDSPLAT(hhossplat, spe_lhx, le_64_hypv);
|
2007-03-21 01:11:31 +03:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
GEN_SPEOP_LD(hhesplat, 1);
|
|
|
|
GEN_SPEOP_LD(hhousplat, 1);
|
|
|
|
GEN_SPEOP_LD(hhossplat, 1);
|
|
|
|
GEN_SPEOP_LD(wwsplat, 2);
|
|
|
|
GEN_SPEOP_LD(whsplat, 2);
|
|
|
|
|
|
|
|
GEN_SPE(evlddx, evldd, 0x00, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evldwx, evldw, 0x01, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evldhx, evldh, 0x02, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlhhesplatx, evlhhesplat, 0x04, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlhhousplatx, evlhhousplat, 0x06, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlhhossplatx, evlhhossplat, 0x07, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlwhex, evlwhe, 0x08, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlwhoux, evlwhou, 0x0A, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlwhosx, evlwhos, 0x0B, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlwwsplatx, evlwwsplat, 0x0C, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evlwhsplatx, evlwhsplat, 0x0E, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstddx, evstdd, 0x10, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstdwx, evstdw, 0x11, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstdhx, evstdh, 0x12, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstwhex, evstwhe, 0x18, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstwhox, evstwho, 0x1A, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstwwex, evstwwe, 0x1C, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
GEN_SPE(evstwwox, evstwwo, 0x1E, 0x0C, 0x00000000, PPC_SPE); //
|
|
|
|
|
|
|
|
/* Multiply and add - TODO */
|
|
|
|
#if 0
|
|
|
|
GEN_SPE(speundef, evmhessf, 0x01, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhossf, 0x03, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmheumi, evmhesmi, 0x04, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhesmf, 0x05, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhoumi, evmhosmi, 0x06, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhosmf, 0x07, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhessfa, 0x11, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhossfa, 0x13, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmheumia, evmhesmia, 0x14, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhesmfa, 0x15, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhoumia, evmhosmia, 0x16, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhosmfa, 0x17, 0x10, 0x00000000, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(speundef, evmwhssf, 0x03, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwlumi, speundef, 0x04, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwhumi, evmwhsmi, 0x06, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwhsmf, 0x07, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwssf, 0x09, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwumi, evmwsmi, 0x0C, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwsmf, 0x0D, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwhssfa, 0x13, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwlumia, speundef, 0x14, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwhumia, evmwhsmia, 0x16, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwhsmfa, 0x17, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwssfa, 0x19, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwumia, evmwsmia, 0x1C, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwsmfa, 0x1D, 0x11, 0x00000000, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(evadduiaaw, evaddsiaaw, 0x00, 0x13, 0x0000F800, PPC_SPE);
|
|
|
|
GEN_SPE(evsubfusiaaw, evsubfssiaaw, 0x01, 0x13, 0x0000F800, PPC_SPE);
|
|
|
|
GEN_SPE(evaddumiaaw, evaddsmiaaw, 0x04, 0x13, 0x0000F800, PPC_SPE);
|
|
|
|
GEN_SPE(evsubfumiaaw, evsubfsmiaaw, 0x05, 0x13, 0x0000F800, PPC_SPE);
|
|
|
|
GEN_SPE(evdivws, evdivwu, 0x06, 0x13, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmra, speundef, 0x07, 0x13, 0x0000F800, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(evmheusiaaw, evmhessiaaw, 0x00, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhessfaaw, 0x01, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhousiaaw, evmhossiaaw, 0x02, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhossfaaw, 0x03, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmheumiaaw, evmhesmiaaw, 0x04, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhesmfaaw, 0x05, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhoumiaaw, evmhosmiaaw, 0x06, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhosmfaaw, 0x07, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhegumiaa, evmhegsmiaa, 0x14, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhegsmfaa, 0x15, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhogumiaa, evmhogsmiaa, 0x16, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhogsmfaa, 0x17, 0x14, 0x00000000, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(evmwlusiaaw, evmwlssiaaw, 0x00, 0x15, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwlumiaaw, evmwlsmiaaw, 0x04, 0x15, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwssfaa, 0x09, 0x15, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwumiaa, evmwsmiaa, 0x0C, 0x15, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwsmfaa, 0x0D, 0x15, 0x00000000, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(evmheusianw, evmhessianw, 0x00, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhessfanw, 0x01, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhousianw, evmhossianw, 0x02, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhossfanw, 0x03, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmheumianw, evmhesmianw, 0x04, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhesmfanw, 0x05, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhoumianw, evmhosmianw, 0x06, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhosmfanw, 0x07, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhegumian, evmhegsmian, 0x14, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhegsmfan, 0x15, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmhigumian, evmhigsmian, 0x16, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmhogsmfan, 0x17, 0x16, 0x00000000, PPC_SPE);
|
|
|
|
|
|
|
|
GEN_SPE(evmwlusianw, evmwlssianw, 0x00, 0x17, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwlumianw, evmwlsmianw, 0x04, 0x17, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwssfan, 0x09, 0x17, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(evmwumian, evmwsmian, 0x0C, 0x17, 0x00000000, PPC_SPE);
|
|
|
|
GEN_SPE(speundef, evmwsmfan, 0x0D, 0x17, 0x00000000, PPC_SPE);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*** SPE floating-point extension ***/
|
|
|
|
#define GEN_SPEFPUOP_CONV(name) \
|
2007-10-07 21:13:44 +04:00
|
|
|
static always_inline void gen_##name (DisasContext *ctx) \
|
2007-03-21 01:11:31 +03:00
|
|
|
{ \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_load_gpr64(cpu_T64[0], rB(ctx->opcode)); \
|
2007-03-21 01:11:31 +03:00
|
|
|
gen_op_##name(); \
|
2008-09-04 09:25:47 +04:00
|
|
|
gen_store_gpr64(rD(ctx->opcode), cpu_T64[0]); \
|
2007-03-21 01:11:31 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Single precision floating-point vectors operations */
|
|
|
|
/* Arithmetic */
|
|
|
|
GEN_SPEOP_ARITH2(evfsadd);
|
|
|
|
GEN_SPEOP_ARITH2(evfssub);
|
|
|
|
GEN_SPEOP_ARITH2(evfsmul);
|
|
|
|
GEN_SPEOP_ARITH2(evfsdiv);
|
|
|
|
GEN_SPEOP_ARITH1(evfsabs);
|
|
|
|
GEN_SPEOP_ARITH1(evfsnabs);
|
|
|
|
GEN_SPEOP_ARITH1(evfsneg);
|
|
|
|
/* Conversion */
|
|
|
|
GEN_SPEFPUOP_CONV(evfscfui);
|
|
|
|
GEN_SPEFPUOP_CONV(evfscfsi);
|
|
|
|
GEN_SPEFPUOP_CONV(evfscfuf);
|
|
|
|
GEN_SPEFPUOP_CONV(evfscfsf);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctui);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctsi);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctuf);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctsf);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctuiz);
|
|
|
|
GEN_SPEFPUOP_CONV(evfsctsiz);
|
|
|
|
/* Comparison */
|
|
|
|
GEN_SPEOP_COMP(evfscmpgt);
|
|
|
|
GEN_SPEOP_COMP(evfscmplt);
|
|
|
|
GEN_SPEOP_COMP(evfscmpeq);
|
|
|
|
GEN_SPEOP_COMP(evfststgt);
|
|
|
|
GEN_SPEOP_COMP(evfststlt);
|
|
|
|
GEN_SPEOP_COMP(evfststeq);
|
|
|
|
|
|
|
|
/* Opcodes definitions */
|
|
|
|
GEN_SPE(evfsadd, evfssub, 0x00, 0x0A, 0x00000000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsabs, evfsnabs, 0x02, 0x0A, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsneg, speundef, 0x03, 0x0A, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsmul, evfsdiv, 0x04, 0x0A, 0x00000000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfscmpgt, evfscmplt, 0x06, 0x0A, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfscmpeq, speundef, 0x07, 0x0A, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfscfui, evfscfsi, 0x08, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfscfuf, evfscfsf, 0x09, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsctui, evfsctsi, 0x0A, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsctuf, evfsctsf, 0x0B, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsctuiz, speundef, 0x0C, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfsctsiz, speundef, 0x0D, 0x0A, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfststgt, evfststlt, 0x0E, 0x0A, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(evfststeq, speundef, 0x0F, 0x0A, 0x00600000, PPC_SPEFPU); //
|
|
|
|
|
|
|
|
/* Single precision floating-point operations */
|
|
|
|
/* Arithmetic */
|
|
|
|
GEN_SPEOP_ARITH2(efsadd);
|
|
|
|
GEN_SPEOP_ARITH2(efssub);
|
|
|
|
GEN_SPEOP_ARITH2(efsmul);
|
|
|
|
GEN_SPEOP_ARITH2(efsdiv);
|
|
|
|
GEN_SPEOP_ARITH1(efsabs);
|
|
|
|
GEN_SPEOP_ARITH1(efsnabs);
|
|
|
|
GEN_SPEOP_ARITH1(efsneg);
|
|
|
|
/* Conversion */
|
|
|
|
GEN_SPEFPUOP_CONV(efscfui);
|
|
|
|
GEN_SPEFPUOP_CONV(efscfsi);
|
|
|
|
GEN_SPEFPUOP_CONV(efscfuf);
|
|
|
|
GEN_SPEFPUOP_CONV(efscfsf);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctui);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctsi);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctuf);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctsf);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctuiz);
|
|
|
|
GEN_SPEFPUOP_CONV(efsctsiz);
|
|
|
|
GEN_SPEFPUOP_CONV(efscfd);
|
|
|
|
/* Comparison */
|
|
|
|
GEN_SPEOP_COMP(efscmpgt);
|
|
|
|
GEN_SPEOP_COMP(efscmplt);
|
|
|
|
GEN_SPEOP_COMP(efscmpeq);
|
|
|
|
GEN_SPEOP_COMP(efststgt);
|
|
|
|
GEN_SPEOP_COMP(efststlt);
|
|
|
|
GEN_SPEOP_COMP(efststeq);
|
|
|
|
|
|
|
|
/* Opcodes definitions */
|
2007-11-18 01:26:51 +03:00
|
|
|
GEN_SPE(efsadd, efssub, 0x00, 0x0B, 0x00000000, PPC_SPEFPU); //
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE(efsabs, efsnabs, 0x02, 0x0B, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efsneg, speundef, 0x03, 0x0B, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efsmul, efsdiv, 0x04, 0x0B, 0x00000000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efscmpgt, efscmplt, 0x06, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efscmpeq, efscfd, 0x07, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efscfui, efscfsi, 0x08, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efscfuf, efscfsf, 0x09, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efsctui, efsctsi, 0x0A, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efsctuf, efsctsf, 0x0B, 0x0B, 0x00180000, PPC_SPEFPU); //
|
2008-08-13 15:30:10 +04:00
|
|
|
GEN_SPE(efsctuiz, speundef, 0x0C, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efsctsiz, speundef, 0x0D, 0x0B, 0x00180000, PPC_SPEFPU); //
|
2007-03-21 01:11:31 +03:00
|
|
|
GEN_SPE(efststgt, efststlt, 0x0E, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efststeq, speundef, 0x0F, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
|
|
|
|
/* Double precision floating-point operations */
|
|
|
|
/* Arithmetic */
|
|
|
|
GEN_SPEOP_ARITH2(efdadd);
|
|
|
|
GEN_SPEOP_ARITH2(efdsub);
|
|
|
|
GEN_SPEOP_ARITH2(efdmul);
|
|
|
|
GEN_SPEOP_ARITH2(efddiv);
|
|
|
|
GEN_SPEOP_ARITH1(efdabs);
|
|
|
|
GEN_SPEOP_ARITH1(efdnabs);
|
|
|
|
GEN_SPEOP_ARITH1(efdneg);
|
|
|
|
/* Conversion */
|
|
|
|
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfui);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfsi);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfuf);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfsf);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctui);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctsi);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctuf);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctsf);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctuiz);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctsiz);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfs);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfuid);
|
|
|
|
GEN_SPEFPUOP_CONV(efdcfsid);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctuidz);
|
|
|
|
GEN_SPEFPUOP_CONV(efdctsidz);
|
|
|
|
/* Comparison */
|
|
|
|
GEN_SPEOP_COMP(efdcmpgt);
|
|
|
|
GEN_SPEOP_COMP(efdcmplt);
|
|
|
|
GEN_SPEOP_COMP(efdcmpeq);
|
|
|
|
GEN_SPEOP_COMP(efdtstgt);
|
|
|
|
GEN_SPEOP_COMP(efdtstlt);
|
|
|
|
GEN_SPEOP_COMP(efdtsteq);
|
|
|
|
|
|
|
|
/* Opcodes definitions */
|
|
|
|
GEN_SPE(efdadd, efdsub, 0x10, 0x0B, 0x00000000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdcfuid, efdcfsid, 0x11, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdabs, efdnabs, 0x12, 0x0B, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdneg, speundef, 0x13, 0x0B, 0x0000F800, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdmul, efddiv, 0x14, 0x0B, 0x00000000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdctuidz, efdctsidz, 0x15, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdcmpgt, efdcmplt, 0x16, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdcmpeq, efdcfs, 0x17, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdcfui, efdcfsi, 0x18, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdcfuf, efdcfsf, 0x19, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdctui, efdctsi, 0x1A, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdctuf, efdctsf, 0x1B, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdctuiz, speundef, 0x1C, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdctsiz, speundef, 0x1D, 0x0B, 0x00180000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdtstgt, efdtstlt, 0x1E, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
GEN_SPE(efdtsteq, speundef, 0x1F, 0x0B, 0x00600000, PPC_SPEFPU); //
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
/* End opcode list */
|
|
|
|
GEN_OPCODE_MARK(end);
|
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
#include "translate_init.c"
|
2007-10-26 01:35:50 +04:00
|
|
|
#include "helper_regs.h"
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
/*****************************************************************************/
|
2005-07-03 00:59:34 +04:00
|
|
|
/* Misc PowerPC helpers */
|
2007-09-17 12:21:54 +04:00
|
|
|
void cpu_dump_state (CPUState *env, FILE *f,
|
|
|
|
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
|
|
|
|
int flags)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2005-07-03 00:59:34 +04:00
|
|
|
#define RGPL 4
|
|
|
|
#define RFPL 4
|
|
|
|
|
2003-11-23 17:55:54 +03:00
|
|
|
int i;
|
|
|
|
|
2007-11-04 04:57:29 +03:00
|
|
|
cpu_fprintf(f, "NIP " ADDRX " LR " ADDRX " CTR " ADDRX " XER %08x\n",
|
|
|
|
env->nip, env->lr, env->ctr, hreg_load_xer(env));
|
2007-11-24 05:03:55 +03:00
|
|
|
cpu_fprintf(f, "MSR " ADDRX " HID0 " ADDRX " HF " ADDRX " idx %d\n",
|
|
|
|
env->msr, env->spr[SPR_HID0], env->hflags, env->mmu_idx);
|
2007-03-17 17:02:15 +03:00
|
|
|
#if !defined(NO_TIMER_DUMP)
|
2007-11-04 04:57:29 +03:00
|
|
|
cpu_fprintf(f, "TB %08x %08x "
|
2007-03-07 11:32:30 +03:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
"DECR %08x"
|
|
|
|
#endif
|
|
|
|
"\n",
|
2007-11-04 04:57:29 +03:00
|
|
|
cpu_ppc_load_tbu(env), cpu_ppc_load_tbl(env)
|
2007-03-07 11:32:30 +03:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
, cpu_ppc_load_decr(env)
|
|
|
|
#endif
|
|
|
|
);
|
2007-11-04 04:57:29 +03:00
|
|
|
#endif
|
2007-03-07 11:32:30 +03:00
|
|
|
for (i = 0; i < 32; i++) {
|
2005-07-03 00:59:34 +04:00
|
|
|
if ((i & (RGPL - 1)) == 0)
|
|
|
|
cpu_fprintf(f, "GPR%02d", i);
|
2007-11-24 05:03:55 +03:00
|
|
|
cpu_fprintf(f, " " REGX, ppc_dump_gpr(env, i));
|
2005-07-03 00:59:34 +04:00
|
|
|
if ((i & (RGPL - 1)) == (RGPL - 1))
|
2004-10-09 22:08:01 +04:00
|
|
|
cpu_fprintf(f, "\n");
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2005-07-03 00:59:34 +04:00
|
|
|
cpu_fprintf(f, "CR ");
|
2007-03-07 11:32:30 +03:00
|
|
|
for (i = 0; i < 8; i++)
|
2004-10-09 22:08:01 +04:00
|
|
|
cpu_fprintf(f, "%01x", env->crf[i]);
|
|
|
|
cpu_fprintf(f, " [");
|
2007-03-07 11:32:30 +03:00
|
|
|
for (i = 0; i < 8; i++) {
|
|
|
|
char a = '-';
|
|
|
|
if (env->crf[i] & 0x08)
|
|
|
|
a = 'L';
|
|
|
|
else if (env->crf[i] & 0x04)
|
|
|
|
a = 'G';
|
|
|
|
else if (env->crf[i] & 0x02)
|
|
|
|
a = 'E';
|
2004-10-09 22:08:01 +04:00
|
|
|
cpu_fprintf(f, " %c%c", a, env->crf[i] & 0x01 ? 'O' : ' ');
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-11-24 05:03:55 +03:00
|
|
|
cpu_fprintf(f, " ] RES " ADDRX "\n", env->reserve);
|
2005-07-03 00:59:34 +04:00
|
|
|
for (i = 0; i < 32; i++) {
|
|
|
|
if ((i & (RFPL - 1)) == 0)
|
|
|
|
cpu_fprintf(f, "FPR%02d", i);
|
2006-06-25 22:15:32 +04:00
|
|
|
cpu_fprintf(f, " %016" PRIx64, *((uint64_t *)&env->fpr[i]));
|
2005-07-03 00:59:34 +04:00
|
|
|
if ((i & (RFPL - 1)) == (RFPL - 1))
|
2004-10-09 22:08:01 +04:00
|
|
|
cpu_fprintf(f, "\n");
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2007-10-07 19:43:50 +04:00
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-11-24 05:03:55 +03:00
|
|
|
cpu_fprintf(f, "SRR0 " ADDRX " SRR1 " ADDRX " SDR1 " ADDRX "\n",
|
2005-07-03 00:59:34 +04:00
|
|
|
env->spr[SPR_SRR0], env->spr[SPR_SRR1], env->sdr1);
|
2007-10-07 19:43:50 +04:00
|
|
|
#endif
|
2003-11-23 17:55:54 +03:00
|
|
|
|
2005-07-03 00:59:34 +04:00
|
|
|
#undef RGPL
|
|
|
|
#undef RFPL
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2007-03-07 11:32:30 +03:00
|
|
|
void cpu_dump_statistics (CPUState *env, FILE*f,
|
|
|
|
int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
|
|
|
|
int flags)
|
|
|
|
{
|
|
|
|
#if defined(DO_PPC_STATISTICS)
|
|
|
|
opc_handler_t **t1, **t2, **t3, *handler;
|
|
|
|
int op1, op2, op3;
|
|
|
|
|
|
|
|
t1 = env->opcodes;
|
|
|
|
for (op1 = 0; op1 < 64; op1++) {
|
|
|
|
handler = t1[op1];
|
|
|
|
if (is_indirect_opcode(handler)) {
|
|
|
|
t2 = ind_table(handler);
|
|
|
|
for (op2 = 0; op2 < 32; op2++) {
|
|
|
|
handler = t2[op2];
|
|
|
|
if (is_indirect_opcode(handler)) {
|
|
|
|
t3 = ind_table(handler);
|
|
|
|
for (op3 = 0; op3 < 32; op3++) {
|
|
|
|
handler = t3[op3];
|
|
|
|
if (handler->count == 0)
|
|
|
|
continue;
|
|
|
|
cpu_fprintf(f, "%02x %02x %02x (%02x %04d) %16s: "
|
|
|
|
"%016llx %lld\n",
|
|
|
|
op1, op2, op3, op1, (op3 << 5) | op2,
|
|
|
|
handler->oname,
|
|
|
|
handler->count, handler->count);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (handler->count == 0)
|
|
|
|
continue;
|
|
|
|
cpu_fprintf(f, "%02x %02x (%02x %04d) %16s: "
|
|
|
|
"%016llx %lld\n",
|
|
|
|
op1, op2, op1, op2, handler->oname,
|
|
|
|
handler->count, handler->count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (handler->count == 0)
|
|
|
|
continue;
|
|
|
|
cpu_fprintf(f, "%02x (%02x ) %16s: %016llx %lld\n",
|
|
|
|
op1, op1, handler->oname,
|
|
|
|
handler->count, handler->count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2004-01-05 01:58:38 +03:00
|
|
|
/*****************************************************************************/
|
2008-07-18 22:01:29 +04:00
|
|
|
static always_inline void gen_intermediate_code_internal (CPUState *env,
|
|
|
|
TranslationBlock *tb,
|
|
|
|
int search_pc)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2004-05-21 16:59:32 +04:00
|
|
|
DisasContext ctx, *ctxp = &ctx;
|
2003-11-23 17:55:54 +03:00
|
|
|
opc_handler_t **table, *handler;
|
2005-01-04 02:43:32 +03:00
|
|
|
target_ulong pc_start;
|
2003-11-23 17:55:54 +03:00
|
|
|
uint16_t *gen_opc_end;
|
2007-11-04 05:55:33 +03:00
|
|
|
int supervisor, little_endian;
|
2003-11-23 17:55:54 +03:00
|
|
|
int j, lj = -1;
|
2008-06-29 05:03:05 +04:00
|
|
|
int num_insns;
|
|
|
|
int max_insns;
|
2003-11-23 17:55:54 +03:00
|
|
|
|
|
|
|
pc_start = tb->pc;
|
|
|
|
gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;
|
2007-10-27 21:54:30 +04:00
|
|
|
#if defined(OPTIMIZE_FPRF_UPDATE)
|
|
|
|
gen_fprf_ptr = gen_fprf_buf;
|
|
|
|
#endif
|
2004-04-26 01:15:35 +04:00
|
|
|
ctx.nip = pc_start;
|
2003-11-23 17:55:54 +03:00
|
|
|
ctx.tb = tb;
|
2007-09-29 17:06:16 +04:00
|
|
|
ctx.exception = POWERPC_EXCP_NONE;
|
2005-07-03 00:59:34 +04:00
|
|
|
ctx.spr_cb = env->spr_cb;
|
2007-10-14 11:07:08 +04:00
|
|
|
supervisor = env->mmu_idx;
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
2007-10-02 14:11:50 +04:00
|
|
|
ctx.supervisor = supervisor;
|
2007-03-17 17:02:15 +03:00
|
|
|
#endif
|
2007-11-04 05:55:33 +03:00
|
|
|
little_endian = env->hflags & (1 << MSR_LE) ? 1 : 0;
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(TARGET_PPC64)
|
|
|
|
ctx.sf_mode = msr_sf;
|
2007-11-04 05:55:33 +03:00
|
|
|
ctx.mem_idx = (supervisor << 2) | (msr_sf << 1) | little_endian;
|
2007-10-02 14:11:50 +04:00
|
|
|
#else
|
2007-11-04 05:55:33 +03:00
|
|
|
ctx.mem_idx = (supervisor << 1) | little_endian;
|
2004-01-05 01:58:38 +03:00
|
|
|
#endif
|
2007-10-04 04:51:58 +04:00
|
|
|
ctx.dcache_line_size = env->dcache_line_size;
|
2005-02-16 02:06:19 +03:00
|
|
|
ctx.fpu_enabled = msr_fp;
|
2007-10-07 22:19:26 +04:00
|
|
|
if ((env->flags & POWERPC_FLAG_SPE) && msr_spe)
|
2007-10-07 18:41:00 +04:00
|
|
|
ctx.spe_enabled = msr_spe;
|
|
|
|
else
|
|
|
|
ctx.spe_enabled = 0;
|
2007-10-07 22:19:26 +04:00
|
|
|
if ((env->flags & POWERPC_FLAG_VRE) && msr_vr)
|
|
|
|
ctx.altivec_enabled = msr_vr;
|
|
|
|
else
|
|
|
|
ctx.altivec_enabled = 0;
|
2007-10-07 18:41:00 +04:00
|
|
|
if ((env->flags & POWERPC_FLAG_SE) && msr_se)
|
2008-05-11 03:28:14 +04:00
|
|
|
ctx.singlestep_enabled = CPU_SINGLE_STEP;
|
2007-10-07 18:41:00 +04:00
|
|
|
else
|
2008-05-11 03:28:14 +04:00
|
|
|
ctx.singlestep_enabled = 0;
|
2007-10-07 18:41:00 +04:00
|
|
|
if ((env->flags & POWERPC_FLAG_BE) && msr_be)
|
2008-05-11 03:28:14 +04:00
|
|
|
ctx.singlestep_enabled |= CPU_BRANCH_STEP;
|
|
|
|
if (unlikely(env->singlestep_enabled))
|
|
|
|
ctx.singlestep_enabled |= GDBSTUB_SINGLE_STEP;
|
2005-07-03 00:59:34 +04:00
|
|
|
#if defined (DO_SINGLE_STEP) && 0
|
2004-01-05 01:58:38 +03:00
|
|
|
/* Single step trace mode */
|
|
|
|
msr_se = 1;
|
|
|
|
#endif
|
2008-06-29 05:03:05 +04:00
|
|
|
num_insns = 0;
|
|
|
|
max_insns = tb->cflags & CF_COUNT_MASK;
|
|
|
|
if (max_insns == 0)
|
|
|
|
max_insns = CF_COUNT_MASK;
|
|
|
|
|
|
|
|
gen_icount_start();
|
2004-01-05 01:58:38 +03:00
|
|
|
/* Set env in case of segfault during code fetch */
|
2007-09-29 17:06:16 +04:00
|
|
|
while (ctx.exception == POWERPC_EXCP_NONE && gen_opc_ptr < gen_opc_end) {
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(env->nb_breakpoints > 0)) {
|
|
|
|
for (j = 0; j < env->nb_breakpoints; j++) {
|
2006-05-23 01:50:20 +04:00
|
|
|
if (env->breakpoints[j] == ctx.nip) {
|
2007-09-17 01:08:06 +04:00
|
|
|
gen_update_nip(&ctx, ctx.nip);
|
2006-05-23 01:50:20 +04:00
|
|
|
gen_op_debug();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(search_pc)) {
|
2003-11-23 17:55:54 +03:00
|
|
|
j = gen_opc_ptr - gen_opc_buf;
|
|
|
|
if (lj < j) {
|
|
|
|
lj++;
|
|
|
|
while (lj < j)
|
|
|
|
gen_opc_instr_start[lj++] = 0;
|
2004-04-26 01:15:35 +04:00
|
|
|
gen_opc_pc[lj] = ctx.nip;
|
2003-11-23 17:55:54 +03:00
|
|
|
gen_opc_instr_start[lj] = 1;
|
2008-06-29 05:03:05 +04:00
|
|
|
gen_opc_icount[lj] = num_insns;
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
}
|
2004-05-21 16:59:32 +04:00
|
|
|
#if defined PPC_DEBUG_DISAS
|
|
|
|
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
2003-11-23 17:55:54 +03:00
|
|
|
fprintf(logfile, "----------------\n");
|
2007-03-23 12:40:22 +03:00
|
|
|
fprintf(logfile, "nip=" ADDRX " super=%d ir=%d\n",
|
2007-10-26 01:35:50 +04:00
|
|
|
ctx.nip, supervisor, (int)msr_ir);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
|
|
|
#endif
|
2008-06-29 05:03:05 +04:00
|
|
|
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
|
|
|
|
gen_io_start();
|
2007-11-04 05:55:33 +03:00
|
|
|
if (unlikely(little_endian)) {
|
|
|
|
ctx.opcode = bswap32(ldl_code(ctx.nip));
|
|
|
|
} else {
|
|
|
|
ctx.opcode = ldl_code(ctx.nip);
|
2005-04-23 22:16:07 +04:00
|
|
|
}
|
2004-05-21 16:59:32 +04:00
|
|
|
#if defined PPC_DEBUG_DISAS
|
|
|
|
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
2005-04-23 22:16:07 +04:00
|
|
|
fprintf(logfile, "translate opcode %08x (%02x %02x %02x) (%s)\n",
|
2004-01-05 01:58:38 +03:00
|
|
|
ctx.opcode, opc1(ctx.opcode), opc2(ctx.opcode),
|
2007-11-04 05:55:33 +03:00
|
|
|
opc3(ctx.opcode), little_endian ? "little" : "big");
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
#endif
|
2004-04-26 01:15:35 +04:00
|
|
|
ctx.nip += 4;
|
2005-07-03 00:59:34 +04:00
|
|
|
table = env->opcodes;
|
2008-06-29 05:03:05 +04:00
|
|
|
num_insns++;
|
2003-11-23 17:55:54 +03:00
|
|
|
handler = table[opc1(ctx.opcode)];
|
|
|
|
if (is_indirect_opcode(handler)) {
|
|
|
|
table = ind_table(handler);
|
|
|
|
handler = table[opc2(ctx.opcode)];
|
|
|
|
if (is_indirect_opcode(handler)) {
|
|
|
|
table = ind_table(handler);
|
|
|
|
handler = table[opc3(ctx.opcode)];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Is opcode *REALLY* valid ? */
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(handler->handler == &gen_invalid)) {
|
2007-04-19 12:42:21 +04:00
|
|
|
if (loglevel != 0) {
|
2007-03-07 11:32:30 +03:00
|
|
|
fprintf(logfile, "invalid/unsupported opcode: "
|
2007-11-24 05:03:55 +03:00
|
|
|
"%02x - %02x - %02x (%08x) " ADDRX " %d\n",
|
2007-03-07 11:32:30 +03:00
|
|
|
opc1(ctx.opcode), opc2(ctx.opcode),
|
2007-10-26 01:35:50 +04:00
|
|
|
opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, (int)msr_ir);
|
2004-05-24 02:18:12 +04:00
|
|
|
} else {
|
|
|
|
printf("invalid/unsupported opcode: "
|
2007-11-24 05:03:55 +03:00
|
|
|
"%02x - %02x - %02x (%08x) " ADDRX " %d\n",
|
2004-05-24 02:18:12 +04:00
|
|
|
opc1(ctx.opcode), opc2(ctx.opcode),
|
2007-10-26 01:35:50 +04:00
|
|
|
opc3(ctx.opcode), ctx.opcode, ctx.nip - 4, (int)msr_ir);
|
2004-05-24 02:18:12 +04:00
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
} else {
|
|
|
|
if (unlikely((ctx.opcode & handler->inval) != 0)) {
|
2007-04-19 12:42:21 +04:00
|
|
|
if (loglevel != 0) {
|
2003-11-23 17:55:54 +03:00
|
|
|
fprintf(logfile, "invalid bits: %08x for opcode: "
|
2007-11-24 05:03:55 +03:00
|
|
|
"%02x - %02x - %02x (%08x) " ADDRX "\n",
|
2003-11-23 17:55:54 +03:00
|
|
|
ctx.opcode & handler->inval, opc1(ctx.opcode),
|
|
|
|
opc2(ctx.opcode), opc3(ctx.opcode),
|
2004-04-26 01:15:35 +04:00
|
|
|
ctx.opcode, ctx.nip - 4);
|
2004-01-05 01:58:38 +03:00
|
|
|
} else {
|
|
|
|
printf("invalid bits: %08x for opcode: "
|
2007-11-24 05:03:55 +03:00
|
|
|
"%02x - %02x - %02x (%08x) " ADDRX "\n",
|
2007-03-07 11:32:30 +03:00
|
|
|
ctx.opcode & handler->inval, opc1(ctx.opcode),
|
|
|
|
opc2(ctx.opcode), opc3(ctx.opcode),
|
2004-04-26 01:15:35 +04:00
|
|
|
ctx.opcode, ctx.nip - 4);
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP_INVAL(ctxp);
|
2004-05-24 02:18:12 +04:00
|
|
|
break;
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
}
|
2004-05-24 02:18:12 +04:00
|
|
|
(*(handler->handler))(&ctx);
|
2007-03-07 11:32:30 +03:00
|
|
|
#if defined(DO_PPC_STATISTICS)
|
|
|
|
handler->count++;
|
|
|
|
#endif
|
2004-01-05 01:58:38 +03:00
|
|
|
/* Check trace mode exceptions */
|
2008-05-11 03:28:14 +04:00
|
|
|
if (unlikely(ctx.singlestep_enabled & CPU_SINGLE_STEP &&
|
|
|
|
(ctx.nip <= 0x100 || ctx.nip > 0xF00) &&
|
|
|
|
ctx.exception != POWERPC_SYSCALL &&
|
|
|
|
ctx.exception != POWERPC_EXCP_TRAP &&
|
|
|
|
ctx.exception != POWERPC_EXCP_BRANCH)) {
|
2007-09-29 17:06:16 +04:00
|
|
|
GEN_EXCP(ctxp, POWERPC_EXCP_TRACE, 0);
|
2007-10-07 18:41:00 +04:00
|
|
|
} else if (unlikely(((ctx.nip & (TARGET_PAGE_SIZE - 1)) == 0) ||
|
2008-06-29 05:03:05 +04:00
|
|
|
(env->singlestep_enabled) ||
|
|
|
|
num_insns >= max_insns)) {
|
2007-10-07 18:41:00 +04:00
|
|
|
/* if we reach a page boundary or are single stepping, stop
|
|
|
|
* generation
|
|
|
|
*/
|
2005-06-05 02:22:27 +04:00
|
|
|
break;
|
2007-03-07 11:32:30 +03:00
|
|
|
}
|
2005-07-03 00:59:34 +04:00
|
|
|
#if defined (DO_SINGLE_STEP)
|
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
}
|
2008-06-29 05:03:05 +04:00
|
|
|
if (tb->cflags & CF_LAST_IO)
|
|
|
|
gen_io_end();
|
2007-09-29 17:06:16 +04:00
|
|
|
if (ctx.exception == POWERPC_EXCP_NONE) {
|
2005-11-20 13:31:08 +03:00
|
|
|
gen_goto_tb(&ctx, 0, ctx.nip);
|
2007-09-29 17:06:16 +04:00
|
|
|
} else if (ctx.exception != POWERPC_EXCP_BRANCH) {
|
2008-05-11 03:28:14 +04:00
|
|
|
if (unlikely(env->singlestep_enabled)) {
|
|
|
|
gen_update_nip(&ctx, ctx.nip);
|
|
|
|
gen_op_debug();
|
|
|
|
}
|
2007-03-07 11:32:30 +03:00
|
|
|
/* Generate the return instruction */
|
2008-02-01 13:50:11 +03:00
|
|
|
tcg_gen_exit_tb(0);
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2008-06-29 05:03:05 +04:00
|
|
|
gen_icount_end(tb, num_insns);
|
2003-11-23 17:55:54 +03:00
|
|
|
*gen_opc_ptr = INDEX_op_end;
|
2007-03-07 11:32:30 +03:00
|
|
|
if (unlikely(search_pc)) {
|
2004-01-05 01:58:38 +03:00
|
|
|
j = gen_opc_ptr - gen_opc_buf;
|
|
|
|
lj++;
|
|
|
|
while (lj <= j)
|
|
|
|
gen_opc_instr_start[lj++] = 0;
|
|
|
|
} else {
|
2004-04-26 01:15:35 +04:00
|
|
|
tb->size = ctx.nip - pc_start;
|
2008-06-29 05:03:05 +04:00
|
|
|
tb->icount = num_insns;
|
2004-01-05 01:58:38 +03:00
|
|
|
}
|
2007-03-17 17:02:15 +03:00
|
|
|
#if defined(DEBUG_DISAS)
|
2004-05-21 16:59:32 +04:00
|
|
|
if (loglevel & CPU_LOG_TB_CPU) {
|
2004-01-05 01:58:38 +03:00
|
|
|
fprintf(logfile, "---------------- excp: %04x\n", ctx.exception);
|
2004-10-09 22:08:01 +04:00
|
|
|
cpu_dump_state(env, logfile, fprintf, 0);
|
2004-05-21 16:59:32 +04:00
|
|
|
}
|
|
|
|
if (loglevel & CPU_LOG_TB_IN_ASM) {
|
2007-03-07 11:32:30 +03:00
|
|
|
int flags;
|
2007-09-29 16:01:46 +04:00
|
|
|
flags = env->bfd_mach;
|
2007-11-04 05:55:33 +03:00
|
|
|
flags |= little_endian << 16;
|
2005-01-04 02:43:32 +03:00
|
|
|
fprintf(logfile, "IN: %s\n", lookup_symbol(pc_start));
|
2007-03-07 11:32:30 +03:00
|
|
|
target_disas(logfile, pc_start, ctx.nip - pc_start, flags);
|
2003-11-23 17:55:54 +03:00
|
|
|
fprintf(logfile, "\n");
|
2004-05-21 16:59:32 +04:00
|
|
|
}
|
2003-11-23 17:55:54 +03:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2008-07-18 22:01:29 +04:00
|
|
|
void gen_intermediate_code (CPUState *env, struct TranslationBlock *tb)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2008-07-18 22:01:29 +04:00
|
|
|
gen_intermediate_code_internal(env, tb, 0);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
|
|
|
|
2008-07-18 22:01:29 +04:00
|
|
|
void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
|
2003-11-23 17:55:54 +03:00
|
|
|
{
|
2008-07-18 22:01:29 +04:00
|
|
|
gen_intermediate_code_internal(env, tb, 1);
|
2003-11-23 17:55:54 +03:00
|
|
|
}
|
2008-04-28 04:32:32 +04:00
|
|
|
|
|
|
|
void gen_pc_load(CPUState *env, TranslationBlock *tb,
|
|
|
|
unsigned long searched_pc, int pc_pos, void *puc)
|
|
|
|
{
|
|
|
|
int type, c;
|
|
|
|
/* for PPC, we need to look at the micro operation to get the
|
|
|
|
* access type */
|
|
|
|
env->nip = gen_opc_pc[pc_pos];
|
|
|
|
c = gen_opc_buf[pc_pos];
|
|
|
|
switch(c) {
|
|
|
|
#if defined(CONFIG_USER_ONLY)
|
|
|
|
#define CASE3(op)\
|
|
|
|
case INDEX_op_ ## op ## _raw
|
|
|
|
#else
|
|
|
|
#define CASE3(op)\
|
|
|
|
case INDEX_op_ ## op ## _user:\
|
|
|
|
case INDEX_op_ ## op ## _kernel:\
|
|
|
|
case INDEX_op_ ## op ## _hypv
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CASE3(stfd):
|
|
|
|
CASE3(stfs):
|
|
|
|
CASE3(lfd):
|
|
|
|
CASE3(lfs):
|
|
|
|
type = ACCESS_FLOAT;
|
|
|
|
break;
|
|
|
|
CASE3(lwarx):
|
|
|
|
type = ACCESS_RES;
|
|
|
|
break;
|
|
|
|
CASE3(stwcx):
|
|
|
|
type = ACCESS_RES;
|
|
|
|
break;
|
|
|
|
CASE3(eciwx):
|
|
|
|
CASE3(ecowx):
|
|
|
|
type = ACCESS_EXT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
type = ACCESS_INT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
env->access_type = type;
|
|
|
|
}
|