summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRaul E Rangel <rrangel@chromium.org>2021-09-22 10:45:51 -0600
committerPatrick Georgi <pgeorgi@google.com>2021-09-27 13:41:41 +0000
commitda68c9d3784d997115f3967a3cd5f96369e04f7e (patch)
tree8ac8f2a73c5e96194a4d7ce13b44eaf5910f1492 /src
parent9f17fa33f9eb393b71bff98cfbbac3501ad0d422 (diff)
arch/x86,cpu/x86: Move cpu_info initialization instructions into macro
This will help reduce duplication and make it easier to add new members to the cpu_info struct. BUG=b:194391185, b:179699789 TEST=Compare assembly of romstage and ramstage before and after Signed-off-by: Raul E Rangel <rrangel@chromium.org> Change-Id: I31f264f4bb8b605fa3cb3bfff0d9bf79224072aa Reviewed-on: https://review.coreboot.org/c/coreboot/+/57859 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/arch/x86/assembly_entry.S9
-rw-r--r--src/arch/x86/c_start.S9
-rw-r--r--src/cpu/x86/cpu_info.S.inc10
3 files changed, 14 insertions, 14 deletions
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S
index b0e15dc700..4e7baf4427 100644
--- a/src/arch/x86/assembly_entry.S
+++ b/src/arch/x86/assembly_entry.S
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <cpu/x86/cpu_info.S.inc>
#include <rules.h>
/*
@@ -35,13 +36,7 @@ _start:
/* reset stack pointer to CAR/EARLYRAM stack */
mov $_STACK_TOP, %esp
-#if CONFIG(COOP_MULTITASKING)
- /* Push the thread pointer. */
- push $0
-#endif
- /* Push the CPU index and struct CPU */
- push $0
- push $0
+ push_cpu_info
/* clear .bss section as it is not shared */
cld
diff --git a/src/arch/x86/c_start.S b/src/arch/x86/c_start.S
index 34ed4e3665..b6375b1243 100644
--- a/src/arch/x86/c_start.S
+++ b/src/arch/x86/c_start.S
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <cpu/x86/cpu_info.S.inc>
#include <cpu/x86/post_code.h>
#include <arch/ram_segs.h>
@@ -76,13 +77,7 @@ _start:
movl $_estack, %esp
andl $(~(CONFIG_STACK_SIZE-1)), %esp
-#if CONFIG(COOP_MULTITASKING)
- /* Push the thread pointer. */
- push $0
-#endif
- /* Push the CPU index and struct CPU */
- push $0
- push $0
+ push_cpu_info
/*
* Now we are finished. Memory is up, data is copied and
diff --git a/src/cpu/x86/cpu_info.S.inc b/src/cpu/x86/cpu_info.S.inc
new file mode 100644
index 0000000000..62b47ca52a
--- /dev/null
+++ b/src/cpu/x86/cpu_info.S.inc
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/* Push struct cpu_info */
+.macro push_cpu_info index=$0
+#if CONFIG(COOP_MULTITASKING)
+ push $0 /* *thread */
+#endif
+ push \index /* index */
+ push $0 /* *cpu */
+.endm