Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2009-2011. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. ; Query physical memory map from BIOS.
  9. ; diamond, 2009
  10.  
  11.         push    ds
  12. ; first call to fn E820
  13.         mov     eax, 0xE820
  14.         xor     ebx, ebx
  15.         mov     es, bx
  16.         mov     ds, bx
  17.         mov     di, 0x9104
  18.         mov     [di-4], ebx ; no blocks yet
  19.         mov     ecx, 20
  20.         mov     edx, 0x534D4150
  21.         int     15h
  22.         jc      no_E820
  23.         cmp     eax, 0x534D4150
  24.         jnz     no_E820
  25. e820_mem_loop:
  26. ;        cmp     byte [di+16], 1 ; ignore non-free areas
  27. ;        jnz     e820_mem_next
  28.         inc     byte [0x9100]
  29.         add     di, 20
  30. e820_mem_next:
  31. ; consequent calls to fn E820
  32.         test    ebx, ebx
  33.         jz      e820_test_done
  34.         cmp     byte [0x9100], 32
  35.         jae     e820_test_done
  36.         mov     eax, 0xE820
  37.         int     15h
  38.         jc      e820_test_done
  39.         jmp     e820_mem_loop
  40. no_E820:
  41. ; let's hope for mem_test from init.inc
  42. e820_test_done:
  43.         pop     ds
  44.