arch/x86/assembly_entry: allow early post CAR stages to use common code
The skylake-based Chromebooks use a separate verstage which runs
just after bootblock and prior to romstage. The normal path for
romstage would be to reload the gdt, however in the previously
described scenario has verstage performing that work. Therefore,
provide that path under those conditions. The only difference
from the C_ENVIRONMENT_BOOTBLOCK scenario is that the stack
should not be reloaded since there's no way to know the top
of the stack.
Signed-off-by: Aaron Durbin <firstname.lastname@example.org>
Reviewed-by: Furquan Shaikh <email@example.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Andrey Petrov <firstname.lastname@example.org>
Reviewed-by: Leroy P Leahy <email@example.com>
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S
index ec3888f..86dbba4 100644
@@ -14,21 +14,35 @@
* GNU General Public License for more details.
- * This path is for stages that post bootblock when employing
- * CONFIG_C_ENVIRONMENT_BOOTBLOCK. There's no need to re-load the gdt, etc
- * as all those settings are cached within the processor. In order to
- * continue with C code execution one needs to set stack pointer and clear
- * CAR_GLOBAL variables that are stage specific.
+ *Take the path where CAR_GLOBAL variables just need to be cleared when
+ * verstage runs directly after bootblock.
+#define ROMSTAGE_AFTER_VERSTAGE \
+ (IS_ENABLED(CONFIG_SEPARATE_VERSTAGE) && \
+ IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK) && ENV_ROMSTAGE)
+#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) || ROMSTAGE_AFTER_VERSTAGE
+ * This path is for stages that are post bootblock when employing
+ * CONFIG_C_ENVIRONMENT_BOOTBLOCK or any intermediate stage succeeding
+ * the first stage to initialize protected mode. There's no need to re-load
+ * the gdt, etc as all those settings are cached within the processor. In
+ * order to continue with C code execution one needs to set stack pointer and
+ * clear CAR_GLOBAL variables that are stage specific.
.section ".text._start", "ax", @progbits
+/* _car_stack_end symbol is only valid when bootblock does CAR setup. */
/* reset stack pointer to CAR stack */
mov $_car_stack_end, %esp
/* clear CAR_GLOBAL area as it is not shared */