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>
26 #include <asm/nospec-branch.h>
33 * because we need identity-mapped pages.
36 #define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
49 * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
70 leaq (__end_init_task - PTREGS_SIZE)(%rip), %rsp
95 * be done now, since this also includes setup of the SEV-SNP CPUID table,
103 /* Sanitize CPU configuration */
117 addq $(early_top_pgt - __START_KERNEL_map), %rax
125 * At this point the CPU runs in 64bit mode CS.L = 1 CS.D = 0,
136 /* Sanitize CPU configuration */
141 * SEV-ES guests. In those guests the call to verify_cpu() would cause
143 * CPU bringup.
145 * All non SEV-ES systems, especially Intel systems, need to execute
152 /* Clear %R15 which holds the boot_params pointer on the boot CPU */
166 addq $(init_top_pgt - __START_KERNEL_map), %rax
193 /* Setup early boot stage 4-/5-level pagetables. */
197 * For SEV guests: Verify that the C-bit is correct. A malicious
198 * hypervisor could lie about the C-bit position to perform a ROP
206 * Switch to new page-table
208 * For the boot CPU this switches to early_top_pgt which still has the
236 * used to look up the CPU number. For booting a single CPU, the
237 * CPU number is encoded in smpboot_control.
240 * Bit 0-23 CPU# if STARTUP_xx flags are not set
246 * No control bit set, single CPU bringup. CPU number is provided
247 * in bit 0-23. This is also the boot CPU case (CPU number 0).
275 /* Read the APIC ID from the fix-mapped MMIO space. */
287 /* EAX contains the APIC ID of the current CPU */
311 /* Get the per cpu offset for the given CPU# which is in ECX */
312 movq __per_cpu_offset(,%rcx,8), %rdx
314 xorl %edx, %edx /* zero-extended to clear all of RDX */
318 * Setup a boot time stack - Any secondary CPU will have lost its stack
319 * by now because the cr3-switch above unmaps the real-mode stack.
321 * RDX contains the per-cpu offset
327 * Now that this CPU is running on its own stack, drop the realmode
328 * protection. For the boot CPU the pointer is NULL!
343 movw $(GDT_SIZE-1), (%rsp)
367 * Note that, on SMP, the boot cpu uses init data section until
368 * the per cpu areas are set up.
421 * Since we are running on identity-mapped space we have to jump
459 * Entry point for soft restart of a CPU. Invoked from xxx_play_dead() for
460 * restarting the boot CPU or for restarting SEV guest CPUs after CPU hot
480 * of __init code and this handler is also used during CPU offlining/onlining.
485 UNWIND_HINT_IRET_REGS offset=8
502 addq $8, %rsp
510 .balign 8
528 UNWIND_HINT_IRET_REGS offset=8
535 .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
550 /* The vector number is currently in the pt_regs->di slot. */
551 pushq %rsi /* pt_regs->si */
552 movq 8(%rsp), %rsi /* RSI = vector number */
553 movq %rdi, 8(%rsp) /* pt_regs->di = RDI */
554 pushq %rdx /* pt_regs->dx */
555 pushq %rcx /* pt_regs->cx */
556 pushq %rax /* pt_regs->ax */
557 pushq %r8 /* pt_regs->r8 */
558 pushq %r9 /* pt_regs->r9 */
559 pushq %r10 /* pt_regs->r10 */
560 pushq %r11 /* pt_regs->r11 */
561 pushq %rbx /* pt_regs->bx */
562 pushq %rbp /* pt_regs->bp */
563 pushq %r12 /* pt_regs->r12 */
564 pushq %r13 /* pt_regs->r13 */
565 pushq %r14 /* pt_regs->r14 */
566 pushq %r15 /* pt_regs->r15 */
580 * paravirtualized INTERRUPT_RETURN and pv-ops don't work that early.
588 UNWIND_HINT_IRET_REGS offset=8
603 addq $8, %rsp
605 /* Pure iret required here - don't use INTERRUPT_RETURN */
615 * Each PGD needs to be 8k long and 8k aligned. We do not
619 * need to worry about whether it has 4k or 8k to work
622 * This ensures PGDs are 8k long:
625 /* This ensures they are 8k-aligned: */
646 .fill 512,8,0
647 .fill PTI_USER_PGD_FILL,8,0
651 .fill 512*EARLY_DYNAMIC_PAGE_TABLES,8,0
660 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
661 .org init_top_pgt + L4_PAGE_OFFSET*8, 0
662 .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
663 .org init_top_pgt + L4_START_KERNEL*8, 0
664 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
665 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
666 .fill PTI_USER_PGD_FILL,8,0
670 .quad level2_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
671 .fill 511, 8, 0
679 * the CPU supports it or it is enabled. But,
680 * the CPU should ignore the bit.
686 .fill 512,8,0
687 .fill PTI_USER_PGD_FILL,8,0
693 .fill 511,8,0
694 .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
699 .fill L3_START_KERNEL,8,0
700 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
701 .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE_NOENC
702 .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE_NOENC
723 .fill (512 - 4 - FIXMAP_PMD_NUM),8,0
726 .quad level1_fixmap_pgt + (pgtno << PAGE_SHIFT) - __START_KERNEL_map \
731 .fill 4,8,0
736 .fill 512,8,0
752 #include "../../x86/xen/xen-head.S"