CN112069056B - UEFI firmware enrichment debugging method - Google Patents
UEFI firmware enrichment debugging method Download PDFInfo
- Publication number
- CN112069056B CN112069056B CN202010758588.2A CN202010758588A CN112069056B CN 112069056 B CN112069056 B CN 112069056B CN 202010758588 A CN202010758588 A CN 202010758588A CN 112069056 B CN112069056 B CN 112069056B
- Authority
- CN
- China
- Prior art keywords
- firmware
- uefi
- information
- uefi firmware
- module
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/3636—Software debugging by tracing the execution of the program
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/362—Software debugging
- G06F11/366—Software debugging using diagnostics
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The invention discloses a UEFI firmware enrichment debugging method, which comprises the following specific steps: s1, starting UEFI firmware; s2, UEFI firmware records module loading information; s3, UEFI firmware records version information; s4, the UEFI firmware records abnormal context information; s5, the EJTAG downloads the memory data recorded by the firmware; s6, searching for a positioning abnormality reason. When firmware crashes based on UEFI, the method can effectively locate the abnormal module and locate the abnormal code segment of the module, thereby being convenient for finding out the code problem and confirming the cause of the crash.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a UEFI firmware enrichment debugging method.
Background
The unified extensible firmware interface (UEFI, abbreviated as Unified Extensible Firmware Interface, english) is a personal computer system specification that defines a software interface between an operating system and system firmware as an alternative to BIOS. The extensible firmware interface is responsible for power-on self test (POST), contacting the operating system, and providing an interface that connects the operating system to the hardware. The significant difference between the UEFI and the traditional BIOS is that the UEFI is a system constructed in a modularized, C language style parameter stack transmission mode and dynamic link mode, and compared with the BIOS, the UEFI is easier to realize and has stronger fault tolerance and error correction characteristics.
Because the UEFI has the characteristic of supporting the dynamic loading module in a modularized manner, the loading address of the module of the UEFI is possibly different when the UEFI is started and operated every time, and the abnormal module cannot be positioned when the firmware is dead, so that the problem of inconvenient positioning is solved.
Disclosure of Invention
The invention aims to provide a UEFI firmware rich debugging method, which effectively solves the problem that the cause of the dead halt cannot be positioned when the firmware is dead halt in the firmware debugging process.
In order to achieve the above purpose, the present invention provides a UEFI firmware enrichment debugging method, which specifically comprises the steps of:
s1, starting UEFI firmware;
s2, UEFI firmware records module loading information;
s3, UEFI firmware records version information;
s4, the UEFI firmware records abnormal context information;
s5, the EJTAG downloads the memory data recorded by the firmware;
s6, searching for a positioning abnormality reason.
Further, the firmware has a dedicated memory space, specifically a 16M memory address space starting at an address of 0x900000000f000000, for storing the information described in steps S2, S3, S4.
Furthermore, the UEFI firmware is a program solidified in the flash of the main board, and a recording code for recording the information described in S2, S3 and S4 is added in the core code.
Further, the firmware is based on a UEFI framework, and the UEFI framework is divided into a PEI phase and a DXE phase in construction.
Further, in step S2, the record code is responsible for recording module loading information, where the module loading information includes a PEI phase module loading address and a DXE phase module loading address, and the module loading information is respectively started with "PMIS" and "DMIS" as signatures and stored in a memory space dedicated to firmware.
Further, in step S4, the record code is responsible for recording exception context information, which refers to the data of the CPU general purpose register and the coprocessor when an exception occurs, beginning with an "EXIS" signature.
Further, the EJTAG supports code-level debugging, using EJTAG to download memory space data dedicated to 16M firmware starting at 0x900000000f000000 address.
Further, the step of searching for the reason of the positioning abnormality in step S6 is as follows:
S6A, analyzing the special memory space data of the firmware downloaded by the EJTAG by using an analysis tool, positioning a loading address, version information and abnormal context information of the PEI phase and the DXE phase module sequentially through a signature character string, and positioning an abnormal module by combining the loading address of the module and the EPC in the abnormal context;
S6B, positioning the abnormal code segment of the module through the disassembled module.
The beneficial effects of the invention are as follows: when firmware based on UEFI crashes, abnormal modules can be effectively positioned, abnormal code segments of the modules can be positioned, code problems can be found conveniently, and the cause of the crashes can be confirmed conveniently.
Drawings
Figure 1 shows a flow chart of the method of the invention.
Detailed Description
The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby making clear and defining the scope of the present invention.
The debugging object of the invention is UEFI firmware, the UEFI firmware is a program solidified in the flash of the main board, and the information required by locating the abnormality is obtained by adding a record code for recording the information in a core code of the UEFI firmware.
Referring to fig. 1, the method for the UEFI firmware enrichment debugging of the present invention specifically includes the following steps:
a) UEFI firmware boot up: preparing a UEFI running environment, including CPU bridge chip initialization and memory initialization.
b) UEFI firmware records module loading information: this stage is responsible for logging the PEI stage module load address and the DXE stage module load address. The memory address interval for recording the module loading address is a memory space special for firmware, and the system can not be used. The specific address is a 16M memory address space starting with an address of 0x900000000f 000000. When the PEI module records, the PMIS is used as a signature, and when the DXE module records, the DMIS is used as a signature, and the signature is used for loading the record by the subsequent convenient positioning module. Each time the UEFI core code loads a module, the record code records a piece of module loading information, and writes the information into a memory space dedicated to firmware.
c) UEFI firmware records version information: the stage is responsible for recording the version information of the firmware, including the firmware version number, the compiling time, the mainboard version number and the like, and the recording code writes the information into a memory space special for the firmware.
d) UEFI firmware records exception context information: if the firmware is abnormally halted, a firmware exception handling program is entered, the exception handling program is responsible for handling exceptions, and the record code is responsible for recording exception context information. The exception context refers to the data of the general purpose registers and coprocessors of the CPU when an exception occurs, and is also recorded in a special memory space of the firmware, and starts with an EXIS signature which is used for conveniently positioning the exception context record later.
e) EJTAG downloads the memory data recorded by the firmware: when the firmware crashes, the firmware cannot execute according to the established program flow, and code level debugging can be performed by using EJTAG. The stage uses the memory space dedicated to 16M firmware from EJTAG download address 0x900000000f000000, and the space contains module loading information, version information and abnormal context information.
f) Searching for a locating abnormality reason: and analyzing the firmware special memory space data downloaded by the EJTAG by using an analysis tool, and positioning the loading address of the PEI and DXE modules, the firmware version information data and the firmware abnormal context data through the signature character strings in sequence. And positioning the abnormal module by combining the module loading address and the PC and the EPC in the abnormal context, and positioning the abnormal code segment of the module through the disassembly module.
In the embodiment of the invention, a Loongson mainboard is connected with EJTAG equipment, the EJTAG equipment is connected with an office computer, one end of the EJTAG connected mainboard is a pin header, one end connected with the office computer is a USB interface, memory data recorded by using EJTAG downloaded firmware in a command line mode at the office computer end is used, and an analysis tool and a disassembly module are used for searching and positioning abnormal reasons.
In the embodiment of the invention, the analysis tool is a dream firmware tool, an EPC is displayed on an abnormal information interface of the tool, the EPC stores an abnormal return address, a module name and an address of two stages of PEI and DXE are displayed on a module information interface of the tool, and an abnormal module is determined according to the EPC and the module loading address.
According to the UEFI firmware enrichment debugging method, when the firmware based on UEFI crashes, the abnormal module can be effectively positioned, the abnormal code segment of the module is positioned, the code problem can be conveniently found, and the cause of the crashes can be conveniently confirmed.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent structures or equivalent processes or direct or indirect application in other related technical fields are included in the scope of the present invention.
Claims (7)
1. The UEFI firmware enrichment debugging method is characterized by comprising the following specific steps of:
s1, starting UEFI firmware;
s2, UEFI firmware records module loading information, wherein the module loading information comprises a PEI phase module loading address and a DXE phase module loading address, and the PEI phase module loading address and the DXE phase module loading address respectively start with 'PMIS' and 'DMIS' as signatures;
s3, UEFI firmware records version information;
s4, the UEFI firmware records abnormal context information, wherein the abnormal context information refers to data of a CPU general register and a coprocessor when an abnormality occurs, and the abnormal context starts with an EXIS signature;
s5, the EJTAG downloads the memory data recorded by the firmware;
s6, searching for a positioning abnormality reason.
2. The method for UEFI firmware rich debugging of claim 1, wherein: the UEFI firmware has a dedicated memory space, specifically a 16M memory address space starting with an address of 0x900000000f000000, for storing the information described in steps S2, S3, S4.
3. The method for UEFI firmware rich debugging of claim 2, wherein: the UEFI firmware is a program solidified in the flash of the main board, a recording code for recording the information of S2, S3 and S4 is added in a core code of the UEFI firmware, and the recording code writes the information into a memory space special for the firmware.
4. The method for UEFI firmware rich debugging of claim 3, wherein: the EJTAG equipment is connected with the main board through a cable and downloads memory space data special for firmware.
5. The method for UEFI firmware rich debugging of claim 4, wherein: the step of searching for the positioning abnormality cause is as follows:
S6A, analyzing the special memory space data of the firmware downloaded by the EJTAG by using an analysis tool, loading information and version information through a signature positioning module, and positioning an abnormal module by combining the module loading information and EPC in the abnormal context information;
S6B, positioning the abnormal code segment of the module through disassembling the module.
6. The method for UEFI firmware rich debugging of claim 5, wherein:
the parsing tool is a dream firmware tool.
7. The method for UEFI firmware rich debugging of claim 5, wherein:
the EPC stores an exception return address.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010758588.2A CN112069056B (en) | 2020-07-31 | 2020-07-31 | UEFI firmware enrichment debugging method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010758588.2A CN112069056B (en) | 2020-07-31 | 2020-07-31 | UEFI firmware enrichment debugging method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112069056A CN112069056A (en) | 2020-12-11 |
CN112069056B true CN112069056B (en) | 2023-09-01 |
Family
ID=73656709
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010758588.2A Active CN112069056B (en) | 2020-07-31 | 2020-07-31 | UEFI firmware enrichment debugging method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112069056B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114090084A (en) * | 2021-10-28 | 2022-02-25 | 联想(北京)有限公司 | Information determination method and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1536488A (en) * | 2003-04-04 | 2004-10-13 | 上海交大达通电子信息有限公司 | Method of network up-grade embedded system firm ware |
CN1704908A (en) * | 2004-05-26 | 2005-12-07 | 华为技术有限公司 | Method for locating program abnormity |
CN106951358A (en) * | 2017-02-07 | 2017-07-14 | 深圳市智微智能科技开发有限公司 | A kind of quick display status information method and system during computer system power-on self-test based on UEFI standards |
CN107566169A (en) * | 2017-08-24 | 2018-01-09 | 上海斐讯数据通信技术有限公司 | A kind of firmware upgrade method and router based on openwrt |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103377063B (en) * | 2012-04-28 | 2016-06-22 | 国际商业机器公司 | From legacy operating systems environment recovery to the method and system of UEFI pre-boot environment |
-
2020
- 2020-07-31 CN CN202010758588.2A patent/CN112069056B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1536488A (en) * | 2003-04-04 | 2004-10-13 | 上海交大达通电子信息有限公司 | Method of network up-grade embedded system firm ware |
CN1704908A (en) * | 2004-05-26 | 2005-12-07 | 华为技术有限公司 | Method for locating program abnormity |
CN106951358A (en) * | 2017-02-07 | 2017-07-14 | 深圳市智微智能科技开发有限公司 | A kind of quick display status information method and system during computer system power-on self-test based on UEFI standards |
CN107566169A (en) * | 2017-08-24 | 2018-01-09 | 上海斐讯数据通信技术有限公司 | A kind of firmware upgrade method and router based on openwrt |
Also Published As
Publication number | Publication date |
---|---|
CN112069056A (en) | 2020-12-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9940225B2 (en) | Automated error checking system for a software application and method therefor | |
US6438688B1 (en) | Method and computer for locally and remotely updating a basic input output system (BIOS) utilizing one update file | |
EP2359247B1 (en) | Transforming user script code for debugging | |
EP2368189B1 (en) | Debugging pipeline | |
US9645911B2 (en) | System and method for debugging firmware/software by generating trace data | |
US20020194313A1 (en) | Method and apparatus for distributing computer platform firmware across a network | |
US20060277443A1 (en) | Method and system for acquiring definitions of debug code of a basic input/output system | |
US20100049961A1 (en) | Update method for basic input/output system and update system thereof | |
US4520440A (en) | Test verification of processor architecture having a partial instruction set | |
CN103077112A (en) | Software debugging method and system | |
US8122293B2 (en) | Method for automatically simulating manual testing of a computer, and testing system for performing the method | |
CN112069056B (en) | UEFI firmware enrichment debugging method | |
US20080168426A1 (en) | Automatic inspection of compiled code | |
CN112216340A (en) | Hard disk test method and device, storage medium and electronic equipment | |
CN113220514A (en) | Solid state disk testing method and device, readable storage medium and electronic equipment | |
US20060026415A1 (en) | Method of updating a portion BIOS | |
CN116501378B (en) | Implementation method and device for reverse engineering reduction source code and electronic equipment | |
CN113268470A (en) | Efficient database rollback scheme verification method | |
CN113315675A (en) | White box switch U-Boot automatic testing method, system and storage medium | |
CN109857583B (en) | Processing method and device | |
US20060224377A1 (en) | ROM emulator | |
CN110096888B (en) | Method and system for accelerating verification and analyzing SMM potential safety hazard | |
CN111897557B (en) | Updating method, device, equipment and storage medium of service system | |
Ji et al. | Design and implementation of retargetable software debugger based on GDB | |
RU2306597C2 (en) | Method for linking (assembling) software |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |