blob: 6fae1ed1cbe2ab53d525af542f82fee825ae202c [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
Raul E Rangelec264282020-06-04 16:42:50 -06005.global bootblock_resume_entry
6bootblock_resume_entry:
7 post_code(0xb0)
8
9 /* Get an early timestamp */
10 rdtsc
11 movd %eax, %mm1
12 movd %edx, %mm2
13
14 /* Fall through to bootblock_pre_c_entry */
15
Felix Held46673222020-04-04 02:37:04 +020016/*
17 * on entry:
18 * mm0: BIST (ignored)
19 * mm2_mm1: timestamp at bootblock_protected_mode_entry
20 */
21
22.global bootblock_pre_c_entry
23bootblock_pre_c_entry:
24 post_code(0xa0)
25
Raul E Rangel6f1d35e2020-06-17 11:10:58 -060026 /* Clear .bss section */
27 cld
28 xor %eax, %eax
29 movl $(_ebss), %ecx
30 movl $(_bss), %edi
31 sub %edi, %ecx
32 shrl $2, %ecx
33 rep stosl
34
Felix Held46673222020-04-04 02:37:04 +020035 movl $_eearlyram_stack, %esp
36
37 /* Align the stack and keep aligned for call to bootblock_c_entry() */
38 and $0xfffffff0, %esp
39 sub $8, %esp
40
41 movd %mm2, %eax
42 pushl %eax /* tsc[63:32] */
43 movd %mm1, %eax
44 pushl %eax /* tsc[31:0] */
45
46 post_code(0xa2)
47
48 call bootblock_c_entry
49 /* Never reached */
50
51.halt_forever:
52 post_code(POST_DEAD_CODE)
53 hlt
54 jmp .halt_forever