1 ; MMURTL Operating System Source Code
\r
2 ; Copyright 1991,1992,1993, Richard A. Burgess
\r
3 ; ALL RIGHTS RESERVED
\r
9 ;=============================================================================
\r
11 ;=============================================================================
\r
15 ; This returns the exchange associated with a service name pointed to in EAX.
\r
16 ; It scans the array of servce names and finds a match. ESI pts to the
\r
17 ; SvcDesc if found and EAX has ercOk, else EAX has error code and ESI
\r
20 ; INPUT - EAX = Pointer to the Service Name (8 bytes long)
\r
21 ; OUTPUT - EAX = result code
\r
23 ; USED - EAX, EBX, ESI, EDX, EFlags
\r
25 ;=============================================================================
\r
28 MOV EDX,[EAX] ; First DWORD of the SvcName in EDX
\r
29 MOV EBX,[EAX+4] ; Second DWORD of the SvcName in EBX
\r
30 MOV ESI,OFFSET rgSVC ; Get the address of rgSVC
\r
31 MOV ECX,nSVC ; Get the number of Service Descriptors
\r
33 CMP EDX, [ESI] ; Compare first 4 bytes
\r
34 JNE SHORT GE0001 ; Not equal.. JUMP
\r
35 CMP EBX, [ESI+4] ; Compare first 4 bytes
\r
36 JNE SHORT GE0001 ; Not equal.. JUMP
\r
37 MOV ESI,[ESI+8] ; Get the Exchange in ESI
\r
38 MOV EAX,ercOk ; Set EAX to ercOk
\r
41 ADD ESI,sSVC ; Move Dest Ptr to Next rgSvc Element
\r
42 LOOP GE0000 ; Loop until ECX = 0
\r
43 MOV EAX,ErcNoSuchSvc ; set result code
\r
46 ;=============================================================================
\r
53 ; MODIFIES : NOTHING
\r
55 ; Searches the list of Service Descriptors and returns a ptr to an empty
\r
56 ; Service Descriptor in ESI with ercOk in EAX.
\r
57 ; If an empty Svc Desc in not found, an Error is returned in EAX
\r
58 ; and ESI is undefined. Used by RegisterSvc (below)
\r
60 MOV ESI, OFFSET rgSVC ; Get address of the Service Descriptor Array
\r
61 MOV ECX,nSVC ; Get number of Service Descriptors
\r
64 CMP DWORD PTR [ESI],0 ; Is the lower dword empty?
\r
65 JNE SHORT FENEXT ; NO
\r
66 CMP DWORD PTR [ESI+4],0 ; Is the upper dword empty?
\r
67 JNE SHORT FENEXT ; NO
\r
68 XOR EAX,EAX ; No Error
\r
74 MOV EAX,ErcOutOfSvcDesc ;
\r
79 ;==============================
\r
83 ; INPUT : EDX:EBX contains name of service to search for
\r
86 ; MODIFIES : NOTHING
\r
88 ; Searches the list of Service Descriptors and returns a ptr to the match
\r
89 ; in ESI with ercOk in EAX.
\r
90 ; If not found an Error is returned in EAX and ESI is undefined.
\r
91 ; Used by RegisterSvc (below)
\r
93 MOV ESI, OFFSET rgSVC ; Get address of the Service Desc Array
\r
94 MOV ECX,nSVC ; Get number of Service Descriptors
\r
97 CMP [ESI],EDX ; lower dword match?
\r
98 JNE SHORT FMNEXT ; NO
\r
99 CMP [ESI+4],EBX ; upper dword match?
\r
100 JNE SHORT FMNEXT ; NO
\r
101 XOR EAX,EAX ; No Error
\r
107 MOV EAX, ErcNoSuchSvc ;
\r
112 ;=============================================================================
\r
114 ; RegisterSvc - The kernel system service name registery. This procedure will
\r
115 ; identify a particular system service name with a particular exchange.
\r
116 ; The name is an 8 byte (null padded) CASE SENSITIVE string. The name is
\r
117 ; registered with the operating system along with a service exchange. Together
\r
118 ; the information allows the OS to direct requests for system services without
\r
119 ; the originator having to know where the actual exchange is located or on
\r
120 ; what machine the request is being serviced.
\r
122 ; A result code in returned in the EAX register.
\r
124 ; Procedural Interface :
\r
126 ; RegisterName(pName,exch):ercType
\r
128 ; pName is a POINTER to the new Service Name
\r
130 ; exch is a DWORD (4 BYTES) containing the exchange where the
\r
131 ; service will accept messages.
\r
133 pSVCName EQU [EBP+16]
\r
134 SVCExchange EQU [EBP+12]
\r
136 PUBLIC __RegisterSvc:
\r
139 MOV EAX,pSVCName ; in EAX
\r
140 MOV EDX,[EAX] ; Get the Name into EDX:EBX for Find call
\r
142 CALL FindMatchSVC ; Is it already there? (if so, overwrite)
\r
143 CMP EAX,ercOk ; ercOk if it is
\r
144 JNE SHORT RSNew ; No, go get an empty one
\r
145 JMP SHORT RSFill ; Yes, Overwrite it
\r
147 CALL FindEmptySVC ;
\r
151 MOV EAX,pSVCName ; pSVCName in EAX
\r
152 MOV EDX, [EAX] ; Low DWORD of name into EDX
\r
153 MOV [ESI], EDX ; Now into Svc Descriptor
\r
154 MOV EBX,[EAX+4] ; Low DWORD of name into EBX
\r
155 MOV [ESI+4], EBX ; Now into Svc Descriptor
\r
156 MOV ECX,SVCExchange ;
\r
157 MOV [ESI+SvcExch],ECX ;
\r
164 ;=============================================================================
\r
166 ; UnRegisterSvc - This removes the service name from the name
\r
167 ; name registry. The name must be an exact match for the one
\r
168 ; supplied to RegisterSvc.
\r
169 ; The name is an 8 byte (null padded) CASE SENSITIVE string.
\r
171 ; A result code in returned in the EAX register.
\r
173 ; Procedural Interface :
\r
175 ; UnRegisterName(pName):ercType
\r
177 ; pName is a POINTER to the existing Service Name
\r
179 ; exch is a DWORD (4 BYTES) containing the exchange where the
\r
180 ; service will accept messages.
\r
182 pOldSVCName EQU [EBP+12]
\r
184 PUBLIC __UnRegisterSvc:
\r
187 MOV EAX,pOldSVCName ; in EAX
\r
188 MOV EDX,[EAX] ; Get the Name into EDX:EBX for Find call
\r
190 CALL FindMatchSVC ; Is it already there? (if so, overwrite)
\r
191 OR EAX, EAX ; ErcOK?
\r
192 JZ SHORT URSKill ; Found it, go kill it
\r
193 JMP SHORT URSDone ; ErcNoSuchSvc already in EAX
\r
195 XOR EAX, EAX ; Low DWORD of name into EDX
\r
196 MOV [ESI], EAX ; Now into Svc Descriptor
\r
197 MOV [ESI+4], EAX ; (EAX already zero for ErcOK)
\r
203 ;=========== End of Module ===================
\r