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

processor.h (997B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2#ifndef __UM_PROCESSOR_H
      3#define __UM_PROCESSOR_H
      4#include <linux/time-internal.h>
      5
      6/* include faultinfo structure */
      7#include <sysdep/faultinfo.h>
      8
      9#ifdef CONFIG_X86_32
     10# include "processor_32.h"
     11#else
     12# include "processor_64.h"
     13#endif
     14
     15#define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP)
     16#define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP)
     17#define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP)
     18
     19#define ARCH_IS_STACKGROW(address) \
     20       (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
     21
     22#include <asm/user.h>
     23
     24/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
     25static __always_inline void rep_nop(void)
     26{
     27	__asm__ __volatile__("rep;nop": : :"memory");
     28}
     29
     30static __always_inline void cpu_relax(void)
     31{
     32	if (time_travel_mode == TT_MODE_INFCPU ||
     33	    time_travel_mode == TT_MODE_EXTERNAL)
     34		time_travel_ndelay(1);
     35	else
     36		rep_nop();
     37}
     38
     39#define task_pt_regs(t) (&(t)->thread.regs)
     40
     41#include <asm/processor-generic.h>
     42
     43#endif