cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

efi-entry.S (1510B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/*
      3 * EFI entry point.
      4 *
      5 * Copyright (C) 2013, 2014 Red Hat, Inc.
      6 * Author: Mark Salter <msalter@redhat.com>
      7 */
      8#include <linux/linkage.h>
      9#include <linux/init.h>
     10
     11#include <asm/assembler.h>
     12
     13	__INIT
     14
     15SYM_CODE_START(efi_enter_kernel)
     16	/*
     17	 * efi_pe_entry() will have copied the kernel image if necessary and we
     18	 * end up here with device tree address in x1 and the kernel entry
     19	 * point stored in x0. Save those values in registers which are
     20	 * callee preserved.
     21	 */
     22	ldr	w2, =primary_entry_offset
     23	add	x19, x0, x2		// relocated Image entrypoint
     24	mov	x20, x1			// DTB address
     25
     26	/*
     27	 * Clean the copied Image to the PoC, and ensure it is not shadowed by
     28	 * stale icache entries from before relocation.
     29	 */
     30	ldr	w1, =kernel_size
     31	add	x1, x0, x1
     32	bl	dcache_clean_poc
     33	ic	ialluis
     34
     35	/*
     36	 * Clean the remainder of this routine to the PoC
     37	 * so that we can safely disable the MMU and caches.
     38	 */
     39	adr	x0, 0f
     40	adr	x1, 3f
     41	bl	dcache_clean_poc
     420:
     43	/* Turn off Dcache and MMU */
     44	mrs	x0, CurrentEL
     45	cmp	x0, #CurrentEL_EL2
     46	b.ne	1f
     47	mrs	x0, sctlr_el2
     48	bic	x0, x0, #1 << 0	// clear SCTLR.M
     49	bic	x0, x0, #1 << 2	// clear SCTLR.C
     50	pre_disable_mmu_workaround
     51	msr	sctlr_el2, x0
     52	isb
     53	b	2f
     541:
     55	mrs	x0, sctlr_el1
     56	bic	x0, x0, #1 << 0	// clear SCTLR.M
     57	bic	x0, x0, #1 << 2	// clear SCTLR.C
     58	pre_disable_mmu_workaround
     59	msr	sctlr_el1, x0
     60	isb
     612:
     62	/* Jump to kernel entry point */
     63	mov	x0, x20
     64	mov	x1, xzr
     65	mov	x2, xzr
     66	mov	x3, xzr
     67	br	x19
     683:
     69SYM_CODE_END(efi_enter_kernel)