Int 15 interrupt function

Source: Internet
Author: User
Document directory
  • Address range descriptor Structure
  • Assumptions and limitations
  • Example address map
  • Sample operating system usage
Int 15 h, Ax = e820h-query system address map Real mode only.

This call returns a memory map of all the installed ram, and of physicalmemory ranges reserved by the BIOS. the address map is returned by makingsuccessive callto this API, each returning one "run" of physical addressinformation. each run has a type which
Dictates how this run of physicaladdress range shoshould be treated by the operating system.

If the information returned from int 15 h, Ax = e820h in some way differs fromint 15 h, Ax = e801h orint 15 h Ah = 88 h, then the information
Returned from e820hsupersedes what is returned from these older interfaces. This allows the biosto return whatever information it wishes to for compatibility reasons.

Input:

EAXFunction CodeE820hEBXContinuationContains the "continuation value" to get thenext run of physical memory.  This is thevalue returned by a previous call to thisroutine.  If this is the first call, EBXmust contain zero.ES:DIBuffer PointerPointer to an  Address Range Descriptorstructure which the BIOS is to fill in.ECXBuffer SizeThe length in bytes of the structure passedto the BIOS.  The BIOS will fill in at mostECX bytes of the structure or however muchof the structure the BIOS implements.  Theminimum size which must be supported by boththe BIOS and the caller is 20 bytes.  Futureimplementations may extend this structure.EDXSignature'SMAP' -  Used by the BIOS to verify thecaller is requesting the system mapinformation to be returned in ES:DI.

Output:

CFCarry FlagNon-Carry - indicates no errorEAXSignature'SMAP' - Signature to verify correct BIOSrevision.ES:DIBuffer PointerReturned Address Range Descriptor pointer.Same value as on input.ECXBuffer SizeNumber of bytes returned by the BIOS in theaddress range descriptor.  The minimum sizestructure returned by the BIOS is 20 bytes.EBXContinuationContains the continuation value to get thenext address descriptor.  The actualsignificance of the continuation value is upto the discretion of the BIOS.  The callermust pass the continuation value unchangedas input to the next iteration of the E820call in order to get the next Address RangeDescriptor.  A return value of zero means thatthis is the last descriptor.  Note that theBIOS indicate that the last valid descriptorhas been returned by either returning a zeroas the continuation value, or by returningcarry.
Address range descriptor Structure
Offset in BytesNameDescription0    BaseAddrLowLow 32 Bits of Base Address4    BaseAddrHighHigh 32 Bits of Base Address8    LengthLowLow 32 Bits of Length in Bytes12    LengthHighHigh 32 Bits of Length in Bytes16    TypeAddress type of  this range.

TheBaseaddrlowAndBaseaddrhighTogether are the 64 bitBaseaddressOf this range.BaseaddressIs the physical address of thestart of the range being specified.

TheLengthlowAndLengthhighTogether are the 64 bitLengthOf this range.LengthIs the physical contiguous length in bytes of a range beingspecified.

TheTypeField describes the usage of the described address range asdefined in the table below.

ValuePneumonicDescription1AddressRangeMemoryThis run is available RAM usable by theoperating system.2AddressRangeReservedThis run of addresses is in use or reservedby the system, and must not be used by theoperating system.OtherUndefinedUndefined - Reserved for future use.  Anyrange of this type must be treated by theOS as if the type returned wasAddressRangeReserved.

The BIOS can use the addressrangereserved address range type to block outvarous addresses as "not suitable" for use by a programmable device.

Some of the reasons a BIOS wocould do this are:

  • The address range contains system ROM.
  • The address range contains RAM in use by the Rom.
  • The address range is in use by a memory mapped system device.
  • The address range is for whatever reason are unsuitable for astandard device to use as a device memory space.
Assumptions and limitations
  • 1.The BIOS will return address ranges describing base boardmemory and ISA or PCI memory that is contiguous with that baseboard memory.
  • 2.The BIOS will not return a range description for the memorymapping of PCI devices, ISA option Rom's, and ISA plug & play cards. Thisis because the OS has mechanisms available to detect them.
  • 3.The BIOS will return chipset defined address holes that are notbeing used by devices as reserved.
  • 4.Address ranges defined for base board memory mapped I/O devices (for example apics) will be returned as reserved.
  • 5.All occurrences of the system BIOS will be mapped as reserved. This includes des the area below 1 MB, at 16 MB (if present) and atend of the address space (4 gig ).
  • 6.Standard PC address ranges will not be reported. example videomemory at a0000 to bffff physical will not be described by thisfunction. the range from e0000 to effff is base board specificand will be reported as suits the bas board.
  • 7.All of lower memory is reported as normal memory. it IS OS 'sresponsibility to handle standard Ram locations reserved forspecific uses, for example: the interrupt vector table (0: 0) andthe BIOS data area (40: 0 ).
Example address map

This sample address map describes a machine which has 128 mb ram, 640kof base memory and 127 MB extended. the base memory has 639 kavailable for the user and 1 K for an extended BIOS data area. thereis a 4 MB linear frame buffer (LFb) based at 12 Mb. the memory
Holecreated by the chipset is from 8 m to 16 m. there are memory mappedapic devices in the system. the IO unit is at fec00000 and the localunit is at fee00000. the system BIOS is remapped to 4G-64 K.

Note that the 639 K endpoint of the first memory range is also the basememory size reported in the BIOS data segment at 40: 13.

Key to types: "arm" is addressrangememory, "arr" is addressrangereserved.

Base (Hex)LengthTypeDescription0000 0000639KARMAvailable Base memory - typically the samevalue as is returned via the INT 12 function.0009 FC001KARRMemory reserved for use by the BIOS(s).This area typically includes the ExtendedBIOS data area.000F 000064KARRSystem BIOS0010 00007MARMExtended memory, this is not limited tothe 64 MB address range.0080 00008MARRChipset memory hole required to support theLFB mapping at 12 MB.0100 0000120MARMBase board RAM relocated above a chipsetmemory hole.FEC0 00004KARRIO APIC memory mapped I/O at FEC00000.  Notethe range of addresses required for an APICdevice may vary from base OEM to OEM.FEE0 00004KARRLocal APIC memory mapped I/O at FEE00000.FFFF 000064KARRRemapped System BIOS at end of address space.
Sample operating system usage

The following code segment is intended to describe the algorithm needed whencalling the query system address map function. It is an implementationexample and uses non standard mechanisms.

    E820Present = FALSE;    Regs.ebx = 0;    do {        Regs.eax = 0xE820;        Regs.es  = SEGMENT (&Descriptor);        Regs.di  = OFFSET  (&Descriptor);        Regs.ecx = sizeof  (Descriptor);Regs.edx = 'SMAP';        _int( 0x15, Regs );        if ((Regs.eflags & EFLAG_CARRY)  ||  Regs.eax != 'SMAP') {            break;        }        if (Regs.ecx < 20  ||  Regs.ecx > sizeof (Descriptor) ) {            // bug in bios - all returned descriptors must be            // at least 20 bytes long, and can not be larger then            // the input buffer.            break;        }E820Present = TRUE;.        .        .        Add address range Descriptor.BaseAddress through        Descriptor.BaseAddress + Descriptor.Length        as type Descriptor.Type.        .        .    } while (Regs.ebx != 0);    if (!E820Present) {.        .        .call INT 15h, AX=E801h and/or INT 15h, AH=88h to obtain old stylememory information.        .        .    }

Int 15 h, Ax = e801h-Get memory size forlarge configurations Real mode only (as far as I know ).

Originally defined for EISA servers, this interface is capable ofreporting up to 4 GB of Ram. While not nearly as flexible as e820h, itis present in need more systems.

Input:

AXFunction CodeE801h

Output:

CFCarry FlagNon-Carry - indicates no errorAXExtended 1Number of contiguous KB between 1 and 16 MB,maximum 0x3C00 = 15 MB.BXExtended 2Number of contiguous 64 KB blocks between16 MB and 4 GB.CXConfigured 1Number of contiguous KB between 1 and 16 MB,maximum 0x3C00 = 15 MB.DXConfigured 2Number of contiguous 64 KB blocks between16 MB and 4 GB.

Not sure what this difference between the "extended" and "configured" numbers are, but they appear to be identical, as reported from the BIOS.

Note: It is possible for a machine using this interface to report a memoryhole just under 16 MB (count 1 is less than 15 MB, but count 2 isnon-zero ).

Int 15 h, Ah = 88 h-get extended memory size Real mode only.

This interface is quite primitive. it returns a single value forcontiguous memory abve 1 MB. the biggestlimitation is that the value returned is a 16-bit value, in KB, so it has a maximum saturation of just under 64 MB even presumingit returns as much
It can. On some systems, it won't returnanything abve the 16 MB boundary.

The one useful point is that it works on every PC available.

Input:

AHFunction Code88h

Output:

CFCarry FlagNon-Carry - indicates no errorAXMemory CountNumber of contiguous KB above 1 MB.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.