mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 18:53:28 +01:00
cellSpursWakeUp, CellSpursWorkloadAttribute
+vm_atomic update (8bit type)
This commit is contained in:
parent
05a7466a5a
commit
e40776ba79
@ -95,6 +95,10 @@ int clock_gettime(int foo, struct timespec *ts);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InterlockedCompareExchange
|
#ifndef InterlockedCompareExchange
|
||||||
|
static __forceinline uint8_t InterlockedCompareExchange(volatile uint8_t* dest, uint8_t exch, uint8_t comp)
|
||||||
|
{
|
||||||
|
return _InterlockedCompareExchange8((volatile char*)dest, exch, comp);
|
||||||
|
}
|
||||||
static __forceinline uint16_t InterlockedCompareExchange(volatile uint16_t* dest, uint16_t exch, uint16_t comp)
|
static __forceinline uint16_t InterlockedCompareExchange(volatile uint16_t* dest, uint16_t exch, uint16_t comp)
|
||||||
{
|
{
|
||||||
return _InterlockedCompareExchange16((volatile short*)dest, exch, comp);
|
return _InterlockedCompareExchange16((volatile short*)dest, exch, comp);
|
||||||
@ -110,6 +114,10 @@ static __forceinline uint64_t InterlockedCompareExchange(volatile uint64_t* dest
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InterlockedExchange
|
#ifndef InterlockedExchange
|
||||||
|
static __forceinline uint8_t InterlockedExchange(volatile uint8_t* dest, uint8_t value)
|
||||||
|
{
|
||||||
|
return _InterlockedExchange8((volatile char*)dest, value);
|
||||||
|
}
|
||||||
static __forceinline uint16_t InterlockedExchange(volatile uint16_t* dest, uint16_t value)
|
static __forceinline uint16_t InterlockedExchange(volatile uint16_t* dest, uint16_t value)
|
||||||
{
|
{
|
||||||
return _InterlockedExchange16((volatile short*)dest, value);
|
return _InterlockedExchange16((volatile short*)dest, value);
|
||||||
@ -125,6 +133,10 @@ static __forceinline uint64_t InterlockedExchange(volatile uint64_t* dest, uint6
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InterlockedOr
|
#ifndef InterlockedOr
|
||||||
|
static __forceinline uint8_t InterlockedOr(volatile uint8_t* dest, uint8_t value)
|
||||||
|
{
|
||||||
|
return _InterlockedOr8((volatile char*)dest, value);
|
||||||
|
}
|
||||||
static __forceinline uint16_t InterlockedOr(volatile uint16_t* dest, uint16_t value)
|
static __forceinline uint16_t InterlockedOr(volatile uint16_t* dest, uint16_t value)
|
||||||
{
|
{
|
||||||
return _InterlockedOr16((volatile short*)dest, value);
|
return _InterlockedOr16((volatile short*)dest, value);
|
||||||
@ -140,6 +152,10 @@ static __forceinline uint64_t InterlockedOr(volatile uint64_t* dest, uint64_t va
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InterlockedAnd
|
#ifndef InterlockedAnd
|
||||||
|
static __forceinline uint8_t InterlockedAnd(volatile uint8_t* dest, uint8_t value)
|
||||||
|
{
|
||||||
|
return _InterlockedAnd8((volatile char*)dest, value);
|
||||||
|
}
|
||||||
static __forceinline uint16_t InterlockedAnd(volatile uint16_t* dest, uint16_t value)
|
static __forceinline uint16_t InterlockedAnd(volatile uint16_t* dest, uint16_t value)
|
||||||
{
|
{
|
||||||
return _InterlockedAnd16((volatile short*)dest, value);
|
return _InterlockedAnd16((volatile short*)dest, value);
|
||||||
@ -155,6 +171,10 @@ static __forceinline uint64_t InterlockedAnd(volatile uint64_t* dest, uint64_t v
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef InterlockedXor
|
#ifndef InterlockedXor
|
||||||
|
static __forceinline uint8_t InterlockedXor(volatile uint8_t* dest, uint8_t value)
|
||||||
|
{
|
||||||
|
return _InterlockedXor8((volatile char*)dest, value);
|
||||||
|
}
|
||||||
static __forceinline uint16_t InterlockedXor(volatile uint16_t* dest, uint16_t value)
|
static __forceinline uint16_t InterlockedXor(volatile uint16_t* dest, uint16_t value)
|
||||||
{
|
{
|
||||||
return _InterlockedXor16((volatile short*)dest, value);
|
return _InterlockedXor16((volatile short*)dest, value);
|
||||||
|
@ -5,11 +5,17 @@ namespace vm
|
|||||||
template<typename T, size_t size = sizeof(T)>
|
template<typename T, size_t size = sizeof(T)>
|
||||||
struct _to_atomic
|
struct _to_atomic
|
||||||
{
|
{
|
||||||
static_assert(size == 2 || size == 4 || size == 8, "Invalid atomic type");
|
static_assert(size == 1 || size == 2 || size == 4 || size == 8, "Invalid atomic type");
|
||||||
|
|
||||||
typedef T type;
|
typedef T type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct _to_atomic<T, 1>
|
||||||
|
{
|
||||||
|
typedef uint8_t type;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct _to_atomic<T, 2>
|
struct _to_atomic<T, 2>
|
||||||
{
|
{
|
||||||
@ -99,21 +105,21 @@ namespace vm
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// atomic bitwise logical OR, returns previous data
|
// atomic bitwise OR, returns previous data
|
||||||
__forceinline const T _or(const T& right) volatile
|
__forceinline const T _or(const T& right) volatile
|
||||||
{
|
{
|
||||||
const atomic_type res = InterlockedOr(&data, (atomic_type&)(right));
|
const atomic_type res = InterlockedOr(&data, (atomic_type&)(right));
|
||||||
return (T&)res;
|
return (T&)res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// atomic bitwise logical AND, returns previous data
|
// atomic bitwise AND, returns previous data
|
||||||
__forceinline const T _and(const T& right) volatile
|
__forceinline const T _and(const T& right) volatile
|
||||||
{
|
{
|
||||||
const atomic_type res = InterlockedAnd(&data, (atomic_type&)(right));
|
const atomic_type res = InterlockedAnd(&data, (atomic_type&)(right));
|
||||||
return (T&)res;
|
return (T&)res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// atomic bitwise logical XOR, returns previous data
|
// atomic bitwise XOR, returns previous data
|
||||||
__forceinline const T _xor(const T& right) volatile
|
__forceinline const T _xor(const T& right) volatile
|
||||||
{
|
{
|
||||||
const atomic_type res = InterlockedXor(&data, (atomic_type&)(right));
|
const atomic_type res = InterlockedXor(&data, (atomic_type&)(right));
|
||||||
|
@ -21,6 +21,7 @@ enum MsgDialogState
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::atomic<MsgDialogState> g_msg_dialog_state(msgDialogNone);
|
std::atomic<MsgDialogState> g_msg_dialog_state(msgDialogNone);
|
||||||
|
u64 g_msg_dialog_status;
|
||||||
u64 g_msg_dialog_wait_until;
|
u64 g_msg_dialog_wait_until;
|
||||||
u32 g_msg_dialog_progress_bar_count;
|
u32 g_msg_dialog_progress_bar_count;
|
||||||
|
|
||||||
@ -100,14 +101,14 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
|
|||||||
case CELL_MSGDIALOG_TYPE_SE_MUTE_ON: break;
|
case CELL_MSGDIALOG_TYPE_SE_MUTE_ON: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 status = CELL_MSGDIALOG_BUTTON_NONE;
|
g_msg_dialog_status = CELL_MSGDIALOG_BUTTON_NONE;
|
||||||
|
|
||||||
volatile bool m_signal = false;
|
volatile bool m_signal = false;
|
||||||
CallAfter([type, msg, &status, &m_signal]()
|
CallAfter([type, msg, &m_signal]()
|
||||||
{
|
{
|
||||||
if (Emu.IsStopped()) return;
|
if (Emu.IsStopped()) return;
|
||||||
|
|
||||||
MsgDialogCreate(type, msg.c_str(), status);
|
MsgDialogCreate(type, msg.c_str(), g_msg_dialog_status);
|
||||||
|
|
||||||
m_signal = true;
|
m_signal = true;
|
||||||
});
|
});
|
||||||
@ -134,9 +135,9 @@ int cellMsgDialogOpen2(u32 type, vm::ptr<const char> msgString, vm::ptr<CellMsgD
|
|||||||
|
|
||||||
if (callback && (g_msg_dialog_state != msgDialogAbort))
|
if (callback && (g_msg_dialog_state != msgDialogAbort))
|
||||||
{
|
{
|
||||||
Emu.GetCallbackManager().Register([callback, status, userData]() -> s32
|
Emu.GetCallbackManager().Register([callback, userData]() -> s32
|
||||||
{
|
{
|
||||||
callback((s32)status, userData);
|
callback((s32)g_msg_dialog_status, userData);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -17,6 +17,27 @@ enum
|
|||||||
CELL_SPURS_CORE_ERROR_NULL_POINTER = 0x80410711,
|
CELL_SPURS_CORE_ERROR_NULL_POINTER = 0x80410711,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_AGAIN = 0x80410801,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_INVAL = 0x80410802,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_NOSYS = 0x80410803,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_NOMEM = 0x80410804,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_SRCH = 0x80410805,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_NOENT = 0x80410806,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_NOEXEC = 0x80410807,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_DEADLK = 0x80410808,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_PERM = 0x80410809,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_BUSY = 0x8041080A,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_ABORT = 0x8041080C,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_FAULT = 0x8041080D,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_CHILD = 0x8041080E,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_STAT = 0x8041080F,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_ALIGN = 0x80410810,
|
||||||
|
CELL_SPURS_POLICY_MODULE_ERROR_NULL_POINTER = 0x80410811,
|
||||||
|
};
|
||||||
|
|
||||||
// Task return codes.
|
// Task return codes.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -207,7 +228,7 @@ struct CellSpurs
|
|||||||
u8 unknown3[0xD5C - 0xD54];
|
u8 unknown3[0xD5C - 0xD54];
|
||||||
be_t<u32> queue; // 0xD5C
|
be_t<u32> queue; // 0xD5C
|
||||||
be_t<u32> port; // 0xD60
|
be_t<u32> port; // 0xD60
|
||||||
be_t<u32> unk19; // 0xD64
|
vm::atomic<u8> unk19[4]; // 0xD64 (used in wakeup)
|
||||||
vm::atomic<u32> enableEH; // 0xD68
|
vm::atomic<u32> enableEH; // 0xD68
|
||||||
be_t<u32> unk21; // 0xD6C
|
be_t<u32> unk21; // 0xD6C
|
||||||
sys_spu_image spuImg; // 0xD70
|
sys_spu_image spuImg; // 0xD70
|
||||||
@ -239,6 +260,37 @@ struct CellSpurs
|
|||||||
|
|
||||||
typedef CellSpurs CellSpurs2;
|
typedef CellSpurs CellSpurs2;
|
||||||
|
|
||||||
|
typedef void(*CellSpursShutdownCompletionEventHook)(vm::ptr<CellSpurs>, u32 wid, vm::ptr<void> arg);
|
||||||
|
|
||||||
|
struct CellSpursWorkloadAttribute
|
||||||
|
{
|
||||||
|
static const uint align = 8;
|
||||||
|
static const uint size = 512;
|
||||||
|
|
||||||
|
union
|
||||||
|
{
|
||||||
|
// raw data
|
||||||
|
u8 _u8[size];
|
||||||
|
|
||||||
|
// real data
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
be_t<u32> revision;
|
||||||
|
be_t<u32> sdkVersion;
|
||||||
|
vm::bptr<const void> pm;
|
||||||
|
be_t<u32> size;
|
||||||
|
be_t<u64> data;
|
||||||
|
u8 priority[8];
|
||||||
|
be_t<u32> minContention;
|
||||||
|
be_t<u32> maxContention;
|
||||||
|
vm::bptr<const char> nameClass;
|
||||||
|
vm::bptr<const char> nameInstance;
|
||||||
|
vm::bptr<CellSpursShutdownCompletionEventHook> hook;
|
||||||
|
vm::bptr<void> hookArg;
|
||||||
|
} m;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
struct CellSpursEventFlag
|
struct CellSpursEventFlag
|
||||||
{
|
{
|
||||||
SPURSManagerEventFlag *eventFlag;
|
SPURSManagerEventFlag *eventFlag;
|
||||||
@ -435,3 +487,6 @@ struct CellSpursTaskBinInfo
|
|||||||
be_t<u32> __reserved__;
|
be_t<u32> __reserved__;
|
||||||
CellSpursTaskLsPattern lsPattern;
|
CellSpursTaskLsPattern lsPattern;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
s64 spursAttachLv2EventQueue(vm::ptr<CellSpurs> spurs, u32 queue, vm::ptr<u8> port, s32 isDynamic, bool wasCreated);
|
||||||
|
s64 spursWakeUp(vm::ptr<CellSpurs> spurs);
|
||||||
|
@ -892,7 +892,7 @@ s32 syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u3
|
|||||||
#ifdef PRX_DEBUG_XXX
|
#ifdef PRX_DEBUG_XXX
|
||||||
return cb_caller<s32, vm::ptr<CellSyncLFQueue>, vm::ptr<u8>, u32, u32, CellSyncQueueDirection, vm::ptr<void>>::call(GetCurrentPPUThread(), libsre + 0x205C, libsre_rtoc,
|
return cb_caller<s32, vm::ptr<CellSyncLFQueue>, vm::ptr<u8>, u32, u32, CellSyncQueueDirection, vm::ptr<void>>::call(GetCurrentPPUThread(), libsre + 0x205C, libsre_rtoc,
|
||||||
queue, buffer, size, depth, direction, eaSignal);
|
queue, buffer, size, depth, direction, eaSignal);
|
||||||
#else
|
#endif
|
||||||
|
|
||||||
if (!queue)
|
if (!queue)
|
||||||
{
|
{
|
||||||
@ -991,7 +991,6 @@ s32 syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u3
|
|||||||
// prx: sync
|
// prx: sync
|
||||||
queue->init.read_sync();
|
queue->init.read_sync();
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal)
|
s32 cellSyncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u32 size, u32 depth, CellSyncQueueDirection direction, vm::ptr<void> eaSignal)
|
||||||
@ -1933,10 +1932,10 @@ s32 syncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncL
|
|||||||
#ifdef PRX_DEBUG
|
#ifdef PRX_DEBUG
|
||||||
return cb_call<s32, vm::ptr<u32>, u32, vm::ptr<CellSyncLFQueue>>(GetCurrentPPUThread(), libsre + 0x19A8, libsre_rtoc,
|
return cb_call<s32, vm::ptr<u32>, u32, vm::ptr<CellSyncLFQueue>>(GetCurrentPPUThread(), libsre + 0x19A8, libsre_rtoc,
|
||||||
spus, num, queue);
|
spus, num, queue);
|
||||||
#else
|
|
||||||
assert(!syncLFQueueAttachLv2EventQueue);
|
|
||||||
return CELL_OK;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
assert(!"syncLFQueueAttachLv2EventQueue");
|
||||||
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 _cellSyncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
|
s32 _cellSyncLFQueueAttachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
|
||||||
@ -1951,10 +1950,10 @@ s32 syncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncL
|
|||||||
#ifdef PRX_DEBUG
|
#ifdef PRX_DEBUG
|
||||||
return cb_call<s32, vm::ptr<u32>, u32, vm::ptr<CellSyncLFQueue>>(GetCurrentPPUThread(), libsre + 0x1DA0, libsre_rtoc,
|
return cb_call<s32, vm::ptr<u32>, u32, vm::ptr<CellSyncLFQueue>>(GetCurrentPPUThread(), libsre + 0x1DA0, libsre_rtoc,
|
||||||
spus, num, queue);
|
spus, num, queue);
|
||||||
#else
|
|
||||||
assert(!syncLFQueueDetachLv2EventQueue);
|
|
||||||
return CELL_OK;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
assert(!"syncLFQueueDetachLv2EventQueue");
|
||||||
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 _cellSyncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
|
s32 _cellSyncLFQueueDetachLv2EventQueue(vm::ptr<u32> spus, u32 num, vm::ptr<CellSyncLFQueue> queue)
|
||||||
|
Loading…
Reference in New Issue
Block a user