Subversion Repositories Kolibri OS

Rev

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

Rev 419 Rev 427
Line 612... Line 612...
612
 
612
 
Line 613... Line 613...
613
align 4
613
align 4
614
proc init_heap
614
proc init_heap
Line 615... Line 615...
615
 
615
 
616
           mov ebx,[CURRENT_TASK]
-
 
617
           shl ebx,8
616
           mov ebx,[current_slot]
618
           mov eax, [SLOT_BASE+APPDATA.heap_top+ebx]
617
           mov eax, [ebx+APPDATA.heap_top]
619
           test eax, eax
618
           test eax, eax
620
           jz @F
619
           jz @F
621
           sub eax,[SLOT_BASE+APPDATA.heap_base+ebx]
620
           sub eax,[ebx+APPDATA.heap_base]
622
           sub eax, 4096
621
           sub eax, 4096
623
           ret
622
           ret
624
@@:
623
@@:
625
           mov esi, [SLOT_BASE+APPDATA.mem_size+ebx]
624
           mov esi, [ebx+APPDATA.mem_size]
626
           add esi, 4095
625
           add esi, 4095
627
           and esi, not 4095
626
           and esi, not 4095
628
           mov [SLOT_BASE+APPDATA.mem_size+ebx], esi
627
           mov [ebx+APPDATA.mem_size], esi
629
           mov eax, HEAP_TOP
628
           mov eax, HEAP_TOP
630
           mov [SLOT_BASE+APPDATA.heap_base+ebx], esi
629
           mov [ebx+APPDATA.heap_base], esi
Line 631... Line 630...
631
           mov [SLOT_BASE+APPDATA.heap_top+ebx], eax
630
           mov [ebx+APPDATA.heap_top], eax
632
 
631
 
633
           sub eax, esi
632
           sub eax, esi
634
       ;    add esi, new_app_base
633
       ;    add esi, new_app_base
Line 649... Line 648...
649
           mov ecx, [alloc_size]
648
           mov ecx, [alloc_size]
650
           add ecx, (4095+4096)
649
           add ecx, (4095+4096)
651
           and ecx, not 4095
650
           and ecx, not 4095
Line 652... Line 651...
652
 
651
 
653
           mov ebx, [CURRENT_TASK]
-
 
654
           shl ebx, 8
652
           mov ebx, [current_slot]
655
           mov esi, dword [ebx+SLOT_BASE+APPDATA.heap_base]; heap_base
653
           mov esi, dword [ebx+APPDATA.heap_base]  ; heap_base
656
           mov edi, dword [ebx+SLOT_BASE+APPDATA.heap_top]; heap_top
-
 
657
      ;     add esi, new_app_base
-
 
658
      ;     add edi, new_app_base
654
           mov edi, dword [ebx+APPDATA.heap_top]   ; heap_top
659
l_0:
655
l_0:
660
           cmp esi, edi
656
           cmp esi, edi
Line 661... Line 657...
661
           jae m_exit
657
           jae m_exit
Line 675... Line 671...
675
           sub eax, ecx;
671
           sub eax, ecx;
676
           or eax, FREE_BLOCK
672
           or eax, FREE_BLOCK
677
           shr edx, 12
673
           shr edx, 12
678
           mov [page_tabs+edx*4], eax
674
           mov [page_tabs+edx*4], eax
679
 
675
@@:
680
@@:
-
 
681
           or ecx, USED_BLOCK
676
           or ecx, USED_BLOCK
682
           mov [page_tabs+ebx*4], ecx
677
           mov [page_tabs+ebx*4], ecx
683
           shr ecx, 12
678
           shr ecx, 12
684
           dec ecx
679
           dec ecx
685
           inc ebx
680
           inc ebx
Line 688... Line 683...
688
           inc ebx
683
           inc ebx
689
           dec ecx
684
           dec ecx
690
           jnz @B
685
           jnz @B
691
 
686
 
Line 692... Line 687...
692
        mov     edx, [CURRENT_TASK]
687
           mov     edx, [current_slot]
693
        shl     edx, 8
-
 
694
        mov     ebx, [alloc_size]
688
           mov     ebx, [alloc_size]
695
        add     ebx, 0xFFF
689
           add     ebx, 0xFFF
696
        and     ebx, not 0xFFF
690
           and     ebx, not 0xFFF
697
        add     ebx, [SLOT_BASE+APPDATA.mem_size+edx]
691
           add     ebx, [edx+APPDATA.mem_size]
698
        call    update_mem_size
692
           call    update_mem_size
Line 699... Line 693...
699
 
693
 
700
           mov eax, esi
694
           mov eax, esi
701
           add eax, 4096
-
 
702
      ;     sub eax, new_app_base
695
           add eax, 4096
703
           ret
696
           ret
704
m_next:
697
m_next:
705
           add esi, eax
698
           add esi, eax
706
           jmp l_0
699
           jmp l_0
Line 748... Line 741...
748
           inc esi
741
           inc esi
749
           dec ecx
742
           dec ecx
750
           jnz .release
743
           jnz .release
751
.not_used:
744
.not_used:
752
           mov edx, [CURRENT_TASK]
745
           mov edx, [current_slot]
753
           shl edx, 8
746
           mov esi, dword [edx+APPDATA.heap_base]
754
           mov esi, dword [edx+SLOT_BASE+APPDATA.heap_base]; heap_base
-
 
755
           mov edi, dword [edx+SLOT_BASE+APPDATA.heap_top]; heap_top
747
           mov edi, dword [edx+APPDATA.heap_top]
756
           sub ebx, [edx+SLOT_BASE+APPDATA.mem_size]
748
           sub ebx, [edx+APPDATA.mem_size]
757
           neg ebx
749
           neg ebx
758
           call update_mem_size
750
           call update_mem_size
759
      ;     add esi, new_app_base
751
           shr esi, 12
760
      ;     add edi, new_app_base
-
 
761
           shr esi, 12
-
 
762
           shr edi, 12
752
           shr edi, 12
763
@@:
753
@@:
764
           mov eax, [page_tabs+esi*4]
754
           mov eax, [page_tabs+esi*4]
765
           test eax, USED_BLOCK
755
           test eax, USED_BLOCK
766
           jz .test_free
756
           jz .test_free