Subversion Repositories Kolibri OS

Rev

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

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