Rev 7122 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2288 | clevermous | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
7122 | dunkaist | 3 | ;; Copyright (C) KolibriOS team 2009-2017. All rights reserved. ;; |
2288 | clevermous | 4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
||
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
7 | |||
4850 | mario79 | 8 | $Revision: 7132 $ |
9 | |||
10 | |||
2288 | clevermous | 11 | ; Query physical memory map from BIOS. |
12 | ; diamond, 2009 |
||
13 | |||
14 | push ds |
||
15 | ; first call to fn E820 |
||
16 | mov eax, 0xE820 |
||
17 | xor ebx, ebx |
||
18 | mov es, bx |
||
19 | mov ds, bx |
||
7132 | dunkaist | 20 | mov di, BOOT_LO.memmap_blocks |
21 | mov [BOOT_LO.memmap_block_cnt], ebx ; no blocks yet |
||
2288 | clevermous | 22 | mov ecx, 20 |
7122 | dunkaist | 23 | mov edx, 'PAMS' ; 'SMAP' |
2288 | clevermous | 24 | int 15h |
25 | jc no_E820 |
||
7122 | dunkaist | 26 | cmp eax, 'PAMS' |
2288 | clevermous | 27 | jnz no_E820 |
28 | e820_mem_loop: |
||
2466 | Serge | 29 | ; cmp byte [di+16], 1 ; ignore non-free areas |
30 | ; jnz e820_mem_next |
||
7132 | dunkaist | 31 | inc byte [BOOT_LO.memmap_block_cnt] |
7122 | dunkaist | 32 | add di, sizeof.e820entry |
2288 | clevermous | 33 | e820_mem_next: |
34 | ; consequent calls to fn E820 |
||
35 | test ebx, ebx |
||
36 | jz e820_test_done |
||
7132 | dunkaist | 37 | cmp byte [BOOT_LO.memmap_block_cnt], MAX_MEMMAP_BLOCKS |
7122 | dunkaist | 38 | jz e820_test_done |
2288 | clevermous | 39 | mov eax, 0xE820 |
40 | int 15h |
||
41 | jc e820_test_done |
||
42 | jmp e820_mem_loop |
||
43 | no_E820: |
||
44 | ; let's hope for mem_test from init.inc |
||
45 | e820_test_done: |
||
46 | pop ds |