diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/i386/math-emu/fpu_system.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/i386/math-emu/fpu_system.h')
-rw-r--r-- | arch/i386/math-emu/fpu_system.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/arch/i386/math-emu/fpu_system.h b/arch/i386/math-emu/fpu_system.h new file mode 100644 index 000000000000..bf26341c8bde --- /dev/null +++ b/arch/i386/math-emu/fpu_system.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /*---------------------------------------------------------------------------+ | ||
2 | | fpu_system.h | | ||
3 | | | | ||
4 | | Copyright (C) 1992,1994,1997 | | ||
5 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | | ||
6 | | Australia. E-mail billm@suburbia.net | | ||
7 | | | | ||
8 | +---------------------------------------------------------------------------*/ | ||
9 | |||
10 | #ifndef _FPU_SYSTEM_H | ||
11 | #define _FPU_SYSTEM_H | ||
12 | |||
13 | /* system dependent definitions */ | ||
14 | |||
15 | #include <linux/sched.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/mm.h> | ||
18 | |||
19 | /* This sets the pointer FPU_info to point to the argument part | ||
20 | of the stack frame of math_emulate() */ | ||
21 | #define SETUP_DATA_AREA(arg) FPU_info = (struct info *) &arg | ||
22 | |||
23 | /* s is always from a cpu register, and the cpu does bounds checking | ||
24 | * during register load --> no further bounds checks needed */ | ||
25 | #define LDT_DESCRIPTOR(s) (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3]) | ||
26 | #define SEG_D_SIZE(x) ((x).b & (3 << 21)) | ||
27 | #define SEG_G_BIT(x) ((x).b & (1 << 23)) | ||
28 | #define SEG_GRANULARITY(x) (((x).b & (1 << 23)) ? 4096 : 1) | ||
29 | #define SEG_286_MODE(x) ((x).b & ( 0xff000000 | 0xf0000 | (1 << 23))) | ||
30 | #define SEG_BASE_ADDR(s) (((s).b & 0xff000000) \ | ||
31 | | (((s).b & 0xff) << 16) | ((s).a >> 16)) | ||
32 | #define SEG_LIMIT(s) (((s).b & 0xff0000) | ((s).a & 0xffff)) | ||
33 | #define SEG_EXECUTE_ONLY(s) (((s).b & ((1 << 11) | (1 << 9))) == (1 << 11)) | ||
34 | #define SEG_WRITE_PERM(s) (((s).b & ((1 << 11) | (1 << 9))) == (1 << 9)) | ||
35 | #define SEG_EXPAND_DOWN(s) (((s).b & ((1 << 11) | (1 << 10))) \ | ||
36 | == (1 << 10)) | ||
37 | |||
38 | #define I387 (current->thread.i387) | ||
39 | #define FPU_info (I387.soft.info) | ||
40 | |||
41 | #define FPU_CS (*(unsigned short *) &(FPU_info->___cs)) | ||
42 | #define FPU_SS (*(unsigned short *) &(FPU_info->___ss)) | ||
43 | #define FPU_DS (*(unsigned short *) &(FPU_info->___ds)) | ||
44 | #define FPU_EAX (FPU_info->___eax) | ||
45 | #define FPU_EFLAGS (FPU_info->___eflags) | ||
46 | #define FPU_EIP (FPU_info->___eip) | ||
47 | #define FPU_ORIG_EIP (FPU_info->___orig_eip) | ||
48 | |||
49 | #define FPU_lookahead (I387.soft.lookahead) | ||
50 | |||
51 | /* nz if ip_offset and cs_selector are not to be set for the current | ||
52 | instruction. */ | ||
53 | #define no_ip_update (*(u_char *)&(I387.soft.no_update)) | ||
54 | #define FPU_rm (*(u_char *)&(I387.soft.rm)) | ||
55 | |||
56 | /* Number of bytes of data which can be legally accessed by the current | ||
57 | instruction. This only needs to hold a number <= 108, so a byte will do. */ | ||
58 | #define access_limit (*(u_char *)&(I387.soft.alimit)) | ||
59 | |||
60 | #define partial_status (I387.soft.swd) | ||
61 | #define control_word (I387.soft.cwd) | ||
62 | #define fpu_tag_word (I387.soft.twd) | ||
63 | #define registers (I387.soft.st_space) | ||
64 | #define top (I387.soft.ftop) | ||
65 | |||
66 | #define instruction_address (*(struct address *)&I387.soft.fip) | ||
67 | #define operand_address (*(struct address *)&I387.soft.foo) | ||
68 | |||
69 | #define FPU_access_ok(x,y,z) if ( !access_ok(x,y,z) ) \ | ||
70 | math_abort(FPU_info,SIGSEGV) | ||
71 | |||
72 | #undef FPU_IGNORE_CODE_SEGV | ||
73 | #ifdef FPU_IGNORE_CODE_SEGV | ||
74 | /* access_ok() is very expensive, and causes the emulator to run | ||
75 | about 20% slower if applied to the code. Anyway, errors due to bad | ||
76 | code addresses should be much rarer than errors due to bad data | ||
77 | addresses. */ | ||
78 | #define FPU_code_access_ok(z) | ||
79 | #else | ||
80 | /* A simpler test than access_ok() can probably be done for | ||
81 | FPU_code_access_ok() because the only possible error is to step | ||
82 | past the upper boundary of a legal code area. */ | ||
83 | #define FPU_code_access_ok(z) FPU_access_ok(VERIFY_READ,(void __user *)FPU_EIP,z) | ||
84 | #endif | ||
85 | |||
86 | #define FPU_get_user(x,y) get_user((x),(y)) | ||
87 | #define FPU_put_user(x,y) put_user((x),(y)) | ||
88 | |||
89 | #endif | ||