Subversion Repositories Kolibri OS

Rev

Rev 793 | Rev 823 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 793 Rev 819
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 793 $
8
$Revision: 819 $
9
 
9
 
10
 
10
 
Line 162... Line 162...
162
; retval
162
; retval
163
;  edi= memory block descriptor
163
;  edi= memory block descriptor
164
;  ebx= descriptor index
164
;  ebx= descriptor index
Line 165... Line 165...
165
 
165
 
166
align 4
166
align 4
167
get_block:
167
get_small_block:
168
           mov ecx, eax
168
           mov ecx, eax
169
           shr ecx, 12
169
           shr ecx, 12
170
           dec ecx
170
           dec ecx
171
           cmp ecx, 63
171
           cmp ecx, 63
Line 209... Line 209...
209
.err:
209
.err:
210
           xor edi, edi
210
           xor edi, edi
211
           ret
211
           ret
Line 212... Line 212...
212
 
212
 
213
align 4
213
align 4
Line 214... Line 214...
214
proc alloc_mem_block
214
alloc_mem_block:
215
 
215
 
216
           mov ebx, [mem_block_start]
216
           mov ebx, [mem_block_start]
217
           mov ecx, [mem_block_end]
217
           mov ecx, [mem_block_end]
Line 231... Line 231...
231
           lea eax,[eax+ebx*8]
231
           lea eax,[eax+ebx*8]
232
           shl eax, 5
232
           shl eax, 5
233
           add eax, [mem_block_arr]
233
           add eax, [mem_block_arr]
234
           dec [free_blocks]
234
           dec [free_blocks]
235
           ret
235
           ret
236
endp
236
align 4
237
 
-
 
238
proc free_mem_block
237
free_mem_block:
239
           mov dword [eax], 0
238
           mov dword [eax], 0
240
           mov dword [eax+4], 0
239
           mov dword [eax+4], 0
241
           mov dword [eax+8], 0
240
           mov dword [eax+8], 0
242
           mov dword [eax+12], 0
241
           mov dword [eax+12], 0
243
           mov dword [eax+16], 0
242
           mov dword [eax+16], 0
Line 261... Line 260...
261
           mov [mem_block_start], eax
260
           mov [mem_block_start], eax
262
	   ret
261
	   ret
263
.err:
262
.err:
264
           xor eax, eax
263
           xor eax, eax
265
	   ret
264
	   ret
266
endp
-
 
Line 267... Line 265...
267
 
265
 
268
align 4
266
align 4
269
proc alloc_kernel_space stdcall, size:dword
267
proc alloc_kernel_space stdcall, size:dword
Line 282... Line 280...
282
           call wait_mutex    ;ebx
280
           call wait_mutex    ;ebx
Line 283... Line 281...
283
 
281
 
284
           cmp eax, [heap_free]
282
           cmp eax, [heap_free]
Line 285... Line 283...
285
           ja .error
283
           ja .error
286
 
284
 
287
           call get_block ; eax
285
           call get_small_block ; eax
Line 288... Line 286...
288
           test edi, edi
286
           test edi, edi
289
           jz .error
287
           jz .error