-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest3.asm
626 lines (526 loc) · 17 KB
/
test3.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
PAGE 118,121
TITLE TEST3 ---- 06/10/85 POST EXCEPTION INTERRUPT TESTS
.286C
.LIST
;--------------------------------------------------------
; TEST.20 :
; ADDITIONAL PROTECTED (VIRTUAL MODE) TEST :
; DESCRIPTION :
; THE PROCESSOR IS PUT IN PROTECTED MODE AND :
; THE FOLLOWING FUNCTIONS ARE VERIFIED :
; :
; 1. VERIFY PROTECTED MODE :
; THE MACHINE STATUS IS CHECK FOR VIRTUAL MODE :
; 2. PROGRAMMED INTERRUPT TEST :
; AN PROGRAMMED INTERRUPT 32 IS ISSUED AND :
; AND VERIFIED :
; 3. EXCEPTION INTERRUPT 13 TEST :
; A DESCRIPTOR SEGMENT LIMIT IS SET TO ZERO :
; AND A WRITE TO THAT SEGMENT IS ATTEMPTED :
; AN EXCEPTION 13 IS EXPECTED AND VERIFIED :
; 4. LDT/SDT LTR/STR TEST :
; LOAD LDT REGISTER AND VERIFY CORRECT :
; LOAD TASK REGISTER AND VERIFY CORRECT :
; THEY ARE VERIFIED VIA THE STORE INSTRUCTION :
; 5. THE CONTROL FLAGS OF THE 286 FOR DIRECTION :
; ARE VERIFIED VIA THE STD AND CLD COMMANDS :
; IN PROTECTED MODE :
; 6. BOUND INSTRUCTION TEST (EXCEPTION INT 5) :
; CREATE A SIGNED ARRAY INDEX WITHIN AND :
; OUTSIDE THE LIMITS, CHECK THAT NO EXC INT :
; IF WITHIN LIMIT AND THAT AN EXC INT 5 :
; OCCURS IF OUTSIDE THE LIMITS. :
; 7. PUSH ALL POP ALL TEST :
; SET GENERAL PURPOSE REGISTERS TO DIFFERENT :
; VALUES ISSUE A PUSH ALL, CLEAR THE REGISTERS :
; ISSUE A POP ALL AND VERIFY CORRECT. :
; 8. CHECK THE VERR/VERW INSTRUCTIONS :
; THE ACCESS BYTE IS SET TO READ ONLY THEN TO :
; A WRITE ONLY AND THE VERR/VERW INSTRUCTIONS :
; ARE VERIFIED, :
; 9. CAUSE AN INTERRUPT 13 VIA A WRITE TO A :
; READ ONLY SEGMENT :
; 10. VERIFY THE ARPL INSTRUCTION FUNCTIONS :
; SET THE RPL FIELD OF A SELECTOR AND :
; VERIFY THAT CURRENT SELECTOR RPL IS SET :
; CORRECTLY. :
; 11. VERIFY THE LAR INSTRUCTION FUNCTIONS :
; 12. VERIFY THE LSL INSTRUCTION FUNCTIONS :
; 13. LOW MEG CHIP SELECT TEST :
;--------------------------------------------------------
CODE SEGMENT BYTE PUBLIC
PUBLIC POST3
EXTRN CMOS_WRITE:NEAR
EXTRN DDS:NEAR
EXTRN PROC_SHUTDOWN:NEAR
EXTRN SYSINIT1:NEAR
ASSUME CS:CODE
POST3 PROC
CALL DDS ; SET DATA SEGMENT
MOV AL,F0H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F0 <><>
;----- SET SHUTDOWN RETURN 7
MOV AX,7*H+CMOS_SHUT_DOWN+NMI ; ADDRESS FOR SHUTDOWN BYTE
CALL CMOS_WRITE ; SET ERROR EXIT (DOUBLE EXCEPTION?)
;----- ENABLE PROTECTED MODE
MOV SP,POST_SS ; SET STACK FOR SYSINIT1
MOV SS,SP
MOV SP,POST_SP
CALL SYSINIT1 ; GO ENABLE PROTECTED MODE
;----- SET TEMPORARY STACK
MOV AX,GDT_PTR
MOV ES,AX
MOV DS,AX
MOV ES:SS_TEMP,BASE_LO_WORD,0
MOV BYTE PTR ES:(SS_TEMP,BASE_HI_BYTE),0
MOV SI,SS_TEMP
MOV SS,SI
MOV SP,MAX_SEG_LEN-2
;----- VERIFY PROTECTED MODE
SMSW AX ; GET THE MACHINE STATUS WORD
DB 00FH,001H,0E0H
TEST AX,VIRTUAL_ENABLE ; ARE WE IN PROTECTED MODE
JNZ T7_1
JMP ERROR_EXIT ; ERROR IF NOT
T7_1: MOV AL,0F1H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F1 <><>
;----- INTERRUPT TEST (PROGRAMMED INTERRUPT 32)
MOV AL,0B0H ; SET EXCEPTION FLAG
OUT DMA_PAGE+0AH,AL ; FOR INTERRUPT 10
INT 32 ; INTERRUPT
SUB CX,CX ; WAIT FOR INTERRUPT
LOOP1: IN AL,DMA_PAGE+0AH
AND AL,AL ; DID THE INTERRUPT OCCUR?
LOOPNZ LOOP1
JZ T7_2
JMP ERROR_EXIT ; MISSING INTERRUPT
;----- CAUSE AN EXCEPTION INTERRUPT (GENERAL PROTECTION INTERRUPT 13D)
T7_2: MOV AL,0F2H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F2 <><>
MOV AL,9DH ; SET INTERRUPT 13 FLAG
OUT DMA_PAGE+0AH,AL ; FOR THE INTERRUPT HANDLER
;----- MODIFY DESCRIPTOR TABLES
;----- SET TEMPORARY ES DESCRIPTOR TO SEGMENT LIMIT
MOV DS:ES_TEMP,SEG_LIMIT,0 ; SET SEGMENT TO 0
;----- CPL0, DATA ACCESS RIGHTS
MOV BYTE PTR DS:(ES_TEMP.DATA_ACC_RIGHTS),CPL0_DATA_ACCESS
MOV BYTE PTR DS:(ES_TEMP.BASE_HI_BYTE),01 ; DO ALL TESTS ON 2ND 64K
MOV WORD PTR DS:(ES:TEMP.BASE_LO_WORD),0
;----- SET ES REGISTER
PUSH BYTE PTR ES_TEMP ; LOAD ES
POP ES
;----- CAUSE AN EXCEPTION 13 INTERRUPT
SUB DI,DI
MOV AX,ES:[DI] ; THIS SHOULD CAUSE AND EXCEPTION
SUB CX,CX ; WAIT FOR INTERRUPT
LOOP2: IN AL,DMA_PAGE+0AH
AND AL,AL ; DID THE INTERRUPT OCCUR?
LOOPNZ LOOP2
JZ T7_3 ; CONTINUE IF INTERRUPT
JMP ERROR_EXIT ; MISSING INTERRUPT
;------------------------------------------
; :
; VERIFY 286 LDT/SDT LTR/STR :
; INSTRUCTIONS :
; DESCRIPTION :
; LOAD LDT REGISTERS WITH A :
; DESCRIPTOR AND VERIFY CORRECT :
;------------------------------------------
;----- WRITE TO 286 LDT REGISTER
T7_3:
MOV AL,0F3H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F3 <><>
MOV DI,POST_LDTR
LLDT DI ; REGISTER FROM THIS AREA
DB 00FH
??0000 LABEL BYTE
MOV DX,DI
??0001 LABEL BYTE
ORG OFFSET CS:??0000
DB 000H
ORG OFFSET CS:??0001
;----- READ AND VERIFY 286 LDT SELECTOR
SUB AX,AX ; CLEAR AX
SLDT AX ; GET THE LDT SELECTOR
DB 00FH
??0002 LABEL BYTE
ADD AX,AX
??0003 LABEL BYTE
ORG OFFSET CS:??0002
DB 000H
GRG OFFSET CS:??0003
AND AX,0F8H ; STRIP TI/RPL
CMP AX,POST_LDTR ; CORRECT SELECTOR?
JNZ ERROR ; GO IF NOT
;----- WRITE TO 286 TR
MOV DI,POST_TR
LTR DI ; REGISTER FROM THIS AREA
DB 00FH
??0004 LABEL BYTE
MOV BX,DI
??0005 LABEL BYTE
ORG OFFSET CS:??0004
DB 000H
ORG OFFSET CS:??0005
;----- VERIFY 286 TR REGISTERS
SUB AX,AX
STR AX ; GET THE TR REGISTER
DB 00FH
??0006 LABEL BYTE
MOV CX,AX
??0007 LABEL BYTE
ORG OFFSET CS:??0006
DB 000H
ORG OFFSET CS:??0007
AND AX,0F8H
CMP AX:POST_TR ; CORRECT SELECTOR?
JNZ ERROR
;----- TEST 286 CONTROL FLAGS
STD ; SET DIRECTION FLAG FOR DECREMENT
PUSHF ; GET THE FLAGS
POP AX
TEST AX,0200H ; INTERRUPT FLAG SHOULD BE OFF
JZ T7_4 ; CONTINUE IF OFF
ERROR: JMP ERROR_EXIT ; GO IF NOT
T7_4:
TEST AX,0400H ; CHECK DIRECTION FLAG
JNZ T7_5
JW ERROR_EXIT ; GO IF NOT SET
T7_5:
CLD ; CLEAR DIRECTION FLAG
PUSHF ; INSURE DIRECTION FLAG IS RESET
POP AX
TEST AX,0400H
JZ T7_6
JMP ERROR_EXIT ; GO IF NOT
;------------------------------------------
; VERIFY 286 BOUND INSTRUCTION :
; DESCRIPTION :
; CREATE A SIGNED ARRAY INDEX :
; WITHIN AND OUTSIDE THE LIMITS :
; (EXPECT INT 5) :
;------------------------------------------
T7_6:
MOV AL,0F4H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F4 <><>
PUSH BYTE PTR ES_TEMP ; LOAD ES REGISTER
POP ES
;----- CHECK BOUND FUNCTIONS CORRECTLY
SUB DI,DI ; POINT BEGINNING OF THE BLOCK
MOV WORD PTR ES:[DI],0 ; SET FIRST WORD TO ZERO
MOV WORD PTR ES:[DI+2],07FFFH ; SET SECOND TO 07FFFH
MOV AL,095H ; SET INTERRUPT 5 FLAG
OUT DMA_PAGE+0AH,AL
MOV AX,1000H ; SET AX WITHIN BOUNDS
BOUND AX,DWORD PTR ES:[DI] ; USE THE ES SEGMENT POINTER
SUB CX,CX ; WAIT FOR POSSIBLE INTERRUPT
LOOPA: LOOP LOOPA
IN AL,DMA_PAGE+0AH ; GET THE RESULTS
CMP AL,0 ; DID AN INTERRUPT OCCUR?
JNZ T7_7 ; CONTINUE IF N0T
JMP ERROR_EXIT ; GO IF YES
;----- CHECK LOW BOUND WORD CAUSES INTERRUPT 5
T7_7:
SUB DI,DI ; POINT BEGINNING OF THE BLOCK
MOV WORD PTR ES:[DI],03FF0H ; SET FIRST WORD TO 03FF0H
MOV AX,1000H ; SET AX OUT OF BOUNDS
BOUND AX,CWORD PTR ES:[DI]
SUB CX,CX ; WAIT FOR POSSIBLE INTERRUPT
LOOPB:
IN AL,DMA_PAGE+0AH ; GET THE RESULTS
CMP AL,0H ; DID AN INTERRUPT OCCUR?
LOOPNZ LOOPB ; TRY AGAIN
JZ T7_8 ; CONTINUE IF INTERRUPT
JMP ERROR_EXIT ; GO IF NO INTERRUPT
;----- CHECK HIGH BOUND WORD CAUSES INTERRUPT 5
T7_8: MOV AL,95H ; SET FLAG FOR INTERRUPT
OUT DMA_PAGE+0AH,AL
SUB DI,DI ; POINT BEGINNING OF THE BLOCK
MOV WORD PTR ES:[DI],0 ; SET FIRST WORD TO 0
MOV WORD PTR ES:[DI+2],0FFFH ; SET SECOND TO 0FFFH
MOV AX,1000H ; SET AX OUT OF BOUNDS
BOUND AX,DWORD PTR ES:[DI]
SUB CX,CX ; WAIT FOR POSSIBLE INTERRUPT
LOOPC:
IN AL,DMA_PAGE+0AH ; GET THE RESULT
CMP AL,0H ; DID AN INTERRUPT OCCUR?
LOOPNZ LOOPC ; TRY AGAIN
JZ T7_9
JMP ERROR_EXIT ; GO IF NO INTERRUPT
;-------------------------------------------------
; VERIFY PUSH ALL AND POP ALL INSTRUCTIONS:
; DESCRIPTION :
; SET REGISTERS TO A KNOWN VALUE AND :
; PUSH ALL. RESET THE REGISTERS, POP ALL :
; AND VERIFY :
;-------------------------------------------------
T7_9:
MOV AL,0F5H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F5 <><>
MOV AX,01 ; SET AX=1
MOV BX,AX ; SET BX=2
INC BX
MOV CX,BX ; SET CX=3
INC CX
MOV DX,CX
INC DX ; SET DX=4
MOV DI,DX
INC DI ; SET DI=5
MOV SI,DI
INC SI ; SET SI=6
PUSH BP ; SAVE THE (BP) ERROR FLAG REGISTER
MOV BP,SI ; SET BP=7
INC BP
PUSHA ; ISSUE THE PUSH ALL COMMAND
SUB AX,AX ; CLEAR ALL REGISTERS
MOV BX,AX
MOV CX,AX
MOV DX,AX
MOV DI,AX
MOV SI,AX
MOV BP,AX
POPA ; GET THE REGISTERS BACK
CMP BP,07 ; SP SHOULD BE 7
POP BP ; RESTORE (BP) ERROR FLAG REGISTER
JNZ ERROR_EXIT1 ; GO IF NOT
CMP AX,01 ; AX SHOULD BE 1
JNZ ERROR_EXIT1 ; GO IF NOT
CMP BX,02 ; BX SHOULD BE 2
JNZ ERROR_EXIT1 ; GO IF NOT
CMP CX,03 ; CX SHOULD BE 3
JNZ ERROR_EXIT1 ; GO IF NOT
CMP DX,04 ; DX SHOULD BE 4
JNZ ERROR_EXIT1 ; GO IF NOT
CMP DI,05 ; DI SHOULD BE 5
JNZ ERROR_EXIT1 ; GO IF NOT
CMP SI,06 ; SI SHOULD BE 6
JZ T7_10 ; CONTINUE IF IT IS
;----- ERROR EXIT
ERROR_EXIT:
JMP ERROR_EXIT
;-------------------------------------------------
; VERIFY ACCESS RIGHTS FUNCTION CORRECTLY :
; DESCRIPTION :
; SET ACCESS RIGHTS OF DESCRIPTOR TO :
; READ ONLY. VERIFY THE VERW/VERR INSTR :
; ACCESS A READ ONLY WITH A WRITE AND :
; VERIFY AN EXCEPTION INTERRUPT 13 :
;-------------------------------------------------
T7_10: MOV AL,0F6H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F6 <><>
MOV DS:ES_TEMP.SEG_LIMIT,MAX_SEG_LEN ; SET SEGMENT TO 0FFFFH
MOV BYTE PTR DS:(ES_TEMP.BASE_HI_BYTE),0 ; SET THE ADDRESS
MOV DS:ES_TEMP.BASE_LO_WORD,0F000H
MOV AX,ES_TEMP ; LOAD ES REGISTER
MOV ES,AX ; THIS SEGMENT SHOULD BE WRITEABLE
;----- INSURE ACCESS RIGHTS MAY BE WRITTEN
SEGOV DS ; SET SEGMENT OVERRIDE TO START OF TABLE
DB 03EH
VERW AX ; CHECK THE ACCESS RIGHTS OF ES TEMP
DB 00FH
??0009 LABEL BYTE
MOV BP,AX
??000A LABEL BYTE
ORG OFFSET CS:??0009
DB 000M
ORG OFFSET CS:??000A
JNZ ERROR_EXIT1 ; ERROR IF SEGMENT CAN NOT WRITE
;----- SET ACCESS RIGHTS TO READ ONLY
MOV BYTE PTR DS:(ES_TEMP.DATA_ACC_RIGHTS),91H
MOV AX,ES_TEMP ; LOAD ES REGISTER
MOV ES,AX
SEGOV DS ; SET SEGMENT OVERRIDE TO START OF TABLE
DB 03EH
VERW AX ; CHECK THE ACCESS RIGHTS OF ES_TEMP
DB 00FH
??000C LABEL BYTE
MOV BP,AX
??000D LABEL BYTE
ORG OFFSET CS:??000C
DB 000H
ORG OFFSET CS;??000D
JZ ERROR_EXIT1 ; ERROR IF SEGMENT IS WRITEABLE
MOV AX,ES_TEMP ; INSURE THAT SEGMENT IS READABLE
SEGOV DS
DB 03CH
VERR AX
DB 00FH
??000F LABEL BYTE
MOV SP,AX
??0010 LABEL BYTE
ORG OFFSET CS:??000F
DB 000H
ORG OFFSET CS:??0010
JNZ ERROR_EXIT1 ; GO IF SEGMENT NOT READABLE
;----- CAUSE AN EXCEPTION 13 INTERRUPT
MOV AL,09DH ; SET EXCEPTION FLAG
OUT DMA_PAGE+0AH,AL ; FOR INTERRUPT 13
SUB SI,SI
MOV BYTE PTR ES:[SI],00 ; WRITE A BYTE THAT SHOULD
SUB CX,CX ; WAIT FOR INTERRUPT
LOOPD: IN AL,DMA_PAGE+0AH
AND AL,AL ; DID THE INTERRUPT OCCUR?
LOOPNZ LOOPD
JNZ ERROR_EXIT1 ; MISSING INTERRUPT
;----- RESTORE THE ACCESS RIGHTS BYTE
MOV BYTE PTR DS:(ES_TEMP.DATA_ACC_RIGHTS),CPL0_DATA_ACCESS
;-------------------------------------------------
; VERIFY ADJUST RPL FIELD OF SELECTOR :
; INSTRUCTION (ARPL) FUNCTIONS :
; DESCRIPTION :
; SET THE RPL FIELD OF A SELECTOR :
; AND VERIFY THAT THE ZERO FLAG IS SET :
; CORRECTLY AND THAT THE SELECTOR RPL :
; FIELD IS SET CORRECTLY :
;-------------------------------------------------
MOV AL,0F7H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F7 <><>
MOV AX,ES_TEMP ; PUT A SELECTOR IN AX
MOV BX,DS_TEMP ; PUT A SELECTOR IN BX
OR AX,03H ; MAKE ACCESS OF AX < BX
;----- NOTE BX - FIRST OPERAND AX = SECOND OPERAND
ARPL AX,BX ; ISSUE THE RPL COMMAND
??0011 LABEL BYTE
MOV AX,BX
??0012 LABEL BYTE
ORG OFFSET CS:??0011
DB 063H
ORG OFFSET CS:??0012
JNZ ERROR_EXIT1 ; GO IF RPL, WAS NOT CHANGED
AND BL,03H ; STRIP UNWANTED SITS
CMP BL,03H ; AS EXPECTED?
JNZ ERROR_EXIT1 ; GO IF NOT
;----- CHECK THAT ACCESS RIGHTS DO NOT CHANGE
MOV BX,DS_TEMP ; PUT A SELECTOR IN BX
MOV AX,ES_TEMP ; PUT A SELECTOR IN AX
OR BL,03H ; MAKE ACCESS OF BX < AX
;----- NOTE BX = FIRST OPERAND AX = SECOND OPERAND
ARPL AX,BX ; ISSUE THE RPL COMMAND
??0013 LABEL BYTE
MOV AX,BX
??0014 LABEL BYTE
ORG OFFSET CS:??0013
DB 063H
ORG OFFSET CS:??0014
JZ ERROR_EXIT1 ; GO IF RPL WAS NOT CHANGED
AND BL,03H ; STRIP UNWANTED BITS
CMP BL,03H ; AS EXPECTED?
JNZ ERROR_EXIT2 ; GO IF NOT
;----- VERIFY LOAD SEGMENT LIMIT (LSL)
;----- AND LOAD ACCESS RIGHTS (LAR) INSTRUCTION
;----- CHECK THE LAR INSTRUCTION
MQV AL,0F8H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F8 <><>
;----- SET THE DESCRIPTOR TO LEVEL 3
MOV BYTE PTR DS:(ES_TEMP,DATA_ACC_RIGHTS),CPL3_DATA_ACCESS
MOV BX,ES_TEMP
SUB AX,AX ; CLEAR AX
;----- GET THE CURRENT DESCRIPTORS ACCESS RIGHTS
LAR AX,BX ; ISSUE THE LAR COMMAND
DB 00FH
??0015 LABEL BYTE
MOV AX,BX
??0016 LABEL BYTE
ORG OFFSET CS:??0015
DB 002H
ORG OFFSET CS:??0016
;----- INSURE THE DESCRIPTOR WAS VISIBLE
JNZ ERROR_EXIT2 ; GO IF LAR WAS NOT CHANGED
;----- THE DESCRIPTORS ACCESS RIGHTS MUST BE 3
CMP AH,CPL3_DATA_ACCESS ; AS EXPECTED?
JNZ ERROR_EXIT2 ; GO IF NOT
;----- CHECK THE LSL (LOAD SEGMENT LIMITS)
MOV AL,0F9H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT F9 <><>
MOV DS:ES_TEMP.SEG_LIMIT,0AAAAH ; SET SEGMENT LIMIT TO 0AAAAH
MOV BYTE PTR DS:(ES_TEMP.DATA_ACC_RIGHTS),CPL0_DATA_ACCESS
MOV AX,ES_TEMP ; LOAD ES REGISTER
LSL BX,AX ; GET THE DESCRIPTOR SEGMENT LIMIT
DB 00FH
??0017 LABEL BYTE
MOV BX,AX
??0018 LABEL BYTE
ORG OFFSET CS:??0017
DB 003H
ORG OFFSET CS:??0018
JZ R07 ; GO IF OK
ERROR_EXIT2:
JMP ERROR_EXIT ; GO IF NOT SUCCESSFUL
R07: CMP BX,0AAAAH ; INSURE CORRECT SEGMENT LIMIT
MOV DS:ES_TEMP.SEG_LIMIT,05555H ; SET THE SEGMENT LIMIT TO 05555H
MOV AX,ES_TEMP
LSL BX,AX ; GET THE DESCRIPTOR SEGMENT LIMIT
DB 00FH
??0019 LABEL BYTE
MOV BX,AX
??001A LABEL BYTE
ORG OFFSET CS:??0019
DB 003H
ORG OFFSET CS:??001A
JNZ ERROR_EXIT2 ; GO IF NOT SUCCESSFUL
CMP BX,05555H ; INSURE CORRECT SEGMENT LIMIT
JNZ ERROR_EXIT2 ; GO IF NOT
;--------------------------------------------------------
; LOW MEG CHIP SELECT TEST :
; TEST THAT A WRITE TO ADDRESS 1B0000 DOES NOT WRITE :
; TO B000:0, OR 1B8000 DOES NOT WRITE TO B800:0 :
;--------------------------------------------------------
MOV AL,0FAH ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT FA <><>
PUSH BYTE PTR GDT_PTR ; MODIFY THE DESCRIPTOR TABLE
POP DS
;----- SET TEMPORARY ES DESCRIPTOR 64K SEGMENT LIMIT/CPL0 DATA ACCESS
MOV DS:ES_TEMP.SEG_LIMIT,MAX_SEG_LEN
MOV BYTE PTR DS:(ES_TEMP.DATA_ACC_RIGHTS),CPL0_DATA_ACCESS
;----- START WITH SEGMENT 1B0000
MOV BYTE PTR DS:(ES_TEMP.BASE_HI)BYTE),1BH
MOV DS:ES_TEMP.BASE_LO_WORD,0
PUSH BYTE PTR ES_TEMP ; LOAD ES REGISTER
POP ES
SUB DI,DI ; POINT TO FIRST LOCATION
MOV WORD PTR ES:[DI],0AA55H ; WRITE A TEST PATTERN
;----- DO FOR SEGMENT 1B8000
MOV DS:ES_TEMP.BASE_LO_WORD,8000H
PUSH BYTE PTR ES_TEMP ; LOAD ES REGISTER
POP ES
MOV WORD PTR ES:[DI],0AA55H ; WRITE A TEST PATTERN
;----- DO FOR SEGMENT 1A0000
MOV BYTE PTR DS:(ES_TEMP.BASE_HI_BYTE),1AH
MOV DS:ES_TEMP.BASE_LO_WORD,0
PUSH BYTE PTR ES_TEMP ; LOAD ES REGISTER
POP ES
MOV WORD PTR ES:[DI],0AA55H ; WRITE A TEST PATTERN
;----- B/W VIDEO CARD
PUSH BYTE PTR C_BWCRT_PTR
POP DS ; SET DS TO B/W DISPLAY REGEN BUFFER
MOV AX,DS:[DI] ; GET THE WORD FROM B/W VIDEO
;----- COMPATIBLE COLOR
PUSH BYTE PTR C_CCRT_PTR ; SET DS TO COMPATIBLE COLOR MEMORY
POP DS
MOV BX,DS:[DI] ; GET THE WORD FROM COLOR MEMORY
;----- EGA COLOR
PUSH BYTE PTR E_CCRT_PTR ; EGA COLOR CRT POINTER LOW 64K
POP DS
MOV CX,DS:[DI]
;----- TEST FOR ERROR
PUSH AX ; SAVE RESULTS
MOV AL,35H ; <><><><><><><><><><><><>
OUT MFG_PORT,AL ; <><> CHECKPOINT 35 <><>
POP AX
CMP AX,0AA55H
JZ ERROR_EXIT
CMP BX,0AA55H
JZ ERROR_EXIT
CMP CX,0AA55H
JZ ERROR_EXIT
MOV AL,34H ; RESTORE CHECKPOINT
OUT MFG_PORT,AL ; <><> CHECKPOINT 34 <><>
;----- SHUTDOWN
NORMAL_EXIT:
MOV AX,*H+CMOS_SHUT_DOWN+NMI ; ADDRESS FOR SHUTDOWN BYTE
CALL CMOS_WRITE ; SET GOOD ENDING
ERROR_EXIT:
JMP PROC_SHUTOOWN
POST3 ENDP
CODE ENDS
END