OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [commands/] [common_CALL_JMP_int_RET.txt] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
 
2
 
3
//------------------------------------------------------------------------------
4
 
5
6
//----------------------------------- get SS, ESP from TSS
7
 
8
wire [31:0] rd_offset_for_esp_from_tss;
9
wire [31:0] rd_offset_for_ss_from_tss;
10
 
11
wire [31:0] r_limit_for_ss_esp_from_tss;
12
 
13
wire        rd_ss_esp_from_tss_386;
14
 
15
assign rd_ss_esp_from_tss_386 = tr_cache[`DESC_BITS_TYPE] == `DESC_TSS_AVAIL_386 || tr_cache[`DESC_BITS_TYPE] == `DESC_TSS_BUSY_386;
16
 
17
assign r_limit_for_ss_esp_from_tss =
18
    (rd_ss_esp_from_tss_386)?   { 27'd0, glob_descriptor[`DESC_BITS_DPL], 3'd0 } + 32'd11 :
19
                                { 28'd0, glob_descriptor[`DESC_BITS_DPL], 2'd0 } + 32'd5;
20
 
21
assign rd_offset_for_ss_from_tss =
22
    (rd_ss_esp_from_tss_386)?   { 27'd0, glob_descriptor[`DESC_BITS_DPL], 3'd0 } + 32'd8 :
23
                                { 28'd0, glob_descriptor[`DESC_BITS_DPL], 2'd0 } + 32'd4;
24
 
25
assign rd_offset_for_esp_from_tss =
26
    (rd_ss_esp_from_tss_386)?   { 27'd0, glob_descriptor[`DESC_BITS_DPL], 3'd0 } + 32'd4 :
27
                                { 28'd0, glob_descriptor[`DESC_BITS_DPL], 2'd0 } + 32'd2;
28
 
29
assign rd_ss_esp_from_tss_fault =
30
    (   (rd_cmd == `CMD_CALL_2 && rd_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_0) ||
31
        (rd_cmd == `CMD_int_2  && rd_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_0) ) &&
32
     r_limit_for_ss_esp_from_tss > tr_limit;
33
34
 
35
 
36
37
IF( (rd_cmd == `CMD_int_2  && rd_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_0) ||
38
    (rd_cmd == `CMD_CALL_2 && rd_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_0) );
39
 
40
    SET(rd_error_code, `SELECTOR_FOR_CODE(tr));
41
 
42
    SET(rd_system_linear, tr_base + rd_offset_for_ss_from_tss);
43
 
44
    IF(rd_ss_esp_from_tss_fault); SET(rd_waiting);
45
    ELSE();
46
 
47
        SET(read_system_word);
48
 
49
        SET(rd_glob_param_3_set);
50
        SET(rd_glob_param_3_value, { 16'd0, read_4[15:0] });
51
 
52
        IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
53
    ENDIF();
54
ENDIF();
55
56
 
57
58
IF( (rd_cmd == `CMD_int_2 && rd_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_1) ||
59
    (rd_cmd == `CMD_CALL_2 && rd_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_1) );
60
 
61
    SET(rd_system_linear, tr_base + rd_offset_for_esp_from_tss);
62
 
63
    SET(read_system_word,  ~(rd_ss_esp_from_tss_386));
64
    SET(read_system_dword, rd_ss_esp_from_tss_386);
65
 
66
    SET(rd_glob_param_4_set);
67
    SET(rd_glob_param_4_value, (rd_ss_esp_from_tss_386)? read_4 : { 16'd0, read_4[15:0] });
68
 
69
    IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
70
ENDIF();
71
72
 
73
74
IF( (rd_cmd == `CMD_int_2 && rd_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_2) ||
75
    (rd_cmd == `CMD_CALL_2 && rd_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_2) );
76
 
77
    IF(rd_mutex_busy_active); SET(rd_waiting); // wait for previous step -- exception possible, move glob_param_1
78
    ELSE();
79
 
80
        IF(~(rd_descriptor_not_in_limits));
81
 
82
            SET(rd_glob_descriptor_set);
83
            SET(rd_glob_descriptor_value, read_8);
84
 
85
            SET(rd_glob_param_5_set);
86
            SET(rd_glob_param_5_value, 32'd0);
87
 
88
            SET(read_system_descriptor);
89
 
90
            IF(~(read_for_rd_ready)); SET(rd_waiting); ENDIF();
91
        ELSE();
92
            SET(rd_glob_param_5_set);
93
            SET(rd_glob_param_5_value, { 31'd0, rd_descriptor_not_in_limits });
94
        ENDIF();
95
    ENDIF();
96
ENDIF();
97
98
 
99
100
IF((exe_cmd == `CMD_CALL && exe_cmdex == `CMDEX_CALL_protected_STEP_0) ||
101
   (exe_cmd == `CMD_JMP  && exe_cmdex == `CMDEX_JMP_protected_STEP_0));
102
 
103
    IF(glob_param_1[15:2] == 14'd0 ||
104
        (exe_descriptor[`DESC_BIT_SEG] == `FALSE && (
105
            exe_descriptor[`DESC_BITS_DPL] < cpl ||
106
            exe_descriptor[`DESC_BITS_DPL] < exe_selector[`SELECTOR_BITS_RPL] ||
107
 
108
            ((exe_descriptor[`DESC_BITS_TYPE] == 4'd1 || exe_descriptor[`DESC_BITS_TYPE] == 4'd9) && exe_selector[`SELECTOR_BIT_TI]) || //AVAIL_286_TSS, AVAIL_386_TSS
109
 
110
            exe_descriptor[`DESC_BITS_TYPE] == 4'd0  || exe_descriptor[`DESC_BITS_TYPE] == 4'd8  ||
111
            exe_descriptor[`DESC_BITS_TYPE] == 4'd10 || exe_descriptor[`DESC_BITS_TYPE] == 4'd13 ||
112
            exe_descriptor[`DESC_BITS_TYPE] == 4'd2  || exe_descriptor[`DESC_BITS_TYPE] == 4'd3  ||
113
            exe_descriptor[`DESC_BITS_TYPE] == 4'd6  || exe_descriptor[`DESC_BITS_TYPE] == 4'd7  ||
114
            exe_descriptor[`DESC_BITS_TYPE] == 4'd11 || exe_descriptor[`DESC_BITS_TYPE] == 4'd14 ||
115
            exe_descriptor[`DESC_BITS_TYPE] == 4'd15) //new_cs_descriptor.valid == 0, system not valid
116
        )
117
        ||
118
        (exe_descriptor[`DESC_BIT_SEG] && (
119
            `DESC_IS_DATA(exe_descriptor) ||
120
            (`DESC_IS_CODE_NON_CONFORMING(exe_descriptor) && (exe_descriptor[`DESC_BITS_DPL] != cpl || exe_selector[`SELECTOR_BITS_RPL] > cpl)) ||
121
            (`DESC_IS_CODE_CONFORMING(exe_descriptor)     &&  exe_descriptor[`DESC_BITS_DPL] > cpl)) //check_cs()
122
        )
123
    );
124
        SET(exe_waiting);
125
        SET(exe_trigger_gp_fault); //exception GP(val)
126
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
127
    ENDIF();
128
 
129
    IF(~(exe_trigger_gp_fault) && exe_descriptor[`DESC_BIT_P] == `FALSE && //check_cs()
130
            (exe_descriptor[`DESC_BIT_SEG] || exe_descriptor[`DESC_BITS_TYPE] == 4'd1 || exe_descriptor[`DESC_BITS_TYPE] == 4'd9 || //AVAIL_286_TSS, AVAIL_386_TSS
131
             exe_descriptor[`DESC_BITS_TYPE] == 4'd4 || exe_descriptor[`DESC_BITS_TYPE] == 4'd12 || //286_CALL_GATE, 386_CALL_GATE
132
             exe_descriptor[`DESC_BITS_TYPE] == 4'd5) //TASK_GATE
133
    );
134
        SET(exe_waiting);
135
        SET(exe_trigger_np_fault); //exception GP(val)
136
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
137
    ENDIF();
138
ENDIF();
139
140
 
141
142
IF((exe_cmd == `CMD_CALL_2 && exe_cmdex == `CMDEX_CALL_2_task_switch_STEP_0) ||
143
   (exe_cmd == `CMD_JMP    && exe_cmdex == `CMDEX_JMP_task_switch_STEP_0));
144
 
145
// task switch:
146
// glob_param_1[15:0]  --> new_tr
147
// glob_param_1[17:16] --> source
148
// glob_param_2        --> [used internal]
149
// glob_param_3[15:0]  --> error_code
150
// glob_param_3[16]    --> push code flag
151
// glob_param_3[17]    --> [internal] is push 32 bit (TSS386)
152
// glob_param_3[21:18] --> cmd_len
153
// glob_descriptor     --> new_tr_cache
154
 
155
    IF(exe_cmd == `CMD_CALL_2);
156
        SET(exe_glob_param_1_set);
157
        SET(exe_glob_param_1_value, { 14'd0, `TASK_SWITCH_FROM_CALL, glob_param_1[15:0] });
158
    ENDIF();
159
 
160
    IF(exe_cmd == `CMD_JMP);
161
        SET(exe_glob_param_1_set);
162
        SET(exe_glob_param_1_value, { 14'd0, `TASK_SWITCH_FROM_JUMP, glob_param_1[15:0] });
163
    ENDIF();
164
 
165
    SET(exe_glob_param_3_set);
166
    SET(exe_glob_param_3_value, { 10'd0, exe_consumed, 1'd0, 1'd0, 16'd0 });
167
ENDIF();
168
169
 
170
171
IF((exe_cmd == `CMD_CALL_2 && exe_cmdex == `CMDEX_CALL_2_task_gate_STEP_1) ||
172
   (exe_cmd == `CMD_JMP    && exe_cmdex == `CMDEX_JMP_task_gate_STEP_1) ||
173
   (exe_cmd == `CMD_int    && exe_cmdex == `CMDEX_int_task_gate_STEP_1));
174
 
175
    IF(glob_param_1[`SELECTOR_BIT_TI] || glob_descriptor[`DESC_BIT_SEG] || (glob_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_AVAIL_386 && glob_descriptor[`DESC_BITS_TYPE] != `DESC_TSS_AVAIL_286));
176
 
177
        SET(exe_waiting);
178
        SET(exe_trigger_gp_fault); //exception GP(val)
179
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
180
    ENDIF();
181
 
182
    IF(~(exe_trigger_gp_fault) && exe_descriptor[`DESC_BIT_P] == `FALSE);
183
        SET(exe_waiting);
184
        SET(exe_trigger_np_fault); //exception GP(val)
185
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
186
    ENDIF();
187
 
188
// task switch:
189
// glob_param_1[15:0]  --> new_tr
190
// glob_param_1[17:16] --> source
191
// glob_param_2        --> [used internal]
192
// glob_param_3[15:0]  --> error_code
193
// glob_param_3[16]    --> push code flag
194
// glob_param_3[17]    --> [internal] is push 32 bit (TSS386)
195
// glob_param_3[21:18] --> cmd_len
196
// glob_descriptor     --> new_tr_cache
197
 
198
    IF(exe_cmd == `CMD_CALL_2);
199
        SET(exe_glob_param_1_set);
200
        SET(exe_glob_param_1_value, { 14'd0, `TASK_SWITCH_FROM_CALL, glob_param_1[15:0] });
201
    ENDIF();
202
 
203
    IF(exe_cmd == `CMD_JMP);
204
        SET(exe_glob_param_1_set);
205
        SET(exe_glob_param_1_value, { 14'd0, `TASK_SWITCH_FROM_JUMP, glob_param_1[15:0] });
206
    ENDIF();
207
 
208
    IF(exe_cmd == `CMD_int);
209
        SET(exe_glob_param_1_set);
210
        SET(exe_glob_param_1_value, { 14'd0, `TASK_SWITCH_FROM_INT,  glob_param_1[15:0] });
211
    ENDIF();
212
 
213
    IF(exe_cmd != `CMD_int);
214
        SET(exe_glob_param_3_set);
215
        SET(exe_glob_param_3_value, { 10'd0, exe_consumed, 1'd0, 1'd0, 16'd0 });
216
    ENDIF();
217
 
218
    IF(exe_cmd == `CMD_int);
219
        SET(exe_glob_param_3_set);
220
        SET(exe_glob_param_3_value, { 10'd0, exe_consumed, 1'd0, exc_push_error, exc_error_code[15:0] });
221
    ENDIF();
222
ENDIF();
223
224
 
225
226
IF((exe_cmd == `CMD_CALL_2 && exe_cmdex == `CMDEX_CALL_2_call_gate_STEP_1) ||
227
   (exe_cmd == `CMD_int    && exe_cmdex == `CMDEX_int_int_trap_gate_STEP_1));
228
 
229
    IF(glob_param_1[15:2] == 14'd0 || glob_descriptor[`DESC_BIT_SEG] == `FALSE ||
230
       `DESC_IS_DATA(glob_descriptor) || glob_descriptor[`DESC_BITS_DPL] > cpl);
231
 
232
        SET(exe_waiting);
233
        SET(exe_trigger_gp_fault); //exception GP(val)
234
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
235
    ENDIF();
236
 
237
    IF(~(exe_trigger_gp_fault) && exe_descriptor[`DESC_BIT_P] == `FALSE);
238
        SET(exe_waiting);
239
        SET(exe_trigger_np_fault); //exception GP(val)
240
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
241
    ENDIF();
242
ENDIF();
243
244
 
245
246
IF((exe_cmd == `CMD_CALL_2 && exe_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_2) ||
247
   (exe_cmd == `CMD_int_2  && exe_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_2));
248
 
249
    IF(exe_cmd == `CMD_CALL_2);
250
        SET(exe_result_push, { 16'd0, ss[15:0] });
251
        SET(offset_new_stack_minus);
252
    ENDIF();
253
 
254
    IF(glob_param_5[0] || glob_param_1[`SELECTOR_BITS_RPL] != glob_descriptor_2[`DESC_BITS_DPL] || // selector not in limits,
255
       glob_descriptor[`DESC_BITS_DPL] != glob_descriptor_2[`DESC_BITS_DPL] ||
256
       glob_descriptor[`DESC_BIT_SEG] == `FALSE || `DESC_IS_CODE(glob_descriptor) || `DESC_IS_DATA_RO(glob_descriptor));
257
 
258
        SET(exe_waiting);
259
 
260
        SET(exe_trigger_ts_fault);
261
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
262
    ENDIF();
263
 
264
    IF(glob_param_5[0] == 1'b0 && ~(exe_trigger_ts_fault) && ~(glob_descriptor[`DESC_BIT_P]));
265
        SET(exe_waiting);
266
 
267
        SET(exe_trigger_ss_fault);
268
        SET(exe_error_code, `SELECTOR_FOR_CODE(glob_param_1));
269
    ENDIF();
270
ENDIF();
271
272
 
273
274
IF((wr_cmd == `CMD_RET_far && wr_cmdex == `CMDEX_RET_far_same_STEP_3) ||
275
   (wr_cmd == `CMD_IRET_2  && wr_cmdex == `CMDEX_IRET_2_protected_same_STEP_0) ||
276
   (wr_cmd == `CMD_CALL_2  && wr_cmdex == `CMDEX_CALL_2_protected_seg_STEP_3) ||
277
   (wr_cmd == `CMD_CALL_2  && wr_cmdex == `CMDEX_CALL_2_call_gate_same_STEP_2) ||
278
   (wr_cmd == `CMD_JMP     && wr_cmdex == `CMDEX_JMP_protected_seg_STEP_0) ||
279
   (wr_cmd == `CMD_JMP_2   && wr_cmdex == `CMDEX_JMP_2_call_gate_STEP_2) ||
280
   (wr_cmd == `CMD_int_2   && wr_cmdex == `CMDEX_int_2_int_trap_gate_same_STEP_4));
281
 
282
    SET(wr_not_finished);
283
 
284
    // save esp
285
    // touch
286
    // save descriptor
287
 
288
    SET(wr_seg_rpl,          (wr_cmd == `CMD_CALL_2 || wr_cmd == `CMD_JMP || wr_cmd == `CMD_JMP_2 || wr_cmd == `CMD_int_2)? cpl : glob_param_1[1:0]);
289
    SET(wr_seg_cache_valid,  `TRUE);
290
    SET(wr_seg_sel,          (wr_cmd == `CMD_CALL_2 || wr_cmd == `CMD_JMP || wr_cmd == `CMD_JMP_2 || wr_cmd == `CMD_int_2)? { glob_param_1[15:2], cpl } : glob_param_1[15:0]); // CPL = RPL
291
 
292
    IF(`DESC_IS_NOT_ACCESSED(glob_descriptor));
293
 
294
        SET(write_system_touch);
295
 
296
        IF(~(write_for_wr_ready)); SET(wr_waiting);
297
        ELSE();
298
            SET(write_seg_cache);
299
            //wr_seg_cache_mask zero
300
 
301
            SET(write_seg_sel);
302
            SET(write_seg_cache_valid);
303
            SET(write_seg_rpl);
304
 
305
            IF(wr_cmd != `CMD_JMP && wr_cmd != `CMD_JMP_2 && wr_cmd != `CMD_int_2); SAVE(esp, wr_stack_esp); ENDIF();
306
            SET(wr_make_esp_commit);
307
        ENDIF();
308
    ELSE();
309
        SET(write_seg_cache);
310
        //wr_seg_cache_mask zero
311
 
312
        SET(write_seg_sel);
313
        SET(write_seg_cache_valid);
314
        SET(write_seg_rpl);
315
 
316
        IF(wr_cmd != `CMD_JMP && wr_cmd != `CMD_JMP_2 && wr_cmd != `CMD_int_2); SAVE(esp, wr_stack_esp); ENDIF();
317
        SET(wr_make_esp_commit);
318
    ENDIF();
319
ENDIF();
320
321
 
322
323
IF((wr_cmd == `CMD_CALL_3 && wr_cmdex == `CMDEX_CALL_3_call_gate_more_STEP_9) ||
324
    (wr_cmd == `CMD_int_3  && wr_cmdex == `CMDEX_int_3_int_trap_gate_more_STEP_4));
325
 
326
    SET(wr_not_finished);
327
 
328
    // touch
329
    // save descriptor
330
 
331
    SET(wr_seg_rpl,          glob_descriptor[`DESC_BITS_DPL]);
332
    SET(wr_seg_cache_valid,  `TRUE);
333
    SET(wr_seg_sel,          { glob_param_1[15:2], glob_descriptor[`DESC_BITS_DPL] });
334
 
335
    IF(`DESC_IS_NOT_ACCESSED(glob_descriptor));
336
 
337
        SET(write_system_touch);
338
 
339
        IF(~(write_for_wr_ready)); SET(wr_waiting);
340
        ELSE();
341
            SET(write_seg_cache);
342
            //wr_seg_cache_mask zero
343
 
344
            SET(write_seg_sel);
345
            SET(write_seg_cache_valid);
346
            SET(write_seg_rpl);
347
        ENDIF();
348
    ELSE();
349
        SET(write_seg_cache);
350
        //wr_seg_cache_mask zero
351
 
352
        SET(write_seg_sel);
353
        SET(write_seg_cache_valid);
354
        SET(write_seg_rpl);
355
    ENDIF();
356
ENDIF();
357
358
 
359
360
IF((wr_cmd == `CMD_RET_far && wr_cmdex == `CMDEX_RET_far_same_STEP_4) ||
361
   (wr_cmd == `CMD_CALL_2  && wr_cmdex == `CMDEX_CALL_2_protected_seg_STEP_4) ||
362
   (wr_cmd == `CMD_CALL_2  && wr_cmdex == `CMDEX_CALL_2_call_gate_same_STEP_3) ||
363
   (wr_cmd == `CMD_CALL_3  && wr_cmdex == `CMDEX_CALL_3_call_gate_more_STEP_10) ||
364
   (wr_cmd == `CMD_JMP     && wr_cmdex == `CMDEX_JMP_protected_seg_STEP_1) ||
365
   (wr_cmd == `CMD_JMP_2   && wr_cmdex == `CMDEX_JMP_2_call_gate_STEP_3));
366
 
367
    // clear pipeline
368
    SET(wr_req_reset_pr);
369
    SET(wr_req_reset_dec);
370
    SET(wr_req_reset_micro);
371
    SET(wr_req_reset_rd);
372
    SET(wr_req_reset_exe);
373
ENDIF();
374
375
 
376
377
IF((wr_cmd == `CMD_RET_far && wr_cmdex == `CMDEX_RET_far_outer_STEP_5) ||
378
   (wr_cmd == `CMD_IRET_2  && wr_cmdex == `CMDEX_IRET_2_protected_outer_STEP_3));
379
 
380
    SET(wr_not_finished);
381
 
382
    SAVE(wr_task_rpl, cpl);
383
 
384
    // touch
385
    // save descriptor
386
 
387
    SET(wr_seg_rpl,          glob_param_1[1:0]);
388
    SET(wr_seg_cache_valid,  `TRUE);
389
    SET(wr_seg_sel,          glob_param_1[15:0]); // CPL = RPL
390
 
391
    IF(`DESC_IS_NOT_ACCESSED(glob_descriptor));
392
 
393
        SET(write_system_touch);
394
 
395
        IF(~(write_for_wr_ready)); SET(wr_waiting);
396
        ELSE();
397
            SET(write_seg_cache);
398
            //wr_seg_cache_mask zero
399
 
400
            SET(write_seg_sel);
401
            SET(write_seg_cache_valid);
402
            SET(write_seg_rpl);
403
        ENDIF();
404
    ELSE();
405
        SET(write_seg_cache);
406
        //wr_seg_cache_mask zero
407
 
408
        SET(write_seg_sel);
409
        SET(write_seg_cache_valid);
410
        SET(write_seg_rpl);
411
    ENDIF();
412
ENDIF();
413
414
 
415
416
IF((wr_cmd == `CMD_RET_far && wr_cmdex == `CMDEX_RET_far_outer_STEP_6) ||
417
   (wr_cmd == `CMD_IRET_2  && wr_cmdex == `CMDEX_IRET_2_protected_outer_STEP_5) ||
418
   (wr_cmd == `CMD_CALL_3  && wr_cmdex == `CMDEX_CALL_3_call_gate_more_STEP_8) ||
419
   (wr_cmd == `CMD_int_3   && wr_cmdex == `CMDEX_int_3_int_trap_gate_more_STEP_5));
420
 
421
    SET(wr_not_finished);
422
 
423
    // touch
424
    // save descriptor
425
 
426
    SET(wr_seg_rpl,          glob_param_1[1:0]);
427
    SET(wr_seg_cache_valid,  `TRUE);
428
    SET(wr_seg_sel,          glob_param_1[15:0]); // ss.rpl == cs.rpl (checked before)
429
 
430
    IF(`DESC_IS_NOT_ACCESSED(glob_descriptor) && glob_param_1[15:2] != 14'd0);
431
 
432
        SET(write_system_touch);
433
 
434
        IF(~(write_for_wr_ready)); SET(wr_waiting);
435
        ELSE();
436
            SET(write_seg_cache);
437
            //wr_seg_cache_mask zero
438
 
439
            SET(write_seg_sel);
440
            SET(write_seg_cache_valid);
441
            SET(write_seg_rpl);
442
        ENDIF();
443
    ELSE();
444
        SET(write_seg_cache);
445
        //wr_seg_cache_mask zero
446
 
447
        SET(write_seg_sel);
448
        SET(write_seg_cache_valid);
449
        SET(write_seg_rpl);
450
    ENDIF();
451
ENDIF();
452
453
 
454
455
IF((wr_cmd == `CMD_RET_far && wr_cmdex == `CMDEX_RET_far_outer_STEP_7) ||  +
456
    (wr_cmd == `CMD_IRET_2 && wr_cmdex == `CMDEX_IRET_2_protected_outer_STEP_6));
457
    // save esp
458
 
459
    SAVE(esp, wr_stack_esp);
460
    SET(wr_make_esp_commit);
461
 
462
    // validate seg regs
463
    SET(wr_validate_seg_regs);
464
 
465
    // clear pipeline
466
    SET(wr_req_reset_pr);
467
    SET(wr_req_reset_dec);
468
    SET(wr_req_reset_micro);
469
    SET(wr_req_reset_rd);
470
    SET(wr_req_reset_exe);
471
ENDIF();
472
473
 
474
475
IF((wr_cmd == `CMD_CALL && (wr_cmdex == `CMDEX_CALL_protected_STEP_0 || wr_cmdex == `CMDEX_CALL_protected_STEP_1)) ||
476
    (wr_cmd == `CMD_JMP  && (wr_cmdex == `CMDEX_JMP_protected_STEP_0  || wr_cmdex == `CMDEX_JMP_protected_STEP_1)));
477
 
478
    SET(wr_not_finished);
479
ENDIF();
480
481
 
482
483
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_task_gate_STEP_0) ||
484
   (wr_cmd == `CMD_JMP    && wr_cmdex == `CMDEX_JMP_task_gate_STEP_0) ||
485
   (wr_cmd == `CMD_int    && wr_cmdex == `CMDEX_int_task_gate_STEP_0));
486
 
487
    SET(wr_not_finished);
488
ENDIF();
489
490
 
491
492
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_task_gate_STEP_1) ||
493
    (wr_cmd == `CMD_JMP    && wr_cmdex == `CMDEX_JMP_task_gate_STEP_1) ||
494
    (wr_cmd == `CMD_int    && wr_cmdex == `CMDEX_int_task_gate_STEP_1));
495
 
496
    SET(wr_not_finished);
497
ENDIF();
498
499
 
500
501
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_call_gate_STEP_0) ||
502
    (wr_cmd == `CMD_int    && wr_cmdex == `CMDEX_int_int_trap_gate_STEP_0));
503
 
504
    SET(wr_not_finished);
505
ENDIF();
506
507
 
508
509
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_call_gate_STEP_1) ||
510
    (wr_cmd == `CMD_int    && wr_cmdex == `CMDEX_int_int_trap_gate_STEP_1));
511
 
512
    SET(wr_not_finished);
513
ENDIF();
514
515
 
516
517
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_call_gate_STEP_2) ||
518
    (wr_cmd == `CMD_int    && wr_cmdex == `CMDEX_int_int_trap_gate_STEP_2));
519
 
520
    SET(wr_not_finished);
521
ENDIF();
522
523
 
524
525
IF((wr_cmd == `CMD_CALL_2 && (wr_cmdex == `CMDEX_CALL_2_call_gate_same_STEP_0 || wr_cmdex == `CMDEX_CALL_2_call_gate_same_STEP_1)) ||
526
    (wr_cmd == `CMD_int_2 && (wr_cmdex == `CMDEX_int_2_int_trap_gate_same_STEP_0 || wr_cmdex == `CMDEX_int_2_int_trap_gate_same_STEP_1 ||
527
                              wr_cmdex == `CMDEX_int_2_int_trap_gate_same_STEP_2 || wr_cmdex == `CMDEX_int_2_int_trap_gate_same_STEP_3)));
528
 
529
    SET(wr_not_finished);
530
 
531
    SET(wr_push_ss_fault_check);
532
    SET(wr_one_cycle_wait);
533
 
534
    SET(wr_push_length_word,  ~(glob_param_1[19]));
535
    SET(wr_push_length_dword, glob_param_1[19]);
536
 
537
    IF(~(write_for_wr_ready)); SET(wr_waiting); ENDIF();
538
 
539
    IF(~(wr_push_ss_fault));
540
        SET(write_stack_virtual);
541
 
542
        SAVE(esp, wr_stack_esp); //speculative set before
543
    ENDIF();
544
ENDIF();
545
546
 
547
548
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_0) ||
549
    (wr_cmd == `CMD_int_2  && wr_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_0));
550
 
551
    SET(wr_not_finished);
552
ENDIF();
553
554
 
555
556
IF((wr_cmd == `CMD_CALL_2 && wr_cmdex == `CMDEX_CALL_2_call_gate_more_STEP_1) ||
557
    (wr_cmd == `CMD_int_2  && wr_cmdex == `CMDEX_int_2_int_trap_gate_more_STEP_1));
558
 
559
    SET(wr_not_finished);
560
ENDIF();
561

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.