destroy shared memory. update docs

git-svn-id: svn://kolibrios.org@945 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-12-06 20:24:43 +00:00
parent 31f5bf31ed
commit 34c30dea68
3 changed files with 94 additions and 26 deletions

View File

@ -1149,25 +1149,32 @@ destroy_smap:
pushfd
cli
push ebx
mov ebx, eax
push esi
push edi
mov eax, [eax+SMAP.base]
test eax, eax
jz @F
mov edi, eax
mov esi, [eax+SMAP.parent]
test esi, esi
jz .done
stdcall user_free, eax
@@:
mov eax, [ebx+SMAP.parent]
test eax, eax
jz @F
lock dec [esi+SMEM.refcount]
jnz .done
lock dec [eax+SMEM.refcount]
@@:
mov eax, ebx
mov ecx, [esi+SMEM.bk]
mov edx, [esi+SMEM.fd]
mov [ecx+SMEM.fd], edx
mov [edx+SMEM.bk], ecx
stdcall kernel_free, [esi+SMEM.base]
mov eax, esi
call free
.done:
mov eax, edi
call destroy_kernel_object
pop ebx
pop edi
pop esi
popfd
ret
@ -1395,6 +1402,8 @@ proc shmem_close stdcall, name:dword
push esi
push edi
pushfd
cli
mov esi, [current_slot]
add esi, APP_OBJ_OFFSET
@ -1419,8 +1428,11 @@ proc shmem_close stdcall, name:dword
test eax, eax
jne .next
stdcall user_free, [esi+SMAP.base]
call [esi+APPOBJ.destroy]
@@:
popfd
pop edi
pop esi
.fail:

View File

@ -1024,10 +1024,8 @@ f68call:
dd f68.22
dd f68.23
align 4
f68:
cmp eax,4
jle sys_sheduler
@ -1038,13 +1036,11 @@ f68:
ja .fail
jmp dword [f68call+eax*4-11*4]
.11:
call init_heap
mov [esp+36], eax
ret
.12:
stdcall user_alloc, ebx
mov [esp+36], eax
ret

View File

@ -3814,6 +3814,66 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ‘®¤¥à¦¨¬®¥ ¯ ¬ï⨠¢¯«®âì ¤® ­ ¨¬¥­ì襣® ¨§ áâ à®£® ¨ ­®¢®£®
à §¬¥à®¢ á®åà ­ï¥âáï.
===========================================================================
====== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 22 - ®âªàëâì ¨¬¥­®¢ ­ãî ®¡« áâì ¯ ¬ïâ¨. =====
===========================================================================
<EFBFBD> à ¬¥âàë
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 22 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ¨¬ï ®¡« áâ¨. Œ ªá¨¬ã¬ 32 ᨬ¢®«  ¢ª«îç ï § ¢¥àè î騩 ­®«ì
* edx = à §¬¥à ®¡« á⨠¢ ¡ ©â å ¤«ï SHM_CREATE ¨ SHM_OPEN_ALWAYS
* esi = ä« £¨ ®âªàëâ¨ï ¨ ¤®áâ㯠
SHM_OPEN = 0x00
SHM_OPEN_ALWAYS = 0x04
SHM_CREATE = 0x08
SHM_READ = 0x00
SHM_WRITE = 0x01
SHM_CREATE - ᮧ¤ âì ­®¢ãî ®¡« áâì ¯ ¬ïâ¨. …᫨ ®¡« áâì á
â ª¨¬ ¨¬¥­¥¬ 㦥 áãé¥áâ¢ã¥â äã­ªæ¨ï ¢¥à­ñâ ª®¤ ®è¨¡ª¨ E_ACCESS
SHM_OPEN_ALWAYS - ®âªà뢠¥â áãé¥áâ¢ãîéãî ¨«¨ ᮧ¤ ñâ ­®¢ãî
®¡« áâì ¯ ¬ïâ¨.
SHM_OPEN - ®âªà뢠¥â áãé¥áâ¢ãîéãî ®¡« áâì ¯ ¬ïâ¨. …᫨
®¡« áâì á â ª¨¬ ¨¬¥­¥¬ ­¥ áãé¥áâ¢ã¥â äã­ªæ¨ï ¢¥à­ñâ ª®¤
®è¨¡ª¨ E_NOTFOUND.
SHM_READ - ¤®áâ㯠⮫쪮 ­  ç⥭¨¥.
SHM_WRITE - ¤®áâ㯠­  ç⥭¨¥ ¨ § ¯¨áì.
‚®§¢à é ¥¬ë¥ §­ ç¥­¨ï:
* eax = 㪠§ â¥«ì ­  ®¡« áâì ¯ ¬ï⨠¨«¨ ­®«ì ¢ á«ãç ¥ ®è¨¡ª¨
* edx = ¥á«¨ ­®¢ ï ®¡« áâì ᮧ¤ ñâáï SHM_CREATE ¨«¨ SHM_OPEN_ALWAYS
­®«ì ¢ á«ãç ¥ ãá¯¥å  ¨«¨ ª®¤ ®è¨¡ª¨.
¥á«¨ áãé¥áâ¢ãîé ï ®¡« áâì ®âªà뢠¥âáï SHM_OPEN ¨«¨ SHM_OPEN_ALWAYS
à §¬¥à ®¡« á⨠¢ ¡ ©â å ¨«¨ ª®¤ ®è¨¡ª¨
Š®¤ë ®è¨¡®ª:
* E_NOTFOUND = 5
* E_ACCESS = 10
* E_NOMEM = 30
* E_PARAM = 33
‡ ¬¥ç ­¨ï:
* …᫨ ᮧ¤ ñâáï ­®¢ ï ®¡« áâì â® ä« £¨ ¤®áâ㯠 ãáâ ­ ¢«¨¢ îâ
¬ ªá¨¬ «ì­ë¥ ¯à ¢  ¤®áâ㯠 ¤«ï ®áâ «ì­ëå ¯à®æ¥áᮢ.
* <20>®¤¨â¥«ì᪨© ¯à®æ¥áá ¢á¥£¤  ¨¬¥¥â ¤®áâ㯠­  § ¯¨áì.
===========================================================================
====== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 22 - § ªàëâì ¨¬¥­®¢ ­ãî ®¡« áâì ¯ ¬ïâ¨. =====
===========================================================================
<EFBFBD> à ¬¥âàë
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 23 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ¨¬ï ®¡« áâ¨. Œ ªá¨¬ã¬ 32 ᨬ¢®«  ¢ª«îç ï § ¢¥àè î騩 ­®«ì
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* ­¥ ®¯à¥¤¥«¥­®
======================================================================
======================== ”ã­ªæ¨ï 69 - ®â« ¤ª . =======================
======================================================================