mirror of https://github.com/PCSX2/pcsx2.git
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:
parent
0300f5a80e
commit
70cd51a64b
|
@ -135,13 +135,21 @@ extern void mmap_ResetBlockTracking();
|
||||||
#define memRead8 vtlb_memRead<mem8_t>
|
#define memRead8 vtlb_memRead<mem8_t>
|
||||||
#define memRead16 vtlb_memRead<mem16_t>
|
#define memRead16 vtlb_memRead<mem16_t>
|
||||||
#define memRead32 vtlb_memRead<mem32_t>
|
#define memRead32 vtlb_memRead<mem32_t>
|
||||||
#define memRead64 vtlb_memRead64
|
|
||||||
#define memRead128 vtlb_memRead128
|
|
||||||
|
|
||||||
#define memWrite8 vtlb_memWrite<mem8_t>
|
#define memWrite8 vtlb_memWrite<mem8_t>
|
||||||
#define memWrite16 vtlb_memWrite<mem16_t>
|
#define memWrite16 vtlb_memWrite<mem16_t>
|
||||||
#define memWrite32 vtlb_memWrite<mem32_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);
|
extern u16 ba0R16(u32 mem);
|
||||||
|
|
|
@ -816,7 +816,7 @@ void SQ()
|
||||||
// an address error due to unaligned access isn't possible like it is on other loads/stores.
|
// 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_;
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************************
|
/*********************************************************
|
||||||
|
|
14
pcsx2/VU.h
14
pcsx2/VU.h
|
@ -16,10 +16,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "Vif.h"
|
#include "Vif.h"
|
||||||
|
|
||||||
#ifdef _MSC_VER // Most of the structs here should be packed
|
|
||||||
# pragma pack(1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
enum VURegFlags
|
enum VURegFlags
|
||||||
{
|
{
|
||||||
REG_STATUS_FLAG = 16,
|
REG_STATUS_FLAG = 16,
|
||||||
|
@ -68,7 +64,7 @@ union VECTOR {
|
||||||
s16 SS[8];
|
s16 SS[8];
|
||||||
u8 UC[16];
|
u8 UC[16];
|
||||||
s8 SC[16];
|
s8 SC[16];
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
struct REG_VI {
|
struct REG_VI {
|
||||||
union {
|
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
|
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)
|
// VU0 mem, with only lower 16 bits valid, and the upper 112bits are hardwired to 0 (cottonvibes)
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
//#define VUFLAG_BREAKONMFLAG 0x00000001
|
//#define VUFLAG_BREAKONMFLAG 0x00000001
|
||||||
#define VUFLAG_MFLAGSET 0x00000002
|
#define VUFLAG_MFLAGSET 0x00000002
|
||||||
|
@ -158,7 +154,7 @@ struct VURegs {
|
||||||
, Micro( NULL )
|
, Micro( NULL )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
} __packed;
|
};
|
||||||
|
|
||||||
enum VUPipeState
|
enum VUPipeState
|
||||||
{
|
{
|
||||||
|
@ -184,10 +180,6 @@ struct _VURegsNum {
|
||||||
int cycles;
|
int cycles;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _MSC_VER // Restore to default pack alignment
|
|
||||||
# pragma pack()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern VURegs* g_pVU1;
|
extern VURegs* g_pVU1;
|
||||||
extern __aligned16 VURegs VU0;
|
extern __aligned16 VURegs VU0;
|
||||||
|
|
||||||
|
|
|
@ -88,15 +88,10 @@ namespace OpcodeImpl
|
||||||
void LQC2() {
|
void LQC2() {
|
||||||
u32 addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)cpuRegs.code;
|
u32 addr = cpuRegs.GPR.r[_Rs_].UL[0] + (s16)cpuRegs.code;
|
||||||
if (_Ft_) {
|
if (_Ft_) {
|
||||||
#ifdef __LINUX__
|
memRead128(addr, VU0.VF[_Ft_].UQ);
|
||||||
// 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
|
|
||||||
} else {
|
} else {
|
||||||
u64 val[2];
|
u128 val;
|
||||||
memRead128(addr, val);
|
memRead128(addr, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +100,7 @@ namespace OpcodeImpl
|
||||||
// HUH why ? doesn't make any sense ...
|
// HUH why ? doesn't make any sense ...
|
||||||
void SQC2() {
|
void SQC2() {
|
||||||
u32 addr = _Imm_ + cpuRegs.GPR.r[_Rs_].UL[0];
|
u32 addr = _Imm_ + cpuRegs.GPR.r[_Rs_].UL[0];
|
||||||
//memWrite64(addr, VU0.VF[_Ft_].UD[0]);
|
memWrite128(addr, VU0.VF[_Ft_].UQ);
|
||||||
//memWrite64(addr+8,VU0.VF[_Ft_].UD[1]);
|
|
||||||
memWrite128(addr, VU0.VF[_Ft_].UD);
|
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,10 @@
|
||||||
|
|
||||||
#include "PrecompiledHeader.h"
|
#include "PrecompiledHeader.h"
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
|
#include "VUmicro.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "VUmicro.h"
|
|
||||||
|
|
||||||
using namespace R5900;
|
using namespace R5900;
|
||||||
|
|
||||||
#define VF_VAL(x) ((x==0x80000000)?0:(x))
|
#define VF_VAL(x) ((x==0x80000000)?0:(x))
|
||||||
|
|
|
@ -126,10 +126,6 @@ void __fastcall vtlb_memRead128(u32 mem, mem128_t *out)
|
||||||
((vtlbMemR128FP*)vtlbdata.RWFT[4][0][hand])(paddr, 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 >
|
template< typename DataType >
|
||||||
void __fastcall vtlb_memWrite(u32 addr, DataType data)
|
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)
|
void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* value)
|
||||||
{
|
{
|
||||||
u32 vmv=vtlbdata.vmap[mem>>VTLB_PAGE_BITS];
|
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 mem8_t vtlb_memRead<mem8_t>(u32 mem);
|
||||||
template mem16_t vtlb_memRead<mem16_t>(u32 mem);
|
template mem16_t vtlb_memRead<mem16_t>(u32 mem);
|
||||||
template mem32_t vtlb_memRead<mem32_t>(u32 mem);
|
template mem32_t vtlb_memRead<mem32_t>(u32 mem);
|
||||||
|
|
|
@ -71,13 +71,11 @@ template< typename DataType >
|
||||||
extern DataType __fastcall vtlb_memRead(u32 mem);
|
extern DataType __fastcall vtlb_memRead(u32 mem);
|
||||||
extern void __fastcall vtlb_memRead64(u32 mem, mem64_t *out);
|
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, mem128_t *out);
|
||||||
extern void __fastcall vtlb_memRead128(u32 mem, u64 (&out)[2]);
|
|
||||||
|
|
||||||
template< typename DataType >
|
template< typename DataType >
|
||||||
extern void __fastcall vtlb_memWrite(u32 mem, DataType value);
|
extern void __fastcall vtlb_memWrite(u32 mem, DataType value);
|
||||||
extern void __fastcall vtlb_memWrite64(u32 mem, const mem64_t* 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 mem128_t* value);
|
||||||
extern void __fastcall vtlb_memWrite128(u32 mem, const u64 (&value)[2]);
|
|
||||||
|
|
||||||
extern void vtlb_DynGenWrite(u32 sz);
|
extern void vtlb_DynGenWrite(u32 sz);
|
||||||
extern void vtlb_DynGenRead32(u32 bits, bool sign);
|
extern void vtlb_DynGenRead32(u32 bits, bool sign);
|
||||||
|
|
Loading…
Reference in New Issue