EFI_STATUS
EFIAPI
InitializeUIApplication (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
) {
EFI_STATUS Status = EFI_SUCCESS;
EFI_SHELL_APP_INIT (ImageHandle, SystemTable);
{
UINT64 addr, offset;
UINT16 count = 0, i;
Print(L"Detecting....\n");
//for (addr = 0xC0000; addr < 0xE0000; addr += 0x200)
for (addr = 0x0000; addr < 0x100000; addr += 0x200)
{
//Print(L"address=0x%x\n", addr);
if (
((*(UINT16 *)(addr + 0x00)) == 0xAA55) &&
((*(UINT16 *)(addr + 0x20)) == 0x8086) && //Vendor ID
//((*(UINT16 *)(addr + 0x22)) == 0x27D8) && //Device ID
(1)) {
Print(L"Legacy BIOS is at:0x%08x\n", (UINT32)(UINT64)addr);
for (offset = 0; offset < 4; offset ++){
Print(L"%08x: ", (UINT32)(addr + offset * 0x10));
for (i = 0; i < 16; i ++) {
Print(L"%02x ", (UINT8)*((UINT8 *)addr + offset * 0x10 + i));
}
for (i = 0; i < 16; i ++) {
if (((UINT8)*((UINT8 *)(addr + offset * 0x10 + i)) >= 0x20)
&& ((UINT8)*((UINT8 *)(addr + offset * 0x10 + i)) < 0x80))
Print(L"%c", (UINT8)*((UINT8 *)addr + offset * 0x10 + i));
else
Print(L".");
}
Print(L"\n");
}
count ++;
}
}
if (count == 0)
Print(L"No found any BIOS image.\n");
}
{
Print(L"System BIOS remaining memory[0040h:0013h]=0x%x(%d KBytes)\n", *(UINT16 *)0x413, *(UINT16 *)0x413);
Print(L"Length of EBDA[0040h:000Eh]=%xh:0000h=%dk\n", *(UINT16 *)0x40e, *(UINT8 *)((UINT32)*(UINT16 *)0x40e << 4));
}
return Status;
}
沒有留言:
張貼留言