kolibrios/kernel/trunk/detect/biosmem.inc
Andrew Dent 4165acdf83 Remove $Revision$ from kernel file headers
- To better support git, remove SVN dependant `$Revision$` from file headers. This does *not* remove: the use of `__REV__` macro in `boostr.inc` and `kernel.asm`
- Header Copyright notices updated to 2024.
- Minimal white space cleanup (trailing spaces automatically removed).
- Note: `asmxygen.py` has a *large* amount of whitespace cleanup, due to incorrect line endings.

git-svn-id: svn://kolibrios.org@10051 a494cfbc-eb01-0410-851d-a64ba20cac60
2024-05-22 15:15:14 +00:00

45 lines
1.4 KiB
PHP

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2009-2024. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Query physical memory map from BIOS.
; diamond, 2009
push ds
; first call to fn E820
mov eax, 0xE820
xor ebx, ebx
mov es, bx
mov ds, bx
mov di, BOOT_LO.memmap_blocks
mov [BOOT_LO.memmap_block_cnt], ebx ; no blocks yet
mov ecx, 20
mov edx, 'PAMS' ; 'SMAP'
int 15h
jc no_E820
cmp eax, 'PAMS'
jnz no_E820
e820_mem_loop:
; cmp byte [di+16], 1 ; ignore non-free areas
; jnz e820_mem_next
inc byte [BOOT_LO.memmap_block_cnt]
add di, sizeof.e820entry
e820_mem_next:
; consequent calls to fn E820
test ebx, ebx
jz e820_test_done
cmp byte [BOOT_LO.memmap_block_cnt], MAX_MEMMAP_BLOCKS
jz e820_test_done
mov eax, 0xE820
int 15h
jc e820_test_done
jmp e820_mem_loop
no_E820:
; let's hope for mem_test from init.inc
e820_test_done:
pop ds