https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4bd1e819986d818347413…
commit 4bd1e819986d8183474130d34e9539560aac44d7
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sat May 20 11:59:09 2023 +0300
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Fri Nov 10 19:00:41 2023 +0200
[RTL] Get rid of x86 asm version of RtlpGetStackLimits
There is no point in writing this function in asm.
---
dll/ntdll/dispatch/i386/dispatch.S | 16 ----------------
dll/ntdll/rtl/libsupp.c | 2 --
ntoskrnl/ntos.cmake | 2 +-
ntoskrnl/rtl/i386/{stack.S => prefetch.S} | 22 ----------------------
ntoskrnl/rtl/libsupp.c | 7 +++++--
5 files changed, 6 insertions(+), 43 deletions(-)
diff --git a/dll/ntdll/dispatch/i386/dispatch.S b/dll/ntdll/dispatch/i386/dispatch.S
index 0ef4d37cc37..7564f394565 100644
--- a/dll/ntdll/dispatch/i386/dispatch.S
+++ b/dll/ntdll/dispatch/i386/dispatch.S
@@ -275,20 +275,4 @@ PUBLIC _KiFastSystemCallRet@0
.ENDP
-PUBLIC _RtlpGetStackLimits@8
-_RtlpGetStackLimits@8:
-
- /* Get the stack limits */
- mov eax, [fs:TEB_STACK_LIMIT]
- mov ecx, [fs:TEB_STACK_BASE]
-
- /* Return them */
- mov edx, [esp+4]
- mov [edx], eax
- mov edx, [esp+8]
- mov [edx], ecx
-
- /* return */
- ret 8
-
END
diff --git a/dll/ntdll/rtl/libsupp.c b/dll/ntdll/rtl/libsupp.c
index e25892e4001..7053bf401d7 100644
--- a/dll/ntdll/rtl/libsupp.c
+++ b/dll/ntdll/rtl/libsupp.c
@@ -330,7 +330,6 @@ RtlWalkFrameChain(OUT PVOID *Callers,
}
#endif
-#ifdef _AMD64_
VOID
NTAPI
RtlpGetStackLimits(
@@ -341,7 +340,6 @@ RtlpGetStackLimits(
*HighLimit = (ULONG_PTR)NtCurrentTeb()->NtTib.StackBase;
return;
}
-#endif
BOOLEAN
NTAPI
diff --git a/ntoskrnl/ntos.cmake b/ntoskrnl/ntos.cmake
index a85cb19e39a..47e7c01eda3 100644
--- a/ntoskrnl/ntos.cmake
+++ b/ntoskrnl/ntos.cmake
@@ -309,7 +309,7 @@ if(ARCH STREQUAL "i386")
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/trap.s
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/usercall_asm.S
${REACTOS_SOURCE_DIR}/ntoskrnl/ke/i386/zeropage.S
- ${REACTOS_SOURCE_DIR}/ntoskrnl/rtl/i386/stack.S)
+ ${REACTOS_SOURCE_DIR}/ntoskrnl/rtl/i386/prefetch.S)
list(APPEND SOURCE
${REACTOS_SOURCE_DIR}/ntoskrnl/config/i386/cmhardwr.c
${REACTOS_SOURCE_DIR}/ntoskrnl/kd64/i386/kdx86.c
diff --git a/ntoskrnl/rtl/i386/stack.S b/ntoskrnl/rtl/i386/prefetch.S
similarity index 72%
rename from ntoskrnl/rtl/i386/stack.S
rename to ntoskrnl/rtl/i386/prefetch.S
index 767aef6c414..5a0afa0e8e6 100644
--- a/ntoskrnl/rtl/i386/stack.S
+++ b/ntoskrnl/rtl/i386/prefetch.S
@@ -16,28 +16,6 @@ EXTERN _KePrefetchNTAGranularity:DWORD
/* FUNCTIONS *****************************************************************/
.code
-PUBLIC _RtlpGetStackLimits@8
-_RtlpGetStackLimits@8:
-
- /* Get the current thread */
- mov eax, [fs:KPCR_CURRENT_THREAD]
-
- /* Get the stack limits */
- mov ecx, [eax+KTHREAD_STACK_LIMIT]
- mov edx, [eax+KTHREAD_INITIAL_STACK]
- sub edx, SIZEOF_FX_SAVE_AREA
-
- /* Return them */
- mov eax, [esp+4]
- mov [eax], ecx
-
- mov eax, [esp+8]
- mov [eax], edx
-
- /* return */
- ret 8
-
-
PUBLIC @RtlPrefetchMemoryNonTemporal@8
@RtlPrefetchMemoryNonTemporal@8:
diff --git a/ntoskrnl/rtl/libsupp.c b/ntoskrnl/rtl/libsupp.c
index 66ae4254a73..1a6ac697a7c 100644
--- a/ntoskrnl/rtl/libsupp.c
+++ b/ntoskrnl/rtl/libsupp.c
@@ -506,7 +506,6 @@ RtlWalkFrameChain(OUT PVOID *Callers,
#endif
-#if defined(_M_AMD64) || defined(_M_ARM)
VOID
NTAPI
RtlpGetStackLimits(
@@ -514,10 +513,14 @@ RtlpGetStackLimits(
OUT PULONG_PTR HighLimit)
{
PKTHREAD CurrentThread = KeGetCurrentThread();
+#ifdef _M_IX86
+ * HighLimit = (ULONG_PTR)CurrentThread->InitialStack -
+ sizeof(FX_SAVE_AREA);
+#else
*HighLimit = (ULONG_PTR)CurrentThread->InitialStack;
+#endif
*LowLimit = (ULONG_PTR)CurrentThread->StackLimit;
}
-#endif
/* RTL Atom Tables ************************************************************/