Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
math.c File Reference
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/signal.h>
#include <linux/perf_event.h>
#include <asm/uaccess.h>
#include <asm/processor.h>
#include <asm/io.h>
#include "sfp-util.h"
#include <math-emu/soft-fp.h>
#include <math-emu/single.h>
#include <math-emu/double.h>

Go to the source code of this file.

Macros

#define FPUL   (fregs->fpul)
 
#define FPSCR   (fregs->fpscr)
 
#define FPSCR_RM   (FPSCR&3)
 
#define FPSCR_DN   ((FPSCR>>18)&1)
 
#define FPSCR_PR   ((FPSCR>>19)&1)
 
#define FPSCR_SZ   ((FPSCR>>20)&1)
 
#define FPSCR_FR   ((FPSCR>>21)&1)
 
#define FPSCR_MASK   0x003fffffUL
 
#define BANK(n)   (n^(FPSCR_FR?16:0))
 
#define FR   ((unsigned long*)(fregs->fp_regs))
 
#define FR0   (FR[BANK(0)])
 
#define FRn   (FR[BANK(n)])
 
#define FRm   (FR[BANK(m)])
 
#define DR   ((unsigned long long*)(fregs->fp_regs))
 
#define DRn   (DR[BANK(n)/2])
 
#define DRm   (DR[BANK(m)/2])
 
#define XREG(n)   (n^16)
 
#define XFn   (FR[BANK(XREG(n))])
 
#define XFm   (FR[BANK(XREG(m))])
 
#define XDn   (DR[BANK(XREG(n))/2])
 
#define XDm   (DR[BANK(XREG(m))/2])
 
#define R0   (regs->regs[0])
 
#define Rn   (regs->regs[n])
 
#define Rm   (regs->regs[m])
 
#define WRITE(d, a)   ({if(put_user(d, (typeof (d)*)a)) return -EFAULT;})
 
#define READ(d, a)   ({if(get_user(d, (typeof (d)*)a)) return -EFAULT;})
 
#define PACK_S(r, f)   FP_PACK_SP(&r,f)
 
#define UNPACK_S(f, r)   FP_UNPACK_SP(f,&r)
 
#define PACK_D(r, f)   {u32 t[2]; FP_PACK_DP(t,f); ((u32*)&r)[0]=t[1]; ((u32*)&r)[1]=t[0];}
 
#define UNPACK_D(f, r)   {u32 t[2]; t[0]=((u32*)&r)[1]; t[1]=((u32*)&r)[0]; FP_UNPACK_DP(f,t);}
 
#define BOTH_PRmn(op, x)   FP_DECL_EX; if(FPSCR_PR) op(D,x,DRm,DRn); else op(S,x,FRm,FRn);
 
#define CMP_X(SZ, R, M, N)
 
#define EQ_X(SZ, R, M, N)
 
#define CMP(OP)   ({ int r; BOTH_PRmn(OP##_X,r); r; })
 
#define ARITH_X(SZ, OP, M, N)
 
#define FMOV_EXT(x)   if(x&1) x+=16-1
 
#define NOTYETn(i)
 
#define EMU_FLOAT_X(SZ, N)
 
#define EMU_FTRC_X(SZ, N)
 

Functions

 NOTYETn (ftrv)
 
asmlinkage void do_fpu_error (unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs regs)
 
int do_fpu_inst (unsigned short inst, struct pt_regs *regs)
 

Macro Definition Documentation

#define ARITH_X (   SZ,
  OP,
  M,
  N 
)
Value:
do{ \
FP_DECL_##SZ(Fm); FP_DECL_##SZ(Fn); FP_DECL_##SZ(Fr); \
UNPACK_##SZ(Fm, M); UNPACK_##SZ(Fn, N); \
FP_##OP##_##SZ(Fr, Fn, Fm); \
PACK_##SZ(N, Fr); }while(0)

Definition at line 99 of file math.c.

#define BANK (   n)    (n^(FPSCR_FR?16:0))

Definition at line 35 of file math.c.

#define BOTH_PRmn (   op,
  x 
)    FP_DECL_EX; if(FPSCR_PR) op(D,x,DRm,DRn); else op(S,x,FRm,FRn);

Definition at line 65 of file math.c.

#define CMP (   OP)    ({ int r; BOTH_PRmn(OP##_X,r); r; })

Definition at line 76 of file math.c.

#define CMP_X (   SZ,
  R,
  M,
  N 
)
Value:
do{ \
FP_DECL_##SZ(Fm); FP_DECL_##SZ(Fn); \
UNPACK_##SZ(Fm, M); UNPACK_##SZ(Fn, N); \
FP_CMP_##SZ(R, Fn, Fm, 2); }while(0)

Definition at line 68 of file math.c.

#define DR   ((unsigned long long*)(fregs->fp_regs))

Definition at line 40 of file math.c.

#define DRm   (DR[BANK(m)/2])

Definition at line 42 of file math.c.

#define DRn   (DR[BANK(n)/2])

Definition at line 41 of file math.c.

#define EMU_FLOAT_X (   SZ,
  N 
)
Value:
do { \
FP_DECL_##SZ(Fn); \
FP_FROM_INT_##SZ(Fn, FPUL, 32, int); \
PACK_##SZ(N, Fn); }while(0)
#define EMU_FTRC_X (   SZ,
  N 
)
Value:
do { \
FP_DECL_##SZ(Fn); \
UNPACK_##SZ(Fn, N); \
FP_TO_INT_##SZ(FPUL, Fn, 32, 1); }while(0)

Definition at line 301 of file math.c.

#define EQ_X (   SZ,
  R,
  M,
  N 
)
Value:
do{ \
FP_DECL_##SZ(Fm); FP_DECL_##SZ(Fn); \
UNPACK_##SZ(Fm, M); UNPACK_##SZ(Fn, N); \
FP_CMP_EQ_##SZ(R, Fn, Fm); }while(0)

Definition at line 72 of file math.c.

#define FMOV_EXT (   x)    if(x&1) x+=16-1

Definition at line 152 of file math.c.

#define FPSCR   (fregs->fpscr)

Definition at line 27 of file math.c.

#define FPSCR_DN   ((FPSCR>>18)&1)

Definition at line 29 of file math.c.

#define FPSCR_FR   ((FPSCR>>21)&1)

Definition at line 32 of file math.c.

#define FPSCR_MASK   0x003fffffUL

Definition at line 33 of file math.c.

#define FPSCR_PR   ((FPSCR>>19)&1)

Definition at line 30 of file math.c.

#define FPSCR_RM   (FPSCR&3)

Definition at line 28 of file math.c.

#define FPSCR_SZ   ((FPSCR>>20)&1)

Definition at line 31 of file math.c.

#define FPUL   (fregs->fpul)

Definition at line 26 of file math.c.

#define FR   ((unsigned long*)(fregs->fp_regs))

Definition at line 36 of file math.c.

#define FR0   (FR[BANK(0)])

Definition at line 37 of file math.c.

#define FRm   (FR[BANK(m)])

Definition at line 39 of file math.c.

#define FRn   (FR[BANK(n)])

Definition at line 38 of file math.c.

#define NOTYETn (   i)
Value:
static int i(struct sh_fpu_soft_struct *fregs, int n) \
{ printk( #i " not yet done.\n"); return 0; }

Definition at line 276 of file math.c.

#define PACK_D (   r,
  f 
)    {u32 t[2]; FP_PACK_DP(t,f); ((u32*)&r)[0]=t[1]; ((u32*)&r)[1]=t[0];}

Definition at line 59 of file math.c.

#define PACK_S (   r,
  f 
)    FP_PACK_SP(&r,f)

Definition at line 57 of file math.c.

#define R0   (regs->regs[0])

Definition at line 50 of file math.c.

#define READ (   d,
  a 
)    ({if(get_user(d, (typeof (d)*)a)) return -EFAULT;})

Definition at line 55 of file math.c.

#define Rm   (regs->regs[m])

Definition at line 52 of file math.c.

#define Rn   (regs->regs[n])

Definition at line 51 of file math.c.

#define UNPACK_D (   f,
  r 
)    {u32 t[2]; t[0]=((u32*)&r)[1]; t[1]=((u32*)&r)[0]; FP_UNPACK_DP(f,t);}

Definition at line 61 of file math.c.

#define UNPACK_S (   f,
  r 
)    FP_UNPACK_SP(f,&r)

Definition at line 58 of file math.c.

#define WRITE (   d,
  a 
)    ({if(put_user(d, (typeof (d)*)a)) return -EFAULT;})

Definition at line 54 of file math.c.

#define XDm   (DR[BANK(XREG(m))/2])

Definition at line 48 of file math.c.

#define XDn   (DR[BANK(XREG(n))/2])

Definition at line 47 of file math.c.

#define XFm   (FR[BANK(XREG(m))])

Definition at line 46 of file math.c.

#define XFn   (FR[BANK(XREG(n))])

Definition at line 45 of file math.c.

#define XREG (   n)    (n^16)

Definition at line 44 of file math.c.

Function Documentation

asmlinkage void do_fpu_error ( unsigned long  r4,
unsigned long  r5,
unsigned long  r6,
unsigned long  r7,
struct pt_regs  regs 
)

Definition at line 577 of file math.c.

int do_fpu_inst ( unsigned short  inst,
struct pt_regs regs 
)

do_fpu_inst - Handle reserved instructions for FPU emulation : instruction code. : registers on stack.

Definition at line 617 of file math.c.

NOTYETn ( ftrv  )

Definition at line 279 of file math.c.