本文共 4773 字,大约阅读时间需要 15 分钟。
EFI系统是极端固件接口的一种标准,主要用于描述计算机固件的各种功能。以下是关于EFI代码和相关文件的详细说明。
int macdbg_dmphex_kernel(const char* buff_in, int len) { int retval = 0; int x, y, tot, lineoff; const char* curr; CHAR16 buff[1024]; UINTN index; DEBUG((EFI_D_INFO, "dump addr -> 0x%x: \n", buff_in)); //.DEBUG((EFI_D_INFO, "len = 0x%x.\n", len)); lineoff = 0; curr = buff_in; tot = 0; for (x = 0; x + 16 < len;) { index = 0x00; memset(buff, 0x00, sizeof(buff)); Swprintf(&buff[index], L"0x%04x: ", lineoff); index = Wcslen(buff); //DEBUG((EFI_D_INFO, "index = %d\n", index)); //DEBUG((EFI_D_INFO, "debug.0 = %s\n", buff)); //DEBUG((EFI_D_INFO, "debug.1 = %S\n", buff)); for (y = 0; y < 16; y++) { Swprintf(&buff[index], L"%02x ", (unsigned char)*(curr + y)); index = Wcslen(buff); } Swprintf(&buff[index], L"%s", L" "); index = Wcslen(buff); for (y = 0; y < 16; y++) { char c; c = *(curr + y); if (c > 31 && c < 127) { Swprintf(&buff[index], L"%c", c); } else { Swprintf(&buff[index], L"%c", L'.'); } index = Wcslen(buff); } tot++; curr += 16; x += 16; lineoff += 16; Swprintf(&buff[index], L"%s", L"\n"); //printk("%s", buff); //DEBUG((EFI_D_INFO, "debug.2 = %s\n", buff)); DEBUG((EFI_D_INFO, "%s", buff)); //DEBUG((EFI_D_INFO, "debug.3 = %S\n", buff)); } //do last line //Ser_Printf("tot %d.\r\n", tot); //Ser_Printf("len %d.\r\n", len); index = 0x00; memset(buff, 0x00, sizeof(buff)); if (tot < len) { curr = (buff_in + tot); Swprintf(&buff[index], L"0x%04x: ", lineoff); index = Wcslen(buff); for (y = 0; y < (len - tot); y++) { Swprintf(&buff[index], L"%02x ", (unsigned char)*(curr + y)); index = Wcslen(buff); } //padding with spaces //printk("(len - tot) %d.\r\n", (len - tot)); if ((len - tot) < 16) { for (y = 0; y < (16 - (len - tot)); y++) { Swprintf(&buff[index], L"%s", L" "); index = index + 3; } } Swprintf(&buff[index], L"%s", L" "); index = Wcslen(buff); for (y = 0; y < (len - tot); y++) { char c; c = *(curr + y); if (c > 31 && c < 127) { Swprintf(&buff[index], L"%c", c); } else { Swprintf(&buff[index], L"%c", L'.'); } index = Wcslen(buff); } } Swprintf(&buff[index], L"%s", L"\n"); //printk("%s", buff); DEBUG((EFI_D_INFO, "%s\n", buff)); return retval;} ## @fileComponent description file for EFI Shell module.This is a binary module containing multiple binary shell applications.All .efi file tagged with "ToolCode="DUMMY"" in following file list are raw EFI application,and they are can be run in shell environment.Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.## This program and the accompanying materialsare licensed and made available under the terms and conditions of the BSD Licensewhich accompanies this distribution. The full text of the license may be found athttp://opensource.org/licenses/bsd-license.phpTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.#### [Defines]INF_VERSION = 0x00010006BASE_NAME = FullShell## FILE_GUID = c57ad6b7-0515-40a8-9d21-551652854e37FILE_GUID = 7C04A583-9E3E-4f1c-AD65-E05268D0B4D2MODULE_TYPE = UEFI_APPLICATIONVERSION_STRING = 1.0ENTRY_POINT = UefiMain## VALID_ARCHITECTURES = IA32 X64 IPF#[Sources]kbLEDTest.c[Packages]MdePkg/MdePkg.decServerCommonPkg/ServerCommonPkg.decIntelFrameworkPkg/IntelFrameworkPkg.decAmiCompatibilityPkg/AmiCompatibilityPkg.decShellPkg/ShellPkg.decMdeModulePkg/MdeModulePkg.decAmiPkg/AmiPkg.decMdeModulePkg/MdeModulePkg.decIntelFrameworkModulePkg/IntelFrameworkModulePkg.dec[LibraryClasses]UefiDriverEntryPointMemoryAllocationLibUefiBootServicesTableLibDebugLibUefiLibWheaPlatformHooksLibUefiApplicationEntryPointAmiDxeLibUefiUsbLibUefiLibIoLibShellCEntryLibUefiShellDebug1CommandsLib[Protocols]gEfiSmbiosProtocolGuid[Guids]gEfiSmbiosTableGuid
通过以上分析,可以清晰地了解 EFI Shell 模块的功能实现和相关文件结构,方便开发者进行后续的扩展和优化工作。
转载地址:http://vkxd.baihongyu.com/