Subversion Repositories Kolibri OS

Rev

Rev 1289 | Rev 2455 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1289 Rev 2288
Line 9... Line 9...
9
;
9
;
10
;   External kernel dependencies (libraries) loading
10
;   External kernel dependencies (libraries) loading
11
;
11
;
12
;============================================================================
12
;============================================================================
Line 13... Line 13...
13
 
13
 
Line 14... Line 14...
14
$Revision: 1289 $
14
$Revision: 2288 $
15
 
15
 
16
if 0
16
if 0
17
; The code currently does not work. Kill "if 0/end if" only after correcting
17
; The code currently does not work. Kill "if 0/end if" only after correcting
Line 156... Line 156...
156
endp
156
endp
Line 157... Line 157...
157
 
157
 
158
 
158
 
-
 
159
proc dll.Load, import_table:dword
159
proc dll.Load, import_table:dword
160
        mov     esi, [import_table]
160
		mov	esi,[import_table]
161
  .next_lib:
161
  .next_lib:	mov	edx,[esi]
162
        mov     edx, [esi]
162
		or	edx,edx
163
        or      edx, edx
Line 163... Line 164...
163
		jz	.exit
164
        jz      .exit
Line 164... Line 165...
164
		push	esi
165
        push    esi
165
 
166
 
166
		mov	edi,s_libname
167
        mov     edi, s_libname
-
 
168
 
167
 
169
        mov     al, '/'
168
		mov     al, '/'
170
        stosb
169
		stosb
171
        mov     esi, sysdir_path
170
		mov esi,sysdir_path
172
            @@:
171
	    @@: lodsb
173
        lodsb
172
		stosb
174
        stosb
173
		or	al,al
175
        or      al, al
174
		jnz	@b
176
        jnz     @b
175
		dec edi
177
        dec     edi
176
		mov [edi], dword '/lib'
178
        mov     [edi], dword '/lib'
177
		mov [edi+4],byte '/'
179
        mov     [edi+4], byte '/'
-
 
180
        add     edi, 5
178
		add edi,5
181
        pop     esi
179
		pop esi
182
        push    esi
180
		push esi
183
        mov     esi, [esi+4]
181
		mov	esi,[esi+4]
184
            @@:
Line 182... Line 185...
182
	    @@: lodsb
185
        lodsb
Line 193... Line 196...
193
		stdcall dll.Link,eax,edx
196
        stdcall dll.Link, eax, edx
194
		stdcall dll.Init,[eax+4]
197
        stdcall dll.Init, [eax+4]
195
		pop	esi
198
        pop     esi
196
		add	esi,8
199
        add     esi, 8
197
		jmp	.next_lib
200
        jmp     .next_lib
-
 
201
  .exit:
198
  .exit:	xor	eax,eax
202
        xor     eax, eax
199
		ret
203
        ret
-
 
204
  .fail:
200
  .fail:	add	esp,4
205
        add     esp, 4
201
		xor	eax,eax
206
        xor     eax, eax
202
		inc	eax
207
        inc     eax
203
		ret
208
        ret
204
endp
209
endp
Line 205... Line 210...
205
 
210
 
206
proc dll.Link, exp:dword,imp:dword
211
proc dll.Link, exp:dword,imp:dword
207
		push	eax
212
        push    eax
208
		mov	esi,[imp]
213
        mov     esi, [imp]
209
		test	esi,esi
214
        test    esi, esi
-
 
215
        jz      .done
210
		jz	.done
216
  .next:
211
  .next:	lodsd
217
        lodsd
212
		test	eax,eax
218
        test    eax, eax
213
		jz	.done
219
        jz      .done
214
		stdcall dll.GetProcAddress,[exp],eax
220
        stdcall dll.GetProcAddress, [exp], eax
215
		or	eax,eax
221
        or      eax, eax
216
		jz	@f
222
        jz      @f
217
		mov	[esi-4],eax
223
        mov     [esi-4], eax
-
 
224
        jmp     .next
218
		jmp	.next
225
            @@:
219
	    @@: mov	dword[esp],0
226
        mov     dword[esp], 0
-
 
227
  .done:
220
  .done:	pop	eax
228
        pop     eax
221
		ret
229
        ret
Line 222... Line 230...
222
endp
230
endp
223
 
231
 
Line 232... Line 240...
232
		ret
240
        ret
233
endp
241
endp
Line 234... Line 242...
234
 
242
 
235
proc dll.GetProcAddress, exp:dword,sz_name:dword
243
proc dll.GetProcAddress, exp:dword,sz_name:dword
-
 
244
        mov     edx, [exp]
236
		mov	edx,[exp]
245
  .next:
237
  .next:	test	edx,edx
246
        test    edx, edx
238
		jz	.end
247
        jz      .end
239
                stdcall strncmp,[edx],[sz_name], dword -1
248
        stdcall strncmp, [edx], [sz_name], dword -1
240
		test	eax,eax
249
        test    eax, eax
241
		jz	.ok
250
        jz      .ok
242
		add	edx,8
251
        add     edx, 8
-
 
252
        jmp     .next
243
		jmp	.next
253
  .ok:
244
  .ok:		mov	eax,[edx+4]
254
        mov     eax, [edx+4]
-
 
255
  .end:
245
  .end: 	ret
256
        ret
Line 246... Line 257...
246
endp
257
endp
247
 
258
 
248
;-----------------------------------------------------------------------------
259
;-----------------------------------------------------------------------------
Line 274... Line 285...
274
	lea	ecx,[ebx+4+4095]
285
        lea     ecx, [ebx+4+4095]
275
	and	ecx,not 4095
286
        and     ecx, not 4095
276
	add	ecx,-4
287
        add     ecx, -4
277
	cmp	ecx,[eax-4]
288
        cmp     ecx, [eax-4]
278
	je	.exit
289
        je      .exit
-
 
290
    @@:
279
    @@: mov	eax,ebx
291
        mov     eax, ebx
280
	call	mem.Alloc
292
        call    mem.Alloc
281
	xchg	eax,[esp]
293
        xchg    eax, [esp]
282
	or	eax,eax
294
        or      eax, eax
283
	jz	.exit
295
        jz      .exit
284
	mov	esi,eax
296
        mov     esi, eax
Line 286... Line 298...
286
	mov	edi,eax
298
        mov     edi, eax
287
	mov	ecx,[esi-4]
299
        mov     ecx, [esi-4]
288
	cmp	ecx,[edi-4]
300
        cmp     ecx, [edi-4]
289
	jbe	@f
301
        jbe     @f
290
	mov	ecx,[edi-4]
302
        mov     ecx, [edi-4]
-
 
303
    @@:
291
    @@: add	ecx,3
304
        add     ecx, 3
292
	shr	ecx,2
305
        shr     ecx, 2
293
	cld
306
        cld
294
	rep	movsd
307
        rep movsd
295
	xchg	eax,[esp]
308
        xchg    eax, [esp]
296
	call	mem.Free
309
        call    mem.Free