Better process type emulation.
This commit is contained in:
parent
8c171a6489
commit
4fabd20980
|
@ -34,6 +34,7 @@ KernelState::KernelState(Emulator* emulator)
|
||||||
: emulator_(emulator),
|
: emulator_(emulator),
|
||||||
memory_(emulator->memory()),
|
memory_(emulator->memory()),
|
||||||
has_notified_startup_(false),
|
has_notified_startup_(false),
|
||||||
|
process_type_(X_PROCTYPE_USER),
|
||||||
executable_module_(nullptr) {
|
executable_module_(nullptr) {
|
||||||
processor_ = emulator->processor();
|
processor_ = emulator->processor();
|
||||||
file_system_ = emulator->file_system();
|
file_system_ = emulator->file_system();
|
||||||
|
|
|
@ -59,6 +59,9 @@ class KernelState {
|
||||||
ObjectTable* object_table() const { return object_table_; }
|
ObjectTable* object_table() const { return object_table_; }
|
||||||
std::mutex& object_mutex() { return object_mutex_; }
|
std::mutex& object_mutex() { return object_mutex_; }
|
||||||
|
|
||||||
|
uint32_t process_type() const { return process_type_; }
|
||||||
|
void set_process_type(uint32_t value) { process_type_ = value; }
|
||||||
|
|
||||||
void RegisterModule(XModule* module);
|
void RegisterModule(XModule* module);
|
||||||
void UnregisterModule(XModule* module);
|
void UnregisterModule(XModule* module);
|
||||||
XModule* GetModule(const char* name);
|
XModule* GetModule(const char* name);
|
||||||
|
@ -95,6 +98,7 @@ class KernelState {
|
||||||
std::vector<XNotifyListener*> notify_listeners_;
|
std::vector<XNotifyListener*> notify_listeners_;
|
||||||
bool has_notified_startup_;
|
bool has_notified_startup_;
|
||||||
|
|
||||||
|
uint32_t process_type_;
|
||||||
XUserModule* executable_module_;
|
XUserModule* executable_module_;
|
||||||
|
|
||||||
friend class XObject;
|
friend class XObject;
|
||||||
|
|
|
@ -242,8 +242,19 @@ SHIM_CALL KeGetCurrentProcessType_shim(PPCContext* ppc_state,
|
||||||
|
|
||||||
// DWORD
|
// DWORD
|
||||||
|
|
||||||
int result = X_PROCTYPE_USER;
|
SHIM_SET_RETURN_64(state->process_type());
|
||||||
SHIM_SET_RETURN_64(result);
|
}
|
||||||
|
|
||||||
|
SHIM_CALL KeSetCurrentProcessType_shim(PPCContext* ppc_state,
|
||||||
|
KernelState* state) {
|
||||||
|
uint32_t type = SHIM_GET_ARG_32(0);
|
||||||
|
// One of X_PROCTYPE_?
|
||||||
|
|
||||||
|
XELOGD("KeSetCurrentProcessType(%d)", type);
|
||||||
|
|
||||||
|
assert_true(type >= 0 && type <= 2);
|
||||||
|
|
||||||
|
state->set_process_type(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
SHIM_CALL KeQueryPerformanceFrequency_shim(PPCContext* ppc_state,
|
SHIM_CALL KeQueryPerformanceFrequency_shim(PPCContext* ppc_state,
|
||||||
|
@ -1232,6 +1243,7 @@ void xe::kernel::xboxkrnl::RegisterThreadingExports(
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeSetBasePriorityThread, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeSetBasePriorityThread, state);
|
||||||
|
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeGetCurrentProcessType, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeGetCurrentProcessType, state);
|
||||||
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeSetCurrentProcessType, state);
|
||||||
|
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeQueryPerformanceFrequency, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeQueryPerformanceFrequency, state);
|
||||||
SHIM_SET_MAPPING("xboxkrnl.exe", KeDelayExecutionThread, state);
|
SHIM_SET_MAPPING("xboxkrnl.exe", KeDelayExecutionThread, state);
|
||||||
|
|
Loading…
Reference in New Issue