From 2c9eb54a60064f29a59d1f6cdf2478080690beed Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Wed, 19 Sep 2018 23:19:03 +0000 Subject: [PATCH] Experimental: allocation function control git-svn-id: svn://kolibrios.org@7399 a494cfbc-eb01-0410-851d-a64ba20cac60 --- .../cmm/experimental/allocation/compile.bat | 8 + .../allocation/mallocFreeRealloc.c | 176 ++++++++++++++++++ .../allocation/mallocFreeRealloc.kex | Bin 0 -> 8764 bytes 3 files changed, 184 insertions(+) create mode 100644 programs/cmm/experimental/allocation/compile.bat create mode 100644 programs/cmm/experimental/allocation/mallocFreeRealloc.c create mode 100644 programs/cmm/experimental/allocation/mallocFreeRealloc.kex diff --git a/programs/cmm/experimental/allocation/compile.bat b/programs/cmm/experimental/allocation/compile.bat new file mode 100644 index 0000000000..65245ae83a --- /dev/null +++ b/programs/cmm/experimental/allocation/compile.bat @@ -0,0 +1,8 @@ +@del mallocFreeRealloc.kex +@c-- mallocFreeRealloc.c +rem @kpack Eolite.com +@rename mallocFreeRealloc.com mallocFreeRealloc.kex + +@del warning.txt +@del lang.h-- +@pause \ No newline at end of file diff --git a/programs/cmm/experimental/allocation/mallocFreeRealloc.c b/programs/cmm/experimental/allocation/mallocFreeRealloc.c new file mode 100644 index 0000000000..a59b207c28 --- /dev/null +++ b/programs/cmm/experimental/allocation/mallocFreeRealloc.c @@ -0,0 +1,176 @@ +#pragma option OST +#pragma option ON +#pragma option cri- +#pragma option -CPA +#initallvar 0 +#jumptomain FALSE + +#startaddress 0x0000 + +#code32 TRUE + +char os_name[8] = {'M','E','N','U','E','T','0','1'}; +dword os_version = 0x00000001; +dword start_addr = #main; +dword final_addr = #______STOP______+32; +dword alloc_mem = 20000; +dword x86esp_reg = 20000; +dword I_Param = #param; +dword I_Path = #program_path; +char param[4096] ={0}; +char program_path[4096] = {0}; + + +:dword mallocSystem(dword size) +{ + $push ebx + $push ecx + + $mov eax, 68 + $mov ebx, 12 + $mov ecx, size + $int 0x40 + + $pop ecx + $pop ebx + return EAX; +} + +:dword offsetAllocData = 0; +:dword malloc(dword size) +{ + dword array = 0; + dword orderSize = 1; + dword order = 0; + dword stackAlloc = 0; + dword stackKey = 0; + dword result = 0; + size+=4; + IF(!offsetAllocData) offsetAllocData = mallocSystem(4*32); + + WHILE(orderSizef^D*OM zqnP+%0!)AjFaajO1egF5U;<2l2`~XBzyz286JP>NfC(@GCcp%k025#WOn?b60Vco% z{yl*m{aO|74eg*1_8JXo>V>0oa4s?@$usAf6K{l1!$`U71E@=7V&`$aAeB8ko7vb- z!bUf$k+#ashyM0e)C89DWrm8T+*8)ml;B@eY^bNH8;uzmpZi93&-|3)l)7mpQ74Iz zZ>cQW2dqY6vmS_i-$E|EDij5tT3MP#fgA}>VeABCT)9Z(KOZL8%}}sR$??biVLWi@ z5(UI$tX72_4;yYt8xvF@sC_M>A>%s_AEF)DW$MV1Yq^#cS_AdcYTuAmHLqPlG@3Ff zMLm)oG>BIEd89?N?)}wXMNa{6XnOf>VR*6D-gUe6rN2PB{4E{oomwTlABh1_s-wh< pifH1|7Y^bV!FQaJ3F>J7OU2ga?HW$GD`GO0pjF=6KY+gM`2_fp;bQ;* literal 0 HcmV?d00001