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.data 8 9.align PAGE_SIZE 10.globl ptl2 11ptl2: 12 . = . + 4 * PAGE_SIZE 13.align PAGE_SIZE 14 15.globl ptl3 16ptl3: 17 . = . + PAGE_SIZE 18.align PAGE_SIZE 19 20.globl ptl4 21ptl4: 22 . = . + PAGE_SIZE 23.align PAGE_SIZE 24 25.section .init 26.code64 27.text 28 29.globl load_gdt_tss 30load_gdt_tss: 31 /* Load GDT */ 32 lgdt gdt_descr(%rip) 33 34 /* Load TSS */ 35 mov %rdi, %rax 36 ltr %ax 37 38 /* Update data segments */ 39 mov $0x10, %ax /* 3rd entry in gdt64: 32/64-bit data segment */ 40 mov %ax, %ds 41 mov %ax, %es 42 mov %ax, %fs 43 mov %ax, %gs 44 mov %ax, %ss 45 46 /* 47 * Update the code segment by putting it on the stack before the return 48 * address, then doing a far return: this will use the new code segment 49 * along with the address. 50 */ 51 popq %rdi 52 pushq $0x08 /* 2nd entry in gdt64: 64-bit code segment */ 53 pushq %rdi 54 lretq 55 56.code16 57 58.globl rm_trampoline 59rm_trampoline: 60 61.globl sipi_entry 62sipi_entry: 63 jmp sipi_entry 64 65.globl sipi_end 66sipi_end: 67 68.globl rm_trampoline_end 69rm_trampoline_end: 70