xref: /kvm-unit-tests/x86/efi/efistart64.S (revision dca3f4c041143c8e8dc70c6890a19a5730310230)
1/* Startup code and pre-defined data structures */
2
3#include "apic-defs.h"
4#include "asm-generic/page.h"
5#include "crt0-efi-x86_64.S"
6#include "smp.h"
7
8/* Reserve stack in .data */
9.data
10.align PAGE_SIZE
11	. = . + PAGE_SIZE * MAX_TEST_CPUS
12.globl stacktop
13stacktop:
14
15.globl smp_stacktop
16smp_stacktop:	.long 0
17
18.align PAGE_SIZE
19.globl ptl2
20ptl2:
21	. = . + 4 * PAGE_SIZE
22.align PAGE_SIZE
23
24.globl ptl3
25ptl3:
26	. = . + PAGE_SIZE
27.align PAGE_SIZE
28
29.globl ptl4
30ptl4:
31	. = . + PAGE_SIZE
32.align PAGE_SIZE
33
34.section .init
35.code64
36.text
37
38.code16
39
40.globl rm_trampoline
41rm_trampoline:
42
43.globl sipi_entry
44sipi_entry:
45	mov %cr0, %eax
46	or $1, %eax
47	mov %eax, %cr0
48
49	/* Retrieve relocated ap_rm_gdt_descr address at REALMODE_GDT_LOWMEM. */
50	mov (REALMODE_GDT_LOWMEM), %ebx
51	lgdtl (%ebx)
52
53	lcall $0x18, $0x0
54
55.globl ap_rm_gdt
56ap_rm_gdt:
57	.quad 0
58	.quad 0x00cf9b000000ffff // flat 32-bit code segment
59	.quad 0x00cf93000000ffff // flat 32-bit data segment
60	.quad 0                  // call gate to 32-bit AP entrypoint
61.globl ap_rm_gdt_end
62ap_rm_gdt_end:
63
64.globl ap_rm_gdt_descr
65ap_rm_gdt_descr:
66	.word 0
67	.long 0
68
69.globl sipi_end
70sipi_end:
71
72.globl rm_trampoline_end
73rm_trampoline_end:
74
75#include "../trampolines.S"
76