mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-06-04 05:45:03 -06:00
cellDmuxPamf: consume guest memory on SPU thread group creation
This commit is contained in:
parent
3616424b26
commit
b839d4d1a6
@ -1,6 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "Emu/Cell/PPUModule.h"
|
#include "Emu/Cell/PPUModule.h"
|
||||||
#include "Emu/Cell/lv2/sys_cond.h"
|
#include "Emu/Cell/lv2/sys_cond.h"
|
||||||
|
#include "Emu/Cell/lv2/sys_memory.h"
|
||||||
#include "Emu/Cell/lv2/sys_mutex.h"
|
#include "Emu/Cell/lv2/sys_mutex.h"
|
||||||
#include "Emu/Cell/lv2/sys_ppu_thread.h"
|
#include "Emu/Cell/lv2/sys_ppu_thread.h"
|
||||||
#include "Emu/Cell/lv2/sys_sync.h"
|
#include "Emu/Cell/lv2/sys_sync.h"
|
||||||
@ -1916,8 +1917,8 @@ error_code _CellDmuxCoreOpQueryAttr(vm::cptr<CellDmuxPamfSpecificInfo> pamfSpeci
|
|||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
error_code DmuxPamfContext::open(ppu_thread& ppu, const CellDmuxPamfResource& res, const DmuxCb<DmuxNotifyDemuxDone>& notify_dmux_done, const DmuxCb<DmuxNotifyProgEndCode>& notify_prog_end_code,
|
error_code DmuxPamfContext::open(ppu_thread& ppu, const CellDmuxPamfResource& res, vm::cptr<CellDmuxResourceSpurs> res_spurs, const DmuxCb<DmuxNotifyDemuxDone>& notify_dmux_done,
|
||||||
const DmuxCb<DmuxNotifyFatalErr>& notify_fatal_err, vm::bptr<DmuxPamfContext>& handle)
|
const DmuxCb<DmuxNotifyProgEndCode>& notify_prog_end_code, const DmuxCb<DmuxNotifyFatalErr>& notify_fatal_err, vm::bptr<DmuxPamfContext>& handle)
|
||||||
{
|
{
|
||||||
if (res.ppuThreadPriority >= 0xc00u || res.ppuThreadStackSize < 0x1000u || res.spuThreadPriority >= 0x100u || res.numOfSpus != 1u || !res.memAddr || res.memSize < sizeof(DmuxPamfContext) + 0xe7b)
|
if (res.ppuThreadPriority >= 0xc00u || res.ppuThreadStackSize < 0x1000u || res.spuThreadPriority >= 0x100u || res.numOfSpus != 1u || !res.memAddr || res.memSize < sizeof(DmuxPamfContext) + 0xe7b)
|
||||||
{
|
{
|
||||||
@ -1967,6 +1968,13 @@ error_code DmuxPamfContext::open(ppu_thread& ppu, const CellDmuxPamfResource& re
|
|||||||
|
|
||||||
ensure(std::snprintf(_this->spurs_taskset_name, sizeof(_this->spurs_taskset_name), "_libdmux_pamf_%08x", _this.addr()) == 22);
|
ensure(std::snprintf(_this->spurs_taskset_name, sizeof(_this->spurs_taskset_name), "_libdmux_pamf_%08x", _this.addr()) == 22);
|
||||||
|
|
||||||
|
_this->use_existing_spurs = !!res_spurs;
|
||||||
|
|
||||||
|
if (!res_spurs && g_fxo->get<lv2_memory_container>().take(0x40000) != 0x40000)
|
||||||
|
{
|
||||||
|
return CELL_DMUX_PAMF_ERROR_FATAL;
|
||||||
|
}
|
||||||
|
|
||||||
_this->cmd_queue.init(_this->cmd_queue_buffer);
|
_this->cmd_queue.init(_this->cmd_queue_buffer);
|
||||||
_this->cmd_result_queue.init(_this->cmd_result_queue_buffer);
|
_this->cmd_result_queue.init(_this->cmd_result_queue_buffer);
|
||||||
_this->stream_info_queue.init(_this->stream_info_queue_buffer);
|
_this->stream_info_queue.init(_this->stream_info_queue_buffer);
|
||||||
@ -2032,7 +2040,7 @@ error_code _CellDmuxCoreOpOpen(ppu_thread& ppu, vm::cptr<CellDmuxPamfSpecificInf
|
|||||||
const auto prog_end_code_func = vm::bptr<DmuxNotifyProgEndCode>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(dmuxPamfNotifyProgEndCode)));
|
const auto prog_end_code_func = vm::bptr<DmuxNotifyProgEndCode>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(dmuxPamfNotifyProgEndCode)));
|
||||||
const auto fatal_err_func = vm::bptr<DmuxNotifyFatalErr>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(dmuxPamfNotifyFatalErr)));
|
const auto fatal_err_func = vm::bptr<DmuxNotifyFatalErr>::make(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(dmuxPamfNotifyFatalErr)));
|
||||||
|
|
||||||
const error_code ret = DmuxPamfContext::open(ppu, res, { demux_done_func, _handle }, { prog_end_code_func, _handle }, { fatal_err_func, _handle }, _handle->demuxer);
|
const error_code ret = DmuxPamfContext::open(ppu, res, demuxerResourceSpurs, { demux_done_func, _handle }, { prog_end_code_func, _handle }, { fatal_err_func, _handle }, _handle->demuxer);
|
||||||
|
|
||||||
*handle = _handle;
|
*handle = _handle;
|
||||||
|
|
||||||
@ -2048,6 +2056,11 @@ error_code DmuxPamfContext::close(ppu_thread& ppu)
|
|||||||
|
|
||||||
ensure(idm::remove<dmux_pamf_spu_thread>(hle_spu_thread_id));
|
ensure(idm::remove<dmux_pamf_spu_thread>(hle_spu_thread_id));
|
||||||
|
|
||||||
|
if (!use_existing_spurs)
|
||||||
|
{
|
||||||
|
g_fxo->get<lv2_memory_container>().free(0x40000);
|
||||||
|
}
|
||||||
|
|
||||||
if (sys_cond_destroy(ppu, cond) != CELL_OK
|
if (sys_cond_destroy(ppu, cond) != CELL_OK
|
||||||
|| sys_mutex_destroy(ppu, mutex) != CELL_OK)
|
|| sys_mutex_destroy(ppu, mutex) != CELL_OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -961,7 +961,8 @@ public:
|
|||||||
|
|
||||||
void exec(ppu_thread& ppu);
|
void exec(ppu_thread& ppu);
|
||||||
|
|
||||||
static error_code open(ppu_thread& ppu, const CellDmuxPamfResource& res, const DmuxCb<DmuxNotifyDemuxDone>& notify_dmux_done, const DmuxCb<DmuxNotifyProgEndCode>& notify_prog_end_code, const DmuxCb<DmuxNotifyFatalErr>& notify_fatal_err, vm::bptr<DmuxPamfContext>& handle);
|
static error_code open(ppu_thread& ppu, const CellDmuxPamfResource& res, vm::cptr<CellDmuxResourceSpurs> res_spurs, const DmuxCb<DmuxNotifyDemuxDone>& notify_dmux_done,
|
||||||
|
const DmuxCb<DmuxNotifyProgEndCode>& notify_prog_end_code, const DmuxCb<DmuxNotifyFatalErr>& notify_fatal_err, vm::bptr<DmuxPamfContext>& handle);
|
||||||
error_code create_thread(ppu_thread& ppu);
|
error_code create_thread(ppu_thread& ppu);
|
||||||
error_code close(ppu_thread& ppu);
|
error_code close(ppu_thread& ppu);
|
||||||
error_code reset_stream(ppu_thread& ppu);
|
error_code reset_stream(ppu_thread& ppu);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user