From a6d2ed0e94d8cee07d223625b9509ff59c6d6d62 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Tue, 23 Jan 2024 19:38:57 +0100 Subject: [PATCH 1/2] [Kernel] Changed uninitialized stack value --- src/xenia/kernel/xthread.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index 130f4f06aa..dbcd6ccd98 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -268,8 +268,8 @@ bool XThread::AllocateStack(uint32_t size) { stack_limit_ = address + (padding / 2); stack_base_ = stack_limit_ + size; - // Initialize the stack with junk - memory()->Fill(stack_alloc_base_, actual_size, 0xBE); + // Initialize the stack with junk. 0x42 because you know + memory()->Fill(stack_alloc_base_, actual_size, 0x42); // Setup the guard pages heap->Protect(stack_alloc_base_, padding / 2, kMemoryProtectNoAccess); From 8b14b4bbc4b7a4b13ca73000b6511f8a8e4952ae Mon Sep 17 00:00:00 2001 From: Gliniak Date: Tue, 23 Jan 2024 21:06:57 +0100 Subject: [PATCH 2/2] [Kernel] Removed stack default uninitialized value Now it's 0 from default as expected to be --- src/xenia/kernel/xthread.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/xenia/kernel/xthread.cc b/src/xenia/kernel/xthread.cc index dbcd6ccd98..ea62eb362c 100644 --- a/src/xenia/kernel/xthread.cc +++ b/src/xenia/kernel/xthread.cc @@ -268,9 +268,6 @@ bool XThread::AllocateStack(uint32_t size) { stack_limit_ = address + (padding / 2); stack_base_ = stack_limit_ + size; - // Initialize the stack with junk. 0x42 because you know - memory()->Fill(stack_alloc_base_, actual_size, 0x42); - // Setup the guard pages heap->Protect(stack_alloc_base_, padding / 2, kMemoryProtectNoAccess); heap->Protect(stack_base_, padding / 2, kMemoryProtectNoAccess);