mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-09 17:49:45 +00:00
cellGcmCallback modified
This commit is contained in:
parent
27c35174bc
commit
ac20cf0060
5 changed files with 25 additions and 39 deletions
|
@ -216,12 +216,16 @@ struct CellGcmConfig
|
||||||
be_t<u32> coreFrequency;
|
be_t<u32> coreFrequency;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct CellGcmContextData;
|
||||||
|
|
||||||
|
typedef s32(*CellGcmContextCallback)(vm::ptr<CellGcmContextData>, u32);
|
||||||
|
|
||||||
struct CellGcmContextData
|
struct CellGcmContextData
|
||||||
{
|
{
|
||||||
be_t<u32> begin;
|
be_t<u32> begin;
|
||||||
be_t<u32> end;
|
be_t<u32> end;
|
||||||
be_t<u32> current;
|
be_t<u32> current;
|
||||||
be_t<u32> callback;
|
vm::bptr<CellGcmContextCallback> callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gcmInfo
|
struct gcmInfo
|
||||||
|
|
|
@ -2266,7 +2266,7 @@ void RSXThread::Task()
|
||||||
if(cmd == 0)
|
if(cmd == 0)
|
||||||
{
|
{
|
||||||
LOG_ERROR(Log::RSX, "null cmd: cmd=0x%x, put=0x%x, get=0x%x (addr=0x%x)", cmd, put, get, (u32)Memory.RSXIOMem.RealAddr(get));
|
LOG_ERROR(Log::RSX, "null cmd: cmd=0x%x, put=0x%x, get=0x%x (addr=0x%x)", cmd, put, get, (u32)Memory.RSXIOMem.RealAddr(get));
|
||||||
Emu.Pause();
|
//Emu.Pause();
|
||||||
//HACK! We shouldn't be here
|
//HACK! We shouldn't be here
|
||||||
m_ctrl->get = get + (count + 1) * 4;
|
m_ctrl->get = get + (count + 1) * 4;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -368,7 +368,7 @@ s32 _cellGcmInitBody(vm::ptr<CellGcmContextData> context, u32 cmdSize, u32 ioSiz
|
||||||
current_context.begin = ctx_begin;
|
current_context.begin = ctx_begin;
|
||||||
current_context.end = ctx_begin + ctx_size;
|
current_context.end = ctx_begin + ctx_size;
|
||||||
current_context.current = current_context.begin;
|
current_context.current = current_context.begin;
|
||||||
current_context.callback = Emu.GetRSXCallback() - 4;
|
current_context.callback.set(be_t<u32>::make(Emu.GetRSXCallback() - 4));
|
||||||
|
|
||||||
gcm_info.context_addr = (u32)Memory.MainMem.AllocAlign(0x1000);
|
gcm_info.context_addr = (u32)Memory.MainMem.AllocAlign(0x1000);
|
||||||
gcm_info.control_addr = gcm_info.context_addr + 0x40;
|
gcm_info.control_addr = gcm_info.context_addr + 0x40;
|
||||||
|
@ -502,21 +502,11 @@ s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id)
|
||||||
|
|
||||||
if(current + 8 >= end)
|
if(current + 8 >= end)
|
||||||
{
|
{
|
||||||
cellGcmSys->Error("bad flip!");
|
if (s32 res = ctxt->callback(ctxt, 8 /* ??? */))
|
||||||
//cellGcmCallback(ctxt.addr(), current + 8 - end);
|
{
|
||||||
//copied:
|
cellGcmSys->Error("cellGcmSetPrepareFlip : callback failed (0x%08x)", res);
|
||||||
|
return res;
|
||||||
auto& ctrl = vm::get_ref<CellGcmControl>(gcm_info.control_addr);
|
}
|
||||||
|
|
||||||
const s32 res = ctxt->current - ctxt->begin - ctrl.put;
|
|
||||||
|
|
||||||
memmove(vm::get_ptr<void>(ctxt->begin), vm::get_ptr<void>(ctxt->current - res), res);
|
|
||||||
|
|
||||||
ctxt->current = ctxt->begin + res;
|
|
||||||
|
|
||||||
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
|
||||||
ctrl.put = res;
|
|
||||||
ctrl.get = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
current = ctxt->current;
|
current = ctxt->current;
|
||||||
|
@ -1163,25 +1153,14 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
|
||||||
// TODO: This function was originally located in lv2/SC_GCM and appears in RPCS3 as a lv2 syscall with id 1023,
|
// TODO: This function was originally located in lv2/SC_GCM and appears in RPCS3 as a lv2 syscall with id 1023,
|
||||||
// which according to lv2 dumps isn't the case. So, is this a proper place for this function?
|
// which according to lv2 dumps isn't the case. So, is this a proper place for this function?
|
||||||
|
|
||||||
int cellGcmCallback(u32 context_addr, u32 count)
|
s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count)
|
||||||
{
|
{
|
||||||
cellGcmSys->Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context_addr, count);
|
cellGcmSys->Log("cellGcmCallback(context_addr=0x%x, count=0x%x)", context.addr(), count);
|
||||||
|
|
||||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
|
// TODO: this may be wrong
|
||||||
|
|
||||||
auto& ctx = vm::get_ref<CellGcmContextData>(context_addr);
|
|
||||||
auto& ctrl = vm::get_ref<CellGcmControl>(gcm_info.control_addr);
|
|
||||||
|
|
||||||
const s32 res = ctx.current - ctx.begin - ctrl.put;
|
|
||||||
|
|
||||||
memmove(vm::get_ptr<void>(ctx.begin), vm::get_ptr<void>(ctx.current - res), res);
|
|
||||||
|
|
||||||
ctx.current = ctx.begin + res;
|
|
||||||
|
|
||||||
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
|
||||||
ctrl.put = res;
|
|
||||||
ctrl.get = 0;
|
|
||||||
|
|
||||||
|
vm::write32(context->current, CELL_GCM_METHOD_FLAG_JUMP | CELL_GCM_METHOD_FLAG_NON_INCREMENT | (0)); // set JUMP cmd
|
||||||
|
context->current = context->begin; // rewind to the beginning
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "Emu/RSX/GCM.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -20,8 +21,7 @@ struct CellGcmOffsetTable
|
||||||
void InitOffsetTable();
|
void InitOffsetTable();
|
||||||
u32 gcmGetLocalMemorySize();
|
u32 gcmGetLocalMemorySize();
|
||||||
|
|
||||||
|
// libgcm functions
|
||||||
// SysCalls
|
|
||||||
s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id);
|
s32 cellGcmSetPrepareFlip(vm::ptr<CellGcmContextData> ctxt, u32 id);
|
||||||
|
|
||||||
s32 cellGcmAddressToOffset(u64 address, vm::ptr<be_t<u32>> offset);
|
s32 cellGcmAddressToOffset(u64 address, vm::ptr<be_t<u32>> offset);
|
||||||
|
@ -35,3 +35,6 @@ s32 cellGcmReserveIoMapSize(u32 size);
|
||||||
s32 cellGcmUnmapEaIoAddress(u64 ea);
|
s32 cellGcmUnmapEaIoAddress(u64 ea);
|
||||||
s32 cellGcmUnmapIoAddress(u64 io);
|
s32 cellGcmUnmapIoAddress(u64 io);
|
||||||
s32 cellGcmUnreserveIoMapSize(u32 size);
|
s32 cellGcmUnreserveIoMapSize(u32 size);
|
||||||
|
|
||||||
|
// Syscall
|
||||||
|
s32 cellGcmCallback(vm::ptr<CellGcmContextData> context, u32 count);
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include "lv2/sys_tty.h"
|
#include "lv2/sys_tty.h"
|
||||||
#include "lv2/sys_vm.h"
|
#include "lv2/sys_vm.h"
|
||||||
|
|
||||||
|
#include "Emu/SysCalls/Modules/cellGcmSys.h"
|
||||||
|
|
||||||
#include "SysCalls.h"
|
#include "SysCalls.h"
|
||||||
|
|
||||||
namespace detail{
|
namespace detail{
|
||||||
|
@ -40,8 +42,6 @@ static func_caller *null_func = bind_func(default_syscall);
|
||||||
|
|
||||||
static const int kSyscallTableLength = 1024;
|
static const int kSyscallTableLength = 1024;
|
||||||
|
|
||||||
extern int cellGcmCallback(u32 context_addr, u32 count);
|
|
||||||
|
|
||||||
// UNS = Unused
|
// UNS = Unused
|
||||||
// ROOT = Root
|
// ROOT = Root
|
||||||
// DBG = Debug
|
// DBG = Debug
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue