[Thread] Set pointer for: stack_kernel

Based on disassembly and info from console it is used to store initial thread data like:
 - start_address, context, etc.
This commit is contained in:
Gliniak 2023-06-12 07:40:52 +02:00
parent 4053f7bb0e
commit 9333373872
2 changed files with 3 additions and 0 deletions

View File

@ -199,6 +199,7 @@ void XThread::InitializeGuestObject() {
xe::store_and_swap<uint16_t>(p + 0x056, 1);
xe::store_and_swap<uint32_t>(p + 0x05C, stack_base_);
xe::store_and_swap<uint32_t>(p + 0x060, stack_limit_);
xe::store_and_swap<uint32_t>(p + 0x064, stack_base_ - kThreadKernelStackSize);
xe::store_and_swap<uint32_t>(p + 0x068, tls_static_address_);
xe::store_and_swap<uint8_t>(p + 0x06C, 0);
xe::store_and_swap<uint32_t>(p + 0x074, guest_object() + 0x074);

View File

@ -166,6 +166,8 @@ class XThread : public XObject, public cpu::Thread {
static constexpr uint32_t kStackAddressRangeBegin = 0x70000000;
static constexpr uint32_t kStackAddressRangeEnd = 0x7F000000;
static constexpr uint32_t kThreadKernelStackSize = 0xF0;
struct CreationParams {
uint32_t stack_size;
uint32_t xapi_thread_startup;