A function renamed, some logging improvements

This commit is contained in:
Henrik Rydgård 2017-03-09 11:36:16 +01:00 committed by Henrik Rydgard
parent c7cb3688d8
commit e74749f2b2
10 changed files with 34 additions and 35 deletions

View File

@ -754,6 +754,7 @@ void ARMXEmitter::BL(ARMReg src)
{
Write32(condition | 0x012FFF30 | src);
}
void ARMXEmitter::PUSH(const int num, ...)
{
u16 RegList = 0;
@ -761,14 +762,14 @@ void ARMXEmitter::PUSH(const int num, ...)
int i;
va_list vl;
va_start(vl, num);
for (i=0;i<num;i++)
{
for (i = 0; i < num; i++) {
Reg = va_arg(vl, u32);
RegList |= (1 << Reg);
}
va_end(vl);
Write32(condition | (2349 << 16) | RegList);
}
void ARMXEmitter::POP(const int num, ...)
{
u16 RegList = 0;

View File

@ -478,7 +478,7 @@ inline void CallSyscallWithoutFlags(const HLEFunction *info)
SetDeadbeefRegs();
}
const HLEFunction *GetSyscallInfo(MIPSOpcode op)
const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op)
{
u32 callno = (op >> 6) & 0xFFFFF; //20 bits
int funcnum = callno & 0xFFF;
@ -488,13 +488,14 @@ const HLEFunction *GetSyscallInfo(MIPSOpcode op)
return NULL;
}
if (modulenum >= (int)moduleDB.size()) {
ERROR_LOG(HLE, "Syscall had bad module number %i - probably executing garbage", modulenum);
ERROR_LOG(HLE, "Syscall had bad module number %d - probably executing garbage", modulenum);
return NULL;
}
if (funcnum >= moduleDB[modulenum].numFunctions) {
ERROR_LOG(HLE, "Syscall had bad function number %i in module %i - probably executing garbage", funcnum, modulenum);
ERROR_LOG(HLE, "Syscall had bad function number %d in module %d - probably executing garbage", funcnum, modulenum);
return NULL;
}
INFO_LOG(HLE, "Compiling syscall to %s", moduleDB[modulenum].funcTable[funcnum].name);
return &moduleDB[modulenum].funcTable[funcnum];
}
@ -504,7 +505,7 @@ void *GetQuickSyscallFunc(MIPSOpcode op)
if (g_Config.bShowDebugStats)
return NULL;
const HLEFunction *info = GetSyscallInfo(op);
const HLEFunction *info = GetSyscallFuncPointer(op);
if (!info || !info->func)
return NULL;
@ -532,7 +533,7 @@ void CallSyscall(MIPSOpcode op)
start = time_now_d();
}
const HLEFunction *info = GetSyscallInfo(op);
const HLEFunction *info = GetSyscallFuncPointer(op);
if (!info) {
RETURN(SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED);
return;

View File

@ -148,7 +148,7 @@ void CallSyscall(MIPSOpcode op);
void WriteFuncStub(u32 stubAddr, u32 symAddr);
void WriteFuncMissingStub(u32 stubAddr, u32 nid);
const HLEFunction *GetSyscallInfo(MIPSOpcode op);
const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op);
// For jit, takes arg: const HLEFunction *
void *GetQuickSyscallFunc(MIPSOpcode op);

View File

@ -722,7 +722,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting) {
// It hasn't been exported yet, but hopefully it will later.
bool isKnownModule = GetModuleIndex(func.moduleName) != -1;
if (isKnownModule) {
WARN_LOG_REPORT(LOADER, "Unknown syscall in known module: %s 0x%08x", func.moduleName, func.nid);
WARN_LOG_REPORT(LOADER, "Unknown syscall in known module '%s': 0x%08x", func.moduleName, func.nid);
} else {
INFO_LOG(LOADER, "Function (%s,%08x) unresolved, storing for later resolving", func.moduleName, func.nid);
}
@ -1443,29 +1443,26 @@ static Module *__KernelLoadModule(u8 *fileptr, SceKernelLMOption *options, std::
{
Module *module = 0;
// Check for PBP
if (memcmp(fileptr, "\0PBP", 4) == 0)
{
if (memcmp(fileptr, "\0PBP", 4) == 0) {
// PBP!
u32_le version;
memcpy(&version, fileptr + 4, 4);
u32_le offset0, offsets[16];
int numfiles;
memcpy(&offset0, fileptr + 8, 4);
numfiles = (offset0 - 8)/4;
int numfiles = (offset0 - 8)/4;
offsets[0] = offset0;
for (int i = 1; i < numfiles; i++)
memcpy(&offsets[i], fileptr + 12 + 4*i, 4);
u32 magic = 0;
u8 *temp = 0;
if (offsets[5] & 3) {
// Our loader does NOT like to load from an unaligned address on ARM!
size_t size = offsets[6] - offsets[5];
temp = new u8[size];
memcpy(temp, fileptr + offsets[5], size);
INFO_LOG(LOADER, "Elf unaligned, aligning!");
INFO_LOG(LOADER, "PBP: ELF unaligned (%d: %d), aligning!", offsets[5], offsets[5] & 3);
}
u32 error;

View File

@ -56,11 +56,7 @@ static const bool disasm = false;
extern volatile CoreState coreState;
void ShowPC(u32 sp) {
if (currentMIPS) {
ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp);
} else {
ERROR_LOG(JIT, "Universe corrupt?");
}
ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp);
}
void DisassembleArm(const u8 *data, int size);
@ -149,13 +145,15 @@ void ArmJit::GenerateFixedCode() {
SetCC(CC_AL);
PUSH(9, R4, R5, R6, R7, R8, R9, R10, R11, R_LR);
// Take care to 8-byte align stack for function calls.
// We are misaligned here because of an odd number of args for PUSH.
// It's not like x86 where you need to account for an extra 4 bytes
// consumed by CALL.
SUB(R_SP, R_SP, 4);
// Now we are correctly aligned and plan to stay that way.
if (cpu_info.bNEON) {
VPUSH(D8, 8);
}
// Fixed registers, these are always kept when in Jit context.
// R8 is used to hold flags during delay slots. Not always needed.
@ -169,11 +167,6 @@ void ArmJit::GenerateFixedCode() {
MOVP2R(CTXREG, mips_);
MOVP2R(JITBASEREG, GetBasePtr());
// Doing this down here for better pipelining, just in case.
if (cpu_info.bNEON) {
VPUSH(D8, 8);
}
RestoreDowncount();
MovFromPC(R0);
outerLoopPCInR0 = GetCodePtr();
@ -259,19 +252,18 @@ void ArmJit::GenerateFixedCode() {
SetJumpTarget(badCoreState);
breakpointBailout = GetCodePtr();
SaveDowncount();
RestoreRoundingMode(true);
// Doing this above the downcount for better pipelining (slightly.)
if (cpu_info.bNEON) {
VPOP(D8, 8);
}
SaveDowncount();
RestoreRoundingMode(true);
ADD(R_SP, R_SP, 4);
POP(9, R4, R5, R6, R7, R8, R9, R10, R11, R_PC); // Returns
// Uncomment if you want to see the output...
if (disasm) {
INFO_LOG(JIT, "THE DISASM ========================");

View File

@ -620,7 +620,7 @@ void ArmJit::Comp_Syscall(MIPSOpcode op)
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc)
{
gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallInfo(op));
gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallFuncPointer(op));
// Already flushed, so R1 is safe.
QuickCallFunction(R1, quickFunc);
}

View File

@ -602,7 +602,7 @@ void Arm64Jit::Comp_Syscall(MIPSOpcode op)
// Skip the CallSyscall where possible.
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc) {
MOVI2R(X0, (uintptr_t)GetSyscallInfo(op));
MOVI2R(X0, (uintptr_t)GetSyscallFuncPointer(op));
// Already flushed, so X1 is safe.
QuickCallFunction(X1, quickFunc);
} else {

View File

@ -790,7 +790,7 @@ void Jit::Comp_Syscall(MIPSOpcode op)
// Skip the CallSyscall where possible.
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc)
ABI_CallFunctionP(quickFunc, (void *)GetSyscallInfo(op));
ABI_CallFunctionP(quickFunc, (void *)GetSyscallFuncPointer(op));
else
ABI_CallFunctionC(&CallSyscall, op.encoding);
#endif

View File

@ -711,7 +711,12 @@ void TextureCacheD3D11::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &
mapRowPitch = w * scaleFactor * 4;
} else {
mapRowPitch = std::max(bufw, w) * bpp;
mapData = (u32 *)AllocateAlignedMemory(sizeof(u32) * (mapRowPitch / bpp) * h, 16);
size_t bufSize = sizeof(u32) * (mapRowPitch / bpp) * h;
mapData = (u32 *)AllocateAlignedMemory(bufSize, 16);
if (!mapData) {
ERROR_LOG(G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (alloc size: %d, %dx%d)", bufSize, mapRowPitch / sizeof(u32), h);
return;
}
pixelData = (u32 *)mapData;
decPitch = mapRowPitch;
}

View File

@ -84,6 +84,9 @@
#if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_PARTITION)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define PPSSPP_PLATFORM_UWP 1
#ifdef _M_ARM
#define PPSSPP_ARCH_ARM_HARDFP 1
#endif
#endif
#endif
#elif defined(__APPLE__)