Rev 2455 | Rev 5363 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2455 | Rev 2466 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2009-2011. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2009-2011. 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 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
7 | 7 | ||
8 | ; Query physical memory map from BIOS. |
8 | ; Query physical memory map from BIOS. |
9 | ; diamond, 2009 |
9 | ; diamond, 2009 |
10 | 10 | ||
11 | push ds |
11 | push ds |
12 | ; first call to fn E820 |
12 | ; first call to fn E820 |
13 | mov eax, 0xE820 |
13 | mov eax, 0xE820 |
14 | xor ebx, ebx |
14 | xor ebx, ebx |
15 | mov es, bx |
15 | mov es, bx |
16 | mov ds, bx |
16 | mov ds, bx |
17 | mov di, 0x9104 |
17 | mov di, 0x9104 |
18 | mov [di-4], ebx ; no blocks yet |
18 | mov [di-4], ebx ; no blocks yet |
19 | mov ecx, 20 |
19 | mov ecx, 20 |
20 | mov edx, 0x534D4150 |
20 | mov edx, 0x534D4150 |
21 | int 15h |
21 | int 15h |
22 | jc no_E820 |
22 | jc no_E820 |
23 | cmp eax, 0x534D4150 |
23 | cmp eax, 0x534D4150 |
24 | jnz no_E820 |
24 | jnz no_E820 |
25 | e820_mem_loop: |
25 | e820_mem_loop: |
26 | cmp byte [di+16], 1 ; ignore non-free areas |
26 | ; cmp byte [di+16], 1 ; ignore non-free areas |
27 | jnz e820_mem_next |
27 | ; jnz e820_mem_next |
28 | inc byte [0x9100] |
28 | inc byte [0x9100] |
29 | add di, 20 |
29 | add di, 20 |
30 | e820_mem_next: |
30 | e820_mem_next: |
31 | ; consequent calls to fn E820 |
31 | ; consequent calls to fn E820 |
32 | test ebx, ebx |
32 | test ebx, ebx |
33 | jz e820_test_done |
33 | jz e820_test_done |
34 | cmp byte [0x9100], 32 |
34 | cmp byte [0x9100], 32 |
35 | jae e820_test_done |
35 | jae e820_test_done |
36 | mov eax, 0xE820 |
36 | mov eax, 0xE820 |
37 | int 15h |
37 | int 15h |
38 | jc e820_test_done |
38 | jc e820_test_done |
39 | jmp e820_mem_loop |
39 | jmp e820_mem_loop |
40 | no_E820: |
40 | no_E820: |
41 | ; let's hope for mem_test from init.inc |
41 | ; let's hope for mem_test from init.inc |
42 | e820_test_done: |
42 | e820_test_done: |
43 | pop ds |
43 | pop ds |