From 9b9e621593032ef5b6288c01292e68af061a7347 Mon Sep 17 00:00:00 2001 From: elisha464 Date: Tue, 21 Jan 2014 21:10:44 +0200 Subject: [PATCH] finished all memory mapping functions of libgcm --- rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp | 81 ++++++++++++++++++++++- 1 file changed, 80 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp index c81f3a911c..9a6f0fc686 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGcmSys.cpp @@ -36,7 +36,10 @@ void cellGcmGetOffsetTable(mem_ptr_t table); int32_t cellGcmIoOffsetToAddress(u32 ioOffset, u64 address); int32_t cellGcmMapEaIoAddress(const u32 ea, const u32 io, const u32 size); int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset); - +int32_t cellGcmReserveIoMapSize(const u32 size); +int32_t cellGcmUnmapEaIoAddress(u64 ea); +int32_t cellGcmUnmapIoAddress(u64 io); +int32_t cellGcmUnreserveIoMapSize(u32 size); //------------------------------------------------------------ @@ -717,6 +720,78 @@ int32_t cellGcmMapMainMemory(u64 ea, u32 size, mem32_t offset) return CELL_OK; } +int32_t cellGcmReserveIoMapSize(const u32 size) +{ + if(size & 0xFFFFF) + return CELL_GCM_ERROR_INVALID_ALIGNMENT; + + if(size > cellGcmGetMaxIoMapSize()) + return CELL_GCM_ERROR_INVALID_VALUE; + + Memory.RSXIOMem.Reserve(size); + return CELL_OK; +} + +int32_t cellGcmUnmapEaIoAddress(u64 ea) +{ + u32 size; + if(size = Memory.RSXIOMem.UnmapRealAddress(ea)) + { + u64 io; + ea = ea >> 20; + io = Memory.Read16(offsetTable.io + (ea*sizeof(u16))); + + for(int i=0; i> 20; + ea = Memory.Read16(offsetTable.ea + (io*sizeof(u16))); + + for(int i=0; i Memory.RSXIOMem.GetResevedAmount()) + return CELL_GCM_ERROR_INVALID_VALUE; + + Memory.RSXIOMem.Unreserve(size); + return CELL_OK; +} + +//------------------------------------------------------------ + void cellGcmSys_init() { current_config.ioAddress = NULL; @@ -776,4 +851,8 @@ void cellGcmSys_init() cellGcmSys.AddFunc(0x63441cb4, cellGcmMapEaIoAddress); cellGcmSys.AddFunc(0xdb769b32, cellGcmMapLocalMemory); cellGcmSys.AddFunc(0xa114ec67, cellGcmMapMainMemory); + cellGcmSys.AddFunc(0xa7ede268, cellGcmReserveIoMapSize); + cellGcmSys.AddFunc(0xefd00f54, cellGcmUnmapEaIoAddress); + cellGcmSys.AddFunc(0xdb23e867, cellGcmUnmapIoAddress); + cellGcmSys.AddFunc(0x3b9bd5bd, cellGcmUnreserveIoMapSize); }