Subversion Repositories Kolibri OS

Rev

Rev 7132 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2009-2024. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8.  
  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
  18.         mov     di, BOOT_LO.memmap_blocks
  19.         mov     [BOOT_LO.memmap_block_cnt], ebx ; no blocks yet
  20.         mov     ecx, 20
  21.         mov     edx, 'PAMS' ; 'SMAP'
  22.         int     15h
  23.         jc      no_E820
  24.         cmp     eax, 'PAMS'
  25.         jnz     no_E820
  26. e820_mem_loop:
  27. ;        cmp     byte [di+16], 1 ; ignore non-free areas
  28. ;        jnz     e820_mem_next
  29.         inc     byte [BOOT_LO.memmap_block_cnt]
  30.         add     di, sizeof.e820entry
  31. e820_mem_next:
  32. ; consequent calls to fn E820
  33.         test    ebx, ebx
  34.         jz      e820_test_done
  35.         cmp     byte [BOOT_LO.memmap_block_cnt], MAX_MEMMAP_BLOCKS
  36.         jz      e820_test_done
  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
  45.