From ca0606e04fd6e6f9ed2e11d31155a17bed3d3a12 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Wed, 21 Jul 2021 14:34:00 -0600 Subject: arch/x86,lib/thread: Enable thread support in romstage This change does the following: * Pushes the cpu_info struct into the top of the stack (just like c_start.S). This is required so the cpu_info function works correctly. * Adds the thread.c to the romstage build. I only enabled this for romstage since I haven't done any tests in other stages, but in theory it should work for other stages. BUG=b:179699789 TEST=Boot guybrush with threads enabled in romstage Signed-off-by: Raul E Rangel Change-Id: I8e32e1c54dea0d0c85dd6d6753147099aa54b9b5 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56494 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/arch/x86/Makefile.inc | 2 ++ src/arch/x86/assembly_entry.S | 8 ++++++++ 2 files changed, 10 insertions(+) (limited to 'src/arch') diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 3949e3afa4..e91ddac82d 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -154,6 +154,8 @@ romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c romstage-y += postcar_loader.c romstage-$(CONFIG_COLLECT_TIMESTAMPS_TSC) += timestamp.c romstage-$(CONFIG_HAVE_CF9_RESET) += cf9_reset.c +romstage-$(CONFIG_COOP_MULTITASKING) += thread.c +romstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S romstage-srcs += $(wildcard $(src)/mainboard/$(MAINBOARDDIR)/romstage.c) romstage-libs ?= diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S index 6e730273f8..b0e15dc700 100644 --- a/src/arch/x86/assembly_entry.S +++ b/src/arch/x86/assembly_entry.S @@ -35,6 +35,14 @@ _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 + /* clear .bss section as it is not shared */ cld xor %eax, %eax -- cgit v1.2.3