intwrap get_eisa_map. Fix intwrapping of get_ext_memsize.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-04-10 14:45:27 +02:00
parent c663074e6d
commit 0d06476b05
3 changed files with 23 additions and 41 deletions

View file

@ -23,10 +23,6 @@
#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,

View 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))
{

View 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