freebsd-dev/sys/boot/i386/libi386/biosmem.c
Mike Smith 948486abe3 Initial integration of the i386 bootloader and BTX.
- Discard large amounts of BIOS-related code in favour of the more compact
   BTX vm86 interface.
 - Build the loader module as ELF, although the resulting object is a.out,
   make gensetdefs 32/64-bit sensitive and use a single copy of it.
 - Throw away installboot, as it's no longer required.
 - Use direct bcopy operations in the i386_copy module, as BTX
   maps the first 16M of memory.  Check operations against the
   detected size of actual memory.
1998-09-17 23:52:16 +00:00

53 lines
983 B
C

/*
* mjs copyright
*/
/*
* Obtain memory configuration information from the BIOS
*
* Note that we don't try too hard here; knowing the size of
* base memory and extended memory out to 16 or 64M is enough for
* the requirements of the bootstrap.
*
* We also maintain a pointer to the top of physical memory
* once called to allow rangechecking of load/copy requests.
*/
#include <stand.h>
#include "btxv86.h"
vm_offset_t memtop;
/*
* Return base memory size in kB.
*/
int
getbasemem(void)
{
v86.ctl = 0;
v86.addr = 0x1a; /* int 0x12 */
v86int();
return(v86.eax & 0xffff);
}
/*
* Return extended memory size in kB
*/
int
getextmem(void)
{
int extkb;
v86.ctl = 0;
v86.addr = 0x15; /* int 0x12 function 0x88*/
v86.eax = 0x8800;
v86int();
extkb = v86.eax & 0xffff;
/* Set memtop to actual top or 16M, whicheve is less */
memtop = min((0x100000 + (extkb + 1024)), (16 * 1024 * 1024));
return(extkb);
}