summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2021-08-19 13:06:52 +0200
committerFelix Held <felix-coreboot@felixheld.de>2021-08-31 15:58:58 +0000
commit83eb22e3b1da42de2ce85a2d458fd1286237a745 (patch)
treea55b11e74c916ee7f7aef24bf85be3dc0a298716 /src
parentc33dbc3a40842a0f77c85ee24336d0c0206d9332 (diff)
arch/x86: Implement cpu_info in C code
Change-Id: Ic7396b8429e29739e18a189dacea3a76e571cd58 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57049 Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: David Hendricks <david.hendricks@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/include/arch/cpu.h18
1 files 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 <stdint.h>
#include <types.h>
/*
@@ -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 {