Rev 465 | Rev 593 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 465 | Rev 546 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | $Revision: 465 $ |
1 | $Revision: 546 $ |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
3 | ;; ;; |
3 | ;; ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
4 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; Distributed under terms of the GNU General Public License ;; |
6 | ;; ;; |
6 | ;; ;; |
Line 18... | Line 18... | ||
18 | } |
18 | } |
Line 19... | Line 19... | ||
19 | 19 | ||
20 | MEM_LIST_OFFSET equ 8 |
20 | MEM_LIST_OFFSET equ 8 |
21 | FREE_BLOCK equ 4 |
21 | FREE_BLOCK equ 4 |
- | 22 | USED_BLOCK equ 8 |
|
Line 22... | Line 23... | ||
22 | USED_BLOCK equ 8 |
23 | DONT_FREE_BLOCK equ 10h |
23 | 24 | ||
24 | virtual at 0 |
25 | virtual at 0 |
Line 726... | Line 727... | ||
726 | 727 | ||
727 | xor ebx, ebx |
728 | xor ebx, ebx |
728 | sub esi, 4096 |
729 | sub esi, 4096 |
729 | shr esi, 12 |
730 | shr esi, 12 |
730 | mov eax, [page_tabs+esi*4] |
731 | mov eax, [page_tabs+esi*4] |
731 | test eax, USED_BLOCK |
732 | test al, USED_BLOCK |
- | 733 | jz .not_used |
|
- | 734 | test al, DONT_FREE_BLOCK |
|
Line 732... | Line 735... | ||
732 | jz .not_used |
735 | jnz .cantfree |
733 | 736 | ||
734 | and eax, not 4095 |
737 | and eax, not 4095 |
735 | mov ecx, eax |
738 | mov ecx, eax |
Line 763... | Line 766... | ||
763 | ret |
766 | ret |
764 | .exit: |
767 | .exit: |
765 | xor eax, eax |
768 | xor eax, eax |
766 | inc eax |
769 | inc eax |
767 | ret |
770 | ret |
- | 771 | .cantfree: |
|
- | 772 | xor eax, eax |
|
- | 773 | ret |
|
768 | endp |
774 | endp |
Line 769... | Line 775... | ||
769 | 775 | ||
770 | user_normalize: |
776 | user_normalize: |
771 | ; in: esi=heap_base, edi=heap_top |
777 | ; in: esi=heap_base, edi=heap_top |
Line 834... | Line 840... | ||
834 | .ret0: |
840 | .ret0: |
835 | pop edx ecx |
841 | pop edx ecx |
836 | xor eax, eax |
842 | xor eax, eax |
837 | ret |
843 | ret |
838 | @@: |
844 | @@: |
- | 845 | test edx, DONT_FREE_BLOCK |
|
- | 846 | jnz .ret0 |
|
839 | add ebx, 0x1FFF |
847 | add ebx, 0x1FFF |
840 | shr edx, 12 |
848 | shr edx, 12 |
841 | shr ebx, 12 |
849 | shr ebx, 12 |
842 | ; edx = allocated size, ebx = new size |
850 | ; edx = allocated size, ebx = new size |
843 | add edx, ecx |
851 | add edx, ecx |