summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/XMAEM/INDEDES.MAC
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/INDEDES.MAC
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/INDEDES.MAC')
-rw-r--r--v4.0/src/DEV/XMAEM/INDEDES.MAC173
1 files changed, 173 insertions, 0 deletions
diff --git a/v4.0/src/DEV/XMAEM/INDEDES.MAC b/v4.0/src/DEV/XMAEM/INDEDES.MAC
new file mode 100644
index 0000000..68d1776
--- /dev/null
+++ b/v4.0/src/DEV/XMAEM/INDEDES.MAC
@@ -0,0 +1,173 @@
1COMMENT #
2* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
3* *
4* MODULE NAME : INDEDES *
5* *
6* *
7* 5669-196 (C) COPYRIGHT 1988 Microsoft *
8* *
9* DESCRIPTIVE NAME: Macros for setting up 80386 descriptors *
10* *
11* STATUS (LEVEL) : Version (0) Level (1.0) *
12* *
13* FUNCTION : DESCR_DEF - Define storage for a descriptor *
14* DESCR_INIT - Initialize a descriptor that has already *
15* been defined *
16* *
17* MODULE TYPE : MAC *
18* *
19* REGISTER USAGE : 80286 Standard *
20* *
21* CHANGE ACTIVITY : *
22* *
23* $MAC(INDEDES) COMP(LOAD) PROD(3270PC) : *
24* *
25* $D0=D0004700 410 870604 D : NEW FOR RELEASE 1.1 *
26* $P1=P0000311 410 870804 D : RENAME MODULE'S LIBRARY FILE TYPE TO "MAC" *
27* *
28* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
29#
30
31; DESCR_DEF: Define a descriptor in-line using DWs and DBs.
32;
33; Input: For Segment descriptors, TYPE = SEG.
34; For Gate descriptors, TYPE = GATE.
35; Other parameters are as described by comments below.
36;
37; Output: DWs (define words) and DBs (define bytes) using the passed
38; values. Useful for copying descriptors directly out of the code
39; space, as when their values are forever static.
40;
41; Example: DESCR_DEF SEG, TSS0_LEN, TSS0_LOC, 0, CPL0_DATA_ACCESS
42;
43; This defines a segment format (limit/base/access) descriptor
44; based on the parameters, which are usually equated values. Note
45; that the low word of the address is TSS0_LOC and the high byte
46; is 0.
47
48
49DESCR_DEF MACRO TYPE,PARM1,PARM2,PARM3,ARB
50
51 IFIDN <&TYPE>,<SEG>
52;
53; Segment descriptor definition
54;
55 DW &PARM1 ; Segment limit
56 DW &PARM2 ; Segment base address - low word
57 DB &PARM3 ; Segment base address - high byte
58 DB &ARB ; Access rights byte
59 DW 0 ; Intel reserved
60
61 ENDIF
62
63 IFIDN <&TYPE>,<GATE>
64;
65; Gate descriptor definition
66;
67 DW &PARM1 ; Destination offset
68 DW &PARM2 ; Destination segment selector
69 DB &PARM3 ; Word count for stack-to-stack copy
70 ; (only for call gates when PL changes)
71 DB &ARB ; Access rights byte
72 DW 0 ; Intel reserved
73
74 ENDIF
75
76 ENDM
77
78PAGE
79
80; DESCR_INIT: Initialize a descriptor dynamically.
81;
82; NOTE: ES must already point to the BASE of table
83; where you want the descriptor to go.
84;
85;
86; Input: For Segment descriptors, TYPE = SEG.
87; For 4K granularity Segment descriptors, TYPE = BSEG.
88; For Gate descriptors, TYPE = GATE.
89; If the FIELD parameter is supplied, a MOV DI,FIELD is generated.
90; Otherwise, its current value is used. Other parameters are as
91; described by comments below.
92;
93;
94; Output: DI ends up as DI + 8 (i.e. pointing at next descriptor. This
95; is useful if you are initializing several consecutive
96; descriptors).
97;
98; The passed data is stored at ES:DI using string store. This
99; macro would be used when creating descriptors dynamically, as
100; when allocating virtual machines.
101;
102; Example: DESCR_INIT GATE,INT13_PTR,INT13_IP,INT13_CS,0,TRAP_GATE_ACCESS
103;
104; This stores the parameters in gate format (offset/ selector/word
105; count/access) through ES:DI, where DI is first loaded with
106; INT13_PTR.
107
108
109DESCR_INIT MACRO TYPE,FIELD,PARM1,PARM2,PARM3,ARB
110
111 PUSH AX ; Save the utility register
112
113 IFNB <&FIELD>
114
115 MOV DI,&FIELD ; Set up index value to proper descriptor
116 ADD DI,GDT_LOC
117
118 ENDIF
119
120
121 IFIDN <&TYPE>,<SEG>
122;
123; Segment descriptor initialization
124;
125 MOV AX,&PARM1 ; PARM1 = Segment Limit; load into AX
126 STOSW ; and store
127 MOV AX,&PARM2 ; PARM2 = BASE_LO_W; load into AX
128 STOSW ; and store
129 MOV AL,&PARM3 ; PARM3 = BASE_HI_B; load into AL, and
130 MOV AH,&ARB ; ARB = Access Rights Byte; load into AH
131 STOSW ; and store both
132 MOV AX,0 ; Make sure the Intel
133 STOSW ; reserved word is zero
134
135 ENDIF
136
137
138 IFIDN <&TYPE>,<BSEG>
139;
140; Big (4k granularity) segment descriptor initialization
141;
142 MOV AX,&PARM1 ; PARM1 = Segment Limit; load into AX
143 STOSW ; and store
144 MOV AX,&PARM2 ; PARM2 = BASE_LO_W; load into AX
145 STOSW ; and store
146 MOV AL,&PARM3 ; PARM3 = BASE_HI_B; load into AL, and
147 MOV AH,&ARB ; ARB = Access Rights Byte; load into AH
148 STOSW ; and store both
149 MOV AX,0080H ; 4k granularity bit
150 STOSW
151
152 ENDIF
153
154
155 IFIDN <&TYPE>,<GATE>
156;
157; Gate descriptor initialization
158;
159 MOV AX,&PARM1 ; PARM1 = Destination offset; load into AX
160 STOSW ; and store
161 MOV AX,&PARM2 ; PARM2 = Destination Selector;load into AX
162 STOSW ; and store
163 MOV AL,&PARM3 ; PARM3 = Word Count; load into AL, and
164 MOV AH,&ARB ; ARB = Access Rights Byte; load into AH
165 STOSW ; and store both
166 MOV AX,0 ; Make sure the Intel
167 STOSW ; reserved word is zero
168
169 ENDIF
170
171 POP AX ; Restore AX
172
173 ENDM