1
2
3
4
5
6
7
8
9
10 #ifndef _FPU_SYSTEM_H
11 #define _FPU_SYSTEM_H
12
13
14
15 #include <linux/sched.h>
16 #include <linux/kernel.h>
17
18
19
20 #define SETUP_DATA_AREA(arg) FPU_info = (struct info *) &arg
21
22 #define LDT_DESCRIPTOR(s) (current->ldt[(s) >> 3])
23 #define SEG_D_SIZE(x) ((x).b & (3 << 21))
24 #define SEG_G_BIT(x) ((x).b & (1 << 23))
25 #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1)
26 #define SEG_286_MODE(x) ((x).b & ( 0xff000000 | 0xf0000 | (1 << 23)))
27 #define SEG_BASE_ADDR(s) (((s).b & 0xff000000) \
28 | (((s).b & 0xff) << 16) | ((s).a >> 16))
29 #define SEG_LIMIT(s) (((s).b & 0xff0000) | ((s).a & 0xffff))
30 #define SEG_EXECUTE_ONLY(s) (((s).b & ((1 << 11) | (1 << 9))) == (1 << 11))
31 #define SEG_WRITE_PERM(s) (((s).b & ((1 << 11) | (1 << 9))) == (1 << 9))
32 #define SEG_EXPAND_DOWN(s) (((s).b & ((1 << 11) | (1 << 10))) \
33 == (1 << 10))
34
35 #define I387 (current->tss.i387)
36 #define FPU_info (I387.soft.info)
37
38 #define FPU_CS (*(unsigned short *) &(FPU_info->___cs))
39 #define FPU_SS (*(unsigned short *) &(FPU_info->___ss))
40 #define FPU_DS (*(unsigned short *) &(FPU_info->___ds))
41 #define FPU_EAX (FPU_info->___eax)
42 #define FPU_EFLAGS (FPU_info->___eflags)
43 #define FPU_EIP (FPU_info->___eip)
44 #define FPU_ORIG_EIP (FPU_info->___orig_eip)
45
46 #define FPU_lookahead (I387.soft.lookahead)
47
48
49
50 #define no_ip_update (((char *)&(I387.soft.twd))[0])
51 #define FPU_rm (((unsigned char *)&(I387.soft.twd))[1])
52
53
54
55 #define access_limit (((unsigned char *)&(I387.soft.twd))[2])
56
57 #define partial_status (I387.soft.swd)
58 #define control_word (I387.soft.cwd)
59 #define regs (I387.soft.regs)
60 #define top (I387.soft.top)
61
62 #define instruction_address (*(struct address *)&I387.soft.fip)
63 #define operand_address (*(struct address *)&I387.soft.foo)
64
65 #define FPU_verify_area(x,y,z) if ( verify_area(x,y,z) ) \
66 math_abort(FPU_info,SIGSEGV)
67
68 #undef FPU_IGNORE_CODE_SEGV
69 #ifdef FPU_IGNORE_CODE_SEGV
70
71
72
73
74 #define FPU_code_verify_area(z)
75 #else
76
77
78
79 #define FPU_code_verify_area(z) FPU_verify_area(VERIFY_READ,(void *)FPU_EIP,z)
80 #endif
81
82 #endif