cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

hostdep.h (964B)


      1/*
      2 * hostdep.h : things which are dependent on the host architecture
      3 *
      4 *  * Written by Peter Maydell <peter.maydell@linaro.org>
      5 *
      6 * Copyright (C) 2016 Linaro Limited
      7 *
      8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
      9 * See the COPYING file in the top-level directory.
     10 */
     11
     12#ifndef ARM_HOSTDEP_H
     13#define ARM_HOSTDEP_H
     14
     15/* We have a safe-syscall.inc.S */
     16#define HAVE_SAFE_SYSCALL
     17
     18#ifndef __ASSEMBLER__
     19
     20/* These are defined by the safe-syscall.inc.S file */
     21extern char safe_syscall_start[];
     22extern char safe_syscall_end[];
     23
     24/* Adjust the signal context to rewind out of safe-syscall if we're in it */
     25static inline void rewind_if_in_safe_syscall(void *puc)
     26{
     27    ucontext_t *uc = puc;
     28    unsigned long *pcreg = &uc->uc_mcontext.arm_pc;
     29
     30    if (*pcreg > (uintptr_t)safe_syscall_start
     31        && *pcreg < (uintptr_t)safe_syscall_end) {
     32        *pcreg = (uintptr_t)safe_syscall_start;
     33    }
     34}
     35
     36#endif /* __ASSEMBLER__ */
     37
     38#endif