#endif
if (user_mode && address > 0x7FFFFFFFUL)
return TLBRET_BADADDR;
- if (address < SIGN_EXTEND32(0x80000000UL)) {
+ if (address < (int32_t)0x80000000UL) {
if (!(env->hflags & MIPS_HFLAG_ERL)) {
#ifdef MIPS_USES_R4K_TLB
ret = map_address(env, physical, prot, address, rw, access_type);
*physical = address;
*prot = PAGE_READ | PAGE_WRITE;
}
- } else if (address < SIGN_EXTEND32(0xA0000000UL)) {
+ } else if (address < (int32_t)0xA0000000UL) {
/* kseg0 */
/* XXX: check supervisor mode */
- *physical = address - SIGN_EXTEND32(0x80000000UL);
+ *physical = address - (int32_t)0x80000000UL;
*prot = PAGE_READ | PAGE_WRITE;
- } else if (address < SIGN_EXTEND32(0xC0000000UL)) {
+ } else if (address < (int32_t)0xC0000000UL) {
/* kseg1 */
/* XXX: check supervisor mode */
- *physical = address - SIGN_EXTEND32(0xA0000000UL);
+ *physical = address - (int32_t)0xA0000000UL;
*prot = PAGE_READ | PAGE_WRITE;
- } else if (address < SIGN_EXTEND32(0xE0000000UL)) {
+ } else if (address < (int32_t)0xE0000000UL) {
/* kseg2 */
#ifdef MIPS_USES_R4K_TLB
ret = map_address(env, physical, prot, address, rw, access_type);
enter_debug_mode:
env->hflags |= MIPS_HFLAG_DM;
/* EJTAG probe trap enable is not implemented... */
- env->PC = SIGN_EXTEND32(0xBFC00480);
+ env->PC = (int32_t)0xBFC00480;
break;
case EXCP_RESET:
cpu_reset(env);
}
env->hflags |= MIPS_HFLAG_ERL;
env->CP0_Status |= (1 << CP0St_ERL) | (1 << CP0St_BEV);
- env->PC = SIGN_EXTEND32(0xBFC00000);
+ env->PC = (int32_t)0xBFC00000;
break;
case EXCP_MCHECK:
cause = 24;
env->CP0_Cause &= ~0x80000000;
}
if (env->CP0_Status & (1 << CP0St_BEV)) {
- env->PC = SIGN_EXTEND32(0xBFC00200);
+ env->PC = (int32_t)0xBFC00200;
} else {
- env->PC = SIGN_EXTEND32(0x80000000);
+ env->PC = (int32_t)0x80000000;
}
env->hflags |= MIPS_HFLAG_EXL;
env->CP0_Status |= (1 << CP0St_EXL);
/* Arithmetic */
void op_add (void)
{
- T0 = SIGN_EXTEND32((int32_t)T0 + (int32_t)T1);
+ T0 = (int32_t)((int32_t)T0 + (int32_t)T1);
RETURN();
}
/* operands of same sign, result different sign */
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
- T0 = SIGN_EXTEND32(T0);
+ T0 = (int32_t)T0;
RETURN();
}
void op_sub (void)
{
- T0 = SIGN_EXTEND32((int32_t)T0 - (int32_t)T1);
+ T0 = (int32_t)((int32_t)T0 - (int32_t)T1);
RETURN();
}
/* operands of different sign, first operand and result different sign */
CALL_FROM_TB1(do_raise_exception_direct, EXCP_OVERFLOW);
}
- T0 = SIGN_EXTEND32(T0);
+ T0 = (int32_t)T0;
RETURN();
}
void op_mul (void)
{
- T0 = SIGN_EXTEND32((int32_t)T0 * (int32_t)T1);
+ T0 = (int32_t)((int32_t)T0 * (int32_t)T1);
RETURN();
}
void op_div (void)
{
if (T1 != 0) {
- env->LO = SIGN_EXTEND32((int32_t)T0 / (int32_t)T1);
- env->HI = SIGN_EXTEND32((int32_t)T0 % (int32_t)T1);
+ env->LO = (int32_t)((int32_t)T0 / (int32_t)T1);
+ env->HI = (int32_t)((int32_t)T0 % (int32_t)T1);
}
RETURN();
}
void op_divu (void)
{
if (T1 != 0) {
- env->LO = SIGN_EXTEND32((uint32_t)T0 / (uint32_t)T1);
- env->HI = SIGN_EXTEND32((uint32_t)T0 % (uint32_t)T1);
+ env->LO = (int32_t)((uint32_t)T0 / (uint32_t)T1);
+ env->HI = (int32_t)((uint32_t)T0 % (uint32_t)T1);
}
RETURN();
}
void op_sll (void)
{
- T0 = SIGN_EXTEND32((uint32_t)T0 << (uint32_t)T1);
+ T0 = (int32_t)((uint32_t)T0 << (uint32_t)T1);
RETURN();
}
void op_sra (void)
{
- T0 = SIGN_EXTEND32((int32_t)T0 >> (uint32_t)T1);
+ T0 = (int32_t)((int32_t)T0 >> (uint32_t)T1);
RETURN();
}
void op_srl (void)
{
- T0 = SIGN_EXTEND32((uint32_t)T0 >> (uint32_t)T1);
+ T0 = (int32_t)((uint32_t)T0 >> (uint32_t)T1);
RETURN();
}
target_ulong tmp;
if (T1) {
- tmp = SIGN_EXTEND32((uint32_t)T0 << (0x20 - (uint32_t)T1));
- T0 = SIGN_EXTEND32((uint32_t)T0 >> (uint32_t)T1) | tmp;
+ tmp = (int32_t)((uint32_t)T0 << (0x20 - (uint32_t)T1));
+ T0 = (int32_t)((uint32_t)T0 >> (uint32_t)T1) | tmp;
} else
T0 = T1;
RETURN();
void op_sllv (void)
{
- T0 = SIGN_EXTEND32((uint32_t)T1 << ((uint32_t)T0 & 0x1F));
+ T0 = (int32_t)((uint32_t)T1 << ((uint32_t)T0 & 0x1F));
RETURN();
}
void op_srav (void)
{
- T0 = SIGN_EXTEND32((int32_t)T1 >> (T0 & 0x1F));
+ T0 = (int32_t)((int32_t)T1 >> (T0 & 0x1F));
RETURN();
}
void op_srlv (void)
{
- T0 = SIGN_EXTEND32((uint32_t)T1 >> (T0 & 0x1F));
+ T0 = (int32_t)((uint32_t)T1 >> (T0 & 0x1F));
RETURN();
}
T0 &= 0x1F;
if (T0) {
- tmp = SIGN_EXTEND32((uint32_t)T1 << (0x20 - T0));
- T0 = SIGN_EXTEND32((uint32_t)T1 >> T0) | tmp;
+ tmp = (int32_t)((uint32_t)T1 << (0x20 - T0));
+ T0 = (int32_t)((uint32_t)T1 >> T0) | tmp;
} else
T0 = T1;
RETURN();
static inline void set_HILO (uint64_t HILO)
{
- env->LO = SIGN_EXTEND32(HILO & 0xFFFFFFFF);
- env->HI = SIGN_EXTEND32(HILO >> 32);
+ env->LO = (int32_t)(HILO & 0xFFFFFFFF);
+ env->HI = (int32_t)(HILO >> 32);
}
void op_mult (void)
/* CP0 functions */
void op_mfc0_index (void)
{
- T0 = SIGN_EXTEND32(env->CP0_index);
+ T0 = (int32_t)(env->CP0_index);
RETURN();
}
void op_mfc0_pagemask (void)
{
- T0 = SIGN_EXTEND32(env->CP0_PageMask);
+ T0 = (int32_t)env->CP0_PageMask;
RETURN();
}
void op_mfc0_pagegrain (void)
{
- T0 = SIGN_EXTEND32(env->CP0_PageGrain);
+ T0 = (int32_t)env->CP0_PageGrain;
RETURN();
}
void op_mfc0_wired (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Wired);
+ T0 = (int32_t)env->CP0_Wired;
RETURN();
}
void op_mfc0_hwrena (void)
{
- T0 = SIGN_EXTEND32(env->CP0_HWREna);
+ T0 = (int32_t)env->CP0_HWREna;
RETURN();
}
void op_mfc0_compare (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Compare);
+ T0 = (int32_t)env->CP0_Compare;
RETURN();
}
void op_mfc0_status (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Status);
+ T0 = (int32_t)env->CP0_Status;
if (env->hflags & MIPS_HFLAG_UM)
T0 |= (1 << CP0St_UM);
if (env->hflags & MIPS_HFLAG_ERL)
void op_mfc0_intctl (void)
{
- T0 = SIGN_EXTEND32(env->CP0_IntCtl);
+ T0 = (int32_t)env->CP0_IntCtl;
RETURN();
}
void op_mfc0_srsctl (void)
{
- T0 = SIGN_EXTEND32(env->CP0_SRSCtl);
+ T0 = (int32_t)env->CP0_SRSCtl;
RETURN();
}
void op_mfc0_cause (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Cause);
+ T0 = (int32_t)env->CP0_Cause;
RETURN();
}
void op_mfc0_prid (void)
{
- T0 = SIGN_EXTEND32(env->CP0_PRid);
+ T0 = (int32_t)env->CP0_PRid;
RETURN();
}
void op_mfc0_config0 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Config0);
+ T0 = (int32_t)env->CP0_Config0;
RETURN();
}
void op_mfc0_config1 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Config1);
+ T0 = (int32_t)env->CP0_Config1;
RETURN();
}
void op_mfc0_config2 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Config2);
+ T0 = (int32_t)env->CP0_Config2;
RETURN();
}
void op_mfc0_config3 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Config3);
+ T0 = (int32_t)env->CP0_Config3;
RETURN();
}
void op_mfc0_watchlo0 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_WatchLo);
+ T0 = (int32_t)env->CP0_WatchLo;
RETURN();
}
void op_mfc0_watchhi0 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_WatchHi);
+ T0 = (int32_t)env->CP0_WatchHi;
RETURN();
}
void op_mfc0_debug (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Debug);
+ T0 = (int32_t)env->CP0_Debug;
if (env->hflags & MIPS_HFLAG_DM)
T0 |= 1 << CP0DB_DM;
RETURN();
void op_mfc0_performance0 (void)
{
- T0 = SIGN_EXTEND32(env->CP0_Performance0);
+ T0 = (int32_t)env->CP0_Performance0;
RETURN();
}
void op_mfc0_taglo (void)
{
- T0 = SIGN_EXTEND32(env->CP0_TagLo);
+ T0 = (int32_t)env->CP0_TagLo;
RETURN();
}
void op_mfc0_datalo (void)
{
- T0 = SIGN_EXTEND32(env->CP0_DataLo);
+ T0 = (int32_t)env->CP0_DataLo;
RETURN();
}
void op_mfc0_taghi (void)
{
- T0 = SIGN_EXTEND32(env->CP0_TagHi);
+ T0 = (int32_t)env->CP0_TagHi;
RETURN();
}
void op_mfc0_datahi (void)
{
- T0 = SIGN_EXTEND32(env->CP0_DataHi);
+ T0 = (int32_t)env->CP0_DataHi;
RETURN();
}
void op_mfc0_desave (void)
{
- T0 = SIGN_EXTEND32(env->CP0_DESAVE);
+ T0 = (int32_t)env->CP0_DESAVE;
RETURN();
}
{
/* Large physaddr not implemented */
/* 1k pages not implemented */
- env->CP0_EntryLo0 = T0 & SIGN_EXTEND32(0x3FFFFFFFUL);
+ env->CP0_EntryLo0 = T0 & (int32_t)0x3FFFFFFF;
RETURN();
}
{
/* Large physaddr not implemented */
/* 1k pages not implemented */
- env->CP0_EntryLo1 = T0 & SIGN_EXTEND32(0x3FFFFFFFUL);
+ env->CP0_EntryLo1 = T0 & (int32_t)0x3FFFFFFF;
RETURN();
}
/* 1k pages not implemented */
/* Ignore MIPS64 TLB for now */
- val = T0 & SIGN_EXTEND32(0xFFFFE0FF);
+ val = T0 & (int32_t)0xFFFFE0FF;
old = env->CP0_EntryHi;
env->CP0_EntryHi = val;
/* If the ASID changes, flush qemu's TLB. */
{
uint32_t val, old, mask;
- val = T0 & SIGN_EXTEND32(0xFA78FF01);
+ val = T0 & (int32_t)0xFA78FF01;
old = env->CP0_Status;
if (T0 & (1 << CP0St_UM))
env->hflags |= MIPS_HFLAG_UM;
{
/* vectored interrupts not implemented */
/* Multi-CPU not implemented */
- env->CP0_EBase = SIGN_EXTEND32(0x80000000) | (T0 & 0x3FFFF000);
+ env->CP0_EBase = (int32_t)0x80000000 | (T0 & 0x3FFFF000);
RETURN();
}
void op_mtc0_taglo (void)
{
- env->CP0_TagLo = T0 & SIGN_EXTEND32(0xFFFFFCF6);
+ env->CP0_TagLo = T0 & (int32_t)0xFFFFFCF6;
RETURN();
}