ppc fixes (Jocelyn Mayer)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@765 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2004-04-26 19:48:05 +00:00
parent 7fd7b91fac
commit 1ef59d0acf
5 changed files with 30 additions and 13 deletions

View file

@ -139,6 +139,8 @@ void do_sraw(void);
void do_fctiw (void); void do_fctiw (void);
void do_fctiwz (void); void do_fctiwz (void);
void do_fnmadds (void);
void do_fnmsubs (void);
void do_fsqrt (void); void do_fsqrt (void);
void do_fsqrts (void); void do_fsqrts (void);
void do_fres (void); void do_fres (void);

View file

@ -163,7 +163,6 @@ static int get_bat (CPUState *env, uint32_t *real, int *prot,
*BATu, *BATl, BEPIu, BEPIl, bl); *BATu, *BATl, BEPIu, BEPIl, bl);
} }
#endif #endif
env->spr[DAR] = virtual;
} }
/* No hit */ /* No hit */
return ret; return ret;
@ -543,12 +542,12 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw,
access_type = env->access_type; access_type = env->access_type;
if (env->user_mode_only) { if (env->user_mode_only) {
/* user mode only emulation */ /* user mode only emulation */
ret = -1; ret = -2;
goto do_fault; goto do_fault;
} }
/* NASTY BUG workaround */ /* NASTY BUG workaround */
if (access_type == ACCESS_CODE && rw) { if (access_type == ACCESS_CODE && rw) {
// printf("%s: ERROR WRITE CODE ACCESS\n", __func__); printf("%s: ERROR WRITE CODE ACCESS\n", __func__);
access_type = ACCESS_INT; access_type = ACCESS_INT;
} }
ret = get_physical_address(env, &physical, &prot, ret = get_physical_address(env, &physical, &prot,
@ -674,10 +673,10 @@ uint32_t _load_msr (CPUState *env)
void _store_msr (CPUState *env, uint32_t value) void _store_msr (CPUState *env, uint32_t value)
{ {
if (((T0 >> MSR_IR) & 0x01) != msr_ir || if (((value >> MSR_IR) & 0x01) != msr_ir ||
((T0 >> MSR_DR) & 0x01) != msr_dr) { ((value >> MSR_DR) & 0x01) != msr_dr) {
/* Flush all tlb when changing translation mode or privilege level */ /* Flush all tlb when changing translation mode or privilege level */
do_tlbia(); tlb_flush(env, 1);
} }
msr_pow = (value >> MSR_POW) & 0x03; msr_pow = (value >> MSR_POW) & 0x03;
msr_ile = (value >> MSR_ILE) & 0x01; msr_ile = (value >> MSR_ILE) & 0x01;
@ -931,7 +930,7 @@ void do_interrupt (CPUState *env)
env->nip = excp << 8; env->nip = excp << 8;
env->exception_index = EXCP_NONE; env->exception_index = EXCP_NONE;
/* Invalidate all TLB as we may have changed translation mode */ /* Invalidate all TLB as we may have changed translation mode */
do_tlbia(); tlb_flush(env, 1);
/* ensure that no TB jump will be modified as /* ensure that no TB jump will be modified as
the program flow was changed */ the program flow was changed */
#ifdef __sparc__ #ifdef __sparc__

View file

@ -1368,28 +1368,32 @@ PPC_OP(fmsubs)
/* fnmadd - fnmadd. - fnmadds - fnmadds. */ /* fnmadd - fnmadd. - fnmadds - fnmadds. */
PPC_OP(fnmadd) PPC_OP(fnmadd)
{ {
FT0 = -((FT0 * FT1) + FT2); FT0 *= FT1;
FT0 += FT2;
FT0 = -FT0;
RETURN(); RETURN();
} }
/* fnmadds - fnmadds. */ /* fnmadds - fnmadds. */
PPC_OP(fnmadds) PPC_OP(fnmadds)
{ {
FTS0 = -((FTS0 * FTS1) + FTS2); do_fnmadds();
RETURN(); RETURN();
} }
/* fnmsub - fnmsub. */ /* fnmsub - fnmsub. */
PPC_OP(fnmsub) PPC_OP(fnmsub)
{ {
FT0 = -((FT0 * FT1) - FT2); FT0 *= FT1;
FT0 -= FT2;
FT0 = -FT0;
RETURN(); RETURN();
} }
/* fnmsubs - fnmsubs. */ /* fnmsubs - fnmsubs. */
PPC_OP(fnmsubs) PPC_OP(fnmsubs)
{ {
FTS0 = -((FTS0 * FTS1) - FTS2); do_fnmsubs();
RETURN(); RETURN();
} }

View file

@ -267,6 +267,16 @@ void do_fctiwz (void)
fesetround(cround); fesetround(cround);
} }
void do_fnmadds (void)
{
FTS0 = -((FTS0 * FTS1) + FTS2);
}
void do_fnmsubs (void)
{
FTS0 = -((FTS0 * FTS1) - FTS2);
}
void do_fsqrt (void) void do_fsqrt (void)
{ {
FT0 = sqrt(FT0); FT0 = sqrt(FT0);

View file

@ -276,7 +276,7 @@ static inline uint32_t MASK (uint32_t start, uint32_t end)
} }
#define GEN_OPCODE(name, op1, op2, op3, invl, _typ) \ #define GEN_OPCODE(name, op1, op2, op3, invl, _typ) \
__attribute__ ((section(".opcodes"), unused)) \ __attribute__ ((section(".opcodes"), unused, aligned (8) )) \
static opcode_t opc_##name = { \ static opcode_t opc_##name = { \
.opc1 = op1, \ .opc1 = op1, \
.opc2 = op2, \ .opc2 = op2, \
@ -289,7 +289,7 @@ static opcode_t opc_##name = { \
} }
#define GEN_OPCODE_MARK(name) \ #define GEN_OPCODE_MARK(name) \
__attribute__ ((section(".opcodes"), unused)) \ __attribute__ ((section(".opcodes"), unused, aligned (8) )) \
static opcode_t opc_##name = { \ static opcode_t opc_##name = { \
.opc1 = 0xFF, \ .opc1 = 0xFF, \
.opc2 = 0xFF, \ .opc2 = 0xFF, \
@ -3144,7 +3144,9 @@ int gen_intermediate_code_internal (CPUState *env, TranslationBlock *tb,
fprintf(logfile, "---------------- excp: %04x\n", ctx.exception); fprintf(logfile, "---------------- excp: %04x\n", ctx.exception);
cpu_ppc_dump_state(env, logfile, 0); cpu_ppc_dump_state(env, logfile, 0);
fprintf(logfile, "IN: %s\n", lookup_symbol((void *)pc_start)); fprintf(logfile, "IN: %s\n", lookup_symbol((void *)pc_start));
#if defined(CONFIG_USER_ONLY)
disas(logfile, (void *)pc_start, ctx.nip - pc_start, 0, 0); disas(logfile, (void *)pc_start, ctx.nip - pc_start, 0, 0);
#endif
fprintf(logfile, "\n"); fprintf(logfile, "\n");
fprintf(logfile, "OP:\n"); fprintf(logfile, "OP:\n");