From 83eb22e3b1da42de2ce85a2d458fd1286237a745 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Thu, 19 Aug 2021 13:06:52 +0200 Subject: arch/x86: Implement cpu_info in C code Change-Id: Ic7396b8429e29739e18a189dacea3a76e571cd58 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/57049 Reviewed-by: Tim Wawrzynczak Reviewed-by: Furquan Shaikh Reviewed-by: David Hendricks Tested-by: build bot (Jenkins) --- src/arch/x86/include/arch/cpu.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index bec190e618..f736a147fe 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -3,6 +3,7 @@ #ifndef ARCH_CPU_H #define ARCH_CPU_H +#include #include /* @@ -237,20 +238,9 @@ struct cpu_info { static inline struct cpu_info *cpu_info(void) { - struct cpu_info *ci; - __asm__( -#if ENV_X86_64 - "and %%rsp,%0; " - "or %2, %0 " -#else - "andl %%esp,%0; " - "orl %2, %0 " -#endif - : "=r" (ci) - : "0" (~(CONFIG_STACK_SIZE - 1)), - "r" (CONFIG_STACK_SIZE - sizeof(struct cpu_info)) - ); - return ci; + char s; + uintptr_t info = ALIGN_UP((uintptr_t)&s, CONFIG_STACK_SIZE) - sizeof(struct cpu_info); + return (struct cpu_info *)info; } struct cpuinfo_x86 { -- cgit v1.2.3