mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 22:20:45 +00:00
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: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
880a3cc438
commit
21b9b14b49
1 changed files with 19 additions and 0 deletions
|
@ -30,4 +30,23 @@ enum {
|
|||
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue