load_library: disable interrupts for smaller time

git-svn-id: svn://kolibrios.org@3827 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
CleverMouse 2013-07-19 15:31:01 +00:00
parent 835120b53f
commit 7e9ae9b030

View File

@ -1030,8 +1030,6 @@ proc load_library stdcall, file_name:dword
img_base dd ? img_base dd ?
endl endl
cli
; resolve file name ; resolve file name
mov ebx, [file_name] mov ebx, [file_name]
lea edi, [fullname+1] lea edi, [fullname+1]
@ -1042,6 +1040,8 @@ proc load_library stdcall, file_name:dword
; scan for required DLL in list of already loaded for this process, ; scan for required DLL in list of already loaded for this process,
; ignore timestamp ; ignore timestamp
cli
mov esi, [CURRENT_TASK] mov esi, [CURRENT_TASK]
shl esi, 8 shl esi, 8
lea edi, [fullname] lea edi, [fullname]
@ -1065,6 +1065,7 @@ proc load_library stdcall, file_name:dword
mov eax, [ecx+DLLDESCR.exports] mov eax, [ecx+DLLDESCR.exports]
sub eax, [ecx+DLLDESCR.defaultbase] sub eax, [ecx+DLLDESCR.defaultbase]
add eax, [esi+HDLL.base] add eax, [esi+HDLL.base]
sti
ret ret
.next_in_process: .next_in_process:
mov esi, [esi+HDLL.fd] mov esi, [esi+HDLL.fd]
@ -1072,10 +1073,12 @@ proc load_library stdcall, file_name:dword
.not_in_process: .not_in_process:
; scan in full list, compare timestamp ; scan in full list, compare timestamp
sti
lea eax, [fileinfo] lea eax, [fileinfo]
stdcall get_fileinfo, edi, eax stdcall get_fileinfo, edi, eax
test eax, eax test eax, eax
jnz .fail jnz .fail
cli
mov esi, [dll_list.fd] mov esi, [dll_list.fd]
.scan_for_dlls: .scan_for_dlls:
cmp esi, dll_list cmp esi, dll_list
@ -1097,6 +1100,7 @@ proc load_library stdcall, file_name:dword
; new DLL ; new DLL
.load_new: .load_new:
sti
; load file ; load file
stdcall load_file, edi stdcall load_file, edi
test eax, eax test eax, eax
@ -1124,13 +1128,6 @@ proc load_library stdcall, file_name:dword
mov dword [esi+DLLDESCR.timestamp], eax mov dword [esi+DLLDESCR.timestamp], eax
mov eax, dword [fileinfo+28] mov eax, dword [fileinfo+28]
mov dword [esi+DLLDESCR.timestamp+4], eax mov dword [esi+DLLDESCR.timestamp+4], eax
; initialize DLLDESCR struct
and dword [esi+DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
mov [esi+DLLDESCR.fd], dll_list
mov eax, [dll_list.bk]
mov [dll_list.bk], esi
mov [esi+DLLDESCR.bk], eax
mov [eax+DLLDESCR.fd], esi
; calculate size of loaded DLL ; calculate size of loaded DLL
mov edx, [coff] mov edx, [coff]
@ -1300,6 +1297,14 @@ proc load_library stdcall, file_name:dword
stdcall kernel_free, [coff] stdcall kernel_free, [coff]
cli
; initialize DLLDESCR struct
and dword [esi+DLLDESCR.refcount], 0; no HDLLs yet; later it will be incremented
mov [esi+DLLDESCR.fd], dll_list
mov eax, [dll_list.bk]
mov [dll_list.bk], esi
mov [esi+DLLDESCR.bk], eax
mov [eax+DLLDESCR.fd], esi
.dll_already_loaded: .dll_already_loaded:
inc [esi+DLLDESCR.refcount] inc [esi+DLLDESCR.refcount]
push esi push esi
@ -1372,6 +1377,7 @@ proc load_library stdcall, file_name:dword
mov eax, [esi+DLLDESCR.exports] mov eax, [esi+DLLDESCR.exports]
sub eax, [esi+DLLDESCR.defaultbase] sub eax, [esi+DLLDESCR.defaultbase]
add eax, [img_base] add eax, [img_base]
sti
ret ret
.fail_and_free_data: .fail_and_free_data:
stdcall kernel_free, [esi+DLLDESCR.data] stdcall kernel_free, [esi+DLLDESCR.data]
@ -1388,6 +1394,7 @@ proc load_library stdcall, file_name:dword
.fail_and_dereference: .fail_and_dereference:
mov eax, 1 ; delete 1 reference mov eax, 1 ; delete 1 reference
call dereference_dll call dereference_dll
sti
xor eax, eax xor eax, eax
ret ret
endp endp