diff mbox

[U-Boot,v2,07/33] x86: Add processor functions to halt and get stack pointer

Message ID 1415667650-14899-8-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Nov. 11, 2014, 1 a.m. UTC
Add a function to get the stack pointer and another to halt the CPU.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2:
- Remove the cpuid functions since they were already added in another patch

 arch/x86/include/asm/processor.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Bin Meng Nov. 11, 2014, 9:32 a.m. UTC | #1
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>

On Tue, Nov 11, 2014 at 9:00 AM, Simon Glass <sjg@chromium.org> wrote:
> Add a function to get the stack pointer and another to halt the CPU.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2:
> - Remove the cpuid functions since they were already added in another patch
>
>  arch/x86/include/asm/processor.h | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> index bb3172f..b2854a9 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
> --
> 2.1.0.rc2.206.gedb03e5
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
Simon Glass Nov. 13, 2014, 5:25 a.m. UTC | #2
On 11 November 2014 02:32, Bin Meng <bmeng.cn@gmail.com> wrote:
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
>

Applied to u-boot-x86.
diff mbox

Patch

diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index bb3172f..b2854a9 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