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 #include <asm/segment.h>
21
22 #include "fpu_system.h"
23 #include "exception.h"
24 #include "fpu_emu.h"
25 #include "status_w.h"
26
27
28 #define _NONE_ 0
29 #define _REG0_ 1
30 #define _PUSH_ 3
31 #define _null_ 4
32
33 #define pop_0() { pop_ptr->tag = TW_Empty; top++; }
34
35
36 static unsigned char type_table[32] = {
37 _PUSH_, _PUSH_, _PUSH_, _PUSH_,
38 _null_, _null_, _null_, _null_,
39 _REG0_, _REG0_, _REG0_, _REG0_,
40 _REG0_, _REG0_, _REG0_, _REG0_,
41 _null_, _null_, _NONE_, _PUSH_,
42 _NONE_, _PUSH_, _null_, _PUSH_,
43 _null_, _null_, _NONE_, _REG0_,
44 _NONE_, _REG0_, _NONE_, _REG0_
45 };
46
47 void load_store_instr(char type)
48 {
49 FPU_REG *pop_ptr;
50
51 switch ( type_table[(int) (unsigned) type] )
52 {
53 case _NONE_:
54 break;
55 case _REG0_:
56 pop_ptr = &st(0);
57
58
59 FPU_st0_ptr = pop_ptr;
60 FPU_st0_tag = FPU_st0_ptr->tag;
61 break;
62 case _PUSH_:
63 {
64 pop_ptr = &st(-1);
65 if ( pop_ptr->tag != TW_Empty )
66 { stack_overflow(); return; }
67 top--;
68 }
69 break;
70 case _null_:
71 return Un_impl();
72 #ifdef PARANOID
73 default:
74 return EXCEPTION(EX_INTERNAL);
75 #endif PARANOID
76 }
77
78 switch ( type )
79 {
80 case 000:
81 reg_load_single();
82 reg_move(&FPU_loaded_data, pop_ptr);
83 break;
84 case 001:
85 reg_load_int32();
86 reg_move(&FPU_loaded_data, pop_ptr);
87 break;
88 case 002:
89 reg_load_double();
90 reg_move(&FPU_loaded_data, pop_ptr);
91 break;
92 case 003:
93 reg_load_int16();
94 reg_move(&FPU_loaded_data, pop_ptr);
95 break;
96 case 010:
97 reg_store_single();
98 break;
99 case 011:
100 reg_store_int32();
101 break;
102 case 012:
103 reg_store_double();
104 break;
105 case 013:
106 reg_store_int16();
107 break;
108 case 014:
109 if ( reg_store_single() )
110 pop_0();
111
112 break;
113 case 015:
114 if ( reg_store_int32() )
115 pop_0();
116
117 break;
118 case 016:
119 if ( reg_store_double() )
120 pop_0();
121
122 break;
123 case 017:
124 if ( reg_store_int16() )
125 pop_0();
126
127 break;
128 case 020:
129 fldenv();
130 break;
131 case 022:
132 frstor();
133 break;
134 case 023:
135 reg_load_bcd();
136 reg_move(&FPU_loaded_data, pop_ptr);
137 break;
138 case 024:
139 RE_ENTRANT_CHECK_OFF
140 control_word = get_fs_word((unsigned short *) FPU_data_address);
141 RE_ENTRANT_CHECK_ON
142 #ifdef NO_UNDERFLOW_TRAP
143 if ( !(control_word & EX_Underflow) )
144 {
145 control_word |= EX_Underflow;
146 }
147 #endif
148 FPU_data_address = (void *)data_operand_offset;
149 FPU_entry_eip = ip_offset;
150 break;
151 case 025:
152 reg_load_extended();
153 reg_move(&FPU_loaded_data, pop_ptr);
154 break;
155 case 027:
156 reg_load_int64();
157 reg_move(&FPU_loaded_data, pop_ptr);
158 break;
159 case 030:
160 fstenv();
161 FPU_data_address = (void *)data_operand_offset;
162 FPU_entry_eip = ip_offset;
163 break;
164 case 032:
165 fsave();
166 FPU_data_address = (void *)data_operand_offset;
167 FPU_entry_eip = ip_offset;
168 break;
169 case 033:
170 if ( reg_store_bcd() )
171 pop_0();
172
173 break;
174 case 034:
175 RE_ENTRANT_CHECK_OFF
176 verify_area(FPU_data_address,2);
177 put_fs_word(control_word, (short *) FPU_data_address);
178 RE_ENTRANT_CHECK_ON
179 FPU_data_address = (void *)data_operand_offset;
180 FPU_entry_eip = ip_offset;
181 break;
182 case 035:
183 if ( reg_store_extended() )
184 pop_0();
185
186 break;
187 case 036:
188 status_word &= ~SW_TOP;
189 status_word |= (top&7) << SW_TOPS;
190 RE_ENTRANT_CHECK_OFF
191 verify_area(FPU_data_address,2);
192 put_fs_word(status_word,(short *) FPU_data_address);
193 RE_ENTRANT_CHECK_ON
194 FPU_data_address = (void *)data_operand_offset;
195 FPU_entry_eip = ip_offset;
196 break;
197 case 037:
198 if ( reg_store_int64() )
199 pop_0();
200
201 break;
202 }
203 }