]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MEMM/MEMM/INITDEB.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MEMM / MEMM / INITDEB.ASM
1
2
3 page 58,132
4 ;******************************************************************************
5 title InitDeb - initialize debugger
6 ;******************************************************************************
7 ;
8 ; (C) Copyright MICROSOFT Corp. 1986
9 ;
10 ; Title: MEMM.EXE - MICROSOFT Expanded Memory Manager 386 Driver
11 ;
12 ; Module: InitDeb - initialize debugger
13 ;
14 ; Version: 0.04
15 ;
16 ; Date: June 16,1986
17 ;
18 ; Author:
19 ;
20 ;******************************************************************************
21 ;
22 ; Change log:
23 ;
24 ; DATE REVISION DESCRIPTION
25 ; -------- -------- -------------------------------------------------------
26 ; 06/16/86 Original from VDM MAIN.ASM module
27 ; 06/28/86 0.02 Name changed from MEMM386 to MEMM
28 ; 07/06/86 0.04 Changed assume to DGROUP
29 ;
30 ;******************************************************************************
31 ;
32 ; Functional Description:
33 ;
34 ; This routine is linked in when linking with the kernel debugger.
35 ; InitDeb calls the debugger initialization routine.
36 ;
37 ;******************************************************************************
38 .lfcond ; list false conditionals
39 .386p
40 ;******************************************************************************
41 ; P U B L I C S
42 ;******************************************************************************
43
44 public InitDeb
45
46 ;******************************************************************************
47 ; D E F I N E S
48 ;******************************************************************************
49 include VDMseg.inc
50 include VDMsel.inc
51
52 FALSE equ 0
53 TRUE equ not FALSE
54 CR equ 0dh
55 LF equ 0ah
56
57 MASTER_IMR equ 21h ; mask port for master 8259
58
59 ;
60 ; Definition of the packet used in debug initialization. A pointer to
61 ; this structure is passed to Debug_Entry.
62 ;
63 DebugInit struc
64 CSseg dw ? ;Real mode code segment
65 DSseg dw ? ;Real mode data segment
66 CSsel dw ? ;Prot mode code selector
67 DSsel dw ? ;Prot mode data selector
68 SpareSel1 dw ? ;Prot mode alias selector 1
69 SpareSel2 dw ? ;Prot mode alias selector 2
70 GDTalias dw ? ;Prot mode GDT r/w alias
71 ProtIDTaddr dq ? ;Prot mode IDT base & limit
72 RealIDTaddr dq ? ;Real mode IDT base & limit
73 BrkFlag db ? ;TRUE if break to debugger
74 ComFlag db ? ;TRUE if com1, FALSE if com2
75 DebugInit ends
76
77
78 ;******************************************************************************
79 ; E X T E R N A L R E F E R E N C E S
80 ;******************************************************************************
81 ifndef NoBugMode
82 dcode segment
83 extrn _Debug_Entry:far ; (debinit.asm)
84 dcode ends
85 endif
86
87 _DATA SEGMENT
88
89 extrn GDT_Seg:word
90
91 _DATA ENDS
92
93 ;******************************************************************************
94 ; S E G M E N T D E F I N I T I O N S
95 ;******************************************************************************
96
97 _DATA SEGMENT
98
99 InitData DebugInit <>
100
101 _DATA ENDS
102
103 ;
104 ; code
105 ;
106 LAST SEGMENT
107
108 assume cs:LAST, ds:DGROUP, es:DGROUP
109
110 ;******************************************************************************
111 ; InitDeb - initialize kernel debugger
112 ;
113 ;
114 ; ENTRY: Real Mode
115 ; DS = DGROUP
116 ; AL = 00h => dont't break on debug init
117 ; AL = FFh => break on debug init
118 ;
119 ; EXIT: Real Mode
120 ; Kernel debugger initialized
121 ;
122 ; USED: none
123 ;
124 ;******************************************************************************
125 InitDeb proc near
126 ;
127 ifndef NoBugMode
128 pusha
129 push ds
130 push es
131 ;
132 push ds
133 pop es ; ES = data
134 ;
135 mov di, offset DGROUP:InitData
136
137 mov bx, dcode
138 mov [di].CSseg, bx
139 mov bx, ddata
140 mov [di].DSseg, bx
141 mov [di].CSsel, DEBC_GSEL
142 mov [di].DSsel, DEBD_GSEL
143 mov [di].SpareSel1, DEBW1_GSEL
144 mov [di].SpareSel2, DEBW2_GSEL
145 mov [di].GDTalias, GDTD_GSEL
146 mov [di].BrkFlag, al ; ? break on entry ?
147 mov [di].ComFlag, FALSE ; com2
148
149 sidt [di].RealIDTaddr
150
151 push ds
152 push di
153 mov ax, [GDT_Seg]
154 mov ds, ax
155
156 lgdt qword ptr ds:[GDTD_GSEL]
157
158 mov si, IDTD_GSEL
159 mov cx, 6
160 lea di, [di].ProtIDTaddr
161 cld
162 rep movsb
163 pop di
164 pop ds
165
166 call _Debug_Entry
167 ;
168 ; and return
169 ;
170 pop es
171 pop ds
172 popa
173 endif
174 ret
175 InitDeb endp
176
177
178 LAST ends
179
180 END