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

helper.c (660B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Copyright (C) 2020 ARM Limited
      3
      4#include "helper.h"
      5
      6size_t keyia_sign(size_t ptr)
      7{
      8	asm volatile("paciza %0" : "+r" (ptr));
      9	return ptr;
     10}
     11
     12size_t keyib_sign(size_t ptr)
     13{
     14	asm volatile("pacizb %0" : "+r" (ptr));
     15	return ptr;
     16}
     17
     18size_t keyda_sign(size_t ptr)
     19{
     20	asm volatile("pacdza %0" : "+r" (ptr));
     21	return ptr;
     22}
     23
     24size_t keydb_sign(size_t ptr)
     25{
     26	asm volatile("pacdzb %0" : "+r" (ptr));
     27	return ptr;
     28}
     29
     30size_t keyg_sign(size_t ptr)
     31{
     32	/* output is encoded in the upper 32 bits */
     33	size_t dest = 0;
     34	size_t modifier = 0;
     35
     36	asm volatile("pacga %0, %1, %2" : "=r" (dest) : "r" (ptr), "r" (modifier));
     37
     38	return dest;
     39}