blob: 520e3c08b0e2202f6d60a084633340721df5b555 [file] [log] [blame]
Felix Held46673222020-04-04 02:37:04 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Felix Held46673222020-04-04 02:37:04 +02002
3#include <cpu/x86/post_code.h>
4
Kyösti Mälkki7522a8f2020-11-20 16:47:38 +02005.section .init, "ax", @progbits
6
Raul E Rangelec264282020-06-04 16:42:50 -06007.global bootblock_resume_entry
8bootblock_resume_entry:
9 post_code(0xb0)
10
11 /* Get an early timestamp */
12 rdtsc
13 movd %eax, %mm1
14 movd %edx, %mm2
15
16 /* Fall through to bootblock_pre_c_entry */
17
Felix Held46673222020-04-04 02:37:04 +020018/*
19 * on entry:
20 * mm0: BIST (ignored)
21 * mm2_mm1: timestamp at bootblock_protected_mode_entry
22 */
23
24.global bootblock_pre_c_entry
25bootblock_pre_c_entry:
26 post_code(0xa0)
27
Raul E Rangel6f1d35e2020-06-17 11:10:58 -060028 /* Clear .bss section */
29 cld
30 xor %eax, %eax
31 movl $(_ebss), %ecx
32 movl $(_bss), %edi
33 sub %edi, %ecx
34 shrl $2, %ecx
35 rep stosl
36
Felix Held46673222020-04-04 02:37:04 +020037 movl $_eearlyram_stack, %esp
38
39 /* Align the stack and keep aligned for call to bootblock_c_entry() */
40 and $0xfffffff0, %esp
41 sub $8, %esp
42
43 movd %mm2, %eax
44 pushl %eax /* tsc[63:32] */
45 movd %mm1, %eax
46 pushl %eax /* tsc[31:0] */
47
48 post_code(0xa2)
49
50 call bootblock_c_entry
51 /* Never reached */
52
53.halt_forever:
54 post_code(POST_DEAD_CODE)
55 hlt
56 jmp .halt_forever