Lines Matching +full:8 +full:- +full:cpu
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * linux/arch/x86/kernel/head_64.S -- start in 32bit and switch to 64bit
21 #include <asm/processor-flags.h>
25 #include <asm/nospec-branch.h>
32 * because we need identity-mapped pages.
35 #define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
48 * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
69 leaq (__end_init_task - PTREGS_SIZE)(%rip), %rsp
94 * be done now, since this also includes setup of the SEV-SNP CPUID table,
102 /* Sanitize CPU configuration */
116 addq $(early_top_pgt - __START_KERNEL_map), %rax
125 * For SEV guests: Verify that the C-bit is correct. A malicious
126 * hypervisor could lie about the C-bit position to perform a ROP
146 * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
157 /* Sanitize CPU configuration */
162 * SEV-ES guests. In those guests the call to verify_cpu() would cause
164 * CPU bringup.
166 * All non SEV-ES systems, especially Intel systems, need to execute
173 /* Clear %R15 which holds the boot_params pointer on the boot CPU */
187 addq $(init_top_pgt - __START_KERNEL_map), %rax
214 /* Setup early boot stage 4-/5-level pagetables. */
218 * Switch to new page-table
220 * For the boot CPU this switches to early_top_pgt which still has the
248 * used to look up the CPU number. For booting a single CPU, the
249 * CPU number is encoded in smpboot_control.
252 * Bit 0-23 CPU# if STARTUP_xx flags are not set
258 * No control bit set, single CPU bringup. CPU number is provided
259 * in bit 0-23. This is also the boot CPU case (CPU number 0).
287 /* Read the APIC ID from the fix-mapped MMIO space. */
299 /* EAX contains the APIC ID of the current CPU */
323 /* Get the per cpu offset for the given CPU# which is in ECX */
324 movq __per_cpu_offset(,%rcx,8), %rdx
326 xorl %edx, %edx /* zero-extended to clear all of RDX */
330 * Setup a boot time stack - Any secondary CPU will have lost its stack
331 * by now because the cr3-switch above unmaps the real-mode stack.
333 * RDX contains the per-cpu offset
339 * Now that this CPU is running on its own stack, drop the realmode
340 * protection. For the boot CPU the pointer is NULL!
355 movw $(GDT_SIZE-1), (%rsp)
379 * Note that, on SMP, the boot cpu uses init data section until
380 * the per cpu areas are set up.
433 * Since we are running on identity-mapped space we have to jump
471 * Entry point for soft restart of a CPU. Invoked from xxx_play_dead() for
472 * restarting the boot CPU or for restarting SEV guest CPUs after CPU hot
492 * of __init code and this handler is also used during CPU offlining/onlining.
497 UNWIND_HINT_IRET_REGS offset=8
514 addq $8, %rsp
522 .balign 8
540 UNWIND_HINT_IRET_REGS offset=8
547 .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
562 /* The vector number is currently in the pt_regs->di slot. */
563 pushq %rsi /* pt_regs->si */
564 movq 8(%rsp), %rsi /* RSI = vector number */
565 movq %rdi, 8(%rsp) /* pt_regs->di = RDI */
566 pushq %rdx /* pt_regs->dx */
567 pushq %rcx /* pt_regs->cx */
568 pushq %rax /* pt_regs->ax */
569 pushq %r8 /* pt_regs->r8 */
570 pushq %r9 /* pt_regs->r9 */
571 pushq %r10 /* pt_regs->r10 */
572 pushq %r11 /* pt_regs->r11 */
573 pushq %rbx /* pt_regs->bx */
574 pushq %rbp /* pt_regs->bp */
575 pushq %r12 /* pt_regs->r12 */
576 pushq %r13 /* pt_regs->r13 */
577 pushq %r14 /* pt_regs->r14 */
578 pushq %r15 /* pt_regs->r15 */
592 * paravirtualized INTERRUPT_RETURN and pv-ops don't work that early.
600 UNWIND_HINT_IRET_REGS offset=8
615 addq $8, %rsp
617 /* Pure iret required here - don't use INTERRUPT_RETURN */
627 * Each PGD needs to be 8k long and 8k aligned. We do not
631 * need to worry about whether it has 4k or 8k to work
634 * This ensures PGDs are 8k long:
637 /* This ensures they are 8k-aligned: */
658 .fill 512,8,0
659 .fill PTI_USER_PGD_FILL,8,0
663 .fill 512*EARLY_DYNAMIC_PAGE_TABLES,8,0
672 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
673 .org init_top_pgt + L4_PAGE_OFFSET*8, 0
674 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
675 .org init_top_pgt + L4_START_KERNEL*8, 0
676 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
677 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
678 .fill PTI_USER_PGD_FILL,8,0
682 .quad level2_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
683 .fill 511, 8, 0
691 * the CPU supports it or it is enabled. But,
692 * the CPU should ignore the bit.
698 .fill 512,8,0
699 .fill PTI_USER_PGD_FILL,8,0
705 .fill 511,8,0
706 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
711 .fill L3_START_KERNEL,8,0
712 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
713 .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
714 .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
735 .fill (512 - 4 - FIXMAP_PMD_NUM),8,0
738 .quad level1_fixmap_pgt + (pgtno << PAGE_SHIFT) - __START_KERNEL_map \
743 .fill 4,8,0
748 .fill 512,8,0
764 #include "../../x86/xen/xen-head.S"