Device processing method, product, server and medium

By establishing device space in the boot system and pre-executing device drivers within it, the problem of degrading computer system security and reliability caused by defective or malware device drivers is solved, and the effect of improving system security and reliability is achieved. .

CN119227088BActive Publication Date: 2025-02-25INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411721918.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-02-25
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

When a device driver with partial defects or maliciously implanted with special software code is loaded onto the computer to run, the security and reliability of the computer system are reduced.

Method used

By establishing a device space in the boot system, the driver to be called is stored in the storage space corresponding to the device space, and the driver is executed in the device space. After the driver is executed successfully, the address of the driver to be called is mapped to the address corresponding to the boot system, and the driver to be called is executed at the address corresponding to the boot system.

Benefits of technology

This method isolates the boot system and the driver through the device space, pre-executes the driver in the device space, ensures the driver safety, and improves the reliability and security of the computer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227088B_ABST
    Figure CN119227088B_ABST
Patent Text Reader

Abstract

The present invention discloses a device processing method, product, server and medium, and relates to the field of computer technology. A device space is established in a boot system, a driver to be called is stored in a storage space corresponding to the device space, and the driver is executed in the device space. When the driver is successfully executed, the address corresponding to the driver to be called is mapped to the address corresponding to the boot system, and the driver to be called is executed at the address corresponding to the boot system. In this method, the boot system and the driver are isolated using the device space, and the driver is pre-executed in the device space. If the execution is successful, it means that the driver has no defects or has been tampered with, which ensures that the boot system can call a safe driver and improves the reliability and security of the computer system; in addition, when the execution result is successful, the driver to be called is executed at the target address. Since the target address is the corresponding address in the boot system, it can be ensured that the device to be initialized is initialized in the expected manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a device processing method, product, server and medium. Background Art

[0002] With the development of technology, bus interface devices (such as devices that comply with the high-speed Peripheral Component Interconnect Express (PCIe) standard) are of various types and functions. After the bus interface device is installed in the computer system, it needs to be initialized and configured by the computer system's boot system (such as the Basic Input Output System (BIOS)) before it can be used. Some bus interface devices with special functions also require the boot system to call some programs of the bus interface device to further initialize the bus interface device.

[0003] However, when some device drivers that are defective or have been maliciously implanted with special software codes are loaded into the computer by the boot system and run, they will affect the security and reliability of the computer system or cause damage to the computer, such as causing a crash when executing a certain device driver.

[0004] It can be seen that how to reduce the occurrence of system security problems and instability problems caused by device drivers and improve the reliability and security of computer systems are technical problems that people in this field urgently need to solve. Summary of the invention

[0005] The purpose of the present invention is to provide a device processing method, product, server and medium to solve the technical problem that when a device driver that is partially defective or maliciously implanted with special software code is loaded into a computer by a boot system and runs, the security and reliability of the computer system are reduced.

[0006] In order to solve the above technical problems, the present invention provides a device processing method, comprising:

[0007] Acquire information of a driver to be called of a bus interface device to be initialized, a device space corresponding to the driver to be called, and a storage space corresponding to the device space; wherein the device space is a space in a boot system; and the information of the storage space at least includes a storage address;

[0008] storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space;

[0009] Executing the driver to be called located in the storage space in the device space;

[0010] When the execution result is detected to be successful, the address corresponding to the driver to be called is mapped to the target address; wherein the target address is the corresponding address in the boot system;

[0011] The driver to be called is executed at the target address to complete the initialization process of the bus interface device to be initialized.

[0012] On the one hand, before executing the driver to be called in the storage space in the device space, the method further includes:

[0013] Acquire a table entry of a device space control block; wherein the table entry of the device space control block at least includes a table entry corresponding to device information and a table entry corresponding to driver information;

[0014] When a bus interface device is detected and when information about a storage space corresponding to the device space is obtained, data corresponding to an entry of the device space control block is obtained;

[0015] The device space control block is updated according to the data corresponding to the table entry of the device space control block, and the state of the device space is set to a creation state.

[0016] On the other hand, after acquiring the information of the storage space corresponding to the device space and before storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, the method further includes:

[0017] Determine whether the storage address corresponding to the device space exists;

[0018] If yes, the process proceeds to the step of storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space;

[0019] If not, return to obtain the information of the storage space corresponding to the device space.

[0020] On the other hand, after storing the to-be-called driver in the storage space corresponding to the device space according to the information of the storage space, the method further includes:

[0021] Updating the state of the device space from the creation state to the ready state;

[0022] Before executing the driver to be called in the storage space in the device space, the method further includes:

[0023] Reading the state of the device space;

[0024] If it is detected that the state of the device space is the ready state, entering the step of executing the driver to be called located in the storage space in the device space;

[0025] If it is detected that the state of the device space is not the ready state, the process returns to the step of reading the state of the device space.

[0026] On the other hand, after obtaining that the state of the device space is the ready state, before entering the step of executing the driver to be called in the storage space in the device space, the method further includes:

[0027] Determine whether the storage address corresponding to the device space exists;

[0028] If not, updating the state of the device space to a failed state;

[0029] If yes, read the driver entry address recorded in the device space control block, update the state of the device space from the ready state to the running state, and enter the step of executing the driver to be called in the storage space in the device space;

[0030] The executing the driver to be called in the storage space in the device space includes:

[0031] The driver to be called located in the storage space is executed in the device space and at the driver entry address.

[0032] On the other hand, the table entries of the device space control block also include table entries corresponding to timers; after reading the driver entry address recorded in the device space control block and before entering the step of executing the driver to be called in the storage space in the device space, the method further includes:

[0033] Start the timer;

[0034] After the successful execution result is detected, it also includes:

[0035] Stop the timer and get the current count value of the timer;

[0036] The timing time of the timer in the device space control block is recorded as the current count value and the device space state is updated from the running state to the end state.

[0037] On the other hand, the table entry of the device space control block also includes a table entry of pointer backup;

[0038] Before starting the timer, the method further includes:

[0039] Acquire the current instruction position and the data generated by executing the current instruction, and use the current instruction position and the data generated by executing the current instruction as data corresponding to the entry of the pointer backup;

[0040] In the case of detecting success or failure of the execution result, the current instruction is returned for execution according to the data corresponding to the table entry backed up by the pointer.

[0041] On the other hand, if the execution result is failure and an error occurs during the execution, the method further includes:

[0042] Obtaining an interrupt service program triggered by a timer timeout, and updating the state of the device space from the running state to the failed state;

[0043] Restore the current instruction position and the data generated by executing the current instruction using the data corresponding to the table entry backed up by the pointer;

[0044] Return to the step of reading the driver entry address recorded in the device space control block, and exit the interrupt service program.

[0045] On the other hand, if the execution result is failure and there is no error during the execution, the method further includes:

[0046] updating the state of the device space that failed to execute from the running state to the failed state;

[0047] Acquire the device space whose state is the ready state;

[0048] Using the device space in the ready state as the device space to be scheduled;

[0049] Enter the step of executing the driver to be called located in the storage space in the device space.

[0050] On the other hand, the success or failure of the detection execution result includes at least one of the following ways:

[0051] Method 1:

[0052] Starting from the start timer, determine whether the execution is completed within the preset time;

[0053] If so, the execution result is determined to be successful;

[0054] If not, the execution result is determined to be a failure;

[0055] Method 2:

[0056] Receive information returned during the driver execution process to represent the execution status;

[0057] The success or failure of the execution result is determined according to the information used to characterize the execution status.

[0058] On the other hand, after the timing of the stop timer, the method further includes:

[0059] Acquiring the execution status of the driver in the preset device space in the boot system; wherein the execution status of the driver includes executing the driver or not executing the driver;

[0060] In the case where it is detected that the device space in which no driver is executed exists in the preset device space, the process returns to the step of executing the driver to be called in the storage space in the device space.

[0061] On the other hand, after detecting that all the device spaces have been executed, the method further includes:

[0062] Acquire the current state of each of the device spaces; wherein the current state of the device space includes an end state or a failure state;

[0063] When it is detected that the state of the device space is the end state, releasing the device space and the storage space corresponding to the device space, and removing the device space control block;

[0064] When it is detected that the state of the device space is a failure state, a prompt message indicating that the state of the device space is a failure state is output; the device space and a storage space corresponding to the device space are released, and the device space control block is removed.

[0065] In order to solve the above technical problem, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the above device processing method when executed by a processor.

[0066] In order to solve the above technical problem, the present invention further provides a server, comprising:

[0067] Memory for storing computer programs;

[0068] A processor is used to implement the steps of the above-mentioned device processing method when executing the computer program.

[0069] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above device processing method are implemented.

[0070] The beneficial effect of the present invention is that in the device processing method, a device space is established in the boot system, and the driver to be called is stored in the storage space corresponding to the device space, and then the driver can be executed in the device space. When the driver is successfully executed, the address corresponding to the driver to be called is mapped to the address corresponding to the boot system, and the driver to be called is executed at the address corresponding to the boot system. That is, in this method, the boot system and the driver are isolated using the device space, and the driver is pre-executed in the device space. Successful execution indicates that the driver has no defects or has been tampered with, that is, the driver is safe, and it is guaranteed as much as possible that the boot system can call a safe driver, thereby improving the reliability and security of the computer system; in addition, when the execution result is successful, the driver to be called is executed at the target address. Since the target address is the corresponding address in the boot system, it can be ensured that the device to be initialized is initialized in the expected manner.

[0071] In addition, by establishing a device space control block, the device information and driver information can be intuitively understood. The device space control block records counter information, so that the device space execution driver success or failure can be judged based on the counter information; the device space control block also records the pointer backup table entry and the data corresponding to the table entry (the current instruction position and the data generated by executing the current instruction), so that if the execution result is a failure and an error occurs during the execution process, the data corresponding to the stored pointer backup table entry can be used to restore the current instruction position and the data generated by executing the current instruction according to the interrupt service program triggered by the timer timeout, that is, the context recovery of the backup program is triggered by the interrupt program.

[0072] Before storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, it is first determined whether the storage address corresponding to the device space exists (ie, whether it is a valid address), thereby ensuring that the driver can be stored.

[0073] By setting the status of the device space (including creation, ready, running, completion or failure status), the status of each device space can be intuitively understood. In the event of execution failure, the device space in the ready state can be directly selected to call to avoid repeated operation. Compared with the method of not marking the device space status, the method provided by the present invention can quickly locate the device space in various states.

[0074] After detecting that all device spaces have been executed, the device space, the storage space corresponding to the device space, and the device space control block are recycled, reducing the space occupied by the device space; in addition, for device spaces in a failed state, an alarm is issued before recycling, so that the user can intuitively understand the status of the device space execution driver.

[0075] In addition, the present invention also provides a computer program product, a server, and a computer-readable storage medium, which have the same or corresponding technical features as the above-mentioned device processing method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0077] Figure 1 A flow chart of a device processing method provided by an embodiment of the present invention;

[0078] Figure 2 A flow chart of a device space processing method provided by an embodiment of the present invention;

[0079] Figure 3 A schematic diagram of a device space state provided by an embodiment of the present invention;

[0080] Figure 4 An architecture diagram of a device driver processing provided by an embodiment of the present invention;

[0081] Figure 5 A flowchart of a method for creating a device space provided by an embodiment of the present invention;

[0082] Figure 6 A flowchart of a method for loading a driver in a device space provided by an embodiment of the present invention;

[0083] Figure 7 A flowchart of a method for executing a drive provided by an embodiment of the present invention;

[0084] Figure 8 A flowchart of a method for driving execution exception handling provided by an embodiment of the present invention;

[0085] Fig. 9 A flow chart of a device space recovery method provided by an embodiment of the present invention;

[0086] Fig.10 A structural diagram of a server provided in another embodiment of the present invention. DETAILED DESCRIPTION

[0087] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0088] The core of the present invention is to provide a device processing method, product, server and medium to solve the technical problem that when some device drivers that are defective or maliciously implanted with special software codes are loaded into the computer by the boot system and run, the security and reliability of the computer system are reduced.

[0089] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 A flow chart of a device processing method provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes:

[0090] S1: Acquire information about a driver to be called of a bus interface device to be initialized, a device space corresponding to the driver to be called, and a storage space corresponding to the device space;

[0091] The device space is the space in the boot system; the information of the storage space at least includes the storage address;

[0092] S2: storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space;

[0093] S3: Execute the driver to be called in the storage space in the device space;

[0094] S4: When the execution result is detected to be successful, the address corresponding to the driver to be called is mapped to the target address; wherein the target address is the corresponding address in the boot system;

[0095] S5: Execute the driver to be called at the target address to complete the initialization process of the bus interface device to be initialized.

[0096] The bus interface device to be initialized may be various PCIe devices (such as a network card, a Redundant Array of Independent Disks (Raid) card, a Graphics Processing Unit (GPU) card, etc.). There is no limitation on the driver to be called for the bus interface device to be initialized, which is determined according to actual conditions.

[0097] After the bus interface device is installed in the computer system, the boot system of the computer system initializes and configures each bus interface device. During the initialization process, the boot system may need to call part of the program of the bus interface device to further initialize the bus interface device. When the boot system calls a device driver that has defects or is maliciously implanted with special software code, it will affect the security and reliability of the system. Therefore, in the embodiment of the present invention, a device space (Device Space, DS) is set in the boot system. The device space is a virtual space provided by the boot system for each device driver. This space is created at the beginning of device initialization and has an independent virtual address space. In the process of creating the device space, it is necessary to allocate storage space (i.e., memory space) for the device space. Specifically, a function can be called (such as using malloc or calloc functions) according to the size of the required storage space to dynamically allocate memory from the heap memory.

[0098] After obtaining the information of the driver to be called of the bus interface device to be initialized, the device space corresponding to the driver to be called, and the storage space corresponding to the device space, query the driver address of the bus interface device to be initialized, and copy the driver to be called to the storage (memory) area pointed to by the device space (i.e. load the driver). Obtain the driver entry address of the driver to be called, and execute the driver to be called located in the storage space in the device space (i.e. run the driver). The result of executing the driver can be successful execution or failed execution. Detecting the success or failure of the execution result includes at least one of the following methods. Method 1: Starting from the timing of the start timer, determine whether the execution is completed within the preset time length; if so, determine that the execution result is successful; if not, determine that the execution result is failed. There is no limit on the preset time length, which is determined according to the actual situation. Method 2: Receive information returned during the execution of the driver for characterizing the execution status; determine whether the execution result is successful or failed according to the information for characterizing the execution status. If the information characterizing the execution status is successful, it means that the execution is successful; if the information characterizing the execution status is failed, it means that the execution failed.

[0099] In order to avoid the impact of device drivers with defects or maliciously implanted special software codes on system security, the present invention, when detecting the successful execution result, indicates that the driver to be called does not have defects or maliciously implanted special software codes. Further, the address set by the driver to be called is remapped to the boot system space for use by the operating system (OS Operating System, OS) and other system software. There is no limitation on the target address to which the address corresponding to the driver to be called is mapped, which is determined according to actual needs.

[0100] After the driver is executed in the device space, the device space can be reclaimed in order to reduce the space occupied by the device space. Figure 2A flow chart of a device space processing method provided by an embodiment of the present invention, such as Figure 2 As shown, the method includes:

[0101] S6: Create device space;

[0102] S7: Load driver;

[0103] S8: Run the driver;

[0104] S9: Reclaim device space.

[0105] In the device processing method provided in this embodiment, a device space is established in the boot system, and the driver to be called is stored in the storage space corresponding to the device space, and then the driver can be executed in the device space. When the driver is successfully executed, the address corresponding to the driver to be called is mapped to the address corresponding to the boot system, and the driver to be called is executed at the address corresponding to the boot system. That is, in this method, the boot system and the driver are isolated using the device space, and the driver is pre-executed in the device space. Successful execution indicates that the driver has no defects or has been tampered with, that is, the driver is safe, which ensures that the boot system can call a safe driver as much as possible, and improves the reliability and security of the computer system; in addition, when the execution result is successful, the driver to be called is executed at the target address. Since the target address is the corresponding address in the boot system, it can ensure that the device to be initialized is initialized in the expected manner.

[0106] In order to intuitively understand the status of each device space, multiple states are set for the device space. Figure 3 A schematic diagram of a device space state provided by an embodiment of the present invention, such as Figure 3 As shown, the device space status includes creation status, ready status, running status, completion status or failure status. At the same time, in order to facilitate the maintenance of device space information, before executing the driver to be called in the storage space in the device space, it also includes:

[0107] Acquire table entries of a device space control block; wherein the table entries of the device space control block at least include table entries corresponding to device information and table entries corresponding to driver information;

[0108] When the bus interface device is detected and when the information of the storage space corresponding to the device space is obtained, data corresponding to the table entry of the device space control block is obtained;

[0109] The device space control block is updated according to the data corresponding to the table entry of the device space control block, and the state of the device space is set to the creation state.

[0110] Figure 4 An architecture diagram of a device driver processing provided by an embodiment of the present invention, such as Figure 4As shown in the figure, the architecture includes an operating system, a boot system, and a bus interface device. The boot system includes a device space management engine (DSME), a device space control table (DSCT), multiple device spaces, and drivers corresponding to the bus interface devices running in each device space. The boot system provides a device space management module (i.e., a device space management engine), which is responsible for the creation, management, and recycling of drivers and device spaces; the device space management engine creates a device space for each executed driver, and the driver runs in the device space to complete the initialization and setting of the corresponding device, and stores the information that needs to be fed back to the boot system in the data exchange area for use by the boot system. The device space management module also provides a timer. When an error occurs in the device driver and the system crashes, the timer triggers a hardware interrupt to restore the processor to a normal state on site.

[0111] The device space information maintenance can be performed by the device space management engine to establish the table entries of the device space control block (DSCB Device Space Control Block, DSCB). It is worth noting that when there are multiple drivers to be called, multiple device space control blocks can be established to form the device space control table. Table 1 is a detailed definition of the device space control table entries.

[0112] Table 1

[0113]

[0114] When a bus interface device is detected, the device information (i.e., the last three items in Table 1) and driver information (i.e., the first three items in Table 1) in the device space control table item can be obtained. After obtaining the data corresponding to the information of the storage space corresponding to the device space (i.e., the data exchange area address in Table 1), fill in the data corresponding to the device space control table item, and then set the status of the device space to create.

[0115] The creation of device space mainly includes key steps such as creating a device space control block, allocating memory for the device space, and setting the ready state. Figure 5 A flowchart of a method for creating a device space provided by an embodiment of the present invention, such as Figure 5 As shown, the method includes:

[0116] S60: Discovery of devices;

[0117] S61: Create a device space control block, fill in device information, driver information, interaction data and timer timeout, and add the device space control block to the device space control table;

[0118] S62: Allocate memory space for the driver, and fill the first byte address of the memory into the device space control block;

[0119] S63: Set the device space state to the creation state.

[0120] The above process describes in detail the process of creating a device space. After the device space is created, the driver is loaded. In practice, when storing the driver to be called in the storage space corresponding to the device space, the address of the storage space to be stored may not exist, resulting in the driver to be called being unable to be stored in the corresponding position. In order to avoid this situation, after obtaining the information of the storage space corresponding to the device space, before storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, it also includes:

[0121] Determine whether the storage address corresponding to the device space exists;

[0122] If yes, the process proceeds to the step of storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space;

[0123] If not, return to get the information of the storage space corresponding to the device space.

[0124] After storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, the method further includes:

[0125] Update the state of the device space from the created state to the ready state.

[0126] The device space engine is responsible for loading the driver. After the driver is loaded, the state of the corresponding device space is set to the ready state, waiting for scheduling and execution. Figure 6 A flowchart of a method for loading a driver in a device space provided by an embodiment of the present invention is shown in FIG. Figure 6 As shown, the method includes:

[0127] S71: Read the device space control block;

[0128] S72: query and check the memory space address;

[0129] S73: Query the device driver address, copy the device driver to the memory area pointed to by the device space, and set the driver entry address in the device space control block;

[0130] S74; Update the device space control block and set the device space state to the ready state.

[0131] In practice, when there are multiple drivers to be called, in order to improve the efficiency of driver loading, the device space control block corresponding to each driver to be called in the device space control table is obtained, and the number of drivers to be called is determined according to the device information recorded in the device space control table; when it is detected that the number of drivers to be called is greater than the preset number, the addresses of each device driver are queried in parallel, the device driver programs are copied to the memory area pointed to by the device space corresponding to each driver to be called, and the driver entry address in the device space control block is set; wherein the preset number is at least greater than 2. In this method, in the case of multiple drivers to be called, the driver loading method is adopted to improve the efficiency of driver loading.

[0132] The above process describes in detail the process of driver loading in the device space. After the driver is loaded, the driver is run in the device space. Before executing the driver to be called in the storage space in the device space, it also includes:

[0133] Read the status of the device space;

[0134] If it is detected that the state of the device space is in the ready state, entering the step of executing the driver to be called in the storage space in the device space;

[0135] If it is detected that the state of the device space is not the ready state, the process returns to the step of reading the state of the device space.

[0136] After obtaining that the state of the device space is the ready state, before entering the step of executing the driver to be called in the storage space in the device space, the method further includes:

[0137] Determine whether the storage address corresponding to the device space exists;

[0138] If not, the status of the device space is updated to a failed status;

[0139] If so, read the driver entry address recorded in the device space control block, update the state of the device space from the ready state to the running state, and enter the step of executing the driver to be called in the storage space in the device space.

[0140] Executing the driver to be called in the storage space in the device space includes:

[0141] The driver to be called located in the storage space is executed in the device space and at the driver entry address.

[0142] In order to determine whether the device space executes the driver successfully or fails, the present invention also includes table entries corresponding to the timer in the table entries of the device space control block, such as the timer timeout time, timer count value and timer status in Table 1. After reading the driver entry address recorded in the device space control block, before entering the step of executing the driver to be called in the storage space in the device space, it also includes:

[0143] Start the timer;

[0144] After the successful execution result is detected, it also includes:

[0145] Stop the timer and get the current count value of the timer;

[0146] The timing time of the timer in the device space control block is recorded as the current count value and the device space state is updated from the running state to the end state.

[0147] After stopping the timer, the method further includes:

[0148] Obtaining the execution status of the driver in the preset device space in the boot system; wherein the execution status of the driver includes executing the driver or not executing the driver;

[0149] When it is detected that there is a device space in the preset device space where no driver is executed, the process returns to the step of executing the driver to be called in the storage space in the device space.

[0150] Regardless of whether the driver is executed successfully or failed in the device space, it may be necessary to restore to the position before the driver is executed. In order to find the position before the driver is executed, the table entries of the device space control block also include table entries for pointer backup, such as the program pointer backup and stack pointer backup in Table 1.

[0151] Before starting the timer, also include:

[0152] Obtain the current instruction position and the data generated by executing the current instruction, and use the current instruction position and the data generated by executing the current instruction as the data corresponding to the table entry of the pointer backup (i.e., backup program context);

[0153] When the execution result is detected to be successful or failed, the current instruction is executed according to the data corresponding to the table entry backed up by the pointer.

[0154] In order to enable those skilled in the art to better understand the execution drive process of the present invention, Figure 7 A flowchart of a method for executing a drive provided by an embodiment of the present invention is shown in FIG. Figure 7 As shown, the method includes:

[0155] S801: Read the device space control block;

[0156] S802: Determine whether the device space state is in the ready state; if so, proceed to step S803; if not, return to step S801;

[0157] S803: Determine whether the memory space is valid; if not, proceed to step S804; if yes, proceed to step S805;

[0158] S804: The update status is a failure status;

[0159] S805: Back up the program context and start the timer;

[0160] S806: Update the status to running status;

[0161] S807: Jump to the drive entrance;

[0162] S808: Determine whether the execution is successful; if not, proceed to step S813; if yes, proceed to step S809;

[0163] S809: copy the returned data;

[0164] S810: Update status to completed status;

[0165] S811: stop the timer;

[0166] S812: Determine whether all device spaces have completed execution; if so, end; if not, return to step S801;

[0167] S813: Determine whether an error occurs during execution; if so, proceed to step S814; if not, return to step S804;

[0168] S814: Wait for timer interrupt.

[0169] The execution of the device space can be parallel. The device space engine controls the execution of the driver through the device space control block, and passes parameters and returns data. Specifically, during the execution of the driver, the device space control block is read to check whether the state is ready, the memory space address is queried and checked, and the driver entry address in the device space control block is read. The timer is started and the device space state is updated to the running state. Jump to the driver entry address to execute the driver. When the driver returns normally, the interactive data is copied to the data area and the timer is stopped. The timing time is updated to the device space control block, and the device space state is updated to the end state.

[0170] For the case where the driver execution fails, the execution result includes failure and an error occurs during the execution process; or the execution result is failure and an error does not occur during the execution process. These are all called driver execution exceptions. For the case where the execution result is failure and an error occurs during the execution process, the device processing method also includes:

[0171] Get the interrupt service routine triggered by the timer timeout, and update the status of the device space from the running status to the failed status;

[0172] Use the data corresponding to the table entry backed up by the pointer to restore the current instruction position and the data generated by executing the current instruction;

[0173] Return to the step of reading the driver entry address recorded in the device space control block and exit the interrupt service routine.

[0174] If the execution result is a failure and there is no error during the execution, the device processing method also includes:

[0175] Update the status of the device space where the execution failed from the running status to the failed status;

[0176] Get the device space in the ready state;

[0177] The device space in the ready state is used as the device space to be scheduled;

[0178] Enter the step of executing the driver to be called in the storage space in the device space.

[0179] Figure 8 A flowchart of a method for driving execution exception handling provided by an embodiment of the present invention is shown in FIG. Figure 8 As shown, the method includes:

[0180] S815: timer interrupt trigger;

[0181] S816: Enter the interrupt service routine;

[0182] S817: Restore program context;

[0183] S818: Update the device space status to a failed status;

[0184] S819: Exit the interrupt service routine.

[0185] The device space starts to execute, and ends when the execution is successful; when the device space fails to execute (not when an error occurs during the execution process), the device space engine is executed and the device space execution is rescheduled (it is worth noting that since the device space that failed to execute has been marked as failed, when the device space is rescheduled, it will not run again, but a new device space schedule will be selected from the device space marked as ready); when the device space fails to execute (an error occurs during the execution process), the waiting timer times out, triggers the interrupt service program, sets the device space status to failure, restores the processor context, obtains the device space engine entry address, and finally exits the interrupt service program, that is, the interrupt handler restores the processor to the state before executing the device space.

[0186] In order to reduce the space occupied by the device space, after detecting that all device spaces have been executed, the device processing method further includes:

[0187] Obtain the current state of each device space; wherein the current state of the device space includes an end state or a failure state;

[0188] When it is detected that the state of the device space is the end state, the device space and the storage space corresponding to the device space are released, and the device space control block is removed;

[0189] When it is detected that the state of the device space is a failure state, a prompt message indicating that the state of the device space is a failure state is output; the device space and a storage space corresponding to the device space are released, and the device space control block is removed.

[0190] After all device spaces are executed, the device space engine selects the ones with the completed status for recycling. Before recycling, the driver return data is mapped to provide a device control interface for the operating system or other upper-level software. The device driver that failed to execute is recycled after the device space engine issues an alarm. The device is marked as a faulty device and is not presented to the operating system or other upper-level software. Fig. 9 A flow chart of a device space recovery method provided by an embodiment of the present invention, such as Fig. 9 As shown, the method includes:

[0191] S91: Get device space control block;

[0192] S92: Determine whether the device space is executed successfully; if not, proceed to step S93; if yes, proceed to step S94:

[0193] S93: Alarm prompt;

[0194] S94: Apply for memory and copy device driver;

[0195] S95: Map device address;

[0196] S96: Reclaim the device space control block, the device space, and the memory space corresponding to the device space;

[0197] S97: Determine whether all device space has been released; if so, end; if not, return to step S91.

[0198] The device driver is executed in the device space. After successful execution, it returns normally and sets the device space status to the end status. The device space management engine reclaims the device space and remaps the address. After failure, the device space status is set to failure, and the device space management engine reclaims the space, reducing the space occupied by the device space.

[0199] In the method provided in the embodiment of the present invention, refined management, control and isolation of driver execution are achieved by providing an independent device execution space (i.e., device space) for each device driver. The device driver is executed in the device space. After successful execution, the device space management engine remaps the driver, and the operating system or other software calls the device to provide an interface. The device space focuses on managing the device drivers during the initialization and configuration of the bus interface device, optimizing the uncertainty and security of the driver behavior, reducing system security issues and instability issues caused by device drivers, protecting computer firmware, software and data, and improving the reliability and security of the computer system; reducing system downtime and security incidents caused by single device problems, and greatly improving system security, reliability and compatibility. It is worth noting that the device processing method provided by the present invention is not limited to device drivers. In practice, any functional module that may be affected by external factors during execution can also be applied to the concept of the present invention and is within the scope of protection of the present invention.

[0200] In the above embodiments, the device processing method is described in detail, and the present invention also provides embodiments corresponding to the processing device and the server. It should be noted that the present invention describes the embodiments of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.

[0201] A processing device provided by an embodiment of the present invention, based on the perspective of functional modules, includes:

[0202] A first acquisition module is used to acquire information of a driver to be called of a bus interface device to be initialized, a device space corresponding to the driver to be called, and a storage space corresponding to the device space; wherein the device space is a space in a boot system; and the storage space information includes at least a storage address;

[0203] A storage module, used for storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space;

[0204] A first execution module, used for executing the driver to be called in the storage space in the device space;

[0205] A mapping module, used for mapping the address corresponding to the driver to be called to the target address when the execution result is detected to be successful; wherein the target address is the corresponding address in the boot system;

[0206] The second execution module is used to execute the driver to be called at the target address to complete the initialization processing of the bus interface device to be initialized.

[0207] In some embodiments, the processing device further comprises:

[0208] A second acquisition module is used to acquire table items of a device space control block; wherein the table items of the device space control block at least include table items corresponding to device information and table items corresponding to driver information;

[0209] A third acquisition module is used to acquire data corresponding to the table entry of the device space control block when the bus interface device is detected and when the information of the storage space corresponding to the device space is acquired;

[0210] The updating and setting module is used to update the device space control block according to the data corresponding to the table items of the device space control block, and set the state of the device space to the creation state.

[0211] In some embodiments, the processing device further comprises:

[0212] A first judgment module is used to judge whether the storage address corresponding to the device space exists; if so, the storage module is triggered; if not, the first acquisition submodule is triggered;

[0213] The first acquisition submodule is used to acquire information of the storage space corresponding to the device space.

[0214] In some embodiments, the processing device further comprises:

[0215] A first updating module, used for updating the state of the device space from a creation state to a ready state;

[0216] The processing device also includes:

[0217] The reading module is used to read the status of the device space;

[0218] The checking module is used to trigger the first execution module if it is detected that the state of the device space is in the ready state; if it is detected that the state of the device space is not in the ready state, return to trigger the reading module.

[0219] In some embodiments, the processing device further comprises:

[0220] The second judgment module is used to judge whether the storage address corresponding to the device space exists; if not, the second update module is triggered; if yes, the reading and updating module is triggered;

[0221] A second updating module, used for updating the state of the device space to a failure state;

[0222] A reading and updating module, used for reading the driver entry address recorded in the device space control block, updating the state of the device space from the ready state to the running state, and triggering the first execution module;

[0223] The first execution module is specifically used to execute the driver to be called located in the storage space at the driver entry address in the device space.

[0224] In some embodiments, the processing device further comprises:

[0225] A start module, used to start the timer;

[0226] The processing device also includes:

[0227] The stop and obtain module is used to stop the timer and obtain the current count value of the timer;

[0228] The recording and updating module is used to record the timing time of the timer in the device space control block as the current count value and to update the device space state from the running state to the end state.

[0229] In some embodiments, the processing device further comprises:

[0230] The acquisition and serving module is used to acquire the current instruction position and the data generated by executing the current instruction, and use the current instruction position and the data generated by executing the current instruction as the data corresponding to the table item of the pointer backup;

[0231] The detection and execution module is used to return and execute the current instruction according to the data corresponding to the table item backed up by the pointer when the detection execution result is successful or failed.

[0232] In some embodiments, the processing device further comprises:

[0233] The acquisition and update module is used to acquire the interrupt service program triggered by the timer timeout and update the state of the device space from the running state to the failed state;

[0234] The recovery module is used to restore the current instruction position and the data generated by executing the current instruction using the data corresponding to the table item backed up by the pointer; return to trigger the read and update module, and trigger the exit module;

[0235] The exit module is used to exit the interrupt service routine.

[0236] In some embodiments, the processing device further comprises:

[0237] A third updating module, used for updating the state of the device space that failed to execute from a running state to a failed state;

[0238] A fourth acquisition module is used to acquire a device space in a ready state;

[0239] As a module, it is used to use the device space in the ready state as the device space to be scheduled; and trigger the first execution module.

[0240] In some embodiments, the processing device further comprises:

[0241] A fifth acquisition module is used to acquire the execution status of the driver in the preset device space in the boot system; wherein the execution status of the driver includes executing the driver or not executing the driver;

[0242] The detection module is used to return and trigger the first execution module when detecting that there is a device space in the preset device space where the driver is not executed.

[0243] In some embodiments, the processing device further comprises:

[0244] A sixth acquisition module is used to acquire the current state of each device space; wherein the current state of the device space includes an end state or a failure state;

[0245] A first release and removal module is used to release the device space and the storage space corresponding to the device space and remove the device space control block when detecting that the state of the device space is the end state;

[0246] The second release and removal module is used to output prompt information indicating that the state of the device space is a failure state when detecting that the state of the device space is a failure state; release the device space and the storage space corresponding to the device space, and remove the device space control block.

[0247] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0248] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned device processing method when executed by a processor.

[0249] Fig.10 This is a structural diagram of a server provided by another embodiment of the present invention. This embodiment is based on the hardware perspective, such as Fig.10 As shown, the server includes:

[0250] A memory 20, for storing computer programs;

[0251] The processor 21 is used to implement the steps of the device processing method mentioned in the above embodiment when executing the computer program.

[0252] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU, which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0253] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the device processing method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the above-mentioned device processing method, etc.

[0254] In some embodiments, the server may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .

[0255] Those skilled in the art will understand that Fig.10The structure shown in the figure does not constitute a limitation on the server, and may include more or fewer components than shown in the figure.

[0256] The server provided by the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: device processing method, the effect is the same as above.

[0257] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.

[0258] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.

[0259] The computer-readable storage medium provided by the present invention includes the above-mentioned device processing method, and the effect is the same as above.

[0260] The above is a detailed introduction to a device processing method, product, server and medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.

[0261] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A device processing method, characterized in that: include: Acquire information of a driver to be called of a bus interface device to be initialized, a device space corresponding to the driver to be called, and a storage space corresponding to the device space; wherein the device space is a space in a boot system; and the information of the storage space at least includes a storage address; storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space; Executing the driver to be called located in the storage space in the device space; When the execution result is detected to be successful, the address corresponding to the driver to be called is mapped to the target address; wherein the target address is the corresponding address in the boot system; Executing the driver to be called at the target address to complete the initialization process of the bus interface device to be initialized; Before executing the driver to be called in the storage space in the device space, the method further includes: Acquire a table entry of a device space control block; wherein the table entry of the device space control block at least includes a table entry corresponding to device information and a table entry corresponding to driver information; When a bus interface device is detected and when information about a storage space corresponding to the device space is obtained, data corresponding to an entry of the device space control block is obtained; The device space control block is updated according to the data corresponding to the table entry of the device space control block, and the state of the device space is set to a creation state.

2. The device processing method according to claim 1, characterized in that: After acquiring the information of the storage space corresponding to the device space and before storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, the method further includes: Determine whether the storage address corresponding to the device space exists; If yes, the process proceeds to the step of storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space; If not, return to obtain the information of the storage space corresponding to the device space.

3. The device processing method according to claim 1, characterized in that: After storing the driver to be called in the storage space corresponding to the device space according to the information of the storage space, the method further includes: Updating the state of the device space from the creation state to the ready state; Before executing the driver to be called in the storage space in the device space, the method further includes: Reading the state of the device space; If it is detected that the state of the device space is the ready state, entering the step of executing the driver to be called located in the storage space in the device space; If it is detected that the state of the device space is not the ready state, the process returns to the step of reading the state of the device space.

4. The device processing method according to claim 3, characterized in that: After obtaining that the state of the device space is the ready state, before entering the step of executing the driver to be called in the storage space in the device space, the method further includes: Determine whether the storage address corresponding to the device space exists; If not, updating the state of the device space to a failed state; If yes, read the driver entry address recorded in the device space control block, update the state of the device space from the ready state to the running state, and enter the step of executing the driver to be called in the storage space in the device space; The executing the driver to be called in the storage space in the device space includes: The driver to be called located in the storage space is executed in the device space and at the driver entry address.

5. The device processing method according to claim 4, characterized in that: The table entries of the device space control block also include table entries corresponding to timers; after reading the driver entry address recorded in the device space control block and before entering the step of executing the driver to be called in the storage space in the device space, the method further includes: Start the timer; After the successful execution result is detected, it also includes: Stop the timer and get the current count value of the timer; The timing time of the timer in the device space control block is recorded as the current count value and the device space state is updated from the running state to the end state.

6. The device processing method according to claim 5, characterized in that: The table entries of the device space control block also include table entries of pointer backup; Before starting the timer, the method further includes: Acquire the current instruction position and the data generated by executing the current instruction, and use the current instruction position and the data generated by executing the current instruction as data corresponding to the entry of the pointer backup; In the case of detecting success or failure of the execution result, the current instruction is returned for execution according to the data corresponding to the table entry backed up by the pointer.

7. The device processing method according to claim 6, characterized in that: The execution result is failure and an error occurs during the execution, and the method further includes: Obtaining an interrupt service program triggered by a timer timeout, and updating the state of the device space from the running state to a failed state; Restore the current instruction position and the data generated by executing the current instruction using the data corresponding to the table entry backed up by the pointer; Return to the step of reading the driver entry address recorded in the device space control block, and exit the interrupt service program.

8. The device processing method according to claim 6, characterized in that: The execution result is failure, and there is no error during the execution, and the method further includes: updating the state of the device space that failed to execute from the running state to the failed state; Acquire the device space whose state is the ready state; Using the device space in the ready state as the device space to be scheduled; Enter the step of executing the driver to be called located in the storage space in the device space.

9. The device processing method according to claim 6, characterized in that: The success or failure of the test execution result includes at least one of the following: Method 1: Starting from the start timer, determine whether the execution is completed within the preset time; If so, it is determined that the execution result is successful; If not, the execution result is determined to be a failure; Method 2: Receive information returned during the driver execution process to represent the execution status; The success or failure of the execution result is determined according to the information used to characterize the execution status.

10. The device processing method according to claim 5, characterized in that: After the timing of the stop timer, the method further includes: Acquiring the execution status of the driver in the preset device space in the boot system; wherein the execution status of the driver includes executing the driver or not executing the driver; In the case where it is detected that the preset device space includes the device space in which no driver is executed, the process returns to the step of executing the driver to be called in the storage space in the device space.

11. The device processing method according to any one of claims 1 to 10, characterized in that: After detecting that all the device spaces have been executed, the method further includes: Acquire the current state of each of the device spaces; wherein the current state of the device space includes an end state or a failure state; When it is detected that the state of the device space is the end state, releasing the device space and the storage space corresponding to the device space, and removing the device space control block; When it is detected that the state of the device space is a failure state, a prompt message indicating that the state of the device space is a failure state is output; the device space and a storage space corresponding to the device space are released, and the device space control block is removed.

12. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the device processing method according to any one of claims 1 to 11 are implemented.

13. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the device processing method according to any one of claims 1 to 11 when executing the computer program.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the device processing method according to any one of claims 1 to 11 are implemented.

Citation Information

Patent Citations

  • Boot firmware sandboxing

    CN112740211A