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