Add more wrapper functions to ppc_context_t in kernel, want to switch…

… over to referencing state through ppc_context as much as possible, it'll make implementing things like kernel processes much easier in the future

Move forward definitions of kernel types into kernel_fwd.h

Stub implementation of  XamLoaderGetMediaInfoEx
Partially implement XamSetDashContext
implement XamGetDashContext
Stub implementation of XamUserIsUnsafeProgrammingAllowed
Stub implementation of XamUserGetSubscriptionType
Expanded the supported object types for ObReferenceObjectByHandle and wrapped the logic for encoding the type in a constexpr function
ObReferenceObjectByName was taking lpstring_t for first param, but the function actually takes X_ANSI_STRING ptr

NtReleaseMutant actually does not return anything from KeReleaseMutant, it just checks the handle and returns whether it was invalid.

Changed the raise/lower irql functions to just set the irql on the pcr instead of setting it on field of Processor, processor is a shared object and irql is per-thread

Semi-stub implementation of KeGetImagePageTableEntry. I locked at it in the HV and got it so the values are in the same range the HV returns + actually reflect the page & memory range, but i doubt its equal to the values the hv returns on real hw. Used by modern dashboards, don't know for what.
Log error message for ObDereferenceObject w/ null ptr.

Allocate a special fixed page that dashboards reference, currently don't know what the data on that page is supposed to be.
Add current_irql field to X_KPCR
Added Device object member of XObject::Type enum
Added some notes about other gpu registers, found a table of register names and indices in xam
This commit is contained in:
chss95cs@gmail.com
2023-04-23 10:39:52 -04:00
parent caddaa509a
commit 2fa2f1a78c
14 changed files with 225 additions and 41 deletions

View File

@@ -0,0 +1,30 @@
#ifndef XENIA_KERNEL_UTIL_KERNEL_FWD_H_
#define XENIA_KERNEL_UTIL_KERNEL_FWD_H_
namespace xe::kernel {
class Dispatcher;
class XHostThread;
class KernelModule;
class XModule;
class XNotifyListener;
class XThread;
class UserModule;
struct ProcessInfoBlock;
struct TerminateNotification;
struct X_TIME_STAMP_BUNDLE;
class KernelState;
struct XAPC;
struct X_KPCR;
struct X_KTHREAD;
struct X_OBJECT_HEADER;
struct X_OBJECT_CREATE_INFORMATION;
struct X_OBJECT_TYPE;
} // namespace xe::kernel
namespace xe::kernel::util {
class NativeList;
class ObjectTable;
}
#endif

View File

@@ -8,7 +8,7 @@
*/
#include "xenia/kernel/util/shim_utils.h"
#include "xenia/kernel/xthread.h"
namespace xe {
namespace kernel {
namespace shim {
@@ -17,6 +17,10 @@ thread_local StringBuffer string_buffer_;
StringBuffer* thread_local_string_buffer() { return &string_buffer_; }
XThread* ContextParam::CurrentXThread() const {
return XThread::GetCurrentThread();
}
} // namespace shim
} // namespace kernel
} // namespace xe

View File

@@ -203,8 +203,21 @@ class ContextParam : public Param {
PPCContext* operator->() const { return ctx_; }
template <typename T>
inline T TranslateVirtual(uint32_t guest_addr) const {
return ctx_->TranslateVirtual<T>(guest_addr);
}
template <typename T>
inline T TranslateGPR(uint32_t which_gpr) const {
return ctx_->TranslateVirtualGPR<T>(ctx_->r[which_gpr]);
}
X_KPCR* GetPCR() const { return TranslateGPR<X_KPCR*>(13); }
XThread* CurrentXThread() const;
protected:
PPCContext* ctx_;
PPCContext* XE_RESTRICT ctx_;
};
class PointerParam : public ParamBase<uint32_t> {