Dummy IRQL stuff to silence warnings.
This commit is contained in:
parent
fd95858516
commit
296bb5c87a
|
@ -135,6 +135,17 @@ uint64_t Processor::Execute(
|
||||||
return context->r[3];
|
return context->r[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Irql Processor::RaiseIrql(Irql new_value) {
|
||||||
|
return static_cast<Irql>(
|
||||||
|
poly::atomic_exchange(static_cast<uint32_t>(new_value),
|
||||||
|
reinterpret_cast<volatile uint32_t*>(&irql_)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Processor::LowerIrql(Irql old_value) {
|
||||||
|
poly::atomic_exchange(static_cast<uint32_t>(old_value),
|
||||||
|
reinterpret_cast<volatile uint32_t*>(&irql_));
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t Processor::ExecuteInterrupt(
|
uint64_t Processor::ExecuteInterrupt(
|
||||||
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count) {
|
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count) {
|
||||||
SCOPE_profile_cpu_f("cpu");
|
SCOPE_profile_cpu_f("cpu");
|
||||||
|
|
|
@ -27,6 +27,14 @@ namespace xe {
|
||||||
namespace cpu {
|
namespace cpu {
|
||||||
|
|
||||||
|
|
||||||
|
enum class Irql : uint32_t {
|
||||||
|
PASSIVE = 0,
|
||||||
|
APC = 1,
|
||||||
|
DISPATCH = 2,
|
||||||
|
DPC = 3,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class Processor {
|
class Processor {
|
||||||
public:
|
public:
|
||||||
Processor(Emulator* emulator);
|
Processor(Emulator* emulator);
|
||||||
|
@ -44,6 +52,9 @@ public:
|
||||||
XenonThreadState* thread_state, uint64_t address, uint64_t args[],
|
XenonThreadState* thread_state, uint64_t address, uint64_t args[],
|
||||||
size_t arg_count);
|
size_t arg_count);
|
||||||
|
|
||||||
|
Irql RaiseIrql(Irql new_value);
|
||||||
|
void LowerIrql(Irql old_value);
|
||||||
|
|
||||||
uint64_t ExecuteInterrupt(
|
uint64_t ExecuteInterrupt(
|
||||||
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count);
|
uint32_t cpu, uint64_t address, uint64_t args[], size_t arg_count);
|
||||||
|
|
||||||
|
@ -54,6 +65,7 @@ private:
|
||||||
XenonRuntime* runtime_;
|
XenonRuntime* runtime_;
|
||||||
Memory* memory_;
|
Memory* memory_;
|
||||||
|
|
||||||
|
Irql irql_;
|
||||||
xe_mutex_t* interrupt_thread_lock_;
|
xe_mutex_t* interrupt_thread_lock_;
|
||||||
XenonThreadState* interrupt_thread_state_;
|
XenonThreadState* interrupt_thread_state_;
|
||||||
uint64_t interrupt_thread_block_;
|
uint64_t interrupt_thread_block_;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <xenia/kernel/xboxkrnl_threading.h>
|
#include <xenia/kernel/xboxkrnl_threading.h>
|
||||||
|
|
||||||
|
#include <xenia/cpu/processor.h>
|
||||||
#include <xenia/kernel/dispatcher.h>
|
#include <xenia/kernel/dispatcher.h>
|
||||||
#include <xenia/kernel/kernel_state.h>
|
#include <xenia/kernel/kernel_state.h>
|
||||||
#include <xenia/kernel/native_list.h>
|
#include <xenia/kernel/native_list.h>
|
||||||
|
@ -1275,9 +1276,9 @@ SHIM_CALL KfAcquireSpinLock_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
||||||
|
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KfAcquireSpinLock(%.8X)",
|
// "KfAcquireSpinLock(%.8X)",
|
||||||
lock_ptr);
|
// lock_ptr);
|
||||||
|
|
||||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||||
uint32_t old_irql = xeKfAcquireSpinLock(lock);
|
uint32_t old_irql = xeKfAcquireSpinLock(lock);
|
||||||
|
@ -1301,10 +1302,10 @@ SHIM_CALL KfReleaseSpinLock_shim(
|
||||||
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
||||||
uint32_t old_irql = SHIM_GET_ARG_32(1);
|
uint32_t old_irql = SHIM_GET_ARG_32(1);
|
||||||
|
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KfReleaseSpinLock(%.8X, %d)",
|
// "KfReleaseSpinLock(%.8X, %d)",
|
||||||
lock_ptr,
|
// lock_ptr,
|
||||||
old_irql);
|
// old_irql);
|
||||||
|
|
||||||
xeKfReleaseSpinLock(reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr)),
|
xeKfReleaseSpinLock(reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr)),
|
||||||
old_irql);
|
old_irql);
|
||||||
|
@ -1315,9 +1316,9 @@ SHIM_CALL KeAcquireSpinLockAtRaisedIrql_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
||||||
|
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KeAcquireSpinLockAtRaisedIrql(%.8X)",
|
// "KeAcquireSpinLockAtRaisedIrql(%.8X)",
|
||||||
lock_ptr);
|
// lock_ptr);
|
||||||
|
|
||||||
// Lock.
|
// Lock.
|
||||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||||
|
@ -1332,9 +1333,9 @@ SHIM_CALL KeReleaseSpinLockFromRaisedIrql_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
uint32_t lock_ptr = SHIM_GET_ARG_32(0);
|
||||||
|
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KeReleaseSpinLockFromRaisedIrql(%.8X)",
|
// "KeReleaseSpinLockFromRaisedIrql(%.8X)",
|
||||||
lock_ptr);
|
// lock_ptr);
|
||||||
|
|
||||||
// Unlock.
|
// Unlock.
|
||||||
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
auto lock = reinterpret_cast<uint32_t*>(SHIM_MEM_ADDR(lock_ptr));
|
||||||
|
@ -1349,8 +1350,8 @@ void xeKeEnterCriticalRegion() {
|
||||||
|
|
||||||
SHIM_CALL KeEnterCriticalRegion_shim(
|
SHIM_CALL KeEnterCriticalRegion_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KeEnterCriticalRegion()");
|
// "KeEnterCriticalRegion()");
|
||||||
xeKeEnterCriticalRegion();
|
xeKeEnterCriticalRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1362,12 +1363,31 @@ void xeKeLeaveCriticalRegion() {
|
||||||
|
|
||||||
SHIM_CALL KeLeaveCriticalRegion_shim(
|
SHIM_CALL KeLeaveCriticalRegion_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
XELOGD(
|
// XELOGD(
|
||||||
"KeLeaveCriticalRegion()");
|
// "KeLeaveCriticalRegion()");
|
||||||
xeKeLeaveCriticalRegion();
|
xeKeLeaveCriticalRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SHIM_CALL KeRaiseIrqlToDpcLevel_shim(
|
||||||
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
|
// XELOGD(
|
||||||
|
// "KeRaiseIrqlToDpcLevel()");
|
||||||
|
auto old_value = state->processor()->RaiseIrql(cpu::Irql::DPC);
|
||||||
|
SHIM_SET_RETURN_32(old_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SHIM_CALL KfLowerIrql_shim(
|
||||||
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
|
uint32_t old_value = SHIM_GET_ARG_32(0);
|
||||||
|
// XELOGD(
|
||||||
|
// "KfLowerIrql(%d)",
|
||||||
|
// old_value);
|
||||||
|
state->processor()->LowerIrql(static_cast<cpu::Irql>(old_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SHIM_CALL NtQueueApcThread_shim(
|
SHIM_CALL NtQueueApcThread_shim(
|
||||||
PPCContext* ppc_state, KernelState* state) {
|
PPCContext* ppc_state, KernelState* state) {
|
||||||
uint32_t thread_handle = SHIM_GET_ARG_32(0);
|
uint32_t thread_handle = SHIM_GET_ARG_32(0);
|
||||||
|
@ -1673,6 +1693,9 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeEnterCriticalRegion, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeEnterCriticalRegion, state);
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeLeaveCriticalRegion, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeLeaveCriticalRegion, state);
|
||||||
|
|
||||||
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeRaiseIrqlToDpcLevel, state);
|
||||||
|
SHIM_SET_MAPPING("xboxkrnl.exe", KfLowerIrql, state);
|
||||||
|
|
||||||
//SHIM_SET_MAPPING("xboxkrnl.exe", NtQueueApcThread, state);
|
//SHIM_SET_MAPPING("xboxkrnl.exe", NtQueueApcThread, state);
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeInitializeApc, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeInitializeApc, state);
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeInsertQueueApc, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeInsertQueueApc, state);
|
||||||
|
|
Loading…
Reference in New Issue