Implement RtlGetStackLimits() routine
All checks were successful
ci/woodpecker/push/build Pipeline was successful

This commit is contained in:
Rafal Kupiec 2023-02-15 20:12:58 +01:00
parent d28687631b
commit b1c2b209e3
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
6 changed files with 113 additions and 1 deletions

22
sdk/xtdk/amd64/rtlfuncs.h Normal file
View File

@ -0,0 +1,22 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: sdk/xtdk/amd64/rtlfuncs.h
* DESCRIPTION: XT runtime library routines specific to AMD64 architecture
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#ifndef __XTDK_AMD64_RTLFUNCS_H
#define __XTDK_AMD64_RTLFUNCS_H
#include <xtdefs.h>
#include <xtstruct.h>
#include <xttypes.h>
XTAPI
VOID
RtlGetStackLimits(OUT PULONG_PTR StackBase,
OUT PULONG_PTR StackLimit);
#endif /* __XTDK_AMD64_RTLFUNCS_H */

22
sdk/xtdk/i686/rtlfuncs.h Normal file
View File

@ -0,0 +1,22 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: sdk/xtdk/i686/rtlfuncs.h
* DESCRIPTION: XT runtime library routines specific to i686 architecture
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#ifndef __XTDK_I686_RTLFUNCS_H
#define __XTDK_I686_RTLFUNCS_H
#include <xtdefs.h>
#include <xtstruct.h>
#include <xttypes.h>
XTAPI
VOID
RtlGetStackLimits(OUT PULONG_PTR StackBase,
OUT PULONG_PTR StackLimit);
#endif /* __XTDK_I686_RTLFUNCS_H */

View File

@ -47,6 +47,7 @@
/* Architecture specific XT routines*/
#include ARCH_HEADER(arfuncs.h)
#include ARCH_HEADER(hlfuncs.h)
#include ARCH_HEADER(rtlfuncs.h)
/* Callbacks */
#include <kertptr.h>

View File

@ -26,7 +26,8 @@ list(APPEND XTOSKRNL_SOURCE
${XTOSKRNL_SOURCE_DIR}/rtl/memory.c
${XTOSKRNL_SOURCE_DIR}/rtl/plist.c
${XTOSKRNL_SOURCE_DIR}/rtl/string.c
${XTOSKRNL_SOURCE_DIR}/rtl/widestr.c)
${XTOSKRNL_SOURCE_DIR}/rtl/widestr.c
${XTOSKRNL_SOURCE_DIR}/rtl/${ARCH}/dispatch.c)
# Set module definition SPEC file
set_specfile(xtoskrnl.spec)

View File

@ -0,0 +1,33 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/rtl/amd64/dispatch.c
* DESCRIPTION: Dispatching support for AMD64 architecture
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtos.h>
/**
* Returns the stack limits for the current thread.
*
* @param StackBase
* Supplies a pointer to memory area, where the stack base will be stored.
*
* @param StackLimit
* Suppliws a pointer to memory area, where the stack limit will be stored.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
RtlGetStackLimits(OUT PULONG_PTR StackBase,
OUT PULONG_PTR StackLimit)
{
PKTHREAD Thread = KeGetCurrentThread();
*StackBase = (ULONG_PTR)Thread->StackBase;
*StackLimit = (ULONG_PTR)Thread->StackLimit;
}

View File

@ -0,0 +1,33 @@
/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: xtoskrnl/rtl/i686/dispatch.c
* DESCRIPTION: Dispatching support for i686 architecture
* DEVELOPERS: Rafal Kupiec <belliash@codingworkshop.eu.org>
*/
#include <xtos.h>
/**
* Returns the stack limits for the current thread.
*
* @param StackBase
* Supplies a pointer to memory area, where the stack base will be stored.
*
* @param StackLimit
* Suppliws a pointer to memory area, where the stack limit will be stored.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
RtlGetStackLimits(OUT PULONG_PTR StackBase,
OUT PULONG_PTR StackLimit)
{
PKTHREAD Thread = KeGetCurrentThread();
*StackBase = (ULONG_PTR)Thread->StackBase - sizeof(FX_SAVE_AREA);
*StackLimit = (ULONG_PTR)Thread->StackLimit;
}