Implement ArGetStackPointer() routine
All checks were successful
Builds / ExectOS (amd64) (push) Successful in 30s
Builds / ExectOS (i686) (push) Successful in 28s

This commit is contained in:
Rafal Kupiec 2023-11-19 00:09:16 +01:00
parent 83c692bfcb
commit 71d0608643
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
4 changed files with 50 additions and 0 deletions

View File

@ -67,6 +67,26 @@ ArCpuId(IN OUT PCPUID_REGISTERS Registers)
return TRUE;
}
/**
* Gets the address of the current stack register.
*
* @return This routine returns the current stack pointer.
*
* @since XT 1.0
*/
XTASSEMBLY
XTCDECL
ULONG_PTR
ArGetStackPointer()
{
/* Get current stack pointer */
asm volatile("movq %%rsp, %%rax\n"
"retq\n"
:
:
:);
}
/**
* Halts the central processing unit (CPU).
*

View File

@ -67,6 +67,26 @@ ArCpuId(IN OUT PCPUID_REGISTERS Registers)
return TRUE;
}
/**
* Gets the address of the current stack register.
*
* @return This routine returns the current stack pointer.
*
* @since XT 1.0
*/
XTASSEMBLY
XTCDECL
ULONG_PTR
ArGetStackPointer()
{
/* Get current stack pointer */
asm volatile("mov %%esp, %%eax\n"
"ret\n"
:
:
:);
}
/**
* Halts the central processing unit (CPU).
*

View File

@ -21,6 +21,11 @@ XTCDECL
BOOLEAN
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
XTASSEMBLY
XTCDECL
ULONG_PTR
ArGetStackPointer();
XTCDECL
VOID
ArHalt();

View File

@ -21,6 +21,11 @@ XTCDECL
BOOLEAN
ArCpuId(IN OUT PCPUID_REGISTERS Registers);
XTASSEMBLY
XTCDECL
ULONG_PTR
ArGetStackPointer();
XTCDECL
VOID
ArHalt();