summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/XMAEM/INDEACC.INC
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/DEV/XMAEM/INDEACC.INC
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/DEV/XMAEM/INDEACC.INC')
-rw-r--r--v4.0/src/DEV/XMAEM/INDEACC.INC218
1 files changed, 218 insertions, 0 deletions
diff --git a/v4.0/src/DEV/XMAEM/INDEACC.INC b/v4.0/src/DEV/XMAEM/INDEACC.INC
new file mode 100644
index 0000000..01a28b2
--- /dev/null
+++ b/v4.0/src/DEV/XMAEM/INDEACC.INC
@@ -0,0 +1,218 @@
1COMMENT #
2* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3* *
4* MODULE NAME : INDEACC *
5* *
6* *
7* 5669-196 (C) COPYRIGHT 1988 Microsoft Corporation *
8* *
9* DESCRIPTIVE NAME: Access rights byte definitions for 80386 XMA emulator *
10* *
11* STATUS (LEVEL) : Version (0) Level (1.0) *
12* *
13* FUNCTION : This file defines the access rights bytes used in *
14* descriptors that define the code and data segments. *
15* *
16* MODULE TYPE : INC *
17* *
18* REGISTER USAGE : 80386 Standard *
19* *
20* RESTRICTIONS : None *
21* *
22* DEPENDENCIES : None *
23* *
24* EXTERNAL *
25* REFERENCES : None *
26* *
27* CHANGE ACTIVITY : *
28* *
29* $MAC(INDEACC) COMP(LOAD) PROD(3270PC) : *
30* *
31* $D0=D0004700 410 870530 D : NEW FOR WSP RELEASE 1.1 *
32* $P1=P0000311 410 870804 D : RENAME MODULE'S LIBRARY FILE TYPE TO "INC" *
33* *
34* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
35#
36
37PAGE
38; RECORD DEFINITIONS FOR ACCESS RIGHTS BYTES
39; ====== =========== === ====== ====== =====
40;
41; Data Segments - Interpretation of access rights for DS/ES/SS
42
43
44; Define the bit fields for the access rights byte
45
46DATA_ACC RECORD PRESENT:1,DPL:2,SEG_TYPE:1,XQTBLE:1,EXPDIR:1,WRTBLE:1,ACCESSED:1
47
48 ; PRESENT (1 bit) 0 = segment not present in memory
49 ; 1 = segment present in memory
50 ;
51 ; DPL (2 bits) Descriptor privilege level -- 0 to 3
52 ;
53 ; SEG_TYPE (1 bit) 0 = system segment
54 ; 1 = application segment
55 ;
56 ; XQTBL (1 bit) 0 = segment is not executable (i.e., data)
57 ; 1 = segment is executable (i.e., code)
58 ;
59 ; EXPDIR (1 bit) 0 = expand up, i.e., normal data segment
60 ; 1 = expand down, i.e., stack segment
61 ;
62 ; WRTBLE (1 bit) 0 = data segment is read only
63 ; 1 = data segment is read/write
64 ;
65 ; ACCESSED (1 bit) 0 = segment has not been accessed
66 ; 1 = segment has been accessed
67
68
69; Privilege level 3 read/write data segment access rights byte
70
71CPL3_DATA_ACCESS EQU 11110011B ; Present
72 ; DPL = 3
73 ; Application segment
74 ; Not executable (i.e. data)
75 ; Expand up
76 ; Readable/Writable
77 ; Accessed
78
79; Privilege level 0 read/write data segment access rights byte
80
81CPL0_DATA_ACCESS EQU 10010011B ; Present
82 ; DPL = 0
83 ; Application segment
84 ; Not executable (i.e. data)
85 ; Expand up
86 ; Readable/Writable
87 ; Accessed
88
89
90NULL_ACCESS EQU 00000000B ; Null (Not present)
91
92
93; Descriptor privilege levels. These can be ANDed or ORed with the access
94; rights byte to get the desired DPL for the descriptor.
95
96DPL3 EQU 01100000B
97DPL2 EQU 01000000B
98DPL1 EQU 00100000B
99DPL0 EQU 00000000B
100
101PAGE
102; Code Segments - Interpretation of access rights for CS.
103; Identical to data segments except for two fields.
104
105
106CODE_ACC RECORD DATA_HI:5,CONFORM:1,READABLE:1,DATA_LO:1
107
108 ; DATA_HI (5 bits) Same five bits as described for data segments
109 ; PPRESENT (1), DPL (2), SEG_TYPE (1) and
110 ; XQTBL (1)
111 ;
112 ; CONFORM (1 bit) 0 = Non-conforming - cannot be called by
113 ; someone with a different CPL
114 ; 1 = Conforming - can be called by anyone
115 ; regardless of CPL. CPL remains the same
116 ;
117 ; READABLE (1 bit) 0 = code segment is execute only
118 ; 1 = data segment is executable and readable
119 ;
120 ; DATA_LO (1 bit) Same bit as described for data segments
121 ; ACCESSED (1)
122
123
124; Privilege level 3 conforming readable code segment access rights byte
125; BUT...
126; We switched the DPL to 0. Why? Because the DPL of the current code segment
127; determines the current privilege level (CPL). Whatever is running at the
128; time can only access data with a DPL >= CPL. So if the DPL for the code
129; segment were 3 and we tried to access data with a DPL of 0 we would get a
130; fault. By setting the DPL of the code segment to 0 we can access all data
131; and will never be bothered by faults.
132
133CPL3_CODE_ACCESS EQU 10011111B ; Present
134 ; DPL = 0
135 ; Application segment
136 ; Executable (i.e. code)
137 ; Conforming
138 ; Readable
139 ; Accessed
140
141; Access rights to be able to read and write to a code segment. Code segments
142; may not be written to. So this access byte will define the segment as a
143; read/write data segment. It is the same as CPL3_DATA_ACCESS.
144
145COMP_CODE_ACCESS EQU CPL3_DATA_ACCESS
146
147; Privilege level 0 non-conforming readable code segment access rights byte
148
149CPL0_CODE_ACCESS EQU 10011011B ; Present
150 ; DPL = 0
151 ; Application segment
152 ; Executable (i.e. code)
153 ; Non-conforming
154 ; Readable
155 ; Accessed
156
157PAGE
158; System Segments - Interpretation of access rights for TR/LDTR as well as
159; the four gate types. The access rights byte for the
160; GDTR and IDTR is undefined, meaning anyone can access
161; the table (although not necessarily the segments
162; defined in the table). The uppermost 4 bits are
163; identical to those for data segments; the type field
164; occupies the lowermost 4 bits.
165
166
167SYSTEM_ACC RECORD DATA_H:4,DESC_TYPE:4
168
169 ; DATA_H (4 bits) Same four bits as described for data segments
170 ; PPRESENT (1), DPL (2) and SEG_TYPE (1)
171 ;
172 ; DESC_TYPE(4 bits) 0000 Intel Reserved
173 ; 0001 Available 286 TSS
174 ; 0010 LDT
175 ; 0011 Busy 286 TSS
176 ; 0100 Call Gate
177 ; 0101 Task Gate
178 ; 0110 286 Interrupt Gate
179 ; 0111 286 Trap Gate
180 ; 1000 Intel Reserved
181 ; 1001 Available 386 TSS
182 ; 1010 Intel Reserved
183 ; 1011 Busy 386 TSS
184 ; 1100 386 Call Gate
185 ; 1101 Intel Reserved
186 ; 1110 386 Interrupt Gate
187 ; 1111 386 Trap Gate
188 ;
189
190
191; These equates cover the topmost 4 bits for system segment access
192; rights bytes. They define the privilege level.
193
194LDT_ACCESS EQU 11100000B ; Present, DPL = 3 for LDTs
195
196TSS_ACCESS EQU 10000000B ; Present, DPL = 0 for TSSs
197
198GATE_ACCESS EQU 10000000B ; Present, DPL = 0 for Gates
199
200
201; These are for the type field. When "OR"ed with one of the above,
202; you have a complete access rights byte.
203
204LDT_DESC EQU 00000010B OR LDT_ACCESS
205
206FREE_TSS EQU 00000001B OR TSS_ACCESS
207FREE_TSS_386 EQU 00001001B OR TSS_ACCESS
208
209BUSY_TSS EQU 00000011B OR TSS_ACCESS
210
211CALL_GATE EQU 00000100B OR GATE_ACCESS
212
213TASK_GATE EQU 00000101B OR GATE_ACCESS
214
215INT_GATE EQU 00000110B OR GATE_ACCESS
216
217TRAP_GATE EQU 00000111B OR GATE_ACCESS
218