XObject CreateNative

This commit is contained in:
Dr. Chat
2015-06-12 20:09:47 -05:00
parent a0a8b7ec37
commit bdcadeffe5
5 changed files with 58 additions and 12 deletions

View File

@@ -144,17 +144,13 @@ uint8_t GetFakeCpuNumber(uint8_t proc_mask) {
X_STATUS XThread::Create() {
// Thread kernel object
// TODO: This is supposed to be preceded by X_OBJECT_HEADER, need to see if
// that's absolutely necessary.
thread_object_address_ = memory()->SystemHeapAlloc(sizeof(X_THREAD));
if (!thread_object_address_) {
// This call will also setup the native pointer for us.
uint8_t* guest_object = CreateNative(sizeof(X_THREAD));
if (!guest_object) {
XELOGW("Unable to allocate thread object");
return X_STATUS_NO_MEMORY;
}
// Set native info.
SetNativePointer(thread_object_address_, true);
// Allocate thread state block from heap.
// This is set as r13 for user code and some special inlined Win32 calls
// (like GetLastError/etc) will poke it directly.

View File

@@ -87,7 +87,6 @@ class XThread : public XObject {
uint32_t pcr_ptr() const { return pcr_address_; }
uint32_t thread_state_ptr() const { return thread_state_address_; }
uint32_t object_ptr() const { return thread_object_address_; }
cpu::ThreadState* thread_state() const { return thread_state_; }
uint32_t thread_id() const { return thread_id_; }
@@ -148,7 +147,6 @@ class XThread : public XObject {
uint32_t tls_address_;
uint32_t pcr_address_;
uint32_t thread_state_address_;
uint32_t thread_object_address_; // Kernel object
cpu::ThreadState* thread_state_;
std::string name_;