From f53429e2f80781c2e384c57695f4dff822df1468 Mon Sep 17 00:00:00 2001 From: "Mihail Semenyako (mike.dld)" Date: Sat, 15 Sep 2007 22:17:10 +0000 Subject: [PATCH] Better fix to the problem, thanks diamond for pointing it out There're some other issues revealed though, I'm looking into them git-svn-id: svn://kolibrios.org@627 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/develop/tinypad/trunk/tp-common.asm | 70 +++----------------- 1 file changed, 11 insertions(+), 59 deletions(-) diff --git a/programs/develop/tinypad/trunk/tp-common.asm b/programs/develop/tinypad/trunk/tp-common.asm index 7d5369b53d..308a2f5393 100644 --- a/programs/develop/tinypad/trunk/tp-common.asm +++ b/programs/develop/tinypad/trunk/tp-common.asm @@ -587,75 +587,33 @@ proc mem.Alloc,size ;///////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- push ebx ecx mov ecx,[size] - add ecx,4+4095 - and ecx,not 4095 + add ecx,4 mcall 68,12 add ecx,-4 mov [eax],ecx add eax,4 pop ecx ebx ret -@^ - push ebx ecx - mov eax,[size] - lea ecx,[eax+4+4095] - and ecx,not 4095 - mcall 68,12 - add ecx,-4 - mov [eax],ecx - add eax,4 - pop ecx ebx - ret -^@ endp ;----------------------------------------------------------------------------- proc mem.ReAlloc,mptr,size ;////////////////////////////////////////////////// ;----------------------------------------------------------------------------- -@^ push ebx ecx edx mov ecx,[size] - add ecx,4+4095 - and ecx,not 4095 - mov edx,[mptr] + or ecx,ecx + jz @f + add ecx,4 + @@: mov edx,[mptr] + or edx,edx + jz @f add edx,-4 - mcall 68,20 + @@: mcall 68,20 add ecx,-4 mov [eax],ecx add eax,4 pop edx ecx ebx ret -^@ - push ebx ecx esi edi eax - mov eax,[mptr] - mov ebx,[size] - or eax,eax - jz @f - lea ecx,[ebx+4+4095] - and ecx,not 4095 - add ecx,-4 - cmp ecx,[eax-4] - je .exit - @@: stdcall mem.Alloc,ebx - xchg eax,[esp] - or eax,eax - jz .exit - mov esi,eax - xchg eax,[esp] - mov edi,eax - mov ecx,[esi-4] - cmp ecx,[edi-4] - jbe @f - mov ecx,[edi-4] - @@: add ecx,3 - shr ecx,2 - cld - rep movsd - xchg eax,[esp] - stdcall mem.Free,eax - .exit: - pop eax edi esi ecx ebx - ret endp ;----------------------------------------------------------------------------- @@ -663,16 +621,10 @@ proc mem.Free,mptr ;////////////////////////////////////////////////////////// ;----------------------------------------------------------------------------- push ebx ecx mov ecx,[mptr] + or ecx,ecx + jz @f add ecx,-4 - mcall 68,13 + @@: mcall 68,13 pop ecx ebx ret -@^ - push ebx ecx - mov eax,[mptr] - lea ecx,[eax-4] - mcall 68,13 - pop ecx ebx - ret -^@ endp