Thanks,
-Lance
See also
http://groups-beta.google.com/group/microsoft.public.development.device.drivers/msg/e52f251c8562cdfd
Or simply google for "bios windows" in e.g.
"microsoft.public.development.device.drivers":
Stephan
---
On Thu, 10 Mar 2005 00:15:37 GMT, "news.fc.hp.com" <do...@email.com>
wrote:
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"news.fc.hp.com" <do...@email.com> wrote in message
news:tL0Yd.1442$fS3...@news.cpqcorp.net...
> That is absolutely not true. I write bios for a living. I have tools
> that make calls into the bios from windows. I'm just trying to learn how
> the windows interface works.
>
>
> "Stephan Wolf [MVP]" <ste...@hotmail.com> wrote in message
> news:gu0031ha3jegodpjs...@4ax.com...
"Stephan Wolf [MVP]" <ste...@hotmail.com> wrote in message
news:gu0031ha3jegodpjs...@4ax.com...
"David Welch" <we...@DONTSPAMcwcom.net> wrote in message
news:d0qefn$eej$1...@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"David Welch" <we...@DONTSPAMcwcom.net> wrote in message
news:d0qefn$eej$1...@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com...
Why do you need this? Anything useful there?
BIOS is just to boot the machine.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma...@storagecraft.com
http://www.storagecraft.com
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
ma...@storagecraft.com
http://www.storagecraft.com
"Don Burn" <bu...@stopspam.acm.org> wrote in message
news:QPgYd.398$K14...@fe02.lga...
Exactly, the system does it that case. These kludge techniques of just
map the BIOS into memory an call it don't.
--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Remove StopSpam from the email to reply
"Maxim S. Shatskih" <ma...@storagecraft.com> wrote in message
news:d0sals$gas$1...@gavrilo.mtu.ru...
#include <ntddk.h>
typedef struct
{
UCHAR Signature[4];
ULONG EntryPoint;
UCHAR Revision;
UCHAR Length;
UCHAR Checksum;
UCHAR Reserved[5];
} BIOS32_HEADER;
NTSTATUS DriverEntry(IN PDRIVER_OBJECT DriverObject, IN
PUNICODE_STRING RegistryPath)
{
PVOID BiosSegment;
PVOID EntrypointMap;
PVOID Entrypoint;
ULONG i, j;
BIOS32_HEADER* Header;
ULONG Result;
PHYSICAL_ADDRESS BiosAddress ;
ULONG PciBase, PciLength, PciEntrypoint;
BiosAddress.LowPart = 0xe0000;
BiosAddress.HighPart = 0;
BiosSegment = MmMapIoSpace(BiosAddress, 0x1fff0, MmCached);
if (BiosSegment == NULL)
{
DbgPrint("Couldn't map bios\n");
return STATUS_UNSUCCESSFUL;
}
for (i = 0; i <= 0x1fff0; i+=16)
{
Header = (BIOS32_HEADER*)((PUCHAR)BiosSegment + i);
if (Header->Signature[0] == '_' &&
Header->Signature[1] == '3' &&
Header->Signature[2] == '2' &&
Header->Signature[3] == '_')
{
UCHAR Checksum;
DbgPrint("Found signature at %p\n", Header);
Checksum = 0;
for (j = 0; j < 16; j++)
{
Checksum += ((PUCHAR)BiosSegment)[i + j];
}
if (Checksum != 0)
{
DbgPrint("Found signature but checksum was wrong\n");
continue;
}
break;
}
}
if (i == 0x10000)
{
DbgPrint("No bios32 header found\n");
MmUnmapIoSpace(BiosSegment, 0x10000);
return STATUS_UNSUCCESSFUL;
}
if (Header->EntryPoint < 0xf0000 || Header->EntryPoint > 0x100000)
{
PHYSICAL_ADDRESS EntrypointAddress;
EntrypointAddress.LowPart = Header->EntryPoint & ~0xfff;
EntrypointAddress.HighPart = 0;
EntrypointMap = MmMapIoSpace(EntrypointAddress, 0x2000, MmCached);
if (EntrypointMap == NULL)
{
DbgPrint("Couldn't map memory containing bios32 entrypoint\n");
MmUnmapIoSpace(BiosSegment, 0x10000);
return STATUS_UNSUCCESSFUL;
}
Entrypoint = (PVOID)((PUCHAR)EntrypointMap + (Header->EntryPoint &
0xfff));
}
else
{
Entrypoint = (PVOID)((PUCHAR)BiosSegment + (Header->EntryPoint -
0xe0000));
EntrypointMap = NULL;
}
_asm
{
mov bl, 0
mov eax, (('$' << 0) + ('P' << 8) + ('C' << 16) + ('I' << 24))
mov ebx, 0
push cs
call [Entrypoint]
movzx eax, al
mov [Result], eax
mov [PciBase], ebx
mov [PciLength], ecx
mov [PciEntrypoint], edx
}
if (Result == 0x81)
{
DbgPrint("PCI service doesn't exist.\n");
}
else if (Result == 0x00)
{
DbgPrint("PCI service exists (Base 0x%.8X Length 0x%.8X Entrypoint
0x%.8X).\n", PciBase, PciLength, PciEntrypoint);
}
else
{
DbgPrint("Unexpected result from bios32 entrypoint\n");
}
MmUnmapIoSpace(BiosSegment, 0x10000);
if (EntrypointMap != NULL) MmUnmapIoSpace(EntrypointMap, 0x2000);
return STATUS_UNSUCCESSFUL;
}
As an engineer for a notebook OEM, I can affirm that the BIOS needs to be
called throughout the time that the PC is on and it is done mostly by 32 bit
calls.
Notebook OEMs have been calling into the BIOS on 32 bit OSes even since NT
3.1...that is because the BIOS is where all the power managment code for
battery, suspend, resume, hibernation and other features are kept. While it
is true that you cannot call into any part of the BIOS, parts of the BIOS
have been explicitly coded to allow 32bit calls... and this is just for
older features, with the latest technology features all of this is
accomplish via ACPI.
Phil Doragh
PC SW Engineer for IBM, Compaq and HP
Why not rely on ACPI instead? Hard-code the ACPI methods to the BIOS, and let
the OS's ACPI.SYS to execute them to do suspend/resume. This is how modern
world lives.
Because ACPI did not exist 10 years ago and why re-implement code that is
already working and has been working for years. Now that ACPI exists new
features are being implemented with it instead....of course XP uses APCI to
suspend... but NT 4 uses APM and the boxes have to support various OSes and
versions. Give me and my OEM SW colleagues the benefit of doubt when it
comes to this area, we have been doing this kind of work since Windows was a
gleam in Microsoft's eye.... all the teams I have been a part of know the
pros and cons of the various methods and their affect on the OS. I was just
trying to say that 32bit calls into the BIOS are not inherently bad and
cannot/should not be done as was mentioned in previous posts. They are done
all the time and very safely and with expertise in the right situations and
for the right reasons. Of course as new and better tools come along, OEM
engineers would be fools not use them.
Phil Doragh
Then disassemble VideoPortInt10 and look how it calls KeI386CallBios. Then do
the similar call in your driver.
This will be the safest way.