bugfix of 68.22

git-svn-id: svn://kolibrios.org@1213 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2009-10-13 11:01:18 +00:00
parent c766a6ec5a
commit 00c7719786
2 changed files with 24 additions and 19 deletions

View File

@ -1218,10 +1218,10 @@ proc shmem_open stdcall name:dword, size:dword, access:dword
and eax, SHM_OPEN_MASK and eax, SHM_OPEN_MASK
mov [action], eax mov [action], eax
mov eax, [name] mov ebx, [name]
test eax, eax test ebx, ebx
mov edx, E_PARAM mov edx, E_PARAM
jz .exit jz .fail
mov esi, [shmem_list.fd] mov esi, [shmem_list.fd]
align 4 align 4
@ -1230,7 +1230,7 @@ align 4
je .not_found je .not_found
lea edx, [esi+SMEM.name] ; link , base, size lea edx, [esi+SMEM.name] ; link , base, size
stdcall strncmp, edx, eax, 32 stdcall strncmp, edx, ebx, 32
test eax, eax test eax, eax
je .found je .found
@ -1242,20 +1242,20 @@ align 4
cmp eax, SHM_OPEN cmp eax, SHM_OPEN
mov edx, E_NOTFOUND mov edx, E_NOTFOUND
je .exit je .fail
cmp eax, SHM_CREATE cmp eax, SHM_CREATE
mov edx, E_PARAM mov edx, E_PARAM
je .create_shm je .create_shm
cmp eax, SHM_OPEN_ALWAYS cmp eax, SHM_OPEN_ALWAYS
jne .exit jne .fail
.create_shm: .create_shm:
mov ecx, [size] mov ecx, [size]
test ecx, ecx test ecx, ecx
jz .exit jz .fail
add ecx, 4095 add ecx, 4095
and ecx, -4096 and ecx, -4096
@ -1266,7 +1266,7 @@ align 4
test eax, eax test eax, eax
mov esi, eax mov esi, eax
mov edx, E_NOMEM mov edx, E_NOMEM
jz .exit jz .fail
stdcall kernel_alloc, [size] stdcall kernel_alloc, [size]
test eax, eax test eax, eax
@ -1309,7 +1309,7 @@ align 4
je .create_map je .create_map
cmp eax, SHM_OPEN_ALWAYS cmp eax, SHM_OPEN_ALWAYS
jne .exit jne .fail
.create_map: .create_map:
@ -1318,7 +1318,7 @@ align 4
cmp eax, [esi+SMEM.access] cmp eax, [esi+SMEM.access]
mov [access], eax mov [access], eax
mov edx, E_ACCESS mov edx, E_ACCESS
ja .exit ja .fail
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
shl ebx, 5 shl ebx, 5
@ -1329,12 +1329,14 @@ align 4
test eax, eax test eax, eax
mov edi, eax mov edi, eax
mov edx, E_NOMEM mov edx, E_NOMEM
jz .exit jz .fail
inc [esi+SMEM.refcount]
mov [edi+SMAP.magic], 'SMAP' mov [edi+SMAP.magic], 'SMAP'
mov [edi+SMAP.destroy], destroy_smap mov [edi+SMAP.destroy], destroy_smap
mov [edi+SMAP.parent], esi
mov [edi+SMAP.base], 0 mov [edi+SMAP.base], 0
mov [edi+SMAP.parent], 0
stdcall user_alloc, [esi+SMEM.size] stdcall user_alloc, [esi+SMEM.size]
test eax, eax test eax, eax
@ -1342,9 +1344,7 @@ align 4
mov edx, E_NOMEM mov edx, E_NOMEM
jz .cleanup2 jz .cleanup2
lock inc [esi+SMEM.refcount]
mov [edi+SMAP.base], eax mov [edi+SMAP.base], eax
mov [edi+SMAP.parent], esi
mov ecx, [esi+SMEM.size] mov ecx, [esi+SMEM.size]
mov [size], ecx mov [size], ecx
@ -1371,10 +1371,10 @@ align 4
xor edx, edx xor edx, edx
cmp [owner_access], 0 cmp [owner_access], 0
jne .exit jne .fail
mov edx, [size]
.exit: .exit:
mov edx, [size]
.fail:
mov eax, [mapped] mov eax, [mapped]
popfd popfd
@ -1382,13 +1382,14 @@ align 4
pop esi pop esi
pop ebx pop ebx
ret ret
.cleanup: .cleanup:
mov [size], edx
mov eax, esi mov eax, esi
call free call free
jmp .exit jmp .exit
.cleanup2: .cleanup2:
mov [size], edx
mov eax, edi mov eax, edi
call destroy_smap call destroy_smap
jmp .exit jmp .exit

View File

@ -3666,7 +3666,11 @@ Parameters:
* +16 = +0x10: dword: pointer to output data * +16 = +0x10: dword: pointer to output data
* +20 = +0x14: dword: size of output data * +20 = +0x14: dword: size of output data
Returned value: Returned value:
* eax = determined by driver * eax = error code
0 - successful call
-1 - any error.
-2, -3, -4, etc. reserved for kernel error codes
1, 2, 3, etc driver specific error codes
Remarks: Remarks:
* Function codes and the structure of input/output data * Function codes and the structure of input/output data
are defined by driver. are defined by driver.