Make XThread create a kernel object for itself

This commit is contained in:
Dr. Chat
2015-06-12 19:02:17 -05:00
parent 864e257474
commit 4c9cab4346
3 changed files with 36 additions and 7 deletions

View File

@@ -60,6 +60,19 @@ struct XAPC {
}
};
// http://www.nirsoft.net/kernel_struct/vista/KTHREAD.html
struct X_THREAD {
X_DISPATCH_HEADER header;
xe::be<uint64_t> cycle_time;
xe::be<uint32_t> high_cycle_time; // FIXME: Needed?
xe::be<uint64_t> quantum_target;
xe::be<uint32_t> initial_stack_ptr;
xe::be<uint32_t> stack_limit_ptr;
xe::be<uint32_t> kernel_stack_ptr;
// This struct is actually quite long... so uh, not filling this out!
};
class XThread : public XObject {
public:
XThread(KernelState* kernel_state, uint32_t stack_size,
@@ -74,6 +87,8 @@ 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_; }
uint32_t last_error();
@@ -133,6 +148,7 @@ 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_;