Rev 660 | Rev 663 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 660 | Rev 662 | ||
---|---|---|---|
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: 660 $ |
8 | $Revision: 662 $ |
9 | 9 | ||
10 | 10 | ||
Line 535... | Line 535... | ||
535 | locals |
535 | locals |
536 | lin_addr dd ? |
536 | lin_addr dd ? |
537 | pages_count dd ? |
537 | pages_count dd ? |
538 | endl |
538 | endl |
Line -... | Line 539... | ||
- | 539 | ||
- | 540 | push ebx |
|
- | 541 | push edi |
|
539 | 542 | ||
540 | mov eax, [size] |
543 | mov eax, [size] |
541 | add eax, 4095 |
544 | add eax, 4095 |
542 | and eax, not 4095; |
545 | and eax, not 4095; |
543 | mov [size], eax |
546 | mov [size], eax |
Line 589... | Line 592... | ||
589 | add edx, 0x1000 |
592 | add edx, 0x1000 |
590 | dec ecx |
593 | dec ecx |
591 | jnz @B |
594 | jnz @B |
592 | .end: |
595 | .end: |
593 | mov eax, [lin_addr] |
596 | mov eax, [lin_addr] |
- | 597 | pop edi |
|
- | 598 | pop ebx |
|
594 | ret |
599 | ret |
595 | .err: |
600 | .err: |
596 | xor eax, eax |
601 | xor eax, eax |
- | 602 | pop edi |
|
- | 603 | pop ebx |
|
597 | ret |
604 | ret |
598 | endp |
605 | endp |
Line 599... | Line 606... | ||
599 | 606 | ||
600 | align 4 |
607 | align 4 |
Line 663... | Line 670... | ||
663 | mov eax, HEAP_TOP |
670 | mov eax, HEAP_TOP |
664 | mov [ebx+APPDATA.heap_base], esi |
671 | mov [ebx+APPDATA.heap_base], esi |
665 | mov [ebx+APPDATA.heap_top], eax |
672 | mov [ebx+APPDATA.heap_top], eax |
Line 666... | Line 673... | ||
666 | 673 | ||
667 | sub eax, esi |
- | |
668 | ; add esi, new_app_base |
674 | sub eax, esi |
669 | shr esi, 10 |
675 | shr esi, 10 |
670 | mov ecx, eax |
676 | mov ecx, eax |
671 | sub eax, 4096 |
677 | sub eax, 4096 |
672 | or ecx, FREE_BLOCK |
678 | or ecx, FREE_BLOCK |
Line 675... | Line 681... | ||
675 | endp |
681 | endp |
Line 676... | Line 682... | ||
676 | 682 | ||
677 | align 4 |
683 | align 4 |
Line -... | Line 684... | ||
- | 684 | proc user_alloc stdcall, alloc_size:dword |
|
- | 685 | ||
- | 686 | push ebx |
|
- | 687 | push esi |
|
678 | proc user_alloc stdcall, alloc_size:dword |
688 | push edi |
679 | 689 | ||
680 | mov ecx, [alloc_size] |
690 | mov ecx, [alloc_size] |
Line 681... | Line 691... | ||
681 | add ecx, (4095+4096) |
691 | add ecx, (4095+4096) |
Line 723... | Line 733... | ||
723 | and ebx, not 0xFFF |
733 | and ebx, not 0xFFF |
724 | add ebx, [edx+APPDATA.mem_size] |
734 | add ebx, [edx+APPDATA.mem_size] |
725 | call update_mem_size |
735 | call update_mem_size |
Line 726... | Line 736... | ||
726 | 736 | ||
- | 737 | lea eax, [esi+4096] |
|
- | 738 | ||
- | 739 | pop edi |
|
- | 740 | pop esi |
|
727 | lea eax, [esi+4096] |
741 | pop ebx |
728 | ret |
742 | ret |
729 | test_used: |
743 | test_used: |
730 | test al, USED_BLOCK |
744 | test al, USED_BLOCK |
Line 734... | Line 748... | ||
734 | m_next: |
748 | m_next: |
735 | add esi, eax |
749 | add esi, eax |
736 | jmp l_0 |
750 | jmp l_0 |
737 | m_exit: |
751 | m_exit: |
738 | xor eax, eax |
752 | xor eax, eax |
- | 753 | pop edi |
|
- | 754 | pop esi |
|
- | 755 | pop ebx |
|
739 | ret |
756 | ret |
740 | endp |
757 | endp |
Line 741... | Line 758... | ||
741 | 758 | ||
742 | align 4 |
759 | align 4 |
Line -... | Line 760... | ||
- | 760 | proc user_free stdcall, base:dword |
|
- | 761 | ||
743 | proc user_free stdcall, base:dword |
762 | push esi |
744 | 763 | ||
745 | mov esi, [base] |
764 | mov esi, [base] |
Line -... | Line 765... | ||
- | 765 | test esi, esi |
|
- | 766 | jz .exit |
|
746 | test esi, esi |
767 | |
747 | jz .exit |
768 | push ebx |
748 | 769 | ||
749 | xor ebx, ebx |
770 | xor ebx, ebx |
750 | shr esi, 12 |
771 | shr esi, 12 |
Line 774... | Line 795... | ||
774 | @@: |
795 | @@: |
775 | inc esi |
796 | inc esi |
776 | dec ecx |
797 | dec ecx |
777 | jnz .release |
798 | jnz .release |
778 | .released: |
799 | .released: |
- | 800 | push edi |
|
- | 801 | ||
779 | mov edx, [current_slot] |
802 | mov edx, [current_slot] |
780 | mov esi, dword [edx+APPDATA.heap_base] |
803 | mov esi, dword [edx+APPDATA.heap_base] |
781 | mov edi, dword [edx+APPDATA.heap_top] |
804 | mov edi, dword [edx+APPDATA.heap_top] |
782 | sub ebx, [edx+APPDATA.mem_size] |
805 | sub ebx, [edx+APPDATA.mem_size] |
783 | neg ebx |
806 | neg ebx |
784 | call update_mem_size |
807 | call update_mem_size |
785 | call user_normalize |
808 | call user_normalize |
- | 809 | pop edi |
|
- | 810 | pop ebx |
|
- | 811 | pop esi |
|
786 | ret |
812 | ret |
787 | .exit: |
813 | .exit: |
788 | xor eax, eax |
814 | xor eax, eax |
789 | inc eax |
815 | inc eax |
- | 816 | pop esi |
|
790 | ret |
817 | ret |
791 | .cantfree: |
818 | .cantfree: |
792 | xor eax, eax |
819 | xor eax, eax |
- | 820 | pop edi |
|
- | 821 | pop ebx |
|
- | 822 | pop esi |
|
793 | ret |
823 | ret |
794 | endp |
824 | endp |
Line 795... | Line 825... | ||
795 | 825 | ||
796 | user_normalize: |
826 | user_normalize: |