A 'nice' fix for GCC's fickle dislike of packed structs. 1) the VU registers struct no longer needs packed (the unions ensure proper packing); 2) introduction of 128-bit UQ/SQ members.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3689 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2010-08-25 15:32:17 +00:00
parent 0300f5a80e
commit 70cd51a64b
7 changed files with 22 additions and 40 deletions

View File

@ -135,13 +135,21 @@ extern void mmap_ResetBlockTracking();
#define memRead8 vtlb_memRead<mem8_t>
#define memRead16 vtlb_memRead<mem16_t>
#define memRead32 vtlb_memRead<mem32_t>
#define memRead64 vtlb_memRead64
#define memRead128 vtlb_memRead128
#define memWrite8 vtlb_memWrite<mem8_t>
#define memWrite16 vtlb_memWrite<mem16_t>
#define memWrite32 vtlb_memWrite<mem32_t>
#define memWrite64 vtlb_memWrite64
#define memWrite128 vtlb_memWrite128
static __fi void memRead64(u32 mem, mem64_t* out) { vtlb_memRead64(mem, out); }
static __fi void memRead64(u32 mem, mem64_t& out) { vtlb_memRead64(mem, &out); }
static __fi void memRead128(u32 mem, mem128_t* out) { vtlb_memRead128(mem, out); }
static __fi void memRead128(u32 mem, mem128_t& out) { vtlb_memRead128(mem, &out); }
static __fi void memWrite64(u32 mem, const mem64_t* val) { vtlb_memWrite64(mem, val); }
static __fi void memWrite64(u32 mem, const mem64_t& val) { vtlb_memWrite64(mem, &val); }
static __fi void memWrite128(u32 mem, const mem128_t* val) { vtlb_memWrite128(mem, val); }
static __fi void memWrite128(u32 mem, const mem128_t& val) { vtlb_memWrite128(mem, &val); }
extern u16 ba0R16(u32 mem);

View File

@ -816,7 +816,7 @@ void SQ()
// an address error due to unaligned access isn't possible like it is on other loads/stores.
u32 addr = cpuRegs.GPR.r[_Rs_].UL[0] + _Imm_;
memWrite128(addr & ~0xf, cpuRegs.GPR.r[_Rt_].UD);
memWrite128(addr & ~0xf, cpuRegs.GPR.r[_Rt_].UQ);
}
/*********************************************************

View File

@ -16,10 +16,6 @@
#pragma once
#include "Vif.h"
#ifdef _MSC_VER // Most of the structs here should be packed
# pragma pack(1)
#endif
enum VURegFlags
{
REG_STATUS_FLAG = 16,
@ -68,7 +64,7 @@ union VECTOR {
s16 SS[8];
u8 UC[16];
s8 SC[16];
} __packed;
};
struct REG_VI {
union {
@ -82,7 +78,7 @@ struct REG_VI {
};
u32 padding[3]; // needs padding to make them 128bit; VU0 maps VU1's VI regs as 128bits to addr 0x4xx0 in
// VU0 mem, with only lower 16 bits valid, and the upper 112bits are hardwired to 0 (cottonvibes)
} __packed;
};
//#define VUFLAG_BREAKONMFLAG 0x00000001
#define VUFLAG_MFLAGSET 0x00000002
@ -158,7 +154,7 @@ struct VURegs {
, Micro( NULL )
{
}
} __packed;
};
enum VUPipeState
{
@ -184,10 +180,6 @@ struct _VURegsNum {
int cycles;
};
#ifdef _MSC_VER // Restore to default pack alignment
# pragma pack()
#endif
extern VURegs* g_pVU1;
extern __aligned16 VURegs VU0;

View File

@ -88,14 +88,9 @@ namespace OpcodeImpl
void LQC2() {
u32 addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)cpuRegs.code;
if (_Ft_) {
#ifdef __LINUX__
// Ifdeffing mainly because I haven't gotten around to checking it in Windows yet.
memRead128(addr, &VU0.VF[_Ft_].UQ);
#else
memRead128(addr, VU0.VF[_Ft_].UD);
#endif
memRead128(addr, VU0.VF[_Ft_].UQ);
} else {
u64 val[2];
u128 val;
memRead128(addr, val);
}
}
@ -105,9 +100,7 @@ namespace OpcodeImpl
// HUH why ? doesn't make any sense ...
void SQC2() {
u32 addr = _Imm_ + cpuRegs.GPR.r[_Rs_].UL[0];
//memWrite64(addr, VU0.VF[_Ft_].UD[0]);
//memWrite64(addr+8,VU0.VF[_Ft_].UD[1]);
memWrite128(addr, VU0.VF[_Ft_].UD);
memWrite128(addr, VU0.VF[_Ft_].UQ);
}
}}}

View File

@ -20,11 +20,10 @@
#include "PrecompiledHeader.h"
#include "Common.h"
#include "VUmicro.h"
#include <cmath>
#include "VUmicro.h"
using namespace R5900;
#define VF_VAL(x) ((x==0x80000000)?0:(x))

View File

@ -126,10 +126,6 @@ void __fastcall vtlb_memRead128(u32 mem, mem128_t *out)
((vtlbMemR128FP*)vtlbdata.RWFT[4][0][hand])(paddr, out);
}
}
void __fastcall vtlb_memRead128(u32 mem, u64 (&out)[2])
{
vtlb_memRead128(mem, (mem128_t*)out);
}
template< typename DataType >
void __fastcall vtlb_memWrite(u32 addr, DataType data)
@ -159,6 +155,7 @@ void __fastcall vtlb_memWrite(u32 addr, DataType data)
}
}
}
void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* value)
{
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
@ -197,11 +194,6 @@ void __fastcall vtlb_memWrite128(u32 mem, const mem128_t *value)
}
}
void __fastcall vtlb_memWrite128(u32 mem, const u64 (&out)[2])
{
vtlb_memWrite128(mem, (const mem128_t*)out);
}
template mem8_t vtlb_memRead<mem8_t>(u32 mem);
template mem16_t vtlb_memRead<mem16_t>(u32 mem);
template mem32_t vtlb_memRead<mem32_t>(u32 mem);

View File

@ -71,13 +71,11 @@ template< typename DataType >
extern DataType __fastcall vtlb_memRead(u32 mem);
extern void __fastcall vtlb_memRead64(u32 mem, mem64_t *out);
extern void __fastcall vtlb_memRead128(u32 mem, mem128_t *out);
extern void __fastcall vtlb_memRead128(u32 mem, u64 (&out)[2]);
template< typename DataType >
extern void __fastcall vtlb_memWrite(u32 mem, DataType value);
extern void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* value);
extern void __fastcall vtlb_memWrite128(u32 mem, const mem128_t* value);
extern void __fastcall vtlb_memWrite128(u32 mem, const u64 (&value)[2]);
extern void vtlb_DynGenWrite(u32 sz);
extern void vtlb_DynGenRead32(u32 bits, bool sign);