Rev 2442 | Rev 3555 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2442 | Rev 2465 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. 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: 2442 $ |
8 | $Revision: 2465 $ |
9 | 9 | ||
10 | 10 | ||
Line 43... | Line 43... | ||
43 | mov [BOOT_VAR-OS_BASE + 0x9110], eax |
43 | mov [BOOT_VAR-OS_BASE + 0x9110], eax |
44 | .ret: |
44 | .ret: |
45 | ret |
45 | ret |
46 | endp |
46 | endp |
Line 47... | Line -... | ||
47 | - | ||
48 | 47 | ||
49 | align 4 |
48 | align 4 |
50 | proc init_mem |
- | |
51 | - | ||
52 | xchg bx, bx |
- | |
53 | 49 | proc init_mem |
|
54 | ; calculate maximum allocatable address and number of allocatable pages |
50 | ; calculate maximum allocatable address and number of allocatable pages |
55 | mov edi, BOOT_VAR-OS_BASE + 0x9104 |
51 | mov edi, BOOT_VAR-OS_BASE + 0x9104 |
56 | mov ecx, [edi-4] |
52 | mov ecx, [edi-4] |
57 | xor esi, esi; esi will hold total amount of memory |
53 | xor esi, esi; esi will hold total amount of memory |
Line 92... | Line 88... | ||
92 | sub eax, [edi] |
88 | sub eax, [edi] |
93 | mov [edi+8], eax |
89 | mov [edi+8], eax |
94 | add esi, eax |
90 | add esi, eax |
95 | jmp .usable |
91 | jmp .usable |
96 | .unusable: |
92 | .unusable: |
97 | and dword [edi+8], 0 |
93 | ; and dword [edi+8], 0 |
98 | .usable: |
94 | .usable: |
99 | add edi, 20 |
95 | add edi, 20 |
100 | loop .calcmax |
96 | loop .calcmax |
101 | .calculated: |
97 | .calculated: |
102 | mov [MEM_AMOUNT-OS_BASE], esi |
98 | mov [MEM_AMOUNT-OS_BASE], esi |
Line 200... | Line 196... | ||
200 | 196 | ||
201 | ; scan through memory map and mark free areas as available |
197 | ; scan through memory map and mark free areas as available |
202 | mov ebx, BOOT_VAR-OS_BASE + 0x9104 |
198 | mov ebx, BOOT_VAR-OS_BASE + 0x9104 |
203 | mov edx, [ebx-4] |
199 | mov edx, [ebx-4] |
- | 200 | .scanmap: |
|
- | 201 | cmp [ebx+16], byte 1 |
|
- | 202 | jne .next |
|
204 | .scanmap: |
203 | |
205 | mov ecx, [ebx+8] |
204 | mov ecx, [ebx+8] |
206 | shr ecx, 12; ecx = number of pages |
205 | shr ecx, 12; ecx = number of pages |
207 | jz .next |
206 | jz .next |
208 | mov edi, [ebx] |
207 | mov edi, [ebx] |
Line 540... | Line 539... | ||
540 | mov [acpi_rsdt_base-OS_BASE], ecx |
539 | mov [acpi_rsdt_base-OS_BASE], ecx |
541 | call rsdt_find |
540 | call rsdt_find |
542 | test eax, eax |
541 | test eax, eax |
543 | jz .done |
542 | jz .done |
Line 544... | Line -... | ||
544 | - | ||
545 | ; xchg bx, bx |
- | |
546 | 543 | ||
547 | mov [acpi_madt_base-OS_BASE], eax |
544 | mov [acpi_madt_base-OS_BASE], eax |
548 | mov ecx, [eax+36] |
545 | mov ecx, [eax+36] |
Line 549... | Line 546... | ||
549 | mov [acpi_lapic_base-OS_BASE], ecx |
546 | mov [acpi_lapic_base-OS_BASE], ecx |