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

fctiwz.c (573B)


      1// SPDX-License-Identifier: GPL-2.0
      2#include <linux/types.h>
      3#include <linux/errno.h>
      4#include <linux/uaccess.h>
      5
      6#include <asm/sfp-machine.h>
      7#include <math-emu/soft-fp.h>
      8#include <math-emu/double.h>
      9
     10int
     11fctiwz(u32 *frD, void *frB)
     12{
     13	FP_DECL_D(B);
     14	FP_DECL_EX;
     15	u32 fpscr;
     16	unsigned int r;
     17
     18	fpscr = __FPU_FPSCR;
     19	__FPU_FPSCR &= ~(3);
     20	__FPU_FPSCR |= FP_RND_ZERO;
     21
     22	FP_UNPACK_DP(B, frB);
     23	FP_TO_INT_D(r, B, 32, 1);
     24	frD[1] = r;
     25
     26	__FPU_FPSCR = fpscr;
     27
     28#ifdef DEBUG
     29	printk("%s: D %p, B %p: ", __func__, frD, frB);
     30	dump_double(frD);
     31	printk("\n");
     32#endif
     33
     34	return 0;
     35}