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>
This commit is contained in:
committed by
Felix Held
parent
c33dbc3a40
commit
83eb22e3b1
@@ -3,6 +3,7 @@
|
|||||||
#ifndef ARCH_CPU_H
|
#ifndef ARCH_CPU_H
|
||||||
#define ARCH_CPU_H
|
#define ARCH_CPU_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <types.h>
|
#include <types.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -237,20 +238,9 @@ struct cpu_info {
|
|||||||
|
|
||||||
static inline struct cpu_info *cpu_info(void)
|
static inline struct cpu_info *cpu_info(void)
|
||||||
{
|
{
|
||||||
struct cpu_info *ci;
|
char s;
|
||||||
__asm__(
|
uintptr_t info = ALIGN_UP((uintptr_t)&s, CONFIG_STACK_SIZE) - sizeof(struct cpu_info);
|
||||||
#if ENV_X86_64
|
return (struct cpu_info *)info;
|
||||||
"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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cpuinfo_x86 {
|
struct cpuinfo_x86 {
|
||||||
|
Reference in New Issue
Block a user