Skip to content
Snippets Groups Projects
Commit 21b9b14b authored by Simon Glass's avatar Simon Glass
Browse files

x86: Add processor functions to halt and get stack pointer


Add a function to get the stack pointer and another to halt the CPU.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarBin Meng <bmeng.cn@gmail.com>
parent 880a3cc4
No related branches found
No related tags found
No related merge requests found
...@@ -30,4 +30,23 @@ enum { ...@@ -30,4 +30,23 @@ enum {
#define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE) #define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
#ifndef __ASSEMBLY__
static inline __attribute__((always_inline)) void cpu_hlt(void)
{
asm("hlt");
}
static inline ulong cpu_get_sp(void)
{
ulong result;
asm volatile(
"mov %%esp, %%eax"
: "=a" (result));
return result;
}
#endif /* __ASSEMBLY__ */
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment