From: Simon Glass Date: Tue, 11 Nov 2014 01:00:24 +0000 (-0700) Subject: x86: Add processor functions to halt and get stack pointer X-Git-Tag: v2015.01-rc2~5^2~28 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21b9b14b49b742c3ee70f819aab3918f517bf0b8;p=pandora-u-boot.git 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 Reviewed-by: Bin Meng --- diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index bb3172ff91a..b2854a978ab 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -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