Subversion Repositories Kolibri OS

Rev

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

Rev 453 Rev 455
Line 862... Line 862...
862
        sub     ebx, ecx
862
        sub     ebx, ecx
863
        cmp     ebx, 1
863
        cmp     ebx, 1
864
        jnz     .nofreeall
864
        jnz     .nofreeall
865
        mov     eax, [page_tabs+ecx*4]
865
        mov     eax, [page_tabs+ecx*4]
866
        and     eax, not 0xFFF
866
        and     eax, not 0xFFF
867
        mov     edx, [CURRENT_TASK]
867
        mov     edx, [current_slot]
868
        shl     edx, 8
-
 
869
        mov     ebx, [SLOT_BASE+APPDATA.mem_size+edx]
868
        mov     ebx, [APPDATA.mem_size+edx]
870
        sub     ebx, eax
869
        sub     ebx, eax
871
        add     ebx, 0x1000
870
        add     ebx, 0x1000
872
        or      al, FREE_BLOCK
871
        or      al, FREE_BLOCK
873
        mov     [page_tabs+ecx*4], eax
872
        mov     [page_tabs+ecx*4], eax
874
        push    esi edi
873
        push    esi edi
875
        mov     esi, [SLOT_BASE+APPDATA.heap_base+edx]
874
        mov     esi, [APPDATA.heap_base+edx]
876
        mov     edi, [SLOT_BASE+APPDATA.heap_top+edx]
875
        mov     edi, [APPDATA.heap_top+edx]
877
        call    update_mem_size
876
        call    update_mem_size
878
        call    user_normalize
877
        call    user_normalize
879
        pop     edi esi
878
        pop     edi esi
880
        jmp     .ret0   ; all freed
879
        jmp     .ret0   ; all freed
881
.nofreeall:
880
.nofreeall:
Line 884... Line 883...
884
        or      ebx, USED_BLOCK
883
        or      ebx, USED_BLOCK
885
        xchg    [page_tabs+ecx*4], ebx
884
        xchg    [page_tabs+ecx*4], ebx
886
        shr     ebx, 12
885
        shr     ebx, 12
887
        sub     ebx, edx
886
        sub     ebx, edx
888
        push    ebx ecx edx
887
        push    ebx ecx edx
889
        mov     edx, [CURRENT_TASK]
888
        mov     edx, [current_slot]
890
        shl     edx, 8
-
 
891
        shl     ebx, 12
889
        shl     ebx, 12
892
        sub     ebx, [SLOT_BASE+APPDATA.mem_size+edx]
890
        sub     ebx, [APPDATA.mem_size+edx]
893
        neg     ebx
891
        neg     ebx
894
        call    update_mem_size
892
        call    update_mem_size
895
        pop     edx ecx ebx
893
        pop     edx ecx ebx
896
        lea     eax, [ecx+1]
894
        lea     eax, [ecx+1]
897
        shl     eax, 12
895
        shl     eax, 12
Line 899... Line 897...
899
        add     ecx, ebx
897
        add     ecx, ebx
900
        add     edx, ecx
898
        add     edx, ecx
901
        shl     ebx, 12
899
        shl     ebx, 12
902
        jz      .ret
900
        jz      .ret
903
        push    esi
901
        push    esi
904
        mov     esi, [CURRENT_TASK]
902
        mov     esi, [current_slot]
905
        shl     esi, 8
-
 
906
        mov     esi, [SLOT_BASE+APPDATA.heap_top+esi]
903
        mov     esi, [APPDATA.heap_top+esi]
907
        shr     esi, 12
904
        shr     esi, 12
908
@@:
905
@@:
909
        cmp     edx, esi
906
        cmp     edx, esi
910
        jae     .merge_done
907
        jae     .merge_done
911
        mov     eax, [page_tabs+edx*4]
908
        mov     eax, [page_tabs+edx*4]
Line 923... Line 920...
923
.ret:
920
.ret:
924
        pop     eax edx ecx
921
        pop     eax edx ecx
925
        ret
922
        ret
926
.realloc_add:
923
.realloc_add:
927
; get some additional memory
924
; get some additional memory
928
        mov     eax, [CURRENT_TASK]
925
        mov     eax, [current_slot]
929
        shl     eax, 8
-
 
930
        mov     eax, [SLOT_BASE+APPDATA.heap_top+eax]
926
        mov     eax, [APPDATA.heap_top+eax]
931
        shr     eax, 12
927
        shr     eax, 12
932
        cmp     edx, eax
928
        cmp     edx, eax
933
        jae     .cant_inplace
929
        jae     .cant_inplace
934
        mov     eax, [page_tabs+edx*4]
930
        mov     eax, [page_tabs+edx*4]
935
        shr     eax, 12
931
        shr     eax, 12
Line 956... Line 952...
956
        sub     ebx, edx
952
        sub     ebx, edx
957
        mov     ecx, ebx
953
        mov     ecx, ebx
958
        cld
954
        cld
959
        rep     stosd
955
        rep     stosd
960
        pop     edi
956
        pop     edi
961
        mov     edx, [CURRENT_TASK]
957
        mov     edx, [current_slot]
962
        shl     edx, 8
-
 
963
        shl     ebx, 12
958
        shl     ebx, 12
964
        add     ebx, [SLOT_BASE+APPDATA.mem_size+edx]
959
        add     ebx, [APPDATA.mem_size+edx]
965
        call    update_mem_size
960
        call    update_mem_size
966
        pop     eax edx ecx
961
        pop     eax edx ecx
967
        ret
962
        ret
968
.cant_inplace:
963
.cant_inplace:
969
        push    esi edi
964
        push    esi edi
970
        mov     eax, [CURRENT_TASK]
965
        mov     eax, [current_slot]
971
        shl     eax, 8
-
 
972
        mov     esi, [SLOT_BASE+APPDATA.heap_base+eax]
966
        mov     esi, [APPDATA.heap_base+eax]
973
        mov     edi, [SLOT_BASE+APPDATA.heap_top+eax]
967
        mov     edi, [APPDATA.heap_top+eax]
974
        shr     esi, 12
968
        shr     esi, 12
975
        shr     edi, 12
969
        shr     edi, 12
976
        sub     ebx, ecx
970
        sub     ebx, ecx
977
.find_place:
971
.find_place:
978
        cmp     esi, edi
972
        cmp     esi, edi
Line 1007... Line 1001...
1007
        or      al, USED_BLOCK
1001
        or      al, USED_BLOCK
1008
        mov     [page_tabs+esi*4], eax
1002
        mov     [page_tabs+esi*4], eax
1009
        inc     esi
1003
        inc     esi
1010
        mov     eax, esi
1004
        mov     eax, esi
1011
        shl     eax, 12
1005
        shl     eax, 12
1012
        sub     eax, new_app_base
-
 
1013
        push    eax
1006
        push    eax
1014
        mov     eax, [page_tabs+ecx*4]
1007
        mov     eax, [page_tabs+ecx*4]
1015
        and     eax, not 0xFFF
1008
        and     eax, not 0xFFF
1016
        or      al, FREE_BLOCK
1009
        or      al, FREE_BLOCK
1017
        sub     edx, ecx
1010
        sub     edx, ecx
Line 1028... Line 1021...
1028
        inc     esi
1021
        inc     esi
1029
        dec     ebx
1022
        dec     ebx
1030
        dec     edx
1023
        dec     edx
1031
        jnz     @b
1024
        jnz     @b
1032
        push    ebx
1025
        push    ebx
1033
        mov     edx, [CURRENT_TASK]
1026
        mov     edx, [current_slot]
1034
        shl     edx, 8
-
 
1035
        shl     ebx, 12
1027
        shl     ebx, 12
1036
        add     ebx, [SLOT_BASE+APPDATA.mem_size+edx]
1028
        add     ebx, [APPDATA.mem_size+edx]
1037
        call    update_mem_size
1029
        call    update_mem_size
1038
        pop     ebx
1030
        pop     ebx
1039
@@:
1031
@@:
1040
        mov     dword [page_tabs+esi*4], 2
1032
        mov     dword [page_tabs+esi*4], 2
1041
        inc     esi
1033
        inc     esi