This source file includes following definitions.
- load_store_instr
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #include <asm/segment.h>
22
23 #include "fpu_system.h"
24 #include "exception.h"
25 #include "fpu_emu.h"
26 #include "status_w.h"
27 #include "control_w.h"
28
29
30 #define _NONE_ 0
31 #define _REG0_ 1
32 #define _PUSH_ 3
33 #define _null_ 4
34
35 #define pop_0() { pop_ptr->tag = TW_Empty; top++; }
36
37
38 static unsigned char const type_table[32] = {
39 _PUSH_, _PUSH_, _PUSH_, _PUSH_,
40 _null_, _null_, _null_, _null_,
41 _REG0_, _REG0_, _REG0_, _REG0_,
42 _REG0_, _REG0_, _REG0_, _REG0_,
43 _NONE_, _null_, _NONE_, _PUSH_,
44 _NONE_, _PUSH_, _null_, _PUSH_,
45 _NONE_, _null_, _NONE_, _REG0_,
46 _NONE_, _REG0_, _NONE_, _REG0_
47 };
48
49 void load_store_instr(char type)
50 {
51 FPU_REG *pop_ptr;
52
53
54 pop_ptr = NULL;
55 switch ( type_table[(int) (unsigned) type] )
56 {
57 case _NONE_:
58 break;
59 case _REG0_:
60 pop_ptr = &st(0);
61
62
63 FPU_st0_ptr = pop_ptr;
64 FPU_st0_tag = FPU_st0_ptr->tag;
65 break;
66 case _PUSH_:
67 {
68 pop_ptr = &st(-1);
69 if ( pop_ptr->tag != TW_Empty )
70 { stack_overflow(); return; }
71 top--;
72 }
73 break;
74 case _null_:
75 Un_impl();
76 return;
77 #ifdef PARANOID
78 default:
79 EXCEPTION(EX_INTERNAL);
80 return;
81 #endif PARANOID
82 }
83
84 switch ( type )
85 {
86 case 000:
87 clear_C1();
88 reg_load_single();
89 if ( (FPU_loaded_data.tag == TW_NaN) &&
90 real_2op_NaN(&FPU_loaded_data, &FPU_loaded_data, &FPU_loaded_data) )
91 {
92 top++;
93 break;
94 }
95 reg_move(&FPU_loaded_data, pop_ptr);
96 break;
97 case 001:
98 clear_C1();
99 reg_load_int32();
100 reg_move(&FPU_loaded_data, pop_ptr);
101 break;
102 case 002:
103 clear_C1();
104 reg_load_double();
105 if ( (FPU_loaded_data.tag == TW_NaN) &&
106 real_2op_NaN(&FPU_loaded_data, &FPU_loaded_data, &FPU_loaded_data) )
107 {
108 top++;
109 break;
110 }
111 reg_move(&FPU_loaded_data, pop_ptr);
112 break;
113 case 003:
114 clear_C1();
115 reg_load_int16();
116 reg_move(&FPU_loaded_data, pop_ptr);
117 break;
118 case 010:
119 clear_C1();
120 reg_store_single();
121 break;
122 case 011:
123 clear_C1();
124 reg_store_int32();
125 break;
126 case 012:
127 clear_C1();
128 reg_store_double();
129 break;
130 case 013:
131 clear_C1();
132 reg_store_int16();
133 break;
134 case 014:
135 clear_C1();
136 if ( reg_store_single() )
137 pop_0();
138
139 break;
140 case 015:
141 clear_C1();
142 if ( reg_store_int32() )
143 pop_0();
144
145 break;
146 case 016:
147 clear_C1();
148 if ( reg_store_double() )
149 pop_0();
150
151 break;
152 case 017:
153 clear_C1();
154 if ( reg_store_int16() )
155 pop_0();
156
157 break;
158 case 020:
159 fldenv();
160 break;
161 case 022:
162 frstor();
163 break;
164 case 023:
165 clear_C1();
166 reg_load_bcd();
167 reg_move(&FPU_loaded_data, pop_ptr);
168 break;
169 case 024:
170 RE_ENTRANT_CHECK_OFF;
171 control_word = get_fs_word((unsigned short *) FPU_data_address);
172 RE_ENTRANT_CHECK_ON;
173 if ( partial_status & ~control_word & CW_Exceptions )
174 partial_status |= (SW_Summary | SW_Backward);
175 else
176 partial_status &= ~(SW_Summary | SW_Backward);
177 #ifdef PECULIAR_486
178 control_word |= 0x40;
179 #endif PECULIAR_486
180 NO_NET_DATA_EFFECT;
181 NO_NET_INSTR_EFFECT;
182 break;
183 case 025:
184 clear_C1();
185 reg_load_extended();
186 reg_move(&FPU_loaded_data, pop_ptr);
187 break;
188 case 027:
189 clear_C1();
190 reg_load_int64();
191 reg_move(&FPU_loaded_data, pop_ptr);
192 break;
193 case 030:
194 fstenv();
195 NO_NET_DATA_EFFECT;
196 break;
197 case 032:
198 fsave();
199 NO_NET_DATA_EFFECT;
200 break;
201 case 033:
202 clear_C1();
203 if ( reg_store_bcd() )
204 pop_0();
205
206 break;
207 case 034:
208 RE_ENTRANT_CHECK_OFF;
209 verify_area(VERIFY_WRITE,FPU_data_address,2);
210 put_fs_word(control_word, (short *) FPU_data_address);
211 RE_ENTRANT_CHECK_ON;
212 NO_NET_DATA_EFFECT;
213 NO_NET_INSTR_EFFECT;
214 break;
215 case 035:
216 clear_C1();
217 if ( reg_store_extended() )
218 pop_0();
219
220 break;
221 case 036:
222 RE_ENTRANT_CHECK_OFF;
223 verify_area(VERIFY_WRITE,FPU_data_address,2);
224 put_fs_word(status_word(),(short *) FPU_data_address);
225 RE_ENTRANT_CHECK_ON;
226 NO_NET_DATA_EFFECT;
227 NO_NET_INSTR_EFFECT;
228 break;
229 case 037:
230 clear_C1();
231 if ( reg_store_int64() )
232 pop_0();
233
234 break;
235 }
236 }