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