2005-07-02 18:58:51 +04:00
|
|
|
/*
|
|
|
|
* MIPS emulation micro-operations for qemu.
|
2007-09-17 01:08:06 +04:00
|
|
|
*
|
2005-07-02 18:58:51 +04:00
|
|
|
* Copyright (c) 2004-2005 Jocelyn Mayer
|
2006-06-14 16:56:19 +04:00
|
|
|
* Copyright (c) 2006 Marius Groeger (FPU operations)
|
2007-05-20 05:36:29 +04:00
|
|
|
* Copyright (c) 2007 Thiemo Seufer (64-bit FPU support)
|
2005-07-02 18:58:51 +04: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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "exec.h"
|
2007-10-27 17:05:54 +04:00
|
|
|
#include "host-utils.h"
|
2005-07-02 18:58:51 +04:00
|
|
|
|
2005-07-02 19:39:04 +04:00
|
|
|
#ifndef CALL_FROM_TB0
|
2007-05-07 17:55:33 +04:00
|
|
|
#define CALL_FROM_TB0(func) func()
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB1
|
2007-05-07 17:55:33 +04:00
|
|
|
#define CALL_FROM_TB1(func, arg0) func(arg0)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB1_CONST16
|
2007-05-07 17:55:33 +04:00
|
|
|
#define CALL_FROM_TB1_CONST16(func, arg0) CALL_FROM_TB1(func, arg0)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB2
|
2007-05-07 17:55:33 +04:00
|
|
|
#define CALL_FROM_TB2(func, arg0, arg1) func(arg0, arg1)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB2_CONST16
|
|
|
|
#define CALL_FROM_TB2_CONST16(func, arg0, arg1) \
|
2007-05-07 17:55:33 +04:00
|
|
|
CALL_FROM_TB2(func, arg0, arg1)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB3
|
2007-05-07 17:55:33 +04:00
|
|
|
#define CALL_FROM_TB3(func, arg0, arg1, arg2) func(arg0, arg1, arg2)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
#ifndef CALL_FROM_TB4
|
|
|
|
#define CALL_FROM_TB4(func, arg0, arg1, arg2, arg3) \
|
2007-05-07 17:55:33 +04:00
|
|
|
func(arg0, arg1, arg2, arg3)
|
2005-07-02 19:39:04 +04:00
|
|
|
#endif
|
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
#define FREG 0
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 1
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 2
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 3
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 4
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 5
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 6
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 7
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 8
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 9
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 10
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 11
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 12
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 13
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 14
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 15
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 16
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 17
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 18
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 19
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 20
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 21
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 22
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 23
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 24
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 25
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 26
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 27
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 28
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 29
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 30
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
|
|
|
#define FREG 31
|
2006-06-14 16:56:19 +04:00
|
|
|
#include "fop_template.c"
|
2007-05-07 17:55:33 +04:00
|
|
|
#undef FREG
|
2006-06-14 16:56:19 +04:00
|
|
|
|
2005-07-02 18:58:51 +04:00
|
|
|
/* Load and store */
|
|
|
|
#define MEMSUFFIX _raw
|
|
|
|
#include "op_mem.c"
|
|
|
|
#undef MEMSUFFIX
|
|
|
|
#if !defined(CONFIG_USER_ONLY)
|
|
|
|
#define MEMSUFFIX _user
|
|
|
|
#include "op_mem.c"
|
|
|
|
#undef MEMSUFFIX
|
|
|
|
|
2007-10-28 22:45:05 +03:00
|
|
|
#define MEMSUFFIX _super
|
|
|
|
#include "op_mem.c"
|
|
|
|
#undef MEMSUFFIX
|
|
|
|
|
2005-07-02 18:58:51 +04:00
|
|
|
#define MEMSUFFIX _kernel
|
|
|
|
#include "op_mem.c"
|
|
|
|
#undef MEMSUFFIX
|
|
|
|
#endif
|
|
|
|
|
2006-12-21 04:19:56 +03:00
|
|
|
/* 64 bits arithmetic */
|
|
|
|
#if TARGET_LONG_BITS > HOST_LONG_BITS
|
2005-07-02 18:58:51 +04:00
|
|
|
void op_mult (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mult);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_multu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_multu);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_madd (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_madd);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_maddu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_maddu);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_msub (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msub);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_msubu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msubu);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
2006-12-21 04:19:56 +03:00
|
|
|
|
2007-12-25 23:46:56 +03:00
|
|
|
/* Multiplication variants of the vr54xx. */
|
|
|
|
void op_muls (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_muls);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulsu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mulsu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_macc (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_macc);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_macchi (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_macchi);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_maccu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_maccu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
void op_macchiu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_macchiu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msac (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msac);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msachi (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msachi);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msacu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msacu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msachiu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_msachiu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulhi (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mulhi);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulhiu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mulhiu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulshi (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mulshi);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulshiu (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mulshiu);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
2006-12-21 04:19:56 +03:00
|
|
|
#else /* TARGET_LONG_BITS > HOST_LONG_BITS */
|
|
|
|
|
2007-10-09 07:39:58 +04:00
|
|
|
static always_inline uint64_t get_HILO (void)
|
2006-12-21 04:19:56 +03:00
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
return ((uint64_t)env->HI[env->current_tc][0] << 32) |
|
|
|
|
((uint64_t)(uint32_t)env->LO[env->current_tc][0]);
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
2007-10-09 07:39:58 +04:00
|
|
|
static always_inline void set_HILO (uint64_t HILO)
|
2006-12-21 04:19:56 +03:00
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
|
|
|
|
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
2007-12-25 23:46:56 +03:00
|
|
|
static always_inline void set_HIT0_LO (uint64_t HILO)
|
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
|
|
|
|
T0 = env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
|
2007-12-25 23:46:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static always_inline void set_HI_LOT0 (uint64_t HILO)
|
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
T0 = env->LO[env->current_tc][0] = (int32_t)(HILO & 0xFFFFFFFF);
|
|
|
|
env->HI[env->current_tc][0] = (int32_t)(HILO >> 32);
|
2007-12-25 23:46:56 +03:00
|
|
|
}
|
|
|
|
|
2006-12-21 04:19:56 +03:00
|
|
|
void op_mult (void)
|
|
|
|
{
|
|
|
|
set_HILO((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_multu (void)
|
|
|
|
{
|
|
|
|
set_HILO((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_madd (void)
|
|
|
|
{
|
|
|
|
int64_t tmp;
|
|
|
|
|
|
|
|
tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
|
|
|
|
set_HILO((int64_t)get_HILO() + tmp);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_maddu (void)
|
|
|
|
{
|
|
|
|
uint64_t tmp;
|
|
|
|
|
|
|
|
tmp = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1);
|
|
|
|
set_HILO(get_HILO() + tmp);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_msub (void)
|
|
|
|
{
|
|
|
|
int64_t tmp;
|
|
|
|
|
|
|
|
tmp = ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
|
|
|
|
set_HILO((int64_t)get_HILO() - tmp);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_msubu (void)
|
|
|
|
{
|
|
|
|
uint64_t tmp;
|
|
|
|
|
|
|
|
tmp = ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1);
|
|
|
|
set_HILO(get_HILO() - tmp);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
2007-12-25 23:46:56 +03:00
|
|
|
|
|
|
|
/* Multiplication variants of the vr54xx. */
|
|
|
|
void op_muls (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(0 - ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulsu (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(0 - ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_macc (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(get_HILO() + ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_macchi (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(get_HILO() + ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_maccu (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(get_HILO() + ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_macchiu (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(get_HILO() + ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msac (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(get_HILO() - ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msachi (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(get_HILO() - ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msacu (void)
|
|
|
|
{
|
|
|
|
set_HI_LOT0(get_HILO() - ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_msachiu (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(get_HILO() - ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulhi (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulhiu (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1);
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulshi (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(0 - ((int64_t)(int32_t)T0 * (int64_t)(int32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
|
|
|
void op_mulshiu (void)
|
|
|
|
{
|
|
|
|
set_HIT0_LO(0 - ((uint64_t)(uint32_t)T0 * (uint64_t)(uint32_t)T1));
|
|
|
|
FORCE_RET();
|
|
|
|
}
|
|
|
|
|
2006-12-21 04:19:56 +03:00
|
|
|
#endif /* TARGET_LONG_BITS > HOST_LONG_BITS */
|
|
|
|
|
2007-11-08 21:05:37 +03:00
|
|
|
#if defined(TARGET_MIPS64)
|
2006-12-21 04:19:56 +03:00
|
|
|
void op_dmult (void)
|
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
CALL_FROM_TB4(muls64, &(env->LO[env->current_tc][0]), &(env->HI[env->current_tc][0]), T0, T1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmultu (void)
|
|
|
|
{
|
2008-02-13 00:01:26 +03:00
|
|
|
CALL_FROM_TB4(mulu64, &(env->LO[env->current_tc][0]), &(env->HI[env->current_tc][0]), T0, T1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
2005-07-02 18:58:51 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* CP0 functions */
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_index (void)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Index;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mfc0_mvpcontrol (void)
|
|
|
|
{
|
|
|
|
T0 = env->mvp->CP0_MVPControl;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_mvpconf0 (void)
|
|
|
|
{
|
|
|
|
T0 = env->mvp->CP0_MVPConf0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_mvpconf1 (void)
|
|
|
|
{
|
|
|
|
T0 = env->mvp->CP0_MVPConf1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_random (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mfc0_random);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mfc0_vpecontrol (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEControl;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_vpeconf0 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEConf0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_vpeconf1 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEConf1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_yqmask (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_YQMask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_vpeschedule (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPESchedule;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_vpeschefback (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEScheFBack;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_vpeopt (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEOpt;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_entrylo0 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_EntryLo0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mfc0_tcstatus (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCStatus[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tcstatus(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCStatus[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tcbind (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCBind[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tcbind(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCBind[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tcrestart (void)
|
|
|
|
{
|
|
|
|
T0 = env->PC[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tcrestart(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->PC[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tchalt (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCHalt[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tchalt(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCHalt[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tccontext (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCContext[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tccontext(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCContext[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tcschedule (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCSchedule[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tcschedule(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCSchedule[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_tcschefback (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCScheFBack[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftc0_tcschefback(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->CP0_TCScheFBack[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_entrylo1 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_EntryLo1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_context (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_Context;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_pagemask (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_PageMask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_pagegrain (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_PageGrain;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_wired (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Wired;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mfc0_srsconf0 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSConf0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsconf1 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSConf1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsconf2 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSConf2;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsconf3 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSConf3;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsconf4 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSConf4;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_hwrena (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_HWREna;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_badvaddr (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_BadVAddr;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_count (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB0(do_mfc0_count);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_entryhi (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_EntryHi;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mftc0_entryhi(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = (env->CP0_EntryHi & ~0xff) | (env->CP0_TCStatus[other_tc] & 0xff);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_compare (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Compare;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_status (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Status;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mftc0_status(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
uint32_t tcstatus = env->CP0_TCStatus[other_tc];
|
|
|
|
|
|
|
|
T0 = env->CP0_Status & ~0xf1000018;
|
|
|
|
T0 |= tcstatus & (0xf << CP0TCSt_TCU0);
|
|
|
|
T0 |= (tcstatus & (1 << CP0TCSt_TMX)) >> (CP0TCSt_TMX - CP0St_MX);
|
2007-10-28 22:45:05 +03:00
|
|
|
T0 |= (tcstatus & (0x3 << CP0TCSt_TKSU)) >> (CP0TCSt_TKSU - CP0St_KSU);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_intctl (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_IntCtl;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsctl (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_SRSCtl;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_srsmap (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_SRSMap;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_cause (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Cause;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_epc (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_EPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_prid (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_PRid;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_ebase (void)
|
|
|
|
{
|
2007-01-24 21:01:23 +03:00
|
|
|
T0 = env->CP0_EBase;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_config0 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Config0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_config1 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Config1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_config2 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Config2;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_config3 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Config3;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2007-03-23 03:43:28 +03:00
|
|
|
void op_mfc0_config6 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Config6;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-03-23 03:43:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_config7 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Config7;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-03-23 03:43:28 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_lladdr (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_LLAddr >> 4;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 12:24:25 +04:00
|
|
|
void op_mfc0_watchlo (void)
|
2006-12-06 20:59:07 +03:00
|
|
|
{
|
2007-05-23 12:24:25 +04:00
|
|
|
T0 = (int32_t)env->CP0_WatchLo[PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 12:24:25 +04:00
|
|
|
void op_mfc0_watchhi (void)
|
2006-12-06 20:59:07 +03:00
|
|
|
{
|
2007-05-23 12:24:25 +04:00
|
|
|
T0 = env->CP0_WatchHi[PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_xcontext (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_XContext;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_framemask (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Framemask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_debug (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Debug;
|
2006-12-06 20:59:07 +03:00
|
|
|
if (env->hflags & MIPS_HFLAG_DM)
|
|
|
|
T0 |= 1 << CP0DB_DM;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mftc0_debug(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
/* XXX: Might be wrong, check with EJTAG spec. */
|
|
|
|
T0 = (env->CP0_Debug & ~((1 << CP0DB_SSt) | (1 << CP0DB_Halt))) |
|
|
|
|
(env->CP0_Debug_tcstatus[other_tc] &
|
|
|
|
((1 << CP0DB_SSt) | (1 << CP0DB_Halt)));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_depc (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_DEPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_performance0 (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_Performance0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_taglo (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_TagLo;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_datalo (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_DataLo;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mfc0_taghi (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_TagHi;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_datahi (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_DataHi;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 20:59:07 +03:00
|
|
|
void op_mfc0_errorepc (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = (int32_t)env->CP0_ErrorEPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 20:59:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc0_desave (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
T0 = env->CP0_DESAVE;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_index (void)
|
2005-07-02 18:58:51 +04:00
|
|
|
{
|
2007-10-24 03:58:21 +04:00
|
|
|
int num = 1;
|
|
|
|
unsigned int tmp = env->tlb->nb_tlb;
|
|
|
|
|
|
|
|
do {
|
|
|
|
tmp >>= 1;
|
|
|
|
num <<= 1;
|
|
|
|
} while (tmp);
|
|
|
|
env->CP0_Index = (env->CP0_Index & 0x80000000) | (T0 & (num - 1));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_mvpcontrol (void)
|
|
|
|
{
|
|
|
|
uint32_t mask = 0;
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
if (env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP))
|
|
|
|
mask |= (1 << CP0MVPCo_CPA) | (1 << CP0MVPCo_VPC) |
|
|
|
|
(1 << CP0MVPCo_EVP);
|
|
|
|
if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC))
|
|
|
|
mask |= (1 << CP0MVPCo_STLB);
|
|
|
|
newval = (env->mvp->CP0_MVPControl & ~mask) | (T0 & mask);
|
|
|
|
|
|
|
|
// TODO: Enable/disable shared TLB, enable/disable VPEs.
|
|
|
|
|
|
|
|
env->mvp->CP0_MVPControl = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpecontrol (void)
|
|
|
|
{
|
|
|
|
uint32_t mask;
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
mask = (1 << CP0VPECo_YSI) | (1 << CP0VPECo_GSI) |
|
|
|
|
(1 << CP0VPECo_TE) | (0xff << CP0VPECo_TargTC);
|
|
|
|
newval = (env->CP0_VPEControl & ~mask) | (T0 & mask);
|
|
|
|
|
|
|
|
/* Yield scheduler intercept not implemented. */
|
|
|
|
/* Gating storage scheduler intercept not implemented. */
|
|
|
|
|
|
|
|
// TODO: Enable/disable TCs.
|
|
|
|
|
|
|
|
env->CP0_VPEControl = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpeconf0 (void)
|
|
|
|
{
|
|
|
|
uint32_t mask = 0;
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
if (env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP)) {
|
|
|
|
if (env->CP0_VPEConf0 & (1 << CP0VPEC0_VPA))
|
|
|
|
mask |= (0xff << CP0VPEC0_XTC);
|
|
|
|
mask |= (1 << CP0VPEC0_MVP) | (1 << CP0VPEC0_VPA);
|
|
|
|
}
|
|
|
|
newval = (env->CP0_VPEConf0 & ~mask) | (T0 & mask);
|
|
|
|
|
|
|
|
// TODO: TC exclusive handling due to ERL/EXL.
|
|
|
|
|
|
|
|
env->CP0_VPEConf0 = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpeconf1 (void)
|
|
|
|
{
|
|
|
|
uint32_t mask = 0;
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC))
|
|
|
|
mask |= (0xff << CP0VPEC1_NCX) | (0xff << CP0VPEC1_NCP2) |
|
|
|
|
(0xff << CP0VPEC1_NCP1);
|
|
|
|
newval = (env->CP0_VPEConf1 & ~mask) | (T0 & mask);
|
|
|
|
|
|
|
|
/* UDI not implemented. */
|
|
|
|
/* CP2 not implemented. */
|
|
|
|
|
|
|
|
// TODO: Handle FPU (CP1) binding.
|
|
|
|
|
|
|
|
env->CP0_VPEConf1 = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_yqmask (void)
|
|
|
|
{
|
|
|
|
/* Yield qualifier inputs not implemented. */
|
|
|
|
env->CP0_YQMask = 0x00000000;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpeschedule (void)
|
|
|
|
{
|
|
|
|
env->CP0_VPESchedule = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpeschefback (void)
|
|
|
|
{
|
|
|
|
env->CP0_VPEScheFBack = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_vpeopt (void)
|
|
|
|
{
|
|
|
|
env->CP0_VPEOpt = T0 & 0x0000ffff;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_entrylo0 (void)
|
|
|
|
{
|
2007-12-25 06:13:56 +03:00
|
|
|
/* Large physaddr (PABITS) not implemented */
|
2006-12-06 23:17:30 +03:00
|
|
|
/* 1k pages not implemented */
|
2007-05-13 22:39:10 +04:00
|
|
|
env->CP0_EntryLo0 = T0 & 0x3FFFFFFF;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mtc0_tcstatus (void)
|
|
|
|
{
|
|
|
|
uint32_t mask = env->CP0_TCStatus_rw_bitmask;
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
newval = (env->CP0_TCStatus[env->current_tc] & ~mask) | (T0 & mask);
|
|
|
|
|
|
|
|
// TODO: Sync with CP0_Status.
|
|
|
|
|
|
|
|
env->CP0_TCStatus[env->current_tc] = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tcstatus (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
// TODO: Sync with CP0_Status.
|
|
|
|
|
|
|
|
env->CP0_TCStatus[other_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tcbind (void)
|
|
|
|
{
|
|
|
|
uint32_t mask = (1 << CP0TCBd_TBE);
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC))
|
|
|
|
mask |= (1 << CP0TCBd_CurVPE);
|
|
|
|
newval = (env->CP0_TCBind[env->current_tc] & ~mask) | (T0 & mask);
|
|
|
|
env->CP0_TCBind[env->current_tc] = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tcbind (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
uint32_t mask = (1 << CP0TCBd_TBE);
|
|
|
|
uint32_t newval;
|
|
|
|
|
|
|
|
if (env->mvp->CP0_MVPControl & (1 << CP0MVPCo_VPC))
|
|
|
|
mask |= (1 << CP0TCBd_CurVPE);
|
|
|
|
newval = (env->CP0_TCBind[other_tc] & ~mask) | (T0 & mask);
|
|
|
|
env->CP0_TCBind[other_tc] = newval;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tcrestart (void)
|
|
|
|
{
|
|
|
|
env->PC[env->current_tc] = T0;
|
|
|
|
env->CP0_TCStatus[env->current_tc] &= ~(1 << CP0TCSt_TDS);
|
|
|
|
env->CP0_LLAddr = 0ULL;
|
|
|
|
/* MIPS16 not implemented. */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tcrestart (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
env->PC[other_tc] = T0;
|
|
|
|
env->CP0_TCStatus[other_tc] &= ~(1 << CP0TCSt_TDS);
|
|
|
|
env->CP0_LLAddr = 0ULL;
|
|
|
|
/* MIPS16 not implemented. */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tchalt (void)
|
|
|
|
{
|
|
|
|
env->CP0_TCHalt[env->current_tc] = T0 & 0x1;
|
|
|
|
|
|
|
|
// TODO: Halt TC / Restart (if allocated+active) TC.
|
|
|
|
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tchalt (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
// TODO: Halt TC / Restart (if allocated+active) TC.
|
|
|
|
|
|
|
|
env->CP0_TCHalt[other_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tccontext (void)
|
|
|
|
{
|
|
|
|
env->CP0_TCContext[env->current_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tccontext (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
env->CP0_TCContext[other_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tcschedule (void)
|
|
|
|
{
|
|
|
|
env->CP0_TCSchedule[env->current_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tcschedule (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
env->CP0_TCSchedule[other_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_tcschefback (void)
|
|
|
|
{
|
|
|
|
env->CP0_TCScheFBack[env->current_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttc0_tcschefback (void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
env->CP0_TCScheFBack[other_tc] = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_entrylo1 (void)
|
|
|
|
{
|
2007-12-25 06:13:56 +03:00
|
|
|
/* Large physaddr (PABITS) not implemented */
|
2006-12-06 23:17:30 +03:00
|
|
|
/* 1k pages not implemented */
|
2007-05-13 22:39:10 +04:00
|
|
|
env->CP0_EntryLo1 = T0 & 0x3FFFFFFF;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_context (void)
|
|
|
|
{
|
2007-04-11 06:13:00 +04:00
|
|
|
env->CP0_Context = (env->CP0_Context & 0x007FFFFF) | (T0 & ~0x007FFFFF);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_pagemask (void)
|
|
|
|
{
|
2006-12-06 23:17:30 +03:00
|
|
|
/* 1k pages not implemented */
|
2007-05-13 18:07:26 +04:00
|
|
|
env->CP0_PageMask = T0 & (0x1FFFFFFF & (TARGET_PAGE_MASK << 1));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_pagegrain (void)
|
|
|
|
{
|
|
|
|
/* SmartMIPS not implemented */
|
2007-12-25 06:13:56 +03:00
|
|
|
/* Large physaddr (PABITS) not implemented */
|
2006-12-06 23:17:30 +03:00
|
|
|
/* 1k pages not implemented */
|
|
|
|
env->CP0_PageGrain = 0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_wired (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
env->CP0_Wired = T0 % env->tlb->nb_tlb;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsconf0 (void)
|
|
|
|
{
|
|
|
|
env->CP0_SRSConf0 |= T0 & env->CP0_SRSConf0_rw_bitmask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsconf1 (void)
|
|
|
|
{
|
|
|
|
env->CP0_SRSConf1 |= T0 & env->CP0_SRSConf1_rw_bitmask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsconf2 (void)
|
|
|
|
{
|
|
|
|
env->CP0_SRSConf2 |= T0 & env->CP0_SRSConf2_rw_bitmask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsconf3 (void)
|
|
|
|
{
|
|
|
|
env->CP0_SRSConf3 |= T0 & env->CP0_SRSConf3_rw_bitmask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsconf4 (void)
|
|
|
|
{
|
|
|
|
env->CP0_SRSConf4 |= T0 & env->CP0_SRSConf4_rw_bitmask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_hwrena (void)
|
|
|
|
{
|
|
|
|
env->CP0_HWREna = T0 & 0x0000000F;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_count (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB2(cpu_mips_store_count, env, T0);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_entryhi (void)
|
|
|
|
{
|
2007-01-01 23:35:21 +03:00
|
|
|
target_ulong old, val;
|
2006-12-06 21:19:33 +03:00
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
/* 1k pages not implemented */
|
2007-05-13 23:22:13 +04:00
|
|
|
val = T0 & ((TARGET_PAGE_MASK << 1) | 0xFF);
|
2007-11-08 21:05:37 +03:00
|
|
|
#if defined(TARGET_MIPS64)
|
2007-06-23 22:04:12 +04:00
|
|
|
val &= env->SEGMask;
|
2007-05-13 23:22:13 +04:00
|
|
|
#endif
|
2006-12-06 21:19:33 +03:00
|
|
|
old = env->CP0_EntryHi;
|
|
|
|
env->CP0_EntryHi = val;
|
2007-09-06 04:18:15 +04:00
|
|
|
if (env->CP0_Config3 & (1 << CP0C3_MT)) {
|
|
|
|
uint32_t tcst = env->CP0_TCStatus[env->current_tc] & ~0xff;
|
|
|
|
env->CP0_TCStatus[env->current_tc] = tcst | (val & 0xff);
|
|
|
|
}
|
2006-12-06 21:19:33 +03:00
|
|
|
/* If the ASID changes, flush qemu's TLB. */
|
|
|
|
if ((old & 0xFF) != (val & 0xFF))
|
|
|
|
CALL_FROM_TB2(cpu_mips_tlb_flush, env, 1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mttc0_entryhi(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
env->CP0_EntryHi = (env->CP0_EntryHi & 0xff) | (T0 & ~0xff);
|
|
|
|
env->CP0_TCStatus[other_tc] = (env->CP0_TCStatus[other_tc] & ~0xff) | (T0 & 0xff);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_compare (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB2(cpu_mips_store_compare, env, T0);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_status (void)
|
|
|
|
{
|
2007-01-24 04:47:51 +03:00
|
|
|
uint32_t val, old;
|
2007-09-06 04:18:15 +04:00
|
|
|
uint32_t mask = env->CP0_Status_rw_bitmask;
|
2006-12-06 21:19:33 +03:00
|
|
|
|
2007-05-13 22:39:10 +04:00
|
|
|
val = T0 & mask;
|
2006-12-06 21:19:33 +03:00
|
|
|
old = env->CP0_Status;
|
2007-05-07 17:55:33 +04:00
|
|
|
env->CP0_Status = (env->CP0_Status & ~mask) | val;
|
2007-09-27 03:52:06 +04:00
|
|
|
CALL_FROM_TB1(compute_hflags, env);
|
2007-04-06 22:46:01 +04:00
|
|
|
if (loglevel & CPU_LOG_EXEC)
|
|
|
|
CALL_FROM_TB2(do_mtc0_status_debug, old, val);
|
2007-01-24 04:47:51 +03:00
|
|
|
CALL_FROM_TB1(cpu_mips_update_irq, env);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mttc0_status(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
uint32_t tcstatus = env->CP0_TCStatus[other_tc];
|
|
|
|
|
|
|
|
env->CP0_Status = T0 & ~0xf1000018;
|
|
|
|
tcstatus = (tcstatus & ~(0xf << CP0TCSt_TCU0)) | (T0 & (0xf << CP0St_CU0));
|
|
|
|
tcstatus = (tcstatus & ~(1 << CP0TCSt_TMX)) | ((T0 & (1 << CP0St_MX)) << (CP0TCSt_TMX - CP0St_MX));
|
2007-10-28 22:45:05 +03:00
|
|
|
tcstatus = (tcstatus & ~(0x3 << CP0TCSt_TKSU)) | ((T0 & (0x3 << CP0St_KSU)) << (CP0TCSt_TKSU - CP0St_KSU));
|
2007-09-06 04:18:15 +04:00
|
|
|
env->CP0_TCStatus[other_tc] = tcstatus;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_intctl (void)
|
|
|
|
{
|
2007-09-25 20:53:15 +04:00
|
|
|
/* vectored interrupts not implemented, no performance counters. */
|
|
|
|
env->CP0_IntCtl = (env->CP0_IntCtl & ~0x000002e0) | (T0 & 0x000002e0);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_srsctl (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
uint32_t mask = (0xf << CP0SRSCtl_ESS) | (0xf << CP0SRSCtl_PSS);
|
|
|
|
env->CP0_SRSCtl = (env->CP0_SRSCtl & ~mask) | (T0 & mask);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2007-01-24 01:45:22 +03:00
|
|
|
void op_mtc0_srsmap (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
env->CP0_SRSMap = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_cause (void)
|
|
|
|
{
|
2007-03-18 15:43:40 +03:00
|
|
|
uint32_t mask = 0x00C00300;
|
2007-09-25 20:53:15 +04:00
|
|
|
uint32_t old = env->CP0_Cause;
|
2007-03-18 15:43:40 +03:00
|
|
|
|
2007-09-24 16:48:00 +04:00
|
|
|
if (env->insn_flags & ISA_MIPS32R2)
|
2007-03-18 15:43:40 +03:00
|
|
|
mask |= 1 << CP0Ca_DC;
|
|
|
|
|
2007-04-14 00:17:54 +04:00
|
|
|
env->CP0_Cause = (env->CP0_Cause & ~mask) | (T0 & mask);
|
2006-12-06 21:19:33 +03:00
|
|
|
|
2007-09-25 20:53:15 +04:00
|
|
|
if ((old ^ env->CP0_Cause) & (1 << CP0Ca_DC)) {
|
|
|
|
if (env->CP0_Cause & (1 << CP0Ca_DC))
|
|
|
|
CALL_FROM_TB1(cpu_mips_stop_count, env);
|
|
|
|
else
|
|
|
|
CALL_FROM_TB1(cpu_mips_start_count, env);
|
|
|
|
}
|
|
|
|
|
2007-01-24 04:47:51 +03:00
|
|
|
/* Handle the software interrupt as an hardware one, as they
|
|
|
|
are very similar */
|
|
|
|
if (T0 & CP0Ca_IP_mask) {
|
|
|
|
CALL_FROM_TB1(cpu_mips_update_irq, env);
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_epc (void)
|
|
|
|
{
|
2007-05-13 22:39:10 +04:00
|
|
|
env->CP0_EPC = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_ebase (void)
|
|
|
|
{
|
|
|
|
/* vectored interrupts not implemented */
|
|
|
|
/* Multi-CPU not implemented */
|
2007-01-24 21:01:23 +03:00
|
|
|
env->CP0_EBase = 0x80000000 | (T0 & 0x3FFFF000);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_config0 (void)
|
|
|
|
{
|
2007-06-22 15:50:17 +04:00
|
|
|
env->CP0_Config0 = (env->CP0_Config0 & 0x81FFFFF8) | (T0 & 0x00000007);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_config2 (void)
|
|
|
|
{
|
|
|
|
/* tertiary/secondary caches not implemented */
|
|
|
|
env->CP0_Config2 = (env->CP0_Config2 & 0x8FFF0FFF);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 12:24:25 +04:00
|
|
|
void op_mtc0_watchlo (void)
|
2006-12-06 21:19:33 +03:00
|
|
|
{
|
2007-04-09 18:15:41 +04:00
|
|
|
/* Watch exceptions for instructions, data loads, data stores
|
|
|
|
not implemented. */
|
2007-05-23 12:24:25 +04:00
|
|
|
env->CP0_WatchLo[PARAM1] = (T0 & ~0x7);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 12:24:25 +04:00
|
|
|
void op_mtc0_watchhi (void)
|
2006-12-06 21:19:33 +03:00
|
|
|
{
|
2007-05-23 12:24:25 +04:00
|
|
|
env->CP0_WatchHi[PARAM1] = (T0 & 0x40FF0FF8);
|
|
|
|
env->CP0_WatchHi[PARAM1] &= ~(env->CP0_WatchHi[PARAM1] & T0 & 0x7);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mtc0_xcontext (void)
|
|
|
|
{
|
|
|
|
target_ulong mask = (1ULL << (env->SEGBITS - 7)) - 1;
|
|
|
|
env->CP0_XContext = (env->CP0_XContext & mask) | (T0 & ~mask);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_framemask (void)
|
|
|
|
{
|
|
|
|
env->CP0_Framemask = T0; /* XXX */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_debug (void)
|
|
|
|
{
|
|
|
|
env->CP0_Debug = (env->CP0_Debug & 0x8C03FC1F) | (T0 & 0x13300120);
|
|
|
|
if (T0 & (1 << CP0DB_DM))
|
|
|
|
env->hflags |= MIPS_HFLAG_DM;
|
|
|
|
else
|
|
|
|
env->hflags &= ~MIPS_HFLAG_DM;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_mttc0_debug(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
/* XXX: Might be wrong, check with EJTAG spec. */
|
|
|
|
env->CP0_Debug_tcstatus[other_tc] = T0 & ((1 << CP0DB_SSt) | (1 << CP0DB_Halt));
|
|
|
|
env->CP0_Debug = (env->CP0_Debug & ((1 << CP0DB_SSt) | (1 << CP0DB_Halt))) |
|
|
|
|
(T0 & ~((1 << CP0DB_SSt) | (1 << CP0DB_Halt)));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_depc (void)
|
|
|
|
{
|
2007-05-13 22:39:10 +04:00
|
|
|
env->CP0_DEPC = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_performance0 (void)
|
|
|
|
{
|
2007-10-29 03:49:32 +03:00
|
|
|
env->CP0_Performance0 = T0 & 0x000007ff;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_taglo (void)
|
|
|
|
{
|
2007-01-24 01:45:22 +03:00
|
|
|
env->CP0_TagLo = T0 & 0xFFFFFCF6;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_mtc0_datalo (void)
|
|
|
|
{
|
|
|
|
env->CP0_DataLo = T0; /* XXX */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_taghi (void)
|
|
|
|
{
|
|
|
|
env->CP0_TagHi = T0; /* XXX */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_datahi (void)
|
|
|
|
{
|
|
|
|
env->CP0_DataHi = T0; /* XXX */
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 21:19:33 +03:00
|
|
|
void op_mtc0_errorepc (void)
|
|
|
|
{
|
2007-05-13 22:39:10 +04:00
|
|
|
env->CP0_ErrorEPC = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 21:19:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc0_desave (void)
|
|
|
|
{
|
|
|
|
env->CP0_DESAVE = T0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
2007-11-08 21:05:37 +03:00
|
|
|
#if defined(TARGET_MIPS64)
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_dmfc0_yqmask (void)
|
2007-05-13 22:39:10 +04:00
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = env->CP0_YQMask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_vpeschedule (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPESchedule;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_vpeschefback (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_VPEScheFBack;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-13 22:39:10 +04:00
|
|
|
}
|
|
|
|
|
2007-01-24 01:45:22 +03:00
|
|
|
void op_dmfc0_entrylo0 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_EntryLo0;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
void op_dmfc0_tcrestart (void)
|
|
|
|
{
|
|
|
|
T0 = env->PC[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_tchalt (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCHalt[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_tccontext (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCContext[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_tcschedule (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCSchedule[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_tcschefback (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_TCScheFBack[env->current_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2007-01-24 01:45:22 +03:00
|
|
|
void op_dmfc0_entrylo1 (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_EntryLo1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_context (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Context;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_badvaddr (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_BadVAddr;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_entryhi (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_EntryHi;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_epc (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_EPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_lladdr (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_LLAddr >> 4;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
2007-05-23 12:24:25 +04:00
|
|
|
void op_dmfc0_watchlo (void)
|
2007-01-24 01:45:22 +03:00
|
|
|
{
|
2007-05-23 12:24:25 +04:00
|
|
|
T0 = env->CP0_WatchLo[PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_xcontext (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_XContext;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_depc (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_DEPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmfc0_errorepc (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_ErrorEPC;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-01-24 01:45:22 +03:00
|
|
|
}
|
2007-11-08 21:05:37 +03:00
|
|
|
#endif /* TARGET_MIPS64 */
|
2007-01-24 01:45:22 +03:00
|
|
|
|
2007-09-06 04:18:15 +04:00
|
|
|
/* MIPS MT functions */
|
|
|
|
void op_mftgpr(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->gpr[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftlo(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->LO[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfthi(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->HI[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftacx(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->ACX[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mftdsp(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->DSPControl[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttgpr(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->gpr[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttlo(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->LO[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtthi(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->HI[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttacx(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
2008-05-03 15:06:59 +04:00
|
|
|
T0 = env->ACX[other_tc][PARAM1];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mttdsp(void)
|
|
|
|
{
|
|
|
|
int other_tc = env->CP0_VPEControl & (0xff << CP0VPECo_TargTC);
|
|
|
|
|
|
|
|
T0 = env->DSPControl[other_tc];
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void op_dmt(void)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
T0 = 0;
|
|
|
|
// rt = T0
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_emt(void)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
T0 = 0;
|
|
|
|
// rt = T0
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dvpe(void)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
T0 = 0;
|
|
|
|
// rt = T0
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_evpe(void)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
T0 = 0;
|
|
|
|
// rt = T0
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_fork(void)
|
|
|
|
{
|
|
|
|
// T0 = rt, T1 = rs
|
|
|
|
T0 = 0;
|
|
|
|
// TODO: store to TC register
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_yield(void)
|
|
|
|
{
|
|
|
|
if (T0 < 0) {
|
|
|
|
/* No scheduling policy implemented. */
|
|
|
|
if (T0 != -2) {
|
|
|
|
if (env->CP0_VPEControl & (1 << CP0VPECo_YSI) &&
|
|
|
|
env->CP0_TCStatus[env->current_tc] & (1 << CP0TCSt_DT)) {
|
|
|
|
env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);
|
|
|
|
env->CP0_VPEControl |= 4 << CP0VPECo_EXCPT;
|
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_THREAD);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (T0 == 0) {
|
|
|
|
if (0 /* TODO: TC underflow */) {
|
|
|
|
env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);
|
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_THREAD);
|
|
|
|
} else {
|
|
|
|
// TODO: Deallocate TC
|
|
|
|
}
|
|
|
|
} else if (T0 > 0) {
|
|
|
|
/* Yield qualifier inputs not implemented. */
|
|
|
|
env->CP0_VPEControl &= ~(0x7 << CP0VPECo_EXCPT);
|
|
|
|
env->CP0_VPEControl |= 2 << CP0VPECo_EXCPT;
|
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_THREAD);
|
|
|
|
}
|
|
|
|
T0 = env->CP0_YQMask;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-09-06 04:18:15 +04:00
|
|
|
}
|
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
/* CP1 functions */
|
2006-06-14 16:56:19 +04:00
|
|
|
#if 0
|
|
|
|
# define DEBUG_FPU_STATE() CALL_FROM_TB1(dump_fpu, env)
|
|
|
|
#else
|
|
|
|
# define DEBUG_FPU_STATE() do { } while(0)
|
|
|
|
#endif
|
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
void op_cfc1 (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB1(do_cfc1, PARAM1);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_ctc1 (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB1(do_ctc1, PARAM1);
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfc1 (void)
|
|
|
|
{
|
2007-10-24 04:10:32 +04:00
|
|
|
T0 = (int32_t)WT0;
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mtc1 (void)
|
|
|
|
{
|
|
|
|
WT0 = T0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
void op_dmfc1 (void)
|
|
|
|
{
|
|
|
|
T0 = DT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dmtc1 (void)
|
|
|
|
{
|
|
|
|
DT0 = T0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mfhc1 (void)
|
|
|
|
{
|
2007-10-24 04:10:32 +04:00
|
|
|
T0 = (int32_t)WTH0;
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_mthc1 (void)
|
|
|
|
{
|
|
|
|
WTH0 = T0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
2006-06-14 16:56:19 +04:00
|
|
|
/* Float support.
|
|
|
|
Single precition routines have a "s" suffix, double precision a
|
2007-05-07 17:55:33 +04:00
|
|
|
"d" suffix, 32bit integer "w", 64bit integer "l", paired singe "ps",
|
|
|
|
paired single lowwer "pl", paired single upper "pu". */
|
2006-06-14 16:56:19 +04:00
|
|
|
|
|
|
|
#define FLOAT_OP(name, p) void OPPROTO op_float_##name##_##p(void)
|
|
|
|
|
2006-10-24 01:25:11 +04:00
|
|
|
FLOAT_OP(cvtd, s)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtd_s);
|
2006-10-24 01:25:11 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-10-24 01:25:11 +04:00
|
|
|
}
|
2006-06-14 16:56:19 +04:00
|
|
|
FLOAT_OP(cvtd, w)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtd_w);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtd, l)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtd_l);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtl, d)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtl_d);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtl, s)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtl_s);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtps, s)
|
|
|
|
{
|
|
|
|
WT2 = WT0;
|
|
|
|
WTH2 = WT1;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtps, pw)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtps_pw);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtpw, ps)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtpw_ps);
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
2006-10-24 01:25:11 +04:00
|
|
|
FLOAT_OP(cvts, d)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvts_d);
|
2006-10-24 01:25:11 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-10-24 01:25:11 +04:00
|
|
|
}
|
2006-06-14 16:56:19 +04:00
|
|
|
FLOAT_OP(cvts, w)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvts_w);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvts, l)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvts_l);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvts, pl)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvts_pl);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvts, pu)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvts_pu);
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtw, s)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtw_s);
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(cvtw, d)
|
|
|
|
{
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_cvtw_d);
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
FLOAT_OP(pll, ps)
|
|
|
|
{
|
|
|
|
DT2 = ((uint64_t)WT0 << 32) | WT1;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(plu, ps)
|
|
|
|
{
|
|
|
|
DT2 = ((uint64_t)WT0 << 32) | WTH1;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(pul, ps)
|
|
|
|
{
|
|
|
|
DT2 = ((uint64_t)WTH0 << 32) | WT1;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(puu, ps)
|
|
|
|
{
|
|
|
|
DT2 = ((uint64_t)WTH0 << 32) | WTH1;
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
2007-05-18 15:55:54 +04:00
|
|
|
#define FLOAT_ROUNDOP(op, ttype, stype) \
|
|
|
|
FLOAT_OP(op ## ttype, stype) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB0(do_float_ ## op ## ttype ## _ ## stype); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
2007-05-18 15:55:54 +04:00
|
|
|
FLOAT_ROUNDOP(round, l, d)
|
|
|
|
FLOAT_ROUNDOP(round, l, s)
|
|
|
|
FLOAT_ROUNDOP(round, w, d)
|
|
|
|
FLOAT_ROUNDOP(round, w, s)
|
2006-06-14 16:56:19 +04:00
|
|
|
|
2007-05-18 15:55:54 +04:00
|
|
|
FLOAT_ROUNDOP(trunc, l, d)
|
|
|
|
FLOAT_ROUNDOP(trunc, l, s)
|
|
|
|
FLOAT_ROUNDOP(trunc, w, d)
|
|
|
|
FLOAT_ROUNDOP(trunc, w, s)
|
2006-06-14 16:56:19 +04:00
|
|
|
|
2007-05-18 15:55:54 +04:00
|
|
|
FLOAT_ROUNDOP(ceil, l, d)
|
|
|
|
FLOAT_ROUNDOP(ceil, l, s)
|
|
|
|
FLOAT_ROUNDOP(ceil, w, d)
|
|
|
|
FLOAT_ROUNDOP(ceil, w, s)
|
|
|
|
|
|
|
|
FLOAT_ROUNDOP(floor, l, d)
|
|
|
|
FLOAT_ROUNDOP(floor, l, s)
|
|
|
|
FLOAT_ROUNDOP(floor, w, d)
|
|
|
|
FLOAT_ROUNDOP(floor, w, s)
|
|
|
|
#undef FLOAR_ROUNDOP
|
2006-06-14 16:56:19 +04:00
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
FLOAT_OP(movf, d)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (!(env->fpu->fcr31 & PARAM1))
|
2007-05-07 17:55:33 +04:00
|
|
|
DT2 = DT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movf, s)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (!(env->fpu->fcr31 & PARAM1))
|
2007-05-07 17:55:33 +04:00
|
|
|
WT2 = WT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movf, ps)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (!(env->fpu->fcr31 & PARAM1)) {
|
2007-05-07 17:55:33 +04:00
|
|
|
WT2 = WT0;
|
|
|
|
WTH2 = WTH0;
|
|
|
|
}
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movt, d)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (env->fpu->fcr31 & PARAM1)
|
2007-05-07 17:55:33 +04:00
|
|
|
DT2 = DT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movt, s)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (env->fpu->fcr31 & PARAM1)
|
2007-05-07 17:55:33 +04:00
|
|
|
WT2 = WT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movt, ps)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
if (env->fpu->fcr31 & PARAM1) {
|
2007-05-07 17:55:33 +04:00
|
|
|
WT2 = WT0;
|
|
|
|
WTH2 = WTH0;
|
|
|
|
}
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movz, d)
|
|
|
|
{
|
|
|
|
if (!T0)
|
|
|
|
DT2 = DT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movz, s)
|
|
|
|
{
|
|
|
|
if (!T0)
|
|
|
|
WT2 = WT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movz, ps)
|
|
|
|
{
|
|
|
|
if (!T0) {
|
|
|
|
WT2 = WT0;
|
|
|
|
WTH2 = WTH0;
|
|
|
|
}
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movn, d)
|
|
|
|
{
|
|
|
|
if (T0)
|
|
|
|
DT2 = DT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movn, s)
|
|
|
|
{
|
|
|
|
if (T0)
|
|
|
|
WT2 = WT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(movn, ps)
|
|
|
|
{
|
|
|
|
if (T0) {
|
|
|
|
WT2 = WT0;
|
|
|
|
WTH2 = WTH0;
|
|
|
|
}
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
|
2007-05-20 00:29:41 +04:00
|
|
|
/* operations calling helpers, for s, d and ps */
|
2007-11-10 02:09:41 +03:00
|
|
|
#define FLOAT_HOP(name) \
|
2006-06-14 16:56:19 +04:00
|
|
|
FLOAT_OP(name, d) \
|
|
|
|
{ \
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _d); \
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, s) \
|
|
|
|
{ \
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _s); \
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-07 17:55:33 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, ps) \
|
|
|
|
{ \
|
2007-05-18 15:55:54 +04:00
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _ps); \
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
2007-05-20 00:29:41 +04:00
|
|
|
FLOAT_HOP(add)
|
|
|
|
FLOAT_HOP(sub)
|
|
|
|
FLOAT_HOP(mul)
|
|
|
|
FLOAT_HOP(div)
|
|
|
|
FLOAT_HOP(recip2)
|
|
|
|
FLOAT_HOP(rsqrt2)
|
|
|
|
FLOAT_HOP(rsqrt1)
|
|
|
|
FLOAT_HOP(recip1)
|
|
|
|
#undef FLOAT_HOP
|
|
|
|
|
|
|
|
/* operations calling helpers, for s and d */
|
|
|
|
#define FLOAT_HOP(name) \
|
|
|
|
FLOAT_OP(name, d) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _d); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-20 00:29:41 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, s) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _s); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-20 00:29:41 +04:00
|
|
|
}
|
|
|
|
FLOAT_HOP(rsqrt)
|
|
|
|
FLOAT_HOP(recip)
|
|
|
|
#undef FLOAT_HOP
|
2006-06-14 16:56:19 +04:00
|
|
|
|
2007-05-20 00:29:41 +04:00
|
|
|
/* operations calling helpers, for ps */
|
|
|
|
#define FLOAT_HOP(name) \
|
|
|
|
FLOAT_OP(name, ps) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB0(do_float_ ## name ## _ps); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-11 13:59:10 +04:00
|
|
|
}
|
2007-05-20 00:29:41 +04:00
|
|
|
FLOAT_HOP(addr)
|
|
|
|
FLOAT_HOP(mulr)
|
|
|
|
#undef FLOAT_HOP
|
2007-05-11 13:59:10 +04:00
|
|
|
|
2007-05-07 17:55:33 +04:00
|
|
|
/* ternary operations */
|
|
|
|
#define FLOAT_TERNOP(name1, name2) \
|
|
|
|
FLOAT_OP(name1 ## name2, d) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FDT0 = float64_ ## name1 (FDT0, FDT1, &env->fpu->fp_status); \
|
|
|
|
FDT2 = float64_ ## name2 (FDT0, FDT2, &env->fpu->fp_status); \
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-07 17:55:33 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name1 ## name2, s) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FST0 = float32_ ## name1 (FST0, FST1, &env->fpu->fp_status); \
|
|
|
|
FST2 = float32_ ## name2 (FST0, FST2, &env->fpu->fp_status); \
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-07 17:55:33 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name1 ## name2, ps) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FST0 = float32_ ## name1 (FST0, FST1, &env->fpu->fp_status); \
|
|
|
|
FSTH0 = float32_ ## name1 (FSTH0, FSTH1, &env->fpu->fp_status); \
|
|
|
|
FST2 = float32_ ## name2 (FST0, FST2, &env->fpu->fp_status); \
|
|
|
|
FSTH2 = float32_ ## name2 (FSTH0, FSTH2, &env->fpu->fp_status); \
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_TERNOP(mul, add)
|
|
|
|
FLOAT_TERNOP(mul, sub)
|
|
|
|
#undef FLOAT_TERNOP
|
|
|
|
|
2007-05-11 13:59:10 +04:00
|
|
|
/* negated ternary operations */
|
|
|
|
#define FLOAT_NTERNOP(name1, name2) \
|
|
|
|
FLOAT_OP(n ## name1 ## name2, d) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FDT0 = float64_ ## name1 (FDT0, FDT1, &env->fpu->fp_status); \
|
|
|
|
FDT2 = float64_ ## name2 (FDT0, FDT2, &env->fpu->fp_status); \
|
2007-11-17 17:53:06 +03:00
|
|
|
FDT2 = float64_chs(FDT2); \
|
2007-05-11 13:59:10 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-11 13:59:10 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(n ## name1 ## name2, s) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FST0 = float32_ ## name1 (FST0, FST1, &env->fpu->fp_status); \
|
|
|
|
FST2 = float32_ ## name2 (FST0, FST2, &env->fpu->fp_status); \
|
2007-11-17 17:53:06 +03:00
|
|
|
FST2 = float32_chs(FST2); \
|
2007-05-11 13:59:10 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-11 13:59:10 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(n ## name1 ## name2, ps) \
|
|
|
|
{ \
|
2007-09-06 04:18:15 +04:00
|
|
|
FST0 = float32_ ## name1 (FST0, FST1, &env->fpu->fp_status); \
|
|
|
|
FSTH0 = float32_ ## name1 (FSTH0, FSTH1, &env->fpu->fp_status); \
|
|
|
|
FST2 = float32_ ## name2 (FST0, FST2, &env->fpu->fp_status); \
|
|
|
|
FSTH2 = float32_ ## name2 (FSTH0, FSTH2, &env->fpu->fp_status); \
|
2007-11-17 17:53:06 +03:00
|
|
|
FST2 = float32_chs(FST2); \
|
|
|
|
FSTH2 = float32_chs(FSTH2); \
|
2007-05-11 13:59:10 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-11 13:59:10 +04:00
|
|
|
}
|
|
|
|
FLOAT_NTERNOP(mul, add)
|
|
|
|
FLOAT_NTERNOP(mul, sub)
|
|
|
|
#undef FLOAT_NTERNOP
|
|
|
|
|
2006-06-14 16:56:19 +04:00
|
|
|
/* unary operations, modifying fp status */
|
|
|
|
#define FLOAT_UNOP(name) \
|
|
|
|
FLOAT_OP(name, d) \
|
|
|
|
{ \
|
2007-11-10 02:09:41 +03:00
|
|
|
FDT2 = float64_ ## name(FDT0, &env->fpu->fp_status); \
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, s) \
|
|
|
|
{ \
|
2007-11-10 02:09:41 +03:00
|
|
|
FST2 = float32_ ## name(FST0, &env->fpu->fp_status); \
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
FLOAT_UNOP(sqrt)
|
|
|
|
#undef FLOAT_UNOP
|
|
|
|
|
|
|
|
/* unary operations, not modifying fp status */
|
|
|
|
#define FLOAT_UNOP(name) \
|
|
|
|
FLOAT_OP(name, d) \
|
|
|
|
{ \
|
|
|
|
FDT2 = float64_ ## name(FDT0); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, s) \
|
|
|
|
{ \
|
|
|
|
FST2 = float32_ ## name(FST0); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-07 17:55:33 +04:00
|
|
|
} \
|
|
|
|
FLOAT_OP(name, ps) \
|
|
|
|
{ \
|
|
|
|
FST2 = float32_ ## name(FST0); \
|
|
|
|
FSTH2 = float32_ ## name(FSTH0); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
FLOAT_UNOP(abs)
|
|
|
|
FLOAT_UNOP(chs)
|
|
|
|
#undef FLOAT_UNOP
|
|
|
|
|
|
|
|
FLOAT_OP(mov, d)
|
|
|
|
{
|
|
|
|
FDT2 = FDT0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(mov, s)
|
|
|
|
{
|
|
|
|
FST2 = FST0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
2007-05-07 17:55:33 +04:00
|
|
|
FLOAT_OP(mov, ps)
|
|
|
|
{
|
|
|
|
FST2 = FST0;
|
|
|
|
FSTH2 = FSTH0;
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
|
|
|
FLOAT_OP(alnv, ps)
|
|
|
|
{
|
|
|
|
switch (T0 & 0x7) {
|
|
|
|
case 0:
|
|
|
|
FST2 = FST0;
|
|
|
|
FSTH2 = FSTH0;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
#ifdef TARGET_WORDS_BIGENDIAN
|
|
|
|
FSTH2 = FST0;
|
|
|
|
FST2 = FSTH1;
|
|
|
|
#else
|
|
|
|
FSTH2 = FST1;
|
|
|
|
FST2 = FSTH0;
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
default: /* unpredictable */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
2006-06-14 16:56:19 +04:00
|
|
|
|
|
|
|
#ifdef CONFIG_SOFTFLOAT
|
|
|
|
#define clear_invalid() do { \
|
2007-09-06 04:18:15 +04:00
|
|
|
int flags = get_float_exception_flags(&env->fpu->fp_status); \
|
2006-06-14 16:56:19 +04:00
|
|
|
flags &= ~float_flag_invalid; \
|
2007-11-10 02:09:41 +03:00
|
|
|
set_float_exception_flags(flags, &env->fpu->fp_status); \
|
2006-06-14 16:56:19 +04:00
|
|
|
} while(0)
|
|
|
|
#else
|
|
|
|
#define clear_invalid() do { } while(0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern void dump_fpu_s(CPUState *env);
|
|
|
|
|
2007-05-18 15:55:54 +04:00
|
|
|
#define CMP_OP(fmt, op) \
|
|
|
|
void OPPROTO op_cmp ## _ ## fmt ## _ ## op(void) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB1(do_cmp ## _ ## fmt ## _ ## op, PARAM1); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-18 15:55:54 +04:00
|
|
|
} \
|
|
|
|
void OPPROTO op_cmpabs ## _ ## fmt ## _ ## op(void) \
|
|
|
|
{ \
|
|
|
|
CALL_FROM_TB1(do_cmpabs ## _ ## fmt ## _ ## op, PARAM1); \
|
|
|
|
DEBUG_FPU_STATE(); \
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET(); \
|
2007-05-18 15:55:54 +04:00
|
|
|
}
|
|
|
|
#define CMP_OPS(op) \
|
|
|
|
CMP_OP(d, op) \
|
|
|
|
CMP_OP(s, op) \
|
|
|
|
CMP_OP(ps, op)
|
|
|
|
|
|
|
|
CMP_OPS(f)
|
|
|
|
CMP_OPS(un)
|
|
|
|
CMP_OPS(eq)
|
|
|
|
CMP_OPS(ueq)
|
|
|
|
CMP_OPS(olt)
|
|
|
|
CMP_OPS(ult)
|
|
|
|
CMP_OPS(ole)
|
|
|
|
CMP_OPS(ule)
|
|
|
|
CMP_OPS(sf)
|
|
|
|
CMP_OPS(ngle)
|
|
|
|
CMP_OPS(seq)
|
|
|
|
CMP_OPS(ngl)
|
|
|
|
CMP_OPS(lt)
|
|
|
|
CMP_OPS(nge)
|
|
|
|
CMP_OPS(le)
|
|
|
|
CMP_OPS(ngt)
|
|
|
|
#undef CMP_OPS
|
|
|
|
#undef CMP_OP
|
2006-06-14 16:56:19 +04:00
|
|
|
|
|
|
|
void op_bc1f (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(~GET_FP_COND(env->fpu) & (0x1 << PARAM1));
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
2007-05-18 15:55:54 +04:00
|
|
|
void op_bc1any2f (void)
|
2007-05-07 17:55:33 +04:00
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(~GET_FP_COND(env->fpu) & (0x3 << PARAM1));
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
2007-05-18 15:55:54 +04:00
|
|
|
void op_bc1any4f (void)
|
2007-05-07 17:55:33 +04:00
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(~GET_FP_COND(env->fpu) & (0xf << PARAM1));
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_bc1t (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(GET_FP_COND(env->fpu) & (0x1 << PARAM1));
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
2007-05-18 15:55:54 +04:00
|
|
|
void op_bc1any2t (void)
|
2007-05-07 17:55:33 +04:00
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(GET_FP_COND(env->fpu) & (0x3 << PARAM1));
|
2007-05-07 17:55:33 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-05-07 17:55:33 +04:00
|
|
|
}
|
2007-05-18 15:55:54 +04:00
|
|
|
void op_bc1any4t (void)
|
2007-05-07 17:55:33 +04:00
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
T0 = !!(GET_FP_COND(env->fpu) & (0xf << PARAM1));
|
2006-06-14 16:56:19 +04:00
|
|
|
DEBUG_FPU_STATE();
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-06-14 16:56:19 +04:00
|
|
|
}
|
|
|
|
|
2005-07-02 18:58:51 +04:00
|
|
|
void op_tlbwi (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB0(env->tlb->do_tlbwi);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_tlbwr (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB0(env->tlb->do_tlbwr);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_tlbp (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB0(env->tlb->do_tlbp);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_tlbr (void)
|
|
|
|
{
|
2007-09-06 04:18:15 +04:00
|
|
|
CALL_FROM_TB0(env->tlb->do_tlbr);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Specials */
|
2007-03-02 23:48:00 +03:00
|
|
|
#if defined (CONFIG_USER_ONLY)
|
|
|
|
void op_tls_value (void)
|
|
|
|
{
|
2007-05-07 17:55:33 +04:00
|
|
|
T0 = env->tls_value;
|
2007-03-02 23:48:00 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-07-02 18:58:51 +04:00
|
|
|
void op_pmon (void)
|
|
|
|
{
|
|
|
|
CALL_FROM_TB1(do_pmon, PARAM1);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_di (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Status;
|
2007-01-24 04:47:51 +03:00
|
|
|
env->CP0_Status = T0 & ~(1 << CP0St_IE);
|
|
|
|
CALL_FROM_TB1(cpu_mips_update_irq, env);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_ei (void)
|
|
|
|
{
|
|
|
|
T0 = env->CP0_Status;
|
2007-01-24 04:47:51 +03:00
|
|
|
env->CP0_Status = T0 | (1 << CP0St_IE);
|
|
|
|
CALL_FROM_TB1(cpu_mips_update_irq, env);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_trap (void)
|
|
|
|
{
|
|
|
|
if (T0) {
|
2007-04-06 03:16:25 +04:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_TRAP);
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
void op_debug (void)
|
|
|
|
{
|
2006-12-06 23:17:30 +03:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_DEBUG);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-12-05 22:59:36 +03:00
|
|
|
}
|
|
|
|
|
2007-04-06 22:46:01 +04:00
|
|
|
void debug_pre_eret (void);
|
|
|
|
void debug_post_eret (void);
|
2005-07-02 18:58:51 +04:00
|
|
|
void op_eret (void)
|
|
|
|
{
|
2007-04-06 22:46:01 +04:00
|
|
|
if (loglevel & CPU_LOG_EXEC)
|
|
|
|
CALL_FROM_TB0(debug_pre_eret);
|
2007-03-30 20:44:54 +04:00
|
|
|
if (env->CP0_Status & (1 << CP0St_ERL)) {
|
2007-09-06 04:18:15 +04:00
|
|
|
env->PC[env->current_tc] = env->CP0_ErrorEPC;
|
2007-03-30 20:44:54 +04:00
|
|
|
env->CP0_Status &= ~(1 << CP0St_ERL);
|
2005-07-02 19:23:21 +04:00
|
|
|
} else {
|
2007-09-06 04:18:15 +04:00
|
|
|
env->PC[env->current_tc] = env->CP0_EPC;
|
2007-03-30 20:44:54 +04:00
|
|
|
env->CP0_Status &= ~(1 << CP0St_EXL);
|
2005-07-02 19:23:21 +04:00
|
|
|
}
|
2007-09-27 03:52:06 +04:00
|
|
|
CALL_FROM_TB1(compute_hflags, env);
|
2007-04-06 22:46:01 +04:00
|
|
|
if (loglevel & CPU_LOG_EXEC)
|
|
|
|
CALL_FROM_TB0(debug_post_eret);
|
2005-07-02 18:58:51 +04:00
|
|
|
env->CP0_LLAddr = 1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_deret (void)
|
|
|
|
{
|
2007-04-06 22:46:01 +04:00
|
|
|
if (loglevel & CPU_LOG_EXEC)
|
|
|
|
CALL_FROM_TB0(debug_pre_eret);
|
2007-09-06 04:18:15 +04:00
|
|
|
env->PC[env->current_tc] = env->CP0_DEPC;
|
2007-09-27 03:52:06 +04:00
|
|
|
env->hflags &= MIPS_HFLAG_DM;
|
|
|
|
CALL_FROM_TB1(compute_hflags, env);
|
2007-04-06 22:46:01 +04:00
|
|
|
if (loglevel & CPU_LOG_EXEC)
|
|
|
|
CALL_FROM_TB0(debug_post_eret);
|
2007-03-30 20:44:54 +04:00
|
|
|
env->CP0_LLAddr = 1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_rdhwr_cpunum(void)
|
|
|
|
{
|
2007-09-25 18:49:47 +04:00
|
|
|
if ((env->hflags & MIPS_HFLAG_CP0) ||
|
|
|
|
(env->CP0_HWREna & (1 << 0)))
|
2007-04-06 03:16:25 +04:00
|
|
|
T0 = env->CP0_EBase & 0x3ff;
|
2006-12-06 23:17:30 +03:00
|
|
|
else
|
2007-04-06 03:16:25 +04:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_rdhwr_synci_step(void)
|
|
|
|
{
|
2007-09-25 18:49:47 +04:00
|
|
|
if ((env->hflags & MIPS_HFLAG_CP0) ||
|
|
|
|
(env->CP0_HWREna & (1 << 1)))
|
2007-04-06 03:16:25 +04:00
|
|
|
T0 = env->SYNCI_Step;
|
2006-12-06 23:17:30 +03:00
|
|
|
else
|
2007-04-06 03:16:25 +04:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_rdhwr_cc(void)
|
|
|
|
{
|
2007-09-25 18:49:47 +04:00
|
|
|
if ((env->hflags & MIPS_HFLAG_CP0) ||
|
|
|
|
(env->CP0_HWREna & (1 << 2)))
|
2007-04-06 03:16:25 +04:00
|
|
|
T0 = env->CP0_Count;
|
2006-12-06 23:17:30 +03:00
|
|
|
else
|
2007-04-06 03:16:25 +04:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_rdhwr_ccres(void)
|
|
|
|
{
|
2007-09-25 18:49:47 +04:00
|
|
|
if ((env->hflags & MIPS_HFLAG_CP0) ||
|
|
|
|
(env->CP0_HWREna & (1 << 3)))
|
2007-04-06 03:16:25 +04:00
|
|
|
T0 = env->CCRes;
|
2006-12-06 23:17:30 +03:00
|
|
|
else
|
2007-04-06 03:16:25 +04:00
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_RI);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2007-04-06 03:16:25 +04:00
|
|
|
}
|
|
|
|
|
2005-07-02 18:58:51 +04:00
|
|
|
void op_save_state (void)
|
|
|
|
{
|
|
|
|
env->hflags = PARAM1;
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2005-07-02 18:58:51 +04:00
|
|
|
}
|
|
|
|
|
2005-12-05 22:59:36 +03:00
|
|
|
void op_wait (void)
|
|
|
|
{
|
|
|
|
env->halted = 1;
|
|
|
|
CALL_FROM_TB1(do_raise_exception, EXCP_HLT);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Bitfield operations. */
|
|
|
|
void op_ext(void)
|
|
|
|
{
|
|
|
|
unsigned int pos = PARAM1;
|
|
|
|
unsigned int size = PARAM2;
|
|
|
|
|
2007-11-18 06:36:07 +03:00
|
|
|
T0 = (int32_t)((T1 >> pos) & ((size < 32) ? ((1 << size) - 1) : ~0));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_ins(void)
|
|
|
|
{
|
|
|
|
unsigned int pos = PARAM1;
|
|
|
|
unsigned int size = PARAM2;
|
2007-04-07 05:09:17 +04:00
|
|
|
target_ulong mask = ((size < 32) ? ((1 << size) - 1) : ~0) << pos;
|
2006-12-06 23:17:30 +03:00
|
|
|
|
2007-11-18 06:36:07 +03:00
|
|
|
T0 = (int32_t)((T0 & ~mask) | ((T1 << pos) & mask));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_wsbh(void)
|
|
|
|
{
|
2007-11-18 06:36:07 +03:00
|
|
|
T0 = (int32_t)(((T1 << 8) & ~0x00FF00FF) | ((T1 >> 8) & 0x00FF00FF));
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
2007-11-08 21:05:37 +03:00
|
|
|
#if defined(TARGET_MIPS64)
|
2006-12-21 04:19:56 +03:00
|
|
|
void op_dext(void)
|
|
|
|
{
|
|
|
|
unsigned int pos = PARAM1;
|
|
|
|
unsigned int size = PARAM2;
|
|
|
|
|
2007-11-18 06:36:07 +03:00
|
|
|
T0 = (T1 >> pos) & ((size < 64) ? ((1ULL << size) - 1) : ~0ULL);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dins(void)
|
|
|
|
{
|
|
|
|
unsigned int pos = PARAM1;
|
|
|
|
unsigned int size = PARAM2;
|
2007-11-18 06:36:07 +03:00
|
|
|
target_ulong mask = ((size < 64) ? ((1ULL << size) - 1) : ~0ULL) << pos;
|
2006-12-21 04:19:56 +03:00
|
|
|
|
2007-04-16 01:26:37 +04:00
|
|
|
T0 = (T0 & ~mask) | ((T1 << pos) & mask);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-21 04:19:56 +03:00
|
|
|
}
|
|
|
|
|
2006-12-06 23:17:30 +03:00
|
|
|
void op_dsbh(void)
|
|
|
|
{
|
|
|
|
T0 = ((T1 << 8) & ~0x00FF00FF00FF00FFULL) | ((T1 >> 8) & 0x00FF00FF00FF00FFULL);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void op_dshd(void)
|
|
|
|
{
|
2007-11-18 06:36:07 +03:00
|
|
|
T1 = ((T1 << 16) & ~0x0000FFFF0000FFFFULL) | ((T1 >> 16) & 0x0000FFFF0000FFFFULL);
|
|
|
|
T0 = (T1 << 32) | (T1 >> 32);
|
2007-11-10 02:09:41 +03:00
|
|
|
FORCE_RET();
|
2006-12-06 23:17:30 +03:00
|
|
|
}
|
2006-12-21 04:19:56 +03:00
|
|
|
#endif
|