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