diff --git a/sdk/xtdk/amd64/rtlfuncs.h b/sdk/xtdk/amd64/rtlfuncs.h new file mode 100644 index 0000000..86af1e1 --- /dev/null +++ b/sdk/xtdk/amd64/rtlfuncs.h @@ -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 + */ + +#ifndef __XTDK_AMD64_RTLFUNCS_H +#define __XTDK_AMD64_RTLFUNCS_H + +#include +#include +#include + + +XTAPI +VOID +RtlGetStackLimits(OUT PULONG_PTR StackBase, + OUT PULONG_PTR StackLimit); + +#endif /* __XTDK_AMD64_RTLFUNCS_H */ diff --git a/sdk/xtdk/i686/rtlfuncs.h b/sdk/xtdk/i686/rtlfuncs.h new file mode 100644 index 0000000..bda06cf --- /dev/null +++ b/sdk/xtdk/i686/rtlfuncs.h @@ -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 + */ + +#ifndef __XTDK_I686_RTLFUNCS_H +#define __XTDK_I686_RTLFUNCS_H + +#include +#include +#include + + +XTAPI +VOID +RtlGetStackLimits(OUT PULONG_PTR StackBase, + OUT PULONG_PTR StackLimit); + +#endif /* __XTDK_I686_RTLFUNCS_H */ diff --git a/sdk/xtdk/xtkmapi.h b/sdk/xtdk/xtkmapi.h index 825faa9..da5e380 100644 --- a/sdk/xtdk/xtkmapi.h +++ b/sdk/xtdk/xtkmapi.h @@ -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 diff --git a/xtoskrnl/CMakeLists.txt b/xtoskrnl/CMakeLists.txt index c7c9867..4d7efbb 100644 --- a/xtoskrnl/CMakeLists.txt +++ b/xtoskrnl/CMakeLists.txt @@ -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) diff --git a/xtoskrnl/rtl/amd64/dispatch.c b/xtoskrnl/rtl/amd64/dispatch.c new file mode 100644 index 0000000..61c664e --- /dev/null +++ b/xtoskrnl/rtl/amd64/dispatch.c @@ -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 + */ + +#include + + +/** + * 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; +} diff --git a/xtoskrnl/rtl/i686/dispatch.c b/xtoskrnl/rtl/i686/dispatch.c new file mode 100644 index 0000000..0c8ac96 --- /dev/null +++ b/xtoskrnl/rtl/i686/dispatch.c @@ -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 + */ + +#include + + +/** + * 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; +}