Driver information acquisition method, device and storage medium

By modifying the configuration file of the virtual monitoring layer and the registration linked list of virtual IO devices, the time-consuming and error-prone problem of obtaining Linux driver information in RTOS driver development is solved. Detailed recording and matching of hardware device register information is achieved, simplifying development. process and improves driver stability and performance.

CN118519859BActive Publication Date: 2024-09-17KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410977074.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-09-17
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

When writing RTOS drivers, the process of obtaining Linux driver information is time-consuming and error-prone, especially in complex hardware driver models, where developers need to manually sort out and track the communication and control information of hardware devices.

Method used

By modifying the configuration file of the virtual monitoring layer, deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, generating a mapping error, and pre-registering the linked list virtual IO device in the virtual monitoring layer, traversing the linked list members to match the trapped Device, record the driver operation log and save it to the shared memory.

Benefits of technology

It simplifies the RTOS driver development process, improves the stability and performance of the driver, and provides detailed communication and control information support by recording the register information of the hardware device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118519859B
    Figure CN118519859B
Patent Text Reader

Abstract

The present invention discloses a method, device and storage medium for obtaining driver information, the method comprising: modifying a configuration file of a monitoring layer, wherein the modification content comprises deleting the mapping relationship between the physical address of a hardware driver register address and the virtual physical address; pre-registering a linked list virtual IO device in a virtual monitoring layer, and storing the starting address and size of each device driver in a member data structure of the linked list virtual IO device; when a mapping error occurs, traversing the members of the linked list member linked list virtual IO device, matching the trapped starting address with the address space of each device driver, and determining the trapped device according to the matching result; recording the access address, read-write data, size and read-write attributes of the corresponding register of the trapped device to generate a driver operation log, and saving the driver operation log to the shared memory of the virtual monitoring layer. It is convenient for developers to obtain the communication and control information of hardware devices according to the recorded information, and provides information support for the development of drivers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of hardware driver technology, and in particular to a method, device and storage medium for obtaining driver information. Background Art

[0002] The ecological development of Linux drivers is an evolving process. Through the joint efforts of the community and continuous technological progress, the Linux driver ecosystem has been continuously growing and improving, providing stable and efficient hardware support for the majority of users. With the development of hardware technology, new hardware devices continue to emerge, and the Linux community continues to add support for new hardware. This includes various hardware types such as CPU architecture, graphics cards, network cards, sound cards, storage devices, etc. At the same time, Linux drivers are constantly enhancing and optimizing their functions to meet new functional requirements, improve performance, and improve stability.

[0003] With the emergence of emerging technologies, such as artificial intelligence, the Internet of Things, and edge computing, the demand for driver support for related hardware on real-time operating systems (RTOS) is also increasing. Compared with the Linux system with a complete driver ecosystem, the driver ecosystem of the RTOS system is relatively poor. Some RTOS systems may be customized for specific hardware platforms or application scenarios, so it is necessary to provide driver support for these dedicated hardware. Or some application scenarios have high requirements for customized development of real-time operating systems, so it is necessary to develop customized drivers for specific hardware and application scenarios. This requires developers to write drivers for the RTOS system themselves.

[0004] When writing RTOS drivers, it is necessary to refer to existing Linux drivers with good performance. The driver model of the Linux kernel is a complex framework. Developers need to comb through the Linux kernel code layer by layer, from the unified kernel interface and framework to the complex diversity of hardware and version compatibility, and finally track the communication and control information of the hardware devices. This is a time-consuming and error-prone process. Summary of the invention

[0005] The embodiment of the present invention provides a method, device and storage medium for obtaining driver information, so as to solve the technical problem of obtaining Linux driver information for writing RTOS driver in the prior art, which is time-consuming and error-prone.

[0006] In a first aspect, an embodiment of the present invention provides a method for obtaining driver information, comprising:

[0007] Modify the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error;

[0008] Pre-registering a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver;

[0009] When a mapping error occurs, the members of the linked list virtual IO device are traversed, and the trapped start address is matched with the address space of each device driver, and the trapped device is determined according to the matching result;

[0010] The access address, read / write data, size and read / write attributes of the corresponding register of the trapped device are recorded to generate a driver operation log, and the driver operation log is saved in the shared memory of the virtual monitoring layer.

[0011] In a second aspect, an embodiment of the present invention further provides a device for obtaining driver information, including:

[0012] A modification module is used to modify the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address so as to generate a mapping error;

[0013] A registration module is used to pre-register a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver;

[0014] The traversal module is used to traverse the members of the linked list virtual IO device when a mapping error occurs, match the trapped start address with the address space of each device driver, and determine the trapped device according to the matching result;

[0015] The recording module is used to record the access address, read and write data, size and read and write attributes of the corresponding register of the trapped device to generate a driver operation log, and save the driver operation log to the shared memory of the virtual monitoring layer.

[0016] In a third aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions are used to execute the driver information acquisition method provided in the above embodiment when executed by a computer processor.

[0017] The driver information acquisition method, device and storage medium provided by the embodiment of the present invention modify the configuration file of the virtual monitoring layer, and the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error; pre-registering a linked list virtual IO device in the virtual monitoring layer, and storing the starting address and size of each device driver in the member data structure of the linked list virtual IO device; when a mapping error occurs, traversing the members of the linked list member linked list virtual IO device, matching the trapped starting address with the address space of each device driver, and determining the trapped device according to the matching result; recording the access address, read and write data, size and read and write attributes of the corresponding register of the trapped device to generate a driver operation log, and saving the driver operation log to the shared memory of the virtual monitoring layer. By deleting the mapping relationship between the actual physical address and the virtual physical address of the mapped hardware register to generate a mapping error, and when a mapping error occurs, determining the device with an error, and recording various information of the corresponding register, the information in each register in the device driver can be fully recorded, which is convenient for developers to obtain the communication and control information of the hardware device according to the recorded information, and provides information support for the development of the driver. It greatly simplifies the process and difficulty of RTOS driver development for developers and improves the stability and performance of the driver. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0019] Figure 1 It is a schematic diagram of the principle of driver conversion in the driver information acquisition method provided in the first embodiment of the present invention;

[0020] Figure 2 is a flowchart of a method for obtaining driver information provided by Embodiment 1 of the present invention;

[0021] Figure 3 It is a schematic diagram of the mapping relationship between the physical address, the virtual physical address and the intermediate physical address of the hardware driver register address in the driver information acquisition method provided in the first embodiment of the present invention;

[0022] Figure 4 is a flowchart of a method for obtaining driver information provided by Embodiment 2 of the present invention;

[0023] Figure 5 It is a structural diagram of a device for acquiring driver information provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0024] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0025] Embodiment 1

[0026] Figure 2 : is a flowchart of a method for obtaining driver information provided by Embodiment 1 of the present invention. This embodiment is applicable to the case of obtaining driver information. The method can be executed by a device for obtaining driver information, and specifically includes the following steps:

[0027] Step 110, modifying the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error.

[0028] Figure 1 This is a schematic diagram of the principle of driver conversion in the driver information acquisition method provided in the first embodiment of the present invention. Figure 1 and Figure 2 In this embodiment, the monitoring layer can be a hardware-assisted virtualization layer that implements isolation control of system resources by dividing physical resources and limiting virtual machine access to these resources. The monitoring layer can run at a high level of exception level. In the monitoring layer, the monitoring layer is allowed to control the memory view. It also controls the memory-mapped resources that the system can access, and which locations of these resources correspond to the VM address space.

[0029] The monitoring layer is equipped with a memory mapping table to realize the conversion between the real memory address and the virtual address. In order to obtain the information, the configuration file is modified. Specifically, the mapping relationship between the physical address of the hardware driver register address and the virtual physical address is deleted, resulting in a mapping error, so that the system falls into the virtual monitoring layer when using the driver.

[0030] Figure 3 Schematic diagram of the mapping relationship between the physical address, virtual physical address and intermediate physical address of the hardware driver register address in the driver information acquisition method provided in the first embodiment of the present invention, see Figure 3 , it can be seen that the hardware physical address PA can be mapped to the intermediate physical address IPA, and IPA can be mapped to the operating system kernel virtual address VA.

[0031] In this embodiment, it is necessary to modify the configuration file of the virtual monitoring layer before pre-registering the linked list virtual IO device in the virtual monitoring layer, and the method can also add the following steps: after the Linux system is started, load the driver module. Since Linux itself is a single kernel mechanism, the single kernel is very efficient because all contents are integrated together. Linux modules can be loaded into the kernel space by static or dynamic methods. When a module is loaded into the kernel, it becomes part of the kernel code. The module can be a collection of functions and data types compiled as an independent program. Since it is necessary to start the driver of the corresponding device after the virtual monitoring layer is started, it is necessary to load the driver module accordingly after the Linux system is started. The conventional system and driver simultaneous startup method cannot be adopted.

[0032] Step 120, pre-registering a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver.

[0033] Since the system can correspond to multiple devices, it is necessary to determine the corresponding device that needs to read the driver information from multiple devices. Therefore, the device needs to be managed accordingly in the virtual monitoring layer. Optionally, a linked list virtual IO device is pre-registered in the virtual monitoring layer, which adopts a linked list method. In the linked list, each node can correspond to a virtual device. Correspondingly, the data structure of each node stores the starting address and size corresponding to the device driver.

[0034] Step 130, when a mapping error occurs, traverse the members of the linked list virtual IO device, match the trapped start address with the address space of each device driver, and determine the trapped device according to the matching result.

[0035] After deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, a trap will occur in the driver. The virtual monitoring layer will traverse the linked list members, match the trapped address with the address space of the device driver, and find the device that needs to be driven for simulation.

[0036] Step 140 , recording the access address, read / write data, size and read / write attributes of the corresponding register of the trapped device to generate a driver operation log, and saving the driver operation log to the shared memory of the virtual monitoring layer.

[0037] Exemplarily, the operation of the device driver can be recorded first, and then the corresponding log composed of access address, read and write data, size, read and write attributes, etc. can be obtained through the mapping table in the virtual monitoring layer, and the log can be written into the shared memory of the virtual monitoring layer. Wherein, the shared memory is a memory segment reserved when the Linux system is started, and the reserved memory segment establishes a page table mapping of the CPU permissions of the monitoring layer running the reserved memory segment when the virtual monitoring layer is initialized. Since the above contents are all obtained in the virtual monitoring layer, it is necessary to establish a memory segment available to the virtual monitoring layer for use as shared memory. Exemplarily, the memory segment reserved when the Linux system is started is required to achieve complete isolation from the Linux system, and when the virtual monitoring layer is initialized, a page table mapping of the CPU permissions of the virtual monitoring layer running is established, so that the virtual monitoring layer can write the corresponding data content to the reserved memory segment. Further, the application layer can use the mmap mapping mechanism to map the reserved memory segment to the process address space. That is, by using the mmap mechanism, the process address space is consistent with the content stored in the reserved memory segment, so that the user can use the application layer in the Linux system to read the driver operation log stored in the preset memory segment in the virtual monitoring layer.

[0038] Optionally, the shared memory uses a circular buffer to store log data, inserting the log into the tail of the circular buffer; the application layer process reads the log data from the head of the circular buffer in the process address space, and saves the log data to the disk. The use of a circular buffer can form a consumer-producer model, which is convenient for timely acquisition of log data, and the use of a circular buffer can effectively avoid exceptions caused by log data overflow.

[0039] This embodiment modifies the configuration file of the virtual monitoring layer, and the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error; pre-registering the linked list virtual IO device in the virtual monitoring layer, and saving the starting address and size of each device driver in the member data structure of the linked list virtual IO device; when a mapping error occurs, traverse the members of the linked list member linked list virtual IO device, match the trapped starting address with the address space of each device driver, and determine the trapped device according to the matching result; record the access address, read and write data, size and read and write properties of the corresponding register of the trapped device to generate a driver operation log, and save the driver operation log to the shared memory of the virtual monitoring layer. By deleting the mapping relationship between the actual physical address and the virtual physical address of the mapped hardware register to generate a mapping error, and when a mapping error occurs, determine the device with an error, and record various information of the corresponding register, the information in each register in the device driver can be fully recorded, which is convenient for developers to obtain the communication and control information of the hardware device according to the recorded information, and provides information support for the development of the driver. It greatly simplifies the process and difficulty of RTOS driver development for developers, and improves the stability and performance of the driver.

[0040] Embodiment 2

[0041] Figure 4 It is a flow chart of the driver information acquisition method provided in the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and the access address, read-write data, size and read-write attributes of the register corresponding to the trapped device are recorded, and are specifically optimized as follows: reading the first exception feature register and the second exception feature register, the first exception feature register includes the high address of the exception address, and the second exception feature register includes the low address of the exception address; combining the high address of the exception address and the low address of the exception address to obtain the address where the exception occurs; reading the access address, read-write data, size and read-write attributes corresponding to the exception address from the specific instruction feature field in the exception comprehensive feature register.

[0042] See also Figure 4 , the driver information acquisition method comprises:

[0043] Step 210, modifying the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error.

[0044] Step 220, pre-registering a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver.

[0045] Step 230, when a mapping error occurs, traverse the members of the linked list virtual IO device, match the trapped start address with the address space of each device driver, and determine the trapped device according to the matching result.

[0046] Step 240: read a first abnormality feature register and a second abnormality feature register, wherein the first abnormality feature register includes a high address of the abnormal address, and the second abnormality feature register includes a low address of the abnormal address.

[0047] When the Linux operating system generates an exception due to lack of mapping relationship, the first exception characteristic register and the second exception characteristic register are first read in the code of the virtual monitoring layer, which respectively contain the high address and the low address of the exception address, and the two are combined to obtain the address where the exception occurs.

[0048] Step 250, combining the high address of the abnormal address and the low address of the abnormal address to obtain the address where the abnormality occurs.

[0049] The first abnormal feature register and the second abnormal feature register respectively contain the high address and the low address of the address where the abnormality occurs. Therefore, the address where the abnormality occurs can be obtained by combining the two. Specifically, the high address of the number of bits set by the first abnormal feature register and the low address of the number of bits set by the second abnormal feature register can be taken respectively. The two are combined according to the number of bits, that is, the high address of the first abnormal feature register and the low address of the second abnormal feature register are combined to generate a new address, that is, the address where the abnormality occurs.

[0050] Step 260, reading the access address, read / write data, size and read / write attributes of the exception address from the specific instruction feature field in the exception comprehensive feature register.

[0051] In the arm64 architecture, the CPU's exception comprehensive feature register, the specific instruction feature field of the exception comprehensive feature register contains information related to the specific instruction that caused the exception. That is, the information at the time of the exception will be saved in this register. Exemplarily, the seventh bit of the specific instruction feature field of the exception comprehensive feature register is 1, indicating a write operation, and 0 is a read operation. Bits 17 to 21 of the specific instruction feature field of the exception comprehensive feature register represent the target register number. The target register number can be used to read the contents of the target register from the stack, and the content is the data to be written to the exception address when an exception occurs.

[0052] Step 270: Generate a driver operation log based on the access address, read / write data, size, and read / write attributes of the abnormal address, and save the driver operation log to the shared memory of the virtual monitoring layer.

[0053] This embodiment optimizes the access address, read / write data, size and read / write attributes of the corresponding register of the trapped device by recording the access address, read / write data, size and read / write attributes as follows: reading the first abnormal feature register and the second abnormal feature register, wherein the first abnormal feature register includes the high address of the abnormal address and the second abnormal feature register includes the low address of the abnormal address; combining the high address of the abnormal address and the low address of the abnormal address to obtain the address where the abnormality occurs; reading the access address, read / write data, size and read / write attributes corresponding to the abnormal address from the specific instruction feature field in the abnormal comprehensive feature register. By using the above optimization scheme, the virtual monitoring layer can be used to query the abnormal specific information in the register of the CPU, and obtain the abnormal register address and the corresponding operation information. By using the above method, the detailed register information of the device driver operation can be accurately captured in the virtual monitoring layer.

[0054] In a preferred implementation of this embodiment, the access address, read / write data, size and read / write attributes corresponding to the trapped device can also be recorded to generate a driver operation log, which is specifically optimized as follows: the application layer process of the driver program test program is run to perform multi-scenario testing, and the access address, read / write data, size and read / write attributes corresponding to the trapped device are recorded to generate a driver operation log. Since multiple registers are involved in the driver of each hardware device, a single operation cannot cover all registers. Therefore, in this embodiment, the test program can be run, specifically, the application layer test process can be applied in the Linux operating system, and the application layer test process can cover all test scenarios, and the access address, read / write data, size and read / write attributes corresponding to the trapped device are recorded to generate a driver operation log. Further, the method can also add the following steps: execute the captured hardware operation in the virtual monitoring layer, and return the execution result to the operating system. In addition to recording the hardware operation, the captured hardware operation needs to be executed in the hypervisor, and the execution result is returned to the operating system. For example, if the driver writes 0xfe08 data to the address 0x28008000, the virtual monitoring layer will intercept the operation and write 0xfe08 to the real address 0x28008000 in the Linux system. This ensures the normal operation of the operating system and the correctness of the hardware device status. The operating system cannot perceive the existence of the virtual monitoring layer, and the hardware driver can also achieve normal communication.

[0055] Embodiment 3

[0056] Figure 4 is a schematic diagram of the structure of the device for obtaining driver information provided by the third embodiment of the present invention, see Figure 5 , the driver information acquisition device comprises:

[0057] A modification module 310 is used to modify the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error;

[0058] A registration module 320 is used to pre-register a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver;

[0059] The traversal module 330 is used to traverse the members of the linked list virtual IO device when a mapping error occurs, match the trapped start address with the address space of each device driver, and determine the trapped device according to the matching result;

[0060] The recording module 340 is used to record the access address, read / write data, size and read / write attributes of the corresponding register of the trapped device to generate a driver operation log, and save the driver operation log to the shared memory of the virtual monitoring layer.

[0061] The driver information acquisition device provided in this embodiment modifies the configuration file of the virtual monitoring layer, and the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error; pre-registering the linked list virtual IO device in the virtual monitoring layer, and saving the starting address and size of each device driver in the member data structure of the linked list virtual IO device; when a mapping error occurs, traverse the members of the linked list member linked list virtual IO device, match the trapped starting address with the address space of each device driver, and determine the trapped device according to the matching result; record the access address, read and write data, size and read and write attributes of the corresponding register of the trapped device to generate a driver operation log, and save the driver operation log to the shared memory of the virtual monitoring layer. By deleting the mapping relationship between the actual physical address and the virtual physical address of the mapped hardware register to generate a mapping error, and when a mapping error occurs, determine the device with an error, and record various information of the corresponding register, the information in each register in the device driver can be fully recorded, which is convenient for developers to obtain the communication and control information of the hardware device according to the recorded information, and provides information support for the development of the driver. It greatly simplifies the process and difficulty of RTOS driver development for developers, and improves the stability and performance of the driver.

[0062] Based on the above embodiments, the recording module includes:

[0063] A first reading unit, configured to read a first abnormality feature register and a second abnormality feature register, wherein the first abnormality feature register includes a high address of the abnormal address, and the second abnormality feature register includes a low address of the abnormal address;

[0064] A combining unit, used for combining a high address of the abnormal address with a low address of the abnormal address to obtain an address where the abnormality occurs;

[0065] The second reading unit is used to read the access address, read / write data, size and read / write attributes corresponding to the abnormal address from the specific instruction feature field in the abnormal comprehensive feature register.

[0066] Based on the above embodiments, the device further includes:

[0067] Loading module, used to load the driver module after the Linux system starts.

[0068] Based on the above embodiments, the recording module includes:

[0069] The running unit is used to run the application layer process of the test program of the driver program to perform multi-scenario testing, and record the access address, read and write data, size and read and write properties corresponding to the trapped device to generate a driver operation log.

[0070] Based on the above embodiments, the device further includes:

[0071] The execution unit is used to execute the captured hardware operations in the virtual monitoring layer and return the execution results to the operating system.

[0072] Based on the above embodiments, the shared memory is a memory segment reserved when the Linux system is started. When the virtual monitoring layer is initialized, a page table mapping of the CPU permissions of the virtual monitoring layer running in the reserved memory segment is established.

[0073] Based on the above embodiments, the device further includes:

[0074] The mapping module is used to map the reserved memory segment to the process address space by calling the mmap mapping mechanism by the application layer.

[0075] On the basis of the above embodiments, the shared memory uses a ring buffer to store log data, and inserts the log into the tail of the ring buffer;

[0076] Accordingly, the device further comprises:

[0077] The saving module is used to read the log data from the head of the circular buffer area of ​​the process address space by using the application layer process, and save the log data to the disk.

[0078] The driver information acquisition device provided in the embodiment of the present invention can execute the driver information acquisition method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0079] Embodiment 4

[0080] Embodiment 4 of the present invention further provides a storage medium containing computer executable instructions, and when the computer executable instructions are executed by a computer processor, the computer executable instructions are used to execute any of the driver information acquisition methods provided in the above embodiments.

[0081] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.

[0082] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0083] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0084] Computer program code for performing the operation of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or device. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0085] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for obtaining driver information, It is characterized in that include: Modify the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address, so as to generate a mapping error; Pre-registering a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver; When a mapping error occurs, the members of the linked list member linked list virtual IO device are traversed, and the trapped start address is matched with the address space of each device driver, and the trapped device is determined according to the matching result; The access address, read / write data, size and read / write attributes of the corresponding register of the trapped device are recorded to generate a driver operation log, and the driver operation log is saved in the shared memory of the virtual monitoring layer.

2. The method according to claim 1, It is characterized in that The recording of the access address, read / write data, size and read / write attributes of the register corresponding to the trapped device includes: Reading a first abnormality feature register and a second abnormality feature register, wherein the first abnormality feature register includes a high address of the abnormal address, and the second abnormality feature register includes a low address of the abnormal address; Combine the high address of the exception address and the low address of the exception address to obtain the address where the exception occurred; The access address, read / write data, size and read / write attributes corresponding to the exception address are read from the specific instruction feature field in the exception comprehensive feature register.

3. The method according to claim 1, It is characterized in that Before pre-registering the linked list virtual IO device in the virtual monitoring layer, after modifying the configuration file of the virtual monitoring layer, the method further includes: After the Linux system starts, load the driver module.

4. The method according to claim 1, It is characterized in that The recording of the access address, read / write data, size and read / write attributes corresponding to the trapped device to generate a driver operation log includes: The application layer process of the test program of the driver is run to perform multi-scenario testing, and the access address, read and write data, size and read and write attributes corresponding to the trapped device are recorded to generate a driver operation log.

5. The method according to claim 4, It is characterized in that The method further comprises: The captured hardware operations are executed in the virtual monitoring layer and the execution results are returned to the operating system.

6. The method according to claim 1, It is characterized in that The shared memory is a memory segment reserved when the Linux system is started. When the virtual monitoring layer is initialized, the reserved memory segment establishes a page table mapping of the CPU permissions of the virtual monitoring layer running the reserved memory segment.

7. The method according to claim 6, It is characterized in that The method further comprises: The reserved memory segment is mapped to the process address space by calling the mmap mapping mechanism by the application layer.

8. The method according to claim 7, It is characterized in that The shared memory uses a ring buffer to store log data, and inserts the log into the tail of the ring buffer; Accordingly, the method further includes: The application layer process reads the log data from the head of the ring buffer in the process address space and saves the log data to the disk.

9. A device for acquiring driver information, It is characterized in that include: A modification module is used to modify the configuration file of the virtual monitoring layer, wherein the modification content includes deleting the mapping relationship between the physical address of the hardware driver register address and the virtual physical address so as to generate a mapping error; A registration module is used to pre-register a linked list virtual IO device in the virtual monitoring layer, wherein the member data structure of the linked list virtual IO device stores the starting address and size of each device driver; The traversal module is used to traverse the members of the linked list virtual IO device when a mapping error occurs, match the trapped start address with the address space of each device driver, and determine the trapped device according to the matching result; The recording module is used to record the access address, read and write data, size and read and write attributes of the corresponding register of the trapped device to generate a driver operation log, and save the driver operation log to the shared memory of the virtual monitoring layer.

10. A storage medium containing computer executable instructions, It is characterized in that The computer executable instructions are used to execute the driver information acquisition method according to any one of claims 1 to 8 when executed by a computer processor.