Attention is currently required from: Arthur Heymans. Hello Arthur Heymans,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/57049
to review the following change.
Change subject: arch/x86: Implement cpu_info in C code ......................................................................
arch/x86: Implement cpu_info in C code
Change-Id: Ic7396b8429e29739e18a189dacea3a76e571cd58 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/arch/x86/include/arch/cpu.h 1 file changed, 5 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/49/57049/1
diff --git a/src/arch/x86/include/arch/cpu.h b/src/arch/x86/include/arch/cpu.h index 3fd4c1b..a40b9b4 100644 --- a/src/arch/x86/include/arch/cpu.h +++ b/src/arch/x86/include/arch/cpu.h @@ -233,20 +233,11 @@
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 stack = (uintptr_t)&s; + stack &= ~(CONFIG_STACK_SIZE - 1); + stack |= (CONFIG_STACK_SIZE - sizeof(struct cpu_info)); + return (struct cpu_info *)stack; }
struct cpuinfo_x86 {