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

kexec.h (1689B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * Copyright (C) 2019 FORTH-ICS/CARV
      4 *  Nick Kossifidis <mick@ics.forth.gr>
      5 */
      6
      7#ifndef _RISCV_KEXEC_H
      8#define _RISCV_KEXEC_H
      9
     10#include <asm/page.h>    /* For PAGE_SIZE */
     11
     12/* Maximum physical address we can use pages from */
     13#define KEXEC_SOURCE_MEMORY_LIMIT (-1UL)
     14
     15/* Maximum address we can reach in physical address mode */
     16#define KEXEC_DESTINATION_MEMORY_LIMIT (-1UL)
     17
     18/* Maximum address we can use for the control code buffer */
     19#define KEXEC_CONTROL_MEMORY_LIMIT (-1UL)
     20
     21/* Reserve a page for the control code buffer */
     22#define KEXEC_CONTROL_PAGE_SIZE PAGE_SIZE
     23
     24#define KEXEC_ARCH KEXEC_ARCH_RISCV
     25
     26extern void riscv_crash_save_regs(struct pt_regs *newregs);
     27
     28static inline void
     29crash_setup_regs(struct pt_regs *newregs,
     30		 struct pt_regs *oldregs)
     31{
     32	if (oldregs)
     33		memcpy(newregs, oldregs, sizeof(struct pt_regs));
     34	else
     35		riscv_crash_save_regs(newregs);
     36}
     37
     38
     39#define ARCH_HAS_KIMAGE_ARCH
     40
     41struct kimage_arch {
     42	unsigned long fdt_addr;
     43};
     44
     45extern const unsigned char riscv_kexec_relocate[];
     46extern const unsigned int riscv_kexec_relocate_size;
     47
     48typedef void (*riscv_kexec_method)(unsigned long first_ind_entry,
     49				   unsigned long jump_addr,
     50				   unsigned long fdt_addr,
     51				   unsigned long hartid,
     52				   unsigned long va_pa_off);
     53
     54extern riscv_kexec_method riscv_kexec_norelocate;
     55
     56#ifdef CONFIG_KEXEC_FILE
     57extern const struct kexec_file_ops elf_kexec_ops;
     58
     59struct purgatory_info;
     60int arch_kexec_apply_relocations_add(struct purgatory_info *pi,
     61				     Elf_Shdr *section,
     62				     const Elf_Shdr *relsec,
     63				     const Elf_Shdr *symtab);
     64#define arch_kexec_apply_relocations_add arch_kexec_apply_relocations_add
     65#endif
     66
     67#endif