Rev 1210 | Rev 1333 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1210 | Rev 1211 | ||
---|---|---|---|
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: 1210 $ |
8 | $Revision: 1211 $ |
9 | 9 | ||
10 | 10 | ||
Line 18... | Line 18... | ||
18 | 18 | ||
19 | ; temp |
19 | ; temp |
20 | ; esi= nb |
20 | ; esi= nb |
21 | ; ebx= idx |
21 | ; ebx= idx |
22 | ; |
22 | ; |
23 | align 4 |
23 | align 16 |
24 | malloc: |
24 | malloc: |
Line 25... | Line 25... | ||
25 | push esi |
25 | push esi |
Line 67... | Line 67... | ||
67 | ; if (B == F) |
67 | ; if (B == F) |
68 | cmp edi, eax |
68 | cmp edi, eax |
69 | jne @F |
69 | jne @F |
Line 70... | Line 70... | ||
70 | 70 | ||
71 | btr [mst.smallmap], ebx |
- | |
72 | align 4 |
71 | btr [mst.smallmap], ebx |
Line 73... | Line 72... | ||
73 | @@: |
72 | @@: |
74 | 73 | ||
75 | ; B->fd = F; |
74 | ; B->fd = F; |
Line 90... | Line 89... | ||
90 | or ebp, 3 |
89 | or ebp, 3 |
91 | mov [edx+4], ebp |
90 | mov [edx+4], ebp |
Line 92... | Line 91... | ||
92 | 91 | ||
93 | pop edi |
92 | pop edi |
94 | pop ebp |
- | |
95 | align 4 |
93 | pop ebp |
96 | .done: |
94 | .done: |
97 | pop esi |
95 | pop esi |
98 | mov [mst.mutex], 0 |
96 | mov [mst.mutex], 0 |
99 | ret |
- | |
100 | align 4 |
97 | ret |
101 | .split: |
98 | .split: |
Line 102... | Line 99... | ||
102 | lea ebx, [edx+8] ;ebx=mem |
99 | lea ebx, [edx+8] ;ebx=mem |
103 | 100 | ||
Line 137... | Line 134... | ||
137 | mov [eax+8], edx ; r->fd = F; |
134 | mov [eax+8], edx ; r->fd = F; |
138 | mov [eax+12], ecx ; r->bk = B; |
135 | mov [eax+12], ecx ; r->bk = B; |
139 | mov eax, ebx |
136 | mov eax, ebx |
140 | pop esi |
137 | pop esi |
141 | ret |
138 | ret |
142 | align 4 |
- | |
143 | .small: |
139 | .small: |
Line 144... | Line 140... | ||
144 | 140 | ||
145 | ; if (ms.treemap != 0 && (mem = malloc_small(nb)) != 0) |
141 | ; if (ms.treemap != 0 && (mem = malloc_small(nb)) != 0) |
146 | ;;;;;;;;;;; start a change |
142 | ;;;;;;;;;;; start a change |
Line 154... | Line 150... | ||
154 | test eax, eax |
150 | test eax, eax |
155 | jz .from_top |
151 | jz .from_top |
156 | pop esi |
152 | pop esi |
157 | and [mst.mutex], 0 |
153 | and [mst.mutex], 0 |
158 | ret |
154 | ret |
159 | align 4 |
- | |
160 | .large: |
155 | .large: |
Line 161... | Line 156... | ||
161 | 156 | ||
Line 162... | Line 157... | ||
162 | ; if (ms.treemap != 0 && (mem = malloc_large(nb)) != 0) |
157 | ; if (ms.treemap != 0 && (mem = malloc_large(nb)) != 0) |
163 | 158 | ||
Line 164... | Line 159... | ||
164 | cmp [mst.treemap], 0 |
159 | cmp [mst.treemap], 0 |
165 | je .from_top |
160 | je .from_top |
166 | 161 | ||
167 | call malloc_large ;esi= nb |
- | |
168 | test eax, eax |
162 | call malloc_large ;esi= nb |
Line 169... | Line 163... | ||
169 | jne .done |
163 | test eax, eax |
Line 170... | Line 164... | ||
170 | align 4 |
164 | jne .done |
Line 195... | Line 189... | ||
195 | mov [ecx+4], esi |
189 | mov [ecx+4], esi |
196 | lea eax, [ecx+8] |
190 | lea eax, [ecx+8] |
197 | pop esi |
191 | pop esi |
198 | and [mst.mutex], 0 |
192 | and [mst.mutex], 0 |
199 | ret |
193 | ret |
200 | align 4 |
- | |
201 | .fail: |
194 | .fail: |
202 | xor eax, eax |
195 | xor eax, eax |
203 | pop esi |
196 | pop esi |
204 | and [mst.mutex], 0 |
197 | and [mst.mutex], 0 |
205 | ret |
198 | ret |
Line 206... | Line 199... | ||
206 | 199 | ||
207 | ; param |
200 | ; param |
Line 208... | Line -... | ||
208 | ; eax= mem |
- | |
209 | 201 | ; eax= mem |
|
210 | align 4 |
202 | |
211 | free: |
203 | free: |
212 | push edi |
204 | push edi |
Line 256... | Line 248... | ||
256 | ; ms.smallmap &= ~(1<< I); |
248 | ; ms.smallmap &= ~(1<< I); |
257 | shr ecx, 3 |
249 | shr ecx, 3 |
258 | cmp eax, edx |
250 | cmp eax, edx |
259 | jne @F |
251 | jne @F |
260 | and [mst.smallmap], ecx |
252 | and [mst.smallmap], ecx |
261 | align 4 |
- | |
262 | @@: |
253 | @@: |
263 | mov [eax+12], edx ;F->bk = B; |
254 | mov [eax+12], edx ;F->bk = B; |
264 | mov [edx+8], eax ;B->fd = F |
255 | mov [edx+8], eax ;B->fd = F |
265 | jmp .next |
256 | jmp .next |
266 | align 4 |
- | |
267 | .unlink_large: |
257 | .unlink_large: |
268 | mov edx, edi |
258 | mov edx, edi |
269 | call unlink_large_chunk |
259 | call unlink_large_chunk |
270 | align 4 |
- | |
271 | .next: |
260 | .next: |
Line 272... | Line 261... | ||
272 | 261 | ||
Line 273... | Line 262... | ||
273 | ; if(next->head & PINUSE_BIT) |
262 | ; if(next->head & PINUSE_BIT) |
Line 296... | Line 285... | ||
296 | ; p->head = tsize | PINUSE_BIT; |
285 | ; p->head = tsize | PINUSE_BIT; |
Line 297... | Line 286... | ||
297 | 286 | ||
298 | or eax, 1 |
287 | or eax, 1 |
299 | mov [mst.top], edi |
288 | mov [mst.top], edi |
300 | mov [edi+4], eax |
- | |
301 | align 4 |
289 | mov [edi+4], eax |
302 | .fail2: |
290 | .fail2: |
303 | and [mst.mutex], 0 |
291 | and [mst.mutex], 0 |
304 | pop esi |
- | |
305 | align 4 |
292 | pop esi |
306 | .fail: |
293 | .fail: |
307 | pop edi |
294 | pop edi |
308 | ret |
- | |
309 | align 4 |
295 | ret |
Line 310... | Line 296... | ||
310 | @@: |
296 | @@: |
Line 311... | Line 297... | ||
311 | 297 | ||
Line 327... | Line 313... | ||
327 | cmp edx, ebx |
313 | cmp edx, ebx |
328 | jne @F |
314 | jne @F |
329 | mov ecx, eax |
315 | mov ecx, eax |
330 | shr ecx, 3 |
316 | shr ecx, 3 |
331 | btr [mst.smallmap], ecx |
317 | btr [mst.smallmap], ecx |
332 | align 4 |
- | |
333 | @@: |
318 | @@: |
334 | mov [edx+12], ebx ;F->bk = B |
319 | mov [edx+12], ebx ;F->bk = B |
Line 335... | Line 320... | ||
335 | 320 | ||
Line 349... | Line 334... | ||
349 | mov eax, esi |
334 | mov eax, esi |
350 | pop esi |
335 | pop esi |
351 | mov ecx, edi |
336 | mov ecx, edi |
352 | pop edi |
337 | pop edi |
353 | jmp insert_chunk |
338 | jmp insert_chunk |
354 | align 4 |
- | |
355 | .unl_large: |
339 | .unl_large: |
Line 356... | Line 340... | ||
356 | 340 | ||
Line 357... | Line 341... | ||
357 | ; unlink_large_chunk((tchunkptr)next); |
341 | ; unlink_large_chunk((tchunkptr)next); |
Line 373... | Line 357... | ||
373 | mov eax, esi |
357 | mov eax, esi |
374 | pop esi |
358 | pop esi |
375 | mov ecx, edi |
359 | mov ecx, edi |
376 | pop edi |
360 | pop edi |
377 | jmp insert_chunk |
361 | jmp insert_chunk |
378 | align 4 |
- | |
379 | .fix_next: |
362 | .fix_next: |
Line 380... | Line 363... | ||
380 | 363 | ||
381 | ; (p+psize)->prev_foot = psize; |
364 | ; (p+psize)->prev_foot = psize; |
382 | ; next->head &= ~PINUSE_BIT; |
365 | ; next->head &= ~PINUSE_BIT; |
Line 401... | Line 384... | ||
401 | 384 | ||
402 | ; param |
385 | ; param |
403 | ; ecx = chunk |
386 | ; ecx = chunk |
Line 404... | Line -... | ||
404 | ; eax = size |
- | |
405 | 387 | ; eax = size |
|
Line 406... | Line 388... | ||
406 | align 4 |
388 | |
407 | insert_chunk: |
389 | insert_chunk: |
408 | 390 | ||
Line 427... | Line 409... | ||
427 | mov [esi+8], edx ;P->fd = F |
409 | mov [esi+8], edx ;P->fd = F |
428 | mov [esi+12], eax ;P->bk = B |
410 | mov [esi+12], eax ;P->bk = B |
429 | pop esi |
411 | pop esi |
430 | and [mst.mutex], 0 |
412 | and [mst.mutex], 0 |
431 | ret |
413 | ret |
432 | align 4 |
- | |
433 | .large: |
414 | .large: |
434 | mov ebx, eax |
415 | mov ebx, eax |
435 | call insert_large_chunk |
416 | call insert_large_chunk |
436 | pop esi |
417 | pop esi |
437 | and [mst.mutex], 0 |
418 | and [mst.mutex], 0 |
438 | ret |
419 | ret |
Line 439... | Line -... | ||
439 | - | ||
Line 440... | Line 420... | ||
440 | align 4 |
420 | |
441 | 421 | ||
442 | ; param |
422 | ; param |
Line 443... | Line -... | ||
443 | ; esi= chunk |
- | |
444 | ; ebx= size |
423 | ; esi= chunk |
Line 445... | Line 424... | ||
445 | 424 | ; ebx= size |
|
Line 446... | Line 425... | ||
446 | align 4 |
425 | |
Line 476... | Line 455... | ||
476 | ; ms.treemap |= 1< |
455 | ; ms.treemap |= 1< |
477 | bts [mst.treemap], ecx |
456 | bts [mst.treemap], ecx |
478 | ; *H = X; |
457 | ; *H = X; |
479 | mov dword [edx], esi |
458 | mov dword [edx], esi |
480 | jmp .done |
459 | jmp .done |
481 | align 4 |
- | |
482 | .tree: |
460 | .tree: |
Line 483... | Line 461... | ||
483 | 461 | ||
484 | ; T = *H; |
462 | ; T = *H; |
Line 495... | Line 473... | ||
495 | and ecx, edi |
473 | and ecx, edi |
496 | mov eax, ebx |
474 | mov eax, ebx |
497 | shl eax, cl ;eax= K |
475 | shl eax, cl ;eax= K |
Line 498... | Line 476... | ||
498 | 476 | ||
499 | jmp .loop |
- | |
500 | align 4 |
477 | jmp .loop |
Line 501... | Line 478... | ||
501 | .not_eq_size: |
478 | .not_eq_size: |
502 | 479 | ||
503 | ; C = &(T->child[(K >> 31) & 1]); |
480 | ; C = &(T->child[(K >> 31) & 1]); |
Line 512... | Line 489... | ||
512 | test edi, edi |
489 | test edi, edi |
513 | jz .insert_child |
490 | jz .insert_child |
Line 514... | Line 491... | ||
514 | 491 | ||
515 | ; T = *C; |
492 | ; T = *C; |
516 | mov edx, edi |
- | |
517 | align 4 |
493 | mov edx, edi |
Line 518... | Line 494... | ||
518 | .loop: |
494 | .loop: |
519 | 495 | ||
Line 538... | Line 514... | ||
538 | 514 | ||
539 | and dword [esi+24], 0 |
515 | and dword [esi+24], 0 |
540 | mov [esi+8], eax |
516 | mov [esi+8], eax |
541 | mov [esi+12], edx |
517 | mov [esi+12], edx |
542 | ret |
- | |
543 | align 4 |
518 | ret |
Line 544... | Line 519... | ||
544 | .insert_child: |
519 | .insert_child: |
545 | 520 | ||
546 | ; *C = X; |
- | |
547 | mov [ecx], esi |
521 | ; *C = X; |
Line 548... | Line 522... | ||
548 | align 4 |
522 | mov [ecx], esi |
549 | .done: |
523 | .done: |
Line 558... | Line 532... | ||
558 | 532 | ||
559 | 533 | ||
Line 560... | Line -... | ||
560 | ; param |
- | |
561 | ; edx= chunk |
534 | ; param |
Line 562... | Line 535... | ||
562 | 535 | ; edx= chunk |
|
563 | align 4 |
536 | |
564 | unlink_large_chunk: |
537 | unlink_large_chunk: |
Line 571... | Line 544... | ||
571 | 544 | ||
572 | mov ecx, [edx+8] ;F = X->fd |
545 | mov ecx, [edx+8] ;F = X->fd |
573 | mov [ecx+12], eax ;F->bk = R; |
546 | mov [ecx+12], eax ;F->bk = R; |
574 | mov [eax+8], ecx ;R->fd = F |
547 | mov [eax+8], ecx ;R->fd = F |
575 | jmp .parent |
- | |
576 | align 4 |
548 | jmp .parent |
577 | @@: |
549 | @@: |
578 | mov eax, [edx+20] |
550 | mov eax, [edx+20] |
579 | test eax, eax |
551 | test eax, eax |
580 | push esi |
552 | push esi |
Line 583... | Line 555... | ||
583 | 555 | ||
584 | mov eax, [edx+16] |
556 | mov eax, [edx+16] |
585 | test eax, eax |
557 | test eax, eax |
586 | lea esi, [edx+16] |
558 | lea esi, [edx+16] |
587 | je .l2 |
- | |
588 | align 4 |
559 | je .l2 |
589 | .loop: |
560 | .loop: |
590 | cmp dword [eax+20], 0 |
561 | cmp dword [eax+20], 0 |
591 | lea ecx, [eax+20] |
562 | lea ecx, [eax+20] |
Line 592... | Line 563... | ||
592 | jne @F |
563 | jne @F |
593 | 564 | ||
594 | cmp dword [eax+16], 0 |
565 | cmp dword [eax+16], 0 |
595 | lea ecx, [eax+16] |
- | |
596 | je .l1 |
566 | lea ecx, [eax+16] |
597 | align 4 |
567 | je .l1 |
598 | @@: |
568 | @@: |
599 | mov eax, [ecx] |
569 | mov eax, [ecx] |
600 | mov esi, ecx |
- | |
601 | jmp .loop |
570 | mov esi, ecx |
602 | align 4 |
571 | jmp .loop |
603 | .l1: |
- | |
604 | mov dword [esi], 0 |
572 | .l1: |
605 | align 4 |
573 | mov dword [esi], 0 |
606 | .l2: |
- | |
607 | pop esi |
574 | .l2: |
608 | align 4 |
575 | pop esi |
609 | .parent: |
576 | .parent: |
Line 610... | Line 577... | ||
610 | test edi, edi |
577 | test edi, edi |
Line 621... | Line 588... | ||
621 | 588 | ||
622 | mov ecx, [edx+28] |
589 | mov ecx, [edx+28] |
623 | btr [mst.treemap], ecx |
590 | btr [mst.treemap], ecx |
624 | pop edi |
591 | pop edi |
625 | ret |
592 | ret |
626 | align 4 |
593 | |
627 | .l3: |
594 | .l3: |
628 | cmp [edi+16], edx |
595 | cmp [edi+16], edx |
Line 629... | Line 596... | ||
629 | jne @F |
596 | jne @F |
630 | 597 | ||
631 | mov [edi+16], eax |
598 | mov [edi+16], eax |
632 | jmp .l4 |
599 | jmp .l4 |
633 | align 4 |
600 | |
634 | @@: |
601 | @@: |
635 | mov [edi+20], eax |
602 | mov [edi+20], eax |
636 | align 4 |
603 | |
637 | .l4: |
604 | .l4: |
638 | test eax, eax |
605 | test eax, eax |
639 | je .done |
606 | je .done |
640 | align 4 |
607 | |
641 | .l5: |
608 | .l5: |
642 | mov [eax+24], edi |
609 | mov [eax+24], edi |
643 | mov ecx, [edx+16] |
610 | mov ecx, [edx+16] |
Line 644... | Line 611... | ||
644 | test ecx, ecx |
611 | test ecx, ecx |
645 | je .l6 |
612 | je .l6 |
646 | 613 | ||
647 | mov [eax+16], ecx |
614 | mov [eax+16], ecx |
648 | mov [ecx+24], eax |
615 | mov [ecx+24], eax |
649 | align 4 |
616 | |
650 | .l6: |
617 | .l6: |
Line 651... | Line 618... | ||
651 | mov edx, [edx+20] |
618 | mov edx, [edx+20] |
652 | test edx, edx |
619 | test edx, edx |
653 | je .done |
620 | je .done |
654 | 621 | ||
655 | mov [eax+20], edx |
622 | mov [eax+20], edx |
656 | mov [edx+24], eax |
623 | mov [edx+24], eax |
Line 657... | Line 624... | ||
657 | align 4 |
624 | |
658 | .done: |
625 | .done: |
Line 659... | Line -... | ||
659 | pop edi |
- | |
660 | ret |
626 | pop edi |
661 | 627 | ret |
|
662 | ; param |
628 | |
Line 663... | Line 629... | ||
663 | ; esi= nb |
629 | ; param |
Line 675... | Line 641... | ||
675 | ; rsize = (t->head & ~INUSE_BITS) - nb; |
641 | ; rsize = (t->head & ~INUSE_BITS) - nb; |
Line 676... | Line 642... | ||
676 | 642 | ||
677 | mov edi, [ecx+4] |
643 | mov edi, [ecx+4] |
678 | and edi, -4 |
644 | and edi, -4 |
679 | sub edi, esi |
645 | sub edi, esi |
680 | align 4 |
646 | |
681 | .loop: |
647 | .loop: |
682 | mov ebx, ecx |
648 | mov ebx, ecx |
683 | align 4 |
649 | |
Line 684... | Line 650... | ||
684 | .loop_1: |
650 | .loop_1: |
Line 685... | Line 651... | ||
685 | 651 | ||
686 | ; while ((t = leftmost_child(t)) != 0) |
652 | ; while ((t = leftmost_child(t)) != 0) |
687 | 653 | ||
688 | mov eax, [ecx+16] |
654 | mov eax, [ecx+16] |
689 | test eax, eax |
655 | test eax, eax |
690 | jz @F |
656 | jz @F |
691 | mov ecx, eax |
657 | mov ecx, eax |
692 | jmp .l1 |
658 | jmp .l1 |
693 | align 4 |
659 | |
694 | @@: |
660 | @@: |
695 | mov ecx, [ecx+20] |
661 | mov ecx, [ecx+20] |
696 | align 4 |
662 | |
Line 697... | Line 663... | ||
697 | .l1: |
663 | .l1: |
Line 742... | Line 708... | ||
742 | or dword [eax], 1 |
708 | or dword [eax], 1 |
743 | pop ebp |
709 | pop ebp |
Line 744... | Line 710... | ||
744 | 710 | ||
745 | lea eax, [ebx+8] |
711 | lea eax, [ebx+8] |
746 | ret |
712 | ret |
747 | align 4 |
713 | |
Line 748... | Line 714... | ||
748 | .split: |
714 | .split: |
749 | 715 | ||
750 | ; v->head = nb|PINUSE_BIT|CINUSE_BIT; |
716 | ; v->head = nb|PINUSE_BIT|CINUSE_BIT; |
Line 775... | Line 741... | ||
775 | mov [esi+12], eax |
741 | mov [esi+12], eax |
776 | mov [esi+8], edx |
742 | mov [esi+8], edx |
777 | pop ebp |
743 | pop ebp |
778 | lea eax, [ebx+8] |
744 | lea eax, [ebx+8] |
779 | ret |
745 | ret |
780 | align 4 |
746 | |
781 | .large: |
747 | .large: |
782 | lea eax, [ebx+8] |
748 | lea eax, [ebx+8] |
783 | push eax |
749 | push eax |
784 | mov ebx, edi |
750 | mov ebx, edi |
785 | call insert_large_chunk |
751 | call insert_large_chunk |
Line 790... | Line 756... | ||
790 | 756 | ||
791 | 757 | ||
Line 792... | Line -... | ||
792 | ; param |
- | |
793 | ; esi= nb |
758 | ; param |
794 | 759 | ; esi= nb |
|
795 | align 4 |
760 | |
Line 796... | Line 761... | ||
796 | malloc_large: |
761 | malloc_large: |
Line 829... | Line 794... | ||
829 | 794 | ||
830 | cmp ecx, 31 |
795 | cmp ecx, 31 |
831 | jne @F |
796 | jne @F |
832 | xor ecx, ecx |
797 | xor ecx, ecx |
833 | jmp .l1 |
798 | jmp .l1 |
834 | align 4 |
799 | |
835 | @@: |
800 | @@: |
836 | mov edx, ecx |
801 | mov edx, ecx |
837 | shr edx, 1 |
802 | shr edx, 1 |
838 | mov ecx, 37 |
803 | mov ecx, 37 |
839 | sub ecx, edx |
804 | sub ecx, edx |
840 | align 4 |
805 | |
841 | .l1: |
806 | .l1: |
842 | mov edx, ebx |
807 | mov edx, ebx |
Line 843... | Line 808... | ||
843 | shl edx, cl |
808 | shl edx, cl |
844 | 809 | ||
845 | ; rst = 0; |
810 | ; rst = 0; |
846 | mov [.rst], ebp |
811 | mov [.rst], ebp |
Line 847... | Line 812... | ||
847 | align 4 |
812 | |
Line 848... | Line 813... | ||
848 | .loop: |
813 | .loop: |
Line 862... | Line 827... | ||
862 | 827 | ||
863 | test ecx, ecx |
828 | test ecx, ecx |
864 | mov ebp, eax |
829 | mov ebp, eax |
865 | mov edi, ecx |
830 | mov edi, ecx |
866 | je .l2 |
831 | je .l2 |
867 | align 4 |
832 | |
Line 868... | Line 833... | ||
868 | @@: |
833 | @@: |
Line 869... | Line 834... | ||
869 | 834 | ||
Line 884... | Line 849... | ||
884 | cmp ecx, eax |
849 | cmp ecx, eax |
885 | jz @F |
850 | jz @F |
Line 886... | Line 851... | ||
886 | 851 | ||
887 | ; rst = rt; |
852 | ; rst = rt; |
888 | mov [.rst], ecx |
853 | mov [.rst], ecx |
889 | align 4 |
854 | |
890 | @@: |
855 | @@: |
Line 891... | Line 856... | ||
891 | ; if (t == 0) |
856 | ; if (t == 0) |
892 | 857 | ||
Line 893... | Line 858... | ||
893 | test eax, eax |
858 | test eax, eax |
Line 894... | Line 859... | ||
894 | jz @F |
859 | jz @F |
895 | 860 | ||
896 | ; sizebits <<= 1; |
861 | ; sizebits <<= 1; |
897 | 862 | ||
898 | add edx, edx |
863 | add edx, edx |
899 | jmp .loop |
864 | jmp .loop |
900 | align 4 |
865 | |
901 | @@: |
866 | @@: |
902 | ; t = rst; |
867 | ; t = rst; |
Line 903... | Line 868... | ||
903 | mov eax, [.rst] |
868 | mov eax, [.rst] |
904 | align 4 |
869 | |
905 | .l2: |
870 | .l2: |
906 | ; if (t == 0 && v == 0) |
871 | ; if (t == 0 && v == 0) |
907 | 872 | ||
908 | test eax, eax |
873 | test eax, eax |
909 | jne .l4 |
874 | jne .l4 |
Line 910... | Line 875... | ||
910 | test ebp, ebp |
875 | test ebp, ebp |
911 | jne .l7 |
876 | jne .l7 |
Line 922... | Line 887... | ||
922 | jz @F |
887 | jz @F |
Line 923... | Line 888... | ||
923 | 888 | ||
924 | bsf eax, edx |
889 | bsf eax, edx |
925 | ; t = ms.treebins[i]; |
890 | ; t = ms.treebins[i]; |
926 | mov eax, [mst.treebins+eax*4] |
891 | mov eax, [mst.treebins+eax*4] |
927 | align 4 |
892 | |
Line 928... | Line 893... | ||
928 | @@: |
893 | @@: |
929 | 894 | ||
930 | ; while (t != 0) |
895 | ; while (t != 0) |
931 | test eax, eax |
896 | test eax, eax |
932 | jz .l5 |
897 | jz .l5 |
Line 933... | Line 898... | ||
933 | align 4 |
898 | |
Line 934... | Line 899... | ||
934 | .l4: |
899 | .l4: |
Line 946... | Line 911... | ||
946 | ; rsize = trem; |
911 | ; rsize = trem; |
Line 947... | Line 912... | ||
947 | 912 | ||
948 | mov edi, ecx |
913 | mov edi, ecx |
949 | ; v = t; |
914 | ; v = t; |
950 | mov ebp, eax |
915 | mov ebp, eax |
951 | align 4 |
916 | |
Line 952... | Line 917... | ||
952 | @@: |
917 | @@: |
Line 953... | Line 918... | ||
953 | 918 | ||
954 | ; t = leftmost_child(t); |
919 | ; t = leftmost_child(t); |
955 | 920 | ||
956 | mov ecx, [eax+16] |
921 | mov ecx, [eax+16] |
957 | test ecx, ecx |
922 | test ecx, ecx |
958 | je @F |
923 | je @F |
959 | mov eax, ecx |
924 | mov eax, ecx |
960 | jmp .l6 |
925 | jmp .l6 |
961 | align 4 |
926 | |
962 | @@: |
927 | @@: |
Line 963... | Line 928... | ||
963 | mov eax, [eax+20] |
928 | mov eax, [eax+20] |
Line 964... | Line 929... | ||
964 | align 4 |
929 | |
965 | .l6: |
930 | .l6: |
966 | 931 | ||
967 | ; while (t != 0) |
932 | ; while (t != 0) |
Line 968... | Line 933... | ||
968 | 933 | ||
Line 969... | Line 934... | ||
969 | test eax, eax |
934 | test eax, eax |
970 | jne .l4 |
935 | jne .l4 |
971 | align 4 |
936 | |
972 | .l5: |
937 | .l5: |
Line 973... | Line 938... | ||
973 | 938 | ||
974 | ; if (v != 0) |
939 | ; if (v != 0) |
Line 1004... | Line 969... | ||
1004 | lea eax, [ebp+8] |
969 | lea eax, [ebp+8] |
1005 | add esp, 8 |
970 | add esp, 8 |
1006 | pop edi |
971 | pop edi |
1007 | pop ebp |
972 | pop ebp |
1008 | ret |
973 | ret |
1009 | align 4 |
974 | |
1010 | .large: |
975 | .large: |
Line 1011... | Line 976... | ||
1011 | 976 | ||
1012 | ; v->head = nb|PINUSE_BIT|CINUSE_BIT; |
977 | ; v->head = nb|PINUSE_BIT|CINUSE_BIT; |
Line 1029... | Line 994... | ||
1029 | lea eax, [ebp+8] |
994 | lea eax, [ebp+8] |
1030 | add esp, 8 |
995 | add esp, 8 |
1031 | pop edi |
996 | pop edi |
1032 | pop ebp |
997 | pop ebp |
1033 | ret |
998 | ret |
1034 | align 4 |
999 | |
1035 | .done: |
1000 | .done: |
1036 | add esp, 8 |
1001 | add esp, 8 |
1037 | pop edi |
1002 | pop edi |
1038 | pop ebp |
1003 | pop ebp |
1039 | xor eax, eax |
1004 | xor eax, eax |
1040 | ret |
1005 | ret |
Line 1041... | Line -... | ||
1041 | - | ||
1042 | align 4 |
1006 | |
Line 1043... | Line 1007... | ||
1043 | init_malloc: |
1007 | init_malloc: |
Line 1044... | Line 1008... | ||
1044 | 1008 | ||
1045 | stdcall kernel_alloc, 0x40000 |
1009 | stdcall kernel_alloc, 0x40000 |
1046 | 1010 | ||
1047 | mov [mst.top], eax |
1011 | mov [mst.top], eax |
1048 | mov [mst.topsize], 128*1024 |
1012 | mov [mst.topsize], 128*1024 |
1049 | mov dword [eax+4], (128*1024) or 1 |
1013 | mov dword [eax+4], (128*1024) or 1 |
1050 | mov eax, mst.smallbins |
1014 | mov eax, mst.smallbins |
1051 | align 4 |
1015 | |
1052 | @@: |
1016 | @@: |
1053 | mov [eax+8], eax |
1017 | mov [eax+8], eax |
1054 | mov [eax+12], eax |
1018 | mov [eax+12], eax |
Line 1055... | Line 1019... | ||
1055 | add eax, 16 |
1019 | add eax, 16 |
Line 1056... | Line -... | ||
1056 | cmp eax, mst.smallbins+512 |
- | |
1057 | jb @B |
- | |
1058 | - |