Subversion Repositories Kolibri OS

Rev

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

Rev 2455 Rev 2466
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. 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: 2455 $
8
$Revision: 2466 $
9
 
9
 
10
 
10
 
Line 53... Line 53...
53
        xor     esi, esi; esi will hold total amount of memory
53
        xor     esi, esi; esi will hold total amount of memory
54
        xor     edx, edx; edx will hold maximum allocatable address
54
        xor     edx, edx; edx will hold maximum allocatable address
55
.calcmax:
55
.calcmax:
56
; round all to pages
56
; round all to pages
57
        mov     eax, [edi]
57
        mov     eax, [edi]
-
 
58
        cmp     [edi+16], byte 1
-
 
59
        jne     .unusable
-
 
60
 
58
        test    eax, 0xFFF
61
        test    eax, 0xFFF
59
        jz      @f
62
        jz      @f
60
        neg     eax
63
        neg     eax
61
        and     eax, 0xFFF
64
        and     eax, 0xFFF
62
        add     [edi], eax
65
        add     [edi], eax
Line 85... Line 88...
85
        sub     eax, [edi]
88
        sub     eax, [edi]
86
        mov     [edi+8], eax
89
        mov     [edi+8], eax
87
        add     esi, eax
90
        add     esi, eax
88
        jmp     .usable
91
        jmp     .usable
89
.unusable:
92
.unusable:
90
        and     dword [edi+8], 0
93
;        and     dword [edi+8], 0
91
.usable:
94
.usable:
92
        add     edi, 20
95
        add     edi, 20
93
        loop    .calcmax
96
        loop    .calcmax
94
.calculated:
97
.calculated:
95
        mov     [MEM_AMOUNT-OS_BASE], esi
98
        mov     [MEM_AMOUNT-OS_BASE], esi
Line 193... Line 196...
193
 
196
 
194
; scan through memory map and mark free areas as available
197
; scan through memory map and mark free areas as available
195
        mov     ebx, BOOT_VAR-OS_BASE + 0x9104
198
        mov     ebx, BOOT_VAR-OS_BASE + 0x9104
196
        mov     edx, [ebx-4]
199
        mov     edx, [ebx-4]
-
 
200
.scanmap:
-
 
201
        cmp     [ebx+16], byte 1
-
 
202
        jne     .next
197
.scanmap:
203
 
198
        mov     ecx, [ebx+8]
204
        mov     ecx, [ebx+8]
199
        shr     ecx, 12; ecx = number of pages
205
        shr     ecx, 12; ecx = number of pages
200
        jz      .next
206
        jz      .next
201
        mov     edi, [ebx]
207
        mov     edi, [ebx]