linux-old/arch/s390x/kernel/s390fpu.c
<<
>>
Prefs
   1/*
   2 *  arch/s390/kernel/s390fpu.c
   3 *
   4 *  S390 version
   5 *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
   6 *    Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
   7 *
   8 *  s390fpu.h functions for saving & restoring the fpu state.
   9 *
  10 *  I couldn't inline these as linux/sched.h included half the world
  11 *  & was required to at the task structure.
  12 *  & the functions were too complex to make macros from.
  13 *  ( & as usual I didn't feel like debugging inline code ).
  14 */
  15
  16#include <linux/sched.h>
  17
  18void save_fp_regs(s390_fp_regs *fpregs)
  19{
  20/*
  21 * I don't think we can use STE here as this would load
  22 * fp registers 0 & 2 into memory locations 0 & 1 etc. 
  23 */     
  24        asm volatile ("STFPC 0(%0)\n\t"
  25                      "STD   0,8(%0)\n\t"
  26                      "STD   1,16(%0)\n\t"
  27                      "STD   2,24(%0)\n\t"
  28                      "STD   3,32(%0)\n\t"
  29                      "STD   4,40(%0)\n\t"
  30                      "STD   5,48(%0)\n\t"
  31                      "STD   6,56(%0)\n\t"
  32                      "STD   7,64(%0)\n\t"
  33                      "STD   8,72(%0)\n\t"
  34                      "STD   9,80(%0)\n\t"
  35                      "STD   10,88(%0)\n\t"
  36                      "STD   11,96(%0)\n\t"
  37                      "STD   12,104(%0)\n\t"
  38                      "STD   13,112(%0)\n\t"
  39                      "STD   14,120(%0)\n\t"
  40                      "STD   15,128(%0)\n\t"
  41                      : 
  42                      : "a" (fpregs)
  43                      : "memory"
  44                );
  45}
  46
  47void restore_fp_regs(s390_fp_regs *fpregs)
  48{
  49        /* If we don't mask with the FPC_VALID_MASK here
  50         * we've got a very quick shutdown -h now command
  51         * via a kernel specification exception.
  52         */
  53        fpregs->fpc&=FPC_VALID_MASK;
  54        asm volatile ("LFPC 0(%0)\n\t"
  55                      "LD   0,8(%0)\n\t"
  56                      "LD   1,16(%0)\n\t"
  57                      "LD   2,24(%0)\n\t"
  58                      "LD   3,32(%0)\n\t"
  59                      "LD   4,40(%0)\n\t"
  60                      "LD   5,48(%0)\n\t"
  61                      "LD   6,56(%0)\n\t"
  62                      "LD   7,64(%0)\n\t"
  63                      "LD   8,72(%0)\n\t"
  64                      "LD   9,80(%0)\n\t"
  65                      "LD   10,88(%0)\n\t"
  66                      "LD   11,96(%0)\n\t"
  67                      "LD   12,104(%0)\n\t"
  68                      "LD   13,112(%0)\n\t"
  69                      "LD   14,120(%0)\n\t"
  70                      "LD   15,128(%0)\n\t"
  71                      : 
  72                      : "a" (fpregs)
  73                      : "memory"
  74                );
  75}
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.