Felix Held | 4667322 | 2020-04-04 02:37:04 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Felix Held | 4667322 | 2020-04-04 02:37:04 +0200 | [diff] [blame] | 2 | |
| 3 | #include <cpu/x86/post_code.h> |
| 4 | |
Raul E Rangel | ec26428 | 2020-06-04 16:42:50 -0600 | [diff] [blame] | 5 | .global bootblock_resume_entry |
| 6 | bootblock_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 Held | 4667322 | 2020-04-04 02:37:04 +0200 | [diff] [blame] | 16 | /* |
| 17 | * on entry: |
| 18 | * mm0: BIST (ignored) |
| 19 | * mm2_mm1: timestamp at bootblock_protected_mode_entry |
| 20 | */ |
| 21 | |
| 22 | .global bootblock_pre_c_entry |
| 23 | bootblock_pre_c_entry: |
| 24 | post_code(0xa0) |
| 25 | |
Raul E Rangel | 6f1d35e | 2020-06-17 11:10:58 -0600 | [diff] [blame^] | 26 | /* 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 Held | 4667322 | 2020-04-04 02:37:04 +0200 | [diff] [blame] | 35 | 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 |