Subversion Repositories Kolibri OS

Rev

Rev 4850 | Rev 7122 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2009-2015. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. $Revision: 5363 $
  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, 0x9104
  21.         mov     [di-4], ebx ; no blocks yet
  22.         mov     ecx, 20
  23.         mov     edx, 0x534D4150
  24.         int     15h
  25.         jc      no_E820
  26.         cmp     eax, 0x534D4150
  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 [0x9100]
  32.         add     di, 20
  33. e820_mem_next:
  34. ; consequent calls to fn E820
  35.         test    ebx, ebx
  36.         jz      e820_test_done
  37.         cmp     byte [0x9100], 32
  38.         jae     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.