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

sections.h (1459B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef _ASM_POWERPC_SECTIONS_H
      3#define _ASM_POWERPC_SECTIONS_H
      4#ifdef __KERNEL__
      5
      6#include <linux/elf.h>
      7#include <linux/uaccess.h>
      8
      9#ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
     10typedef struct func_desc func_desc_t;
     11#endif
     12
     13#include <asm-generic/sections.h>
     14
     15extern char __head_end[];
     16
     17#ifdef __powerpc64__
     18
     19extern char __start_interrupts[];
     20extern char __end_interrupts[];
     21
     22extern char __prom_init_toc_start[];
     23extern char __prom_init_toc_end[];
     24
     25#ifdef CONFIG_PPC_POWERNV
     26extern char start_real_trampolines[];
     27extern char end_real_trampolines[];
     28extern char start_virt_trampolines[];
     29extern char end_virt_trampolines[];
     30#endif
     31
     32/*
     33 * This assumes the kernel is never compiled -mcmodel=small or
     34 * the total .toc is always less than 64k.
     35 */
     36static inline unsigned long kernel_toc_addr(void)
     37{
     38	unsigned long toc_ptr;
     39
     40	asm volatile("mr %0, 2" : "=r" (toc_ptr));
     41	return toc_ptr;
     42}
     43
     44static inline int overlaps_interrupt_vector_text(unsigned long start,
     45							unsigned long end)
     46{
     47	unsigned long real_start, real_end;
     48	real_start = __start_interrupts - _stext;
     49	real_end = __end_interrupts - _stext;
     50
     51	return start < (unsigned long)__va(real_end) &&
     52		(unsigned long)__va(real_start) < end;
     53}
     54
     55static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
     56{
     57	return start < (unsigned long)__init_end &&
     58		(unsigned long)_stext < end;
     59}
     60
     61#endif
     62
     63#endif /* __KERNEL__ */
     64#endif	/* _ASM_POWERPC_SECTIONS_H */