moved xsemaphore to xthread.d

add typed guest pointer template
add X_KSPINLOCK, rework spinlock functions.
rework irql related code, use irql on pcr instead of on XThread
add guest linked list helper functions
renamed ProcessInfoBlock to X_KPROCESS
assigned names to many kernel structure fields
This commit is contained in:
disjtqz
2023-10-10 08:50:10 -04:00
committed by Radosław Gliński
parent 32f7241526
commit b5ddd30572
14 changed files with 507 additions and 230 deletions

View File

@@ -16,6 +16,7 @@
#include "xenia/base/mutex.h"
#include "xenia/base/vec128.h"
#include "xenia/guest_pointers.h"
namespace xe {
namespace cpu {
class Processor;
@@ -449,6 +450,24 @@ typedef struct alignas(64) PPCContext_s {
}
template <typename T>
inline T* TranslateVirtual(TypedGuestPointer<T> guest_address) {
return TranslateVirtual<T*>(guest_address.m_ptr);
}
template <typename T>
inline uint32_t HostToGuestVirtual(T* host_ptr) XE_RESTRICT const {
#if XE_PLATFORM_WIN32 == 1
uint32_t guest_tmp = static_cast<uint32_t>(
reinterpret_cast<const uint8_t*>(host_ptr) - virtual_membase);
if (guest_tmp >= static_cast<uint32_t>(reinterpret_cast<uintptr_t>(this))) {
guest_tmp -= 0x1000;
}
return guest_tmp;
#else
return processor->memory()->HostToGuestVirtual(
reinterpret_cast<void*>(host_ptr));
#endif
}
static std::string GetRegisterName(PPCRegister reg);
std::string GetStringFromValue(PPCRegister reg) const;
void SetValueFromString(PPCRegister reg, std::string value);