xref: /kvm-unit-tests/x86/efi/efistart64.S (revision d9de80518112e083dfe412546e422c4e044c31d9)
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
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
39REALMODE_GDT_LOWMEM = PAGE_SIZE - 2
40
41.globl rm_trampoline
42rm_trampoline:
43
44.globl sipi_entry
45sipi_entry:
46	mov %cr0, %eax
47	or $1, %eax
48	mov %eax, %cr0
49
50	/* Retrieve relocated ap_rm_gdt_descr address at REALMODE_GDT_LOWMEM. */
51	mov (REALMODE_GDT_LOWMEM), %ebx
52	lgdtl (%ebx)
53
54	lcall $0x18, $0x0
55
56.globl ap_rm_gdt
57ap_rm_gdt:
58	.quad 0
59	.quad 0x00cf9b000000ffff // flat 32-bit code segment
60	.quad 0x00cf93000000ffff // flat 32-bit data segment
61	.quad 0                  // call gate to 32-bit AP entrypoint
62.globl ap_rm_gdt_end
63ap_rm_gdt_end:
64
65.globl ap_rm_gdt_descr
66ap_rm_gdt_descr:
67	.word 0
68	.long 0
69
70.globl sipi_end
71sipi_end:
72
73.globl rm_trampoline_end
74rm_trampoline_end:
75
76#include "../trampolines.S"
77