1103285Sikob/* SPDX-License-Identifier: GPL-2.0 */
2103285Sikob
3103285Sikob#ifndef __ASM_CSKY_FPU_H
4103285Sikob#define __ASM_CSKY_FPU_H
5103285Sikob
6103285Sikob#include <asm/sigcontext.h>
7103285Sikob#include <asm/ptrace.h>
8103285Sikob
9103285Sikobint fpu_libc_helper(struct pt_regs *regs);
10103285Sikobvoid fpu_fpe(struct pt_regs *regs);
11103285Sikob
12103285Sikobstatic inline void init_fpu(void) { mtcr("cr<1, 2>", 0); }
13103285Sikob
14103285Sikobvoid save_to_user_fp(struct user_fp *user_fp);
15103285Sikobvoid restore_from_user_fp(struct user_fp *user_fp);
16106802Ssimokawa
17103285Sikob/*
18103285Sikob * Define the fesr bit for fpe handle.
19103285Sikob */
20103285Sikob#define  FPE_ILLE  (1 << 16)    /* Illegal instruction  */
21103285Sikob#define  FPE_FEC   (1 << 7)     /* Input float-point arithmetic exception */
22103285Sikob#define  FPE_IDC   (1 << 5)     /* Input denormalized exception */
23103285Sikob#define  FPE_IXC   (1 << 4)     /* Inexact exception */
24103285Sikob#define  FPE_UFC   (1 << 3)     /* Underflow exception */
25103285Sikob#define  FPE_OFC   (1 << 2)     /* Overflow exception */
26103285Sikob#define  FPE_DZC   (1 << 1)     /* Divide by zero exception */
27103285Sikob#define  FPE_IOC   (1 << 0)     /* Invalid operation exception */
28103285Sikob#define  FPE_REGULAR_EXCEPTION (FPE_IXC | FPE_UFC | FPE_OFC | FPE_DZC | FPE_IOC)
29103285Sikob
30103285Sikob#ifdef CONFIG_OPEN_FPU_IDE
31103285Sikob#define IDE_STAT   (1 << 5)
32103285Sikob#else
33103285Sikob#define IDE_STAT   0
34103285Sikob#endif
35103285Sikob
36106802Ssimokawa#ifdef CONFIG_OPEN_FPU_IXE
37103285Sikob#define IXE_STAT   (1 << 4)
38103285Sikob#else
39103285Sikob#define IXE_STAT   0
40103285Sikob#endif
41103285Sikob
42103285Sikob#ifdef CONFIG_OPEN_FPU_UFE
43103285Sikob#define UFE_STAT   (1 << 3)
44103285Sikob#else
45103285Sikob#define UFE_STAT   0
46103285Sikob#endif
47103285Sikob
48103285Sikob#ifdef CONFIG_OPEN_FPU_OFE
49103285Sikob#define OFE_STAT   (1 << 2)
50103285Sikob#else
51103285Sikob#define OFE_STAT   0
52103285Sikob#endif
53103285Sikob
54103285Sikob#ifdef CONFIG_OPEN_FPU_DZE
55103285Sikob#define DZE_STAT   (1 << 1)
56103285Sikob#else
57103285Sikob#define DZE_STAT   0
58103285Sikob#endif
59103285Sikob
60103285Sikob#ifdef CONFIG_OPEN_FPU_IOE
61103285Sikob#define IOE_STAT   (1 << 0)
62103285Sikob#else
63103285Sikob#define IOE_STAT   0
64103285Sikob#endif
65103285Sikob
66103285Sikob#endif /* __ASM_CSKY_FPU_H */
67103285Sikob