Rev 8170 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8170 | Rev 8184 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;/*** |
1 | ;/*** |
Line 2... | Line 2... | ||
2 | 2 | ||
Line 3... | Line 3... | ||
3 | KolibriHeapInit = @@Kolibri@_HeapInit$qpvt1t1 |
3 | KolibriHeapInit = @@Kolibri@_HeapInit$qv |
Line 4... | Line 4... | ||
4 | 4 | ||
Line 5... | Line 5... | ||
5 | KolibriHeapAlloc = @@Kolibri@Alloc$qui |
5 | KolibriHeapAlloc = @@Kolibri@Alloc$qui |
Line 6... | Line -... | ||
6 | - | ||
7 | KolibriHeapReAlloc = @@Kolibri@ReAlloc$qpvui |
- | |
8 | 6 | ||
9 | KolibriHeapFree = @@Kolibri@Free$qpv |
- | |
10 | 7 | KolibriHeapReAlloc = @@Kolibri@ReAlloc$qpvui |
|
11 | KolibriHeapFreeAndThreadFinish = @Kolibri@_FreeAndThreadFinish$qpvpi |
- | |
12 | 8 | ||
13 | proc @Kolibri@_SetUseMemory$qui |
9 | KolibriHeapFree = @@Kolibri@Free$qpv |
14 | push ebx |
- | |
15 | mov eax,64 |
- | |
16 | mov ebx,1 |
- | |
17 | mov ecx,[esp+8] |
- | |
18 | int 0x40 |
- | |
19 | pop ebx |
- | |
20 | test eax,eax |
- | |
21 | jnz .set_use_memory_nomem |
- | |
22 | push ecx |
- | |
23 | push dword [@Kolibri@_KolibriMemBlock] |
- | |
24 | call @@MemoryHeap@ResizeBlock$q20MemoryHeap@TMemBlockpv |
- | |
25 | add esp,8 |
10 | |
26 | mov al,1 |
11 | proc @MemoryHeap@mem_Init$qv uses ebx |
Line 27... | Line 12... | ||
27 | ret |
12 | mov eax,SF_SYS_MISC |
28 | .set_use_memory_nomem: |
13 | mov ebx,SSF_HEAP_INIT |
29 | xor al,al |
- | |
30 | ret |
- | |
31 | endp |
- | |
32 | - | ||
33 | proc @Kolibri@_RecalculateUseMemory$qui |
- | |
34 | mov eax,dword [esp+4] |
14 | int 0x40 |
35 | mov ecx,(U_END + 3) and not 3 |
- | |
36 | cmp eax,ecx |
- | |
37 | jna .recalculate_use_memory_min |
- | |
38 | push ebx |
- | |
39 | sub eax,ecx |
- | |
40 | mov ebx,6 |
15 | ret |
41 | mul ebx |
- | |
42 | dec ebx |
- | |
43 | div ebx |
- | |
44 | add eax,((U_END + 3) and not 3) + 3 |
16 | endp |
45 | and eax,not 3 |
17 | |
Line 46... | Line 18... | ||
46 | pop ebx |
18 | proc @MemoryHeap@mem_Alloc$qul uses ebx |
47 | ret |
19 | mov eax,SF_SYS_MISC |
- | 20 | mov ebx,SSF_MEM_ALLOC |
|
48 | .recalculate_use_memory_min: |
21 | int 0x40 |
49 | mov eax,ecx |
- | |
50 | ret |
- | |
51 | endp |
22 | ret |
52 | - | ||
53 | proc @Kolibri@_FreeAndThreadFinish$qpvpi |
- | |
54 | mov ebx,1 |
- | |
55 | mov ecx,[esp+8] |
- | |
56 | jmp .heap_free_tf_wait |
- | |
57 | .heap_free_tf_wait_loop: |
- | |
58 | mov eax,5 |
- | |
59 | int 0x40 |
- | |
60 | shl ebx,1 |
- | |
61 | cmp ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
- | |
62 | jna .heap_free_tf_wait |
- | |
63 | mov ebx,KOLIBRI_MUTEX_MAX_TIME_WAIT |
- | |
64 | .heap_free_tf_wait: |
- | |
65 | cmp dword [ecx],0 |
- | |
66 | jnz @Kolibri@ExitProcess$qv |
- | |
67 | lock bts dword [@Kolibri@_MemHeapMutex],0 |
- | |
68 | jc .heap_free_tf_wait_loop |
23 | endp |
- | 24 | ||
69 | push dword [esp+4] |
25 | proc @MemoryHeap@mem_ReAlloc$qulpv uses ebx |
Line 70... | Line -... | ||
70 | push @Kolibri@_KolibriFreeSpace |
- | |
71 | call @@MemoryHeap@Free$qr21MemoryHeap@TFreeSpacepv |
- | |
72 | add esp,8 |
26 | mov eax,SF_SYS_MISC |
73 | mov byte [@Kolibri@_MemHeapMutex],0x40 |
27 | mov ebx,SSF_MEM_REALLOC |
74 | or eax,-1 |
- | |
75 | int 0x40 |
28 | mov ecx,[esp+8] |
76 | endp |
- | |
77 | 29 | mov edx,[esp+12] |
|
78 | macro call func |
- | |
79 | { |
- | |
80 | if func eq @MemoryHeap@_FirstNotZeroBit$qui |
30 | int 0x40 |
81 | bsf eax,[esp] |
- | |
82 | else if func eq @MemoryHeap@_CopyMemItemArray$quiuiui |
- | |
83 | xchg edi,[esp] |
- | |
84 | xchg esi,[esp+4] |
31 | ret |
85 | mov ecx,[esp+8] |
- | |
86 | cld |
32 | endp |
87 | sub ecx,esi |
- | |
Line 88... | Line 33... | ||
88 | shr ecx,2 |
33 |