From b4268eda9f6605441f2da1f9a6e38afb5a2082f8 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Wed, 21 Mar 2012 11:48:46 +0000 Subject: [PATCH] Fix for r. 1275 - to use the CLI command is not a good solution. Much better to use a mutex! git-svn-id: svn://kolibrios.org@2486 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/dll.inc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/kernel/trunk/core/dll.inc b/kernel/trunk/core/dll.inc index c5560f3967..93d7740f74 100644 --- a/kernel/trunk/core/dll.inc +++ b/kernel/trunk/core/dll.inc @@ -437,10 +437,25 @@ proc load_file stdcall, file_name:dword jz .cleanup mov [file2], eax - pushfd - cli + + push eax +.wait_lock: + cmp [unpack_mutex], 0 + je .get_lock + call change_task + jmp .wait_lock + +.get_lock: + mov eax, 1 + xchg eax, [unpack_mutex] + test eax, eax + jnz .wait_lock + pop eax + stdcall unpack, [file], eax - popfd + + mov [unpack_mutex], 0 + stdcall kernel_free, [file] mov eax, [file2] mov ebx, [file_size] @@ -470,6 +485,11 @@ proc load_file stdcall, file_name:dword ret endp +iglobal +align 4 +unpack_mutex dd 0 +endg + align 4 proc get_proc_ex stdcall, proc_name:dword, imports:dword