]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
intwrap get_eisa_map. Fix intwrapping of get_ext_memsize.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 10 Apr 2010 12:45:27 +0000 (14:45 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sat, 10 Apr 2010 12:45:27 +0000 (14:45 +0200)
include/grub/i386/pc/init.h
kern/i386/pc/mmap.c
kern/i386/pc/startup.S

index 368668922712a1cad73184a1fdc10bdde31666b3..7dc8ee1f4a0ba24d310314ba0dfd475cd7111ff3 100644 (file)
 #include <grub/symbol.h>
 #include <grub/machine/memory.h>
 
-/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
-   in 1KB parts, and upper 16 bits are above 16MB in 64KB parts.  */
-grub_uint32_t grub_get_eisa_mmap (void);
-
 /* Get a memory map entry. Return next continuation value. Zero means
    the end.  */
 grub_uint32_t grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
index b1bf2056fb1a9f99d245b15218f8639300b99154..2758d17f8b8c77bef33711b6491c88f14239d92e 100644 (file)
@@ -34,10 +34,33 @@ grub_get_ext_memsize (void)
   struct grub_bios_int_registers regs;
 
   regs.eax = 0x8800;
+  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
   grub_bios_interrupt (0x15, &regs);
   return regs.eax & 0xffff;
 }
 
+/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
+   in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. If error, return zero.
+   BIOS call "INT 15H, AH=E801H" to get EISA memory map,
+     AX = memory between 1M and 16M in 1K parts.
+     BX = memory above 16M in 64K parts. 
+*/
+static inline grub_uint32_t
+grub_get_eisa_mmap (void)
+{
+  struct grub_bios_int_registers regs;
+
+  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
+  regs.eax = 0xe801;
+  grub_bios_interrupt (0x15, &regs);
+
+  if ((regs.eax & 0xff00) == 0x8600)
+    return 0;
+
+  return (regs.eax & 0xffff) | (regs.ebx << 16);
+}
+
 grub_err_t
 grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
 {
index 233ab8074bf54c39c43e7d550697ca262c81c2fe..3fa1b11e8a28a9ff0a94668c83aead2c53985b79 100644 (file)
@@ -505,43 +505,6 @@ FUNCTION(grub_chainloader_real_boot)
 
 #include "../loader.S"
 
-/*
- *
- * grub_get_eisa_mmap() :  return packed EISA memory map, lower 16 bits is
- *             memory between 1M and 16M in 1K parts, upper 16 bits is
- *             memory above 16M in 64K parts.  If error, return zero.
- *     BIOS call "INT 15H, AH=E801H" to get EISA memory map,
- *             AX = memory between 1M and 16M in 1K parts.
- *             BX = memory above 16M in 64K parts.
- *
- */
-
-FUNCTION(grub_get_eisa_mmap)
-       pushl   %ebp
-       pushl   %ebx
-
-       call    prot_to_real    /* enter real mode */
-       .code16
-
-       movw    $0xe801, %ax
-       int     $0x15
-
-       shll    $16, %ebx
-       movw    %ax, %bx
-
-       DATA32  call    real_to_prot
-       .code32
-
-       cmpb    $0x86, %bh
-       je      xnoteisa
-
-       movl    %ebx, %eax
-
-xnoteisa:
-       popl    %ebx
-       popl    %ebp
-       ret
-
 /*
  *
  * grub_get_mmap_entry(addr, cont) : address and old continuation value (zero to