mirror of https://github.com/PCSX2/pcsx2.git
Ok the last fix for GCC exploited a bug in MSVC's handling of taking the address of templated functions (one I've run into before). So I gave up and reverted to non-template code.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3647 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
6a18d4f50a
commit
6afa5ba769
|
@ -45,17 +45,15 @@ void MapTLB(int i)
|
|||
u32 mask, addr;
|
||||
u32 saddr, eaddr;
|
||||
|
||||
DevCon.WriteLn("MAP TLB %d: %08x-> [%08x %08x] S=%d G=%d ASID=%d Mask= %03X",
|
||||
i,tlb[i].VPN2,tlb[i].PFN0,tlb[i].PFN1,tlb[i].S,tlb[i].G,tlb[i].ASID,tlb[i].Mask);
|
||||
DevCon.WriteLn("MAP TLB %d: 0x%08X-> [0x%08X 0x%08X] S=0x%08X G=%d ASID=%d Mask=0x%03X",
|
||||
i, tlb[i].VPN2, tlb[i].PFN0, tlb[i].PFN1, tlb[i].S, tlb[i].G, tlb[i].ASID, tlb[i].Mask);
|
||||
|
||||
if (tlb[i].S)
|
||||
{
|
||||
DevCon.WriteLn("OMG SPRAM MAPPING %08X %08X\n", tlb[i].VPN2,tlb[i].Mask);
|
||||
vtlb_VMapBuffer(tlb[i].VPN2, eeMem->Scratch, 0x4000);
|
||||
vtlb_VMapBuffer(tlb[i].VPN2, eeMem->Scratch, Ps2MemSize::Scratch);
|
||||
}
|
||||
|
||||
if (tlb[i].VPN2 == 0x70000000) return; //uh uhh right ...
|
||||
|
||||
if (tlb[i].EntryLo0 & 0x2) {
|
||||
mask = ((~tlb[i].Mask) << 1) & 0xfffff;
|
||||
saddr = tlb[i].VPN2 >> 12;
|
||||
|
|
|
@ -261,49 +261,70 @@ _tmpl(void) vtlbUnmappedPWriteLg(u32 addr,const OperandType* data) { vtlb_BusErr
|
|||
// properly. All addressable physical memory should be configured as TLBMiss or Bus Error.
|
||||
//
|
||||
|
||||
#define _tmpl(ret) template<typename OperandType> ret __fastcall
|
||||
_tmpl(OperandType) vtlbDefaultPhyReadSm(u32 addr)
|
||||
static mem8_t __fastcall vtlbDefaultPhyRead8(u32 addr)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyRead%u: 0x%08X", sizeof(OperandType)*8, addr);
|
||||
Console.Error("vtlbDefaultPhyRead8: 0x%08X", addr);
|
||||
pxFailDev("(VTLB) Attempted read from an unmapped physical address.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
_tmpl(void) vtlbDefaultPhyReadLg(u32 addr,OperandType* data)
|
||||
static mem16_t __fastcall vtlbDefaultPhyRead16(u32 addr)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyRead%u: 0x%08X", sizeof(OperandType)*8, addr);
|
||||
Console.Error("vtlbDefaultPhyRead16: 0x%08X", addr);
|
||||
pxFailDev("(VTLB) Attempted read from an unmapped physical address.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static mem32_t __fastcall vtlbDefaultPhyRead32(u32 addr)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyRead32: 0x%08X", addr);
|
||||
pxFailDev("(VTLB) Attempted read from an unmapped physical address.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __fastcall vtlbDefaultPhyRead64(u32 addr, mem64_t* dest)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyRead64: 0x%08X", addr);
|
||||
pxFailDev("(VTLB) Attempted read from an unmapped physical address.");
|
||||
}
|
||||
|
||||
_tmpl(void) vtlbDefaultPhyWriteSm(u32 addr,OperandType data)
|
||||
static void __fastcall vtlbDefaultPhyRead128(u32 addr, mem128_t* dest)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite%u: 0x%08X",sizeof(OperandType)*8,addr);
|
||||
Console.Error("vtlbDefaultPhyRead128: 0x%08X", addr);
|
||||
pxFailDev("(VTLB) Attempted read from an unmapped physical address.");
|
||||
}
|
||||
|
||||
static void __fastcall vtlbDefaultPhyWrite8(u32 addr, mem8_t data)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite8: 0x%08X",addr);
|
||||
pxFailDev("(VTLB) Attempted write to an unmapped physical address.");
|
||||
}
|
||||
|
||||
_tmpl(void) vtlbDefaultPhyWriteLg(u32 addr,const OperandType* data)
|
||||
static void __fastcall vtlbDefaultPhyWrite16(u32 addr, mem16_t data)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite%u: 0x%08X",sizeof(OperandType)*8,addr);
|
||||
Console.Error("vtlbDefaultPhyWrite16: 0x%08X",addr);
|
||||
pxFailDev("(VTLB) Attempted write to an unmapped physical address.");
|
||||
}
|
||||
|
||||
static void __fastcall vtlbDefaultPhyWrite32(u32 addr, mem32_t data)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite32: 0x%08X",addr);
|
||||
pxFailDev("(VTLB) Attempted write to an unmapped physical address.");
|
||||
}
|
||||
|
||||
static void __fastcall vtlbDefaultPhyWrite64(u32 addr,const mem64_t* data)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite64: 0x%08X",addr);
|
||||
pxFailDev("(VTLB) Attempted write to an unmapped physical address.");
|
||||
}
|
||||
|
||||
static void __fastcall vtlbDefaultPhyWrite128(u32 addr,const mem128_t* data)
|
||||
{
|
||||
Console.Error("vtlbDefaultPhyWrite128: 0x%08X",addr);
|
||||
pxFailDev("(VTLB) Attempted write to an unmapped physical address.");
|
||||
}
|
||||
#undef _tmpl
|
||||
|
||||
// These explicit template instatisations applease GCC 4.5, which itself fixes the GCC4.4 ?: operator
|
||||
// bug (below), but still fails due to not creating instances of the functions when we take their address
|
||||
// below. (guess I shouldn't have templated that code >_<)
|
||||
|
||||
template vtlbMemR8FP vtlbDefaultPhyReadSm<mem8_t>;
|
||||
template vtlbMemR16FP vtlbDefaultPhyReadSm<mem16_t>;
|
||||
template vtlbMemR32FP vtlbDefaultPhyReadSm<mem32_t>;
|
||||
template vtlbMemR64FP vtlbDefaultPhyReadLg<mem64_t>;
|
||||
template vtlbMemR128FP vtlbDefaultPhyReadLg<mem128_t>;
|
||||
|
||||
template vtlbMemW8FP vtlbDefaultPhyWriteSm<mem8_t>;
|
||||
template vtlbMemW16FP vtlbDefaultPhyWriteSm<mem16_t>;
|
||||
template vtlbMemW32FP vtlbDefaultPhyWriteSm<mem32_t>;
|
||||
template vtlbMemW64FP vtlbDefaultPhyWriteLg<mem64_t>;
|
||||
template vtlbMemW128FP vtlbDefaultPhyWriteLg<mem128_t>;
|
||||
|
||||
// ===========================================================================================
|
||||
// VTLB Public API -- Init/Term/RegisterHandler stuff
|
||||
// ===========================================================================================
|
||||
|
@ -320,22 +341,17 @@ __ri void vtlb_ReassignHandler( vtlbHandler rv,
|
|||
vtlbMemR8FP* r8,vtlbMemR16FP* r16,vtlbMemR32FP* r32,vtlbMemR64FP* r64,vtlbMemR128FP* r128,
|
||||
vtlbMemW8FP* w8,vtlbMemW16FP* w16,vtlbMemW32FP* w32,vtlbMemW64FP* w64,vtlbMemW128FP* w128 )
|
||||
{
|
||||
// This macro appleases GCC 4.4 and prior, which apparently cannot handle templated functions as
|
||||
// part of ? : operators -- so we have to use expanded if()/else form instead. (ok, so I *really*
|
||||
// shouldn't have templated that code >_<) --air
|
||||
#define _gccHackFix(a,Type,Size) \
|
||||
if (r8) vtlbdata.RWFT[a][0][rv] = (void*)r##Size; \
|
||||
else vtlbdata.RWFT[a][0][rv] = (void*)vtlbDefaultPhyRead##Type<mem##Size##_t>; \
|
||||
if (w8) vtlbdata.RWFT[a][1][rv] = (void*)w##Size; \
|
||||
else vtlbdata.RWFT[a][1][rv] = (void*)vtlbDefaultPhyWrite##Type<mem##Size##_t>;
|
||||
vtlbdata.RWFT[0][0][rv] = (void*)((r8!=0) ? r8 : vtlbDefaultPhyRead8);
|
||||
vtlbdata.RWFT[1][0][rv] = (void*)((r16!=0) ? r16 : vtlbDefaultPhyRead16);
|
||||
vtlbdata.RWFT[2][0][rv] = (void*)((r32!=0) ? r32 : vtlbDefaultPhyRead32);
|
||||
vtlbdata.RWFT[3][0][rv] = (void*)((r64!=0) ? r64 : vtlbDefaultPhyRead64);
|
||||
vtlbdata.RWFT[4][0][rv] = (void*)((r128!=0) ? r128 : vtlbDefaultPhyRead128);
|
||||
|
||||
_gccHackFix(0,Sm,8);
|
||||
_gccHackFix(1,Sm,16);
|
||||
_gccHackFix(2,Sm,32);
|
||||
_gccHackFix(3,Lg,64);
|
||||
_gccHackFix(4,Lg,128);
|
||||
|
||||
#undef _gccHackFix
|
||||
vtlbdata.RWFT[0][1][rv] = (void*)((w8!=0) ? w8 : vtlbDefaultPhyWrite8);
|
||||
vtlbdata.RWFT[1][1][rv] = (void*)((w16!=0) ? w16 : vtlbDefaultPhyWrite16);
|
||||
vtlbdata.RWFT[2][1][rv] = (void*)((w32!=0) ? w32 : vtlbDefaultPhyWrite32);
|
||||
vtlbdata.RWFT[3][1][rv] = (void*)((w64!=0) ? w64 : vtlbDefaultPhyWrite64);
|
||||
vtlbdata.RWFT[4][1][rv] = (void*)((w128!=0) ? w128 : vtlbDefaultPhyWrite128);
|
||||
}
|
||||
|
||||
vtlbHandler vtlb_NewHandler()
|
||||
|
|
Loading…
Reference in New Issue