Device processing method, product, server and medium
By establishing a device space in the boot system and executing the driver within it, the security and reliability issues of computer systems caused by defective or maliciously injected device drivers are resolved, thus achieving security and reliability in device initialization.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- INSPUR SUZHOU INTELLIGENT TECH CO LTD
- Filing Date
- 2025-11-27
- Publication Date
- 2026-06-04
AI Technical Summary
When a defective device driver or one with maliciously injected special software code is loaded into the computer's runtime system, it reduces the computer system's security and reliability.
A device space is established in the boot system. The driver to be called is stored in the corresponding storage space of the device space, and the driver is executed in the device space. After the execution result is successfully detected, the address of the driver to be called is mapped to the target address of the boot system. The device space isolates the boot system and the driver to ensure driver security.
It improves the reliability and security of computer systems, ensures that device initialization is performed as expected, and reduces system security issues and instability.
Smart Images

Figure CN2025138175_04062026_PF_FP_ABST
Abstract
Description
A device processing method, product, server, and medium
[0001] Cross-reference to related applications
[0002] This application claims priority to Chinese Patent Application No. 202411721918.5, filed on November 28, 2024, entitled "A device processing method, product, server and medium", the entire contents of which are incorporated herein by reference. Technical Field
[0003] This application relates to the field of computer technology, and in particular to a device processing method, product, server, and medium. Background Technology
[0004] With the development of technology, bus interface devices (such as devices compliant with the Peripheral Component Interconnect Express (PCIe) standard) are numerous and diverse in function. After a bus interface device is installed in a computer system, it needs to be initialized and configured by the computer'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 parts of the device's program for further initialization settings.
[0005] However, when some defective device drivers or those with maliciously injected special software code are loaded into the computer by the boot system, they will affect the security and reliability of the computer system or cause damage to the computer, such as causing a crash when a certain device driver is executed.
[0006] Therefore, reducing system security and instability issues caused by device drivers and improving the reliability and security of computer systems are technical problems that urgently need to be solved by those in this field. Summary of the Invention
[0007] The purpose of this application is to provide a device processing method, product, server, and medium to solve the technical problem that when a device driver with defects or maliciously injected special software code is loaded into the computer by the boot system, the security and reliability of the computer system are reduced.
[0008] To solve the above-mentioned technical problems, this application provides a device processing method, including:
[0009] Obtain information about the driver to be called for 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; wherein, the device space is the space in the boot system; the storage space information includes at least the storage address;
[0010] The driver to be called is stored in the storage space corresponding to the device space based on the storage space information;
[0011] Execute the driver to be invoked, located in the storage space, within the device space;
[0012] If the execution result is successful, the address corresponding to the driver to be called is mapped to the target address; where the target address is the address corresponding to the boot system.
[0013] The driver to be called is executed at the target address to complete the initialization process of the bus interface device to be initialized.
[0014] On the one hand, before executing the driver to be invoked located in the storage space within the device space, the following steps are also included:
[0015] Obtain the entries of the device space control block; wherein the entries of the device space control block include at least the entries corresponding to device information and the entries corresponding to drive information;
[0016] If a bus interface device is detected and if information about the storage space corresponding to the device space is obtained, the data corresponding to the table entry of the device space control block is obtained.
[0017] Update the device space control block according to the data corresponding to the table entries in the device space control block, and set the device space status to creation status.
[0018] On the other hand, after obtaining 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 based on the storage space information, the process also includes:
[0019] Determine if the storage address corresponding to the device space exists;
[0020] If a storage address corresponding to the device space exists, proceed to the step of storing the driver to be called in the storage space corresponding to the device space based on the storage space information;
[0021] If the storage address corresponding to the device space does not exist, the information for obtaining the storage space corresponding to the device space will be returned.
[0022] On the other hand, after storing the driver to be called in the storage space corresponding to the device space according to the storage space information, it also includes:
[0023] Update the device space's status from created to ready;
[0024] Before executing the driver to be invoked in the storage space within the device space, the following steps are also included:
[0025] Read the status of the device space;
[0026] If the device space is detected to be in a ready state, proceed to the step of executing the driver to be invoked in the storage space within the device space;
[0027] If the device space is detected to be not in a ready state, return to the step of reading the device space state.
[0028] On the other hand, after obtaining the device space status as ready, before proceeding to the step of executing the driver to be invoked in the storage space within the device space, the process also includes:
[0029] Determine if the storage address corresponding to the device space exists;
[0030] If there is no storage address corresponding to the device space, the status of the device space will be updated to a failure status.
[0031] If a storage address corresponding to the device space exists, the driver entry address recorded in the device space control block is read, the device space state is updated from the ready state to the running state, and the step of executing the driver to be called in the storage space is entered within the device space.
[0032] Executing the driver to be invoked, located in storage space, within the device space includes:
[0033] The driver to be invoked, located in the storage space, is executed within the device space and at the driver entry address.
[0034] On the other hand, the entries in the device space control block also include entries corresponding to timers; after reading the driver entry address recorded in the device space control block, before proceeding to the step of executing the driver to be called located in the storage space within the device space, the following steps are also included:
[0035] Start the timer;
[0036] After detecting a successful execution result, the following is also included:
[0037] Stop the timer and get the current count value of the timer;
[0038] Record the timing of the timer in the device space control block as the current count value and update the device space status from running to finished.
[0039] On the other hand, the entries in the device space control block also include entries for pointer backups;
[0040] Before starting the timer, the following is also included:
[0041] Get 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 pointer backup table entry;
[0042] If the execution result is successful or unsuccessful, the current instruction will be executed based on the data corresponding to the table entry backed up by the pointer.
[0043] On the other hand, if the execution result is failure, and the error occurred during execution, the methods also include:
[0044] Obtain the interrupt service routine triggered by the timer timeout and update the device space state from running state to failed state;
[0045] The current instruction position and the data generated by executing the current instruction are restored using the data corresponding to the table entries backed up by the pointer;
[0046] Return to the step of reading the driver entry address recorded in the device space control block and exit the interrupt service routine.
[0047] On the other hand, if the execution result is failure and it is not due to an error during execution, the methods also include:
[0048] Update the status of the device space that failed the execution from running to failed.
[0049] Acquire the device space that is in the ready state;
[0050] The device space in the ready state is designated as the device space to be scheduled.
[0051] Proceed to the step of executing the driver to be invoked in the storage space within the device space.
[0052] On the other hand, the success or failure of the detection execution result includes at least one of the following:
[0053] Method 1:
[0054] Once the self-starting timer starts counting, determine whether the execution has been completed within the preset time period;
[0055] If the execution is completed within the preset time period, the execution result is considered successful.
[0056] If the execution is not completed within the preset time period, the execution result is determined to be a failure;
[0057] Method 2:
[0058] Receive information returned during driver execution that represents the execution status;
[0059] The success or failure of the execution result is determined based on the information used to characterize the execution status.
[0060] On the other hand, after stopping the timer, it also includes:
[0061] The status of the execution driver in the preset device space within the boot system is obtained; the status of the execution driver includes whether the driver is executed or not.
[0062] If a device space without an executed driver is detected in the preset device space, the process returns to the step of executing the driver to be invoked located in the storage space within the device space.
[0063] On the other hand, after detecting that all device space execution has been completed, the method also includes:
[0064] Obtain the current state of each device space; the current state of a device space includes an end state or a failure state.
[0065] If the device space is detected to be in the terminated state, release the device space and the storage space corresponding to the device space, and remove the device space control block;
[0066] If the device space is detected to be in a failure state, output a prompt message indicating that the device space is in a failure state; release the device space and the storage space corresponding to the device space, and remove the device space control block.
[0067] To address the aforementioned technical problems, this application also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the aforementioned device processing method.
[0068] To address the aforementioned technical problems, this application also provides a server, comprising:
[0069] Memory, used to store computer programs;
[0070] A processor is used to implement the steps of the device processing method described above when executing a computer program.
[0071] To address the aforementioned technical problems, this application also provides a computer non-volatile readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned device processing method.
[0072] The beneficial effects of this application are as follows: In this device processing method, a device space is established in the boot system, and the driver to be called is stored in the corresponding storage space of the device space, thereby enabling the driver to be executed in the device space. After the driver executes successfully, 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, this method uses device space to isolate the boot system and the driver, pre-executing the driver in the device space. Successful execution indicates that the driver is not defective or tampered with, i.e., the driver is secure, thus ensuring that the boot system can call secure drivers as much as possible, improving the reliability and security of the computer system. Furthermore, after successful execution, the driver to be called is executed at the target address. Since the target address is the address corresponding to the boot system, it can be ensured that the device to be initialized is initialized in the expected manner.
[0073] Furthermore, by establishing a device space control block, device and driver information can be intuitively understood. The device space control block also records counter information, allowing for the determination of whether the device space driver execution was successful or failed. Additionally, the device space control block records pointer backup entries and their corresponding data (the current instruction position and the data generated by executing the current instruction). This allows for the restoration of the backup context through an interrupt service routine triggered by a timer timeout, even if the execution result is a failure due to an error during execution.
[0074] Before storing the driver to be called in the storage space corresponding to the device space based on the storage space information, it is first determined whether the storage address corresponding to the device space exists (i.e. whether it is a valid address) to ensure that the driver can be stored.
[0075] By setting the status of device spaces (including creation, ready, running, completed, or failed status), the status of each device space can be intuitively understood. In the case of execution failure, the device space in the ready state can be directly selected for invocation, avoiding repeated execution. Compared with the method of not marking the device space status, the method provided in this application can quickly locate device spaces in various states.
[0076] After all device space execution is completed, the device space, its corresponding storage space, and the device space control block are reclaimed, reducing the space occupied by the device space. In addition, for device spaces in a failed state, an alarm is issued before reclamation, allowing users to intuitively understand the status of the device space execution driver.
[0077] In addition, this application also provides a computer program product, a server, and a computer non-volatile readable storage medium, which have the same or corresponding technical features as the above-mentioned device processing method, and have the same effect. Attached Figure Description
[0078] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application, and will be readily understood by those skilled in the art.
[0079] Without requiring any creative effort, other figures can be obtained from these figures.
[0080] Figure 1 is a flowchart of a device processing method provided in an embodiment of this application;
[0081] Figure 2 is a flowchart of a device space processing method provided in an embodiment of this application;
[0082] Figure 3 is a schematic diagram of a device space state provided in an embodiment of this application;
[0083] Figure 4 is an architecture diagram of a device driver processing provided in an embodiment of this application;
[0084] Figure 5 is a flowchart of a method for creating a device space according to an embodiment of this application;
[0085] Figure 6 is a flowchart of a method for loading a driver within a device space according to an embodiment of this application;
[0086] Figure 7 is a flowchart of an execution-driven method provided in an embodiment of this application;
[0087] Figure 8 is a flowchart of a method for driving exception handling provided in an embodiment of this application;
[0088] Figure 9 is a flowchart of a method for reclaiming equipment space according to an embodiment of this application;
[0089] Figure 10 is a structural diagram of a server provided in another embodiment of this application. Detailed Implementation
[0090] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0091] The core of this application is to provide a device processing method, product, server, and medium to solve the technical problem that when some defective or maliciously injected device drivers are loaded into the computer system for operation, the security and reliability of the computer system are reduced.
[0092] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 1 is a flowchart of a device processing method provided by an embodiment of the present application. As shown in Figure 1, the method includes:
[0093] S1: Obtain information about the driver to be called for 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;
[0094] The device space refers to the space within the boot system; the storage space information includes at least the storage address.
[0095] S2: Store the driver to be called in the storage space corresponding to the device space according to the storage space information;
[0096] S3: Execute the driver to be invoked in the storage space within the device space;
[0097] S4: If the execution result is successful, map the address of the driver to be called to the target address; where the target address is the address in the boot system.
[0098] S5: Execute the driver to be called at the target address to complete the initialization process of the bus interface device to be initialized.
[0099] The bus interface device to be initialized can be various PCIe devices (such as network cards, Redundant Array of Independent Disks (RAID) cards, Graphics Processing Unit (GPU) cards, etc.). There are no restrictions on the driver to be invoked for the bus interface device to be initialized; it will be determined based on the actual situation.
[0100] After the bus interface devices are installed into the computer system, the computer system's boot system initializes and configures each bus interface device. During the initialization process, the boot system may need to call parts of the bus interface device's program to further initialize the device. If the boot system calls a device driver that is defective or has been maliciously injected with special software code, it will affect the system's security and reliability. Therefore, in this embodiment, a 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 start of device initialization and has an independent virtual address space. During the creation of the device space, storage space (i.e., memory space) needs to be allocated for it. Specifically, memory can be dynamically allocated from the heap memory by calling functions (such as using malloc (memory allocation) or calloc (contiguous allocation and initialization) functions) as needed.
[0101] After obtaining information about the driver to be called for the bus interface device to be initialized, the device space corresponding to the driver, and the storage space corresponding to the device space, the driver address of the bus interface device to be initialized is queried, and the driver to be called is copied to the storage (memory) area pointed to by the device space (i.e., loading the driver). The driver entry address of the driver to be called is obtained, and the driver to be called located in the storage space is executed within the device space (i.e., running the driver). The result of driver execution can be success or failure. Detecting the success or failure of the execution result includes at least one of the following methods: Method 1: From the start of the start timer, it is determined whether the execution is completed within a preset time period; if the execution is completed within the preset time period, the execution result is determined to be successful; if the execution is not completed within the preset time period, the execution result is determined to be failed. The preset time period is not limited and is determined according to the actual situation. Method 2: Receive information returned during the driver execution process to characterize the execution status; determine the execution result as success or failure based on the information characterizing the execution status. If the information characterizing the execution status is success, the execution is successful; if the information characterizing the execution status is failure, the execution is failed.
[0102] To avoid the impact of defective or maliciously injected special software code on system security, this application, upon detecting a successful execution result, indicates that the driver to be called is free from defects or maliciously injected special software code. Furthermore, the address set by the driver to be called is remapped into the boot system space for use by the operating system (OS) and other system software. The target address to which the address corresponding to the driver to be called is mapped is not limited and is determined according to actual needs.
[0103] After the driver has finished executing in the device space, the device space can be reclaimed to reduce the space occupied by the device space.
[0104] Figure 2 is a flowchart of a device space processing method provided in an embodiment of this application. As shown in Figure 2, the method includes:
[0105] S6: Create device space;
[0106] S7: Load driver;
[0107] S8: Run the driver;
[0108] S9: Reclaim equipment space.
[0109] 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 corresponding storage space of the device space, so that the driver can be executed in the device space. When the driver executes successfully, 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 device space is used to isolate the boot system and the driver, and the driver is pre-executed in the device space. Successful execution indicates that the driver is not defective or tampered with, that is, the driver is safe. This ensures that the boot system can call a safe driver as much as possible, 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 address corresponding to the boot system, it can be ensured that the device to be initialized is initialized in the expected way.
[0110] To provide a clear understanding of the status of each device space, multiple states are set for each device space. Figure 3 is a schematic diagram of a device space state provided in an embodiment of this application. As shown in Figure 3, the device space states include creation state, ready state, running state, completed state, or failed state. Furthermore, to facilitate the maintenance of device space information, before executing the driver to be invoked located in the storage space within the device space, the following steps are also included:
[0111] Obtain the entries of the device space control block; wherein the entries of the device space control block include at least the entries corresponding to device information and the entries corresponding to drive information;
[0112] If a bus interface device is detected and if information about the storage space corresponding to the device space is obtained, the data corresponding to the table entry of the device space control block is obtained.
[0113] Update the device space control block according to the data corresponding to the table entries in the device space control block, and set the status of the device space to the creation status.
[0114] Figure 4 is an architecture diagram of a device driver processing according to an embodiment of this application. As shown in Figure 4, the architecture includes an operating system, a boot system, and bus interface devices. 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., the device space management engine), responsible for the creation, management, and reclamation of drivers and device spaces. The device space management engine creates a device space for each executed driver. The driver runs within the device space, completes the initialization and configuration of the corresponding device, and stores the information that needs to be fed back to the boot system in the data exchange area for the boot system's use. The device space management module also provides a timer. In the event of a device driver error and subsequent crash, the timer triggers a hardware interrupt to restore the processor to a normal state.
[0115] The maintenance of device space information can be performed by the device space management engine, which creates entries for the Device Space Control Block (DSCB). It is worth noting that when there are multiple drivers to be invoked, multiple DSCBs can be created to form a device space control table. Table 1 shows the detailed definitions of device space control table entries.
[0116] Table 1
[0117] When a bus interface device is detected, the device information (i.e., the last three items in Table 1), driver information (i.e., the first three items in Table 1) in the device space control table can be obtained. After obtaining the data corresponding to the storage space information of the device space (i.e., the data exchange area address in Table 1), the data corresponding to the device space control table can be filled in, and then the status of the device space can be set to creation.
[0118] 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 a ready state. Figure 5 is a flowchart of a method for creating device space according to an embodiment of this application. As shown in Figure 5, the method includes:
[0119] S60: Device detected;
[0120] S61: Create a device space control block, fill in the device information, driver information, interaction data and timer timeout, and add the device space control block to the device space control table;
[0121] S62: Allocate memory space for the driver, and fill the address of the first byte of memory into the device space control block;
[0122] S63: Set the device space status to creation status.
[0123] The above process details the creation of the device space, followed by the loading of the driver. In practice, when storing the driver to be called in the storage space corresponding to the device space, the address of the required storage space may not exist, preventing the driver from being stored at the correct location. To avoid this, after obtaining the information about the storage space corresponding to the device space, and before storing the driver in that space based on that information, the following steps are also included:
[0124] Determine if the storage address corresponding to the device space exists;
[0125] If a storage address corresponding to the device space exists, proceed to the step of storing the driver to be called in the storage space corresponding to the device space based on the storage space information;
[0126] If the storage address corresponding to the device space does not exist, the information for obtaining the storage space corresponding to the device space will be returned.
[0127] After storing the driver to be invoked in the corresponding storage space of the device space according to the storage space information, the process also includes:
[0128] Update the device space's status from created to ready.
[0129] The device space engine is responsible for loading the driver. After the driver is loaded, the corresponding device space state is set to the ready state, waiting for scheduling and execution. Figure 6 is a flowchart of a method for loading a driver within the device space according to an embodiment of this application. As shown in Figure 6, the method includes:
[0130] S71: Read device space control block;
[0131] S72: Queries and checks memory space addresses;
[0132] 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;
[0133] S74; Update the device space control block and set the device space status to ready.
[0134] In practice, when multiple drivers are to be called, to improve driver loading efficiency, the device space control block corresponding to each driver to be called is obtained from the device space control table. The number of drivers to be called is determined based on the device information recorded in the device space control table. If the number of drivers to be called is greater than a preset number, the addresses of each device driver are queried in parallel, and the device driver programs are copied to the memory areas pointed to by the device space corresponding to each driver to be called. The driver entry address in the device space control block is then set. The preset number is at least greater than 2. In this method, for the case of multiple drivers to be called, a parallel driver loading approach is adopted, which improves the efficiency of driver loading.
[0135] The above process describes in detail the driver loading process within device space. After the driver is loaded, it runs in device space. Before executing the driver to be invoked, which resides in storage space, the process also includes:
[0136] Read the status of the device space;
[0137] If the device space is detected to be in a ready state, proceed to the step of executing the driver to be invoked in the storage space within the device space;
[0138] If the device space is detected to be not in a ready state, return to the step of reading the device space state.
[0139] After the device space is found to be in a ready state, before proceeding to the step of executing the driver to be invoked in the storage space within the device space, the following steps are also included:
[0140] Determine if the storage address corresponding to the device space exists;
[0141] If there is no storage address corresponding to the device space, the status of the device space will be updated to a failure status.
[0142] If a storage address corresponding to the device space exists, the driver entry address recorded in the device space control block is read, the device space state is updated from ready to running, and the step of executing the driver to be called in the storage space is entered within the device space.
[0143] Executing the driver to be invoked, located in storage space, within the device space includes:
[0144] The driver to be invoked, located in the storage space, is executed within the device space and at the driver entry address.
[0145] To determine whether the driver execution in device space succeeds or fails, this application also includes entries for timers in the device space control block, such as the timer timeout, timer count, and timer status in Table 1. After reading the driver entry address recorded in the device space control block, before proceeding to the step of executing the driver to be invoked located in the storage space within the device space, the following steps are also included:
[0146] Start the timer;
[0147] After detecting a successful execution result, the following is also included:
[0148] Stop the timer and get the current count value of the timer;
[0149] Record the timing of the timer in the device space control block as the current count value and update the device space status from running to finished.
[0150] After stopping the timer, the following is also included:
[0151] The status of the execution driver in the preset device space within the boot system is obtained; whereby the status of the execution driver includes whether the driver is executed or not.
[0152] If a device space without an executed driver is detected in the preset device space, the process returns to the step of executing the driver to be invoked located in the storage space within the device space.
[0153] Regardless of whether the driver execution succeeds or fails within the device space, it may be necessary to restore the state before the driver execution. To enable locating the previous state, the device space control block includes entries for pointer backups, such as program pointer backups and stack pointer backups in Table 1.
[0154] Before starting the timer, the following is also included:
[0155] Get 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 pointer backup table entry (i.e., the backup program context);
[0156] If the execution result is successful or unsuccessful, the current instruction will be executed based on the data corresponding to the table entry backed up by the pointer.
[0157] To enable those skilled in the art to better understand the execution-driven process of this application, Figure 7 is a flowchart of an execution-driven method provided in an embodiment of this application. As shown in Figure 7, the method includes:
[0158] S801: Read device space control block;
[0159] S802: Determine whether the device space status is ready; if the device space status is ready, proceed to step S803; if the device space status is not ready, return to step S801.
[0160] S803: Determine if the memory space is valid; if the memory space is invalid, proceed to step S804; if the memory space is valid, proceed to step S805.
[0161] S804: Update status is failed;
[0162] S805: Backup program context and start timer;
[0163] S806: Update status to running;
[0164] S807: Jump to the drive entry point;
[0165] S808: Determine whether the execution was successful; if the execution was not completed, proceed to step S813; if the execution was completed, proceed to step S809.
[0166] S809: Copy the returned data;
[0167] S810: Update status is complete;
[0168] S811: Stop timer;
[0169] S812: Determine whether all device spaces have been executed; if all device spaces have been executed, then end; if all device spaces have not been executed, then return to step S801.
[0170] S813: Determine if an error occurred during execution; if an error occurred during execution, proceed to step S814; if no error occurred during execution, return to step S804.
[0171] S814: Waiting for timer interrupt.
[0172] Execution in device space can be parallelized. The device space engine controls driver execution through the device space control block, passing parameters and returning data. Specifically, during driver execution, the process reads the device space control block, checks if the status is ready, queries and checks the memory space address, and reads the driver entry address from the device space control block. A timer is started, and the device space status is updated to running. The process jumps to the driver entry address to execute the driver. When the driver returns normally, the interactive data is copied to the data area, the timer is stopped, the timer duration is updated to the device space control block, and the device space status is updated to finished.
[0173] For situations where driver execution fails, including cases where the execution result is a failure due to an error during execution, or cases where the execution result is a failure but the error was not during execution, these are all referred to as driver execution exceptions. For cases where the execution result is a failure and the error occurred during execution, the device handling methods also include:
[0174] Obtain the interrupt service routine triggered by the timer timeout and update the device space state from running state to failed state;
[0175] The current instruction position and the data generated by executing the current instruction are restored using the data corresponding to the table entries backed up by the pointer;
[0176] Return to the step of reading the driver entry address recorded in the device space control block and exit the interrupt service routine.
[0177] For cases where the execution result is a failure and the error did not occur during execution, the device handling methods also include:
[0178] Update the status of the device space that failed the execution from running to failed.
[0179] Acquire the device space that is in the ready state;
[0180] The device space in the ready state is designated as the device space to be scheduled.
[0181] Proceed to the step of executing the driver to be invoked in the storage space within the device space.
[0182] Figure 8 is a flowchart of a method for driving execution exception handling provided in an embodiment of this application. As shown in Figure 8, the method includes:
[0183] S815: Timer interrupt triggered;
[0184] S816: Enter the interrupt service routine;
[0185] S817: Restore program context;
[0186] S818: Update device space status failed;
[0187] S819: Exit interrupt service routine.
[0188] The device space execution begins and ends upon successful execution. If the device space execution fails (not due to an error during execution), the device space engine is executed, and the device space execution is rescheduled. (It is worth noting that since the failed device space has already been marked as failed, it will not be re-run during rescheduling; instead, a new device space will be selected from the ready device spaces for scheduling.) If the device space execution fails (due to an error during execution), the timer expires, triggering the interrupt service routine. The device space state is set to failed, the processor context is restored, the device space engine entry address is obtained, and finally, the interrupt service routine is exited. In other words, the interrupt handler restores the processor to its state before the device space execution.
[0189] To reduce the space occupied by the device space, the device processing method further includes the following after all device space operations have been completed:
[0190] Obtain the current state of each device space; the current state of a device space includes an end state or a failure state.
[0191] If the device space is detected to be in the terminated state, release the device space and the storage space corresponding to the device space, and remove the device space control block;
[0192] If the device space is detected to be in a failure state, output a prompt message indicating that the device space is in a failure state; release the device space and the storage space corresponding to the device space, and remove the device space control block.
[0193] After all device space operations are completed, the device space engine selects those in the "finished" state for recycling. Before recycling, the driver return data is mapped to provide a device control interface for the operating system or other upper-layer software. Device drivers that fail to execute are recycled after an alert from the device space engine; these devices are marked as faulty devices and are not presented to the operating system or other upper-layer software. Figure 9 is a flowchart of a device space recycling method provided in an embodiment of this application. As shown in Figure 9, the method includes:
[0194] S91: Obtain the device space control block;
[0195] S92: Determine whether the device space execution was successful; if the device space execution was unsuccessful, proceed to step S93; if the device space execution was successful, proceed to step S94.
[0196] S93: Alarm notification;
[0197] S94: Allocate memory and copy device drivers;
[0198] S95: Mapped device address;
[0199] S96: Reclaim the device space control block, device space, and the memory space corresponding to the device space;
[0200] S97: Determine whether all device space has been released; if all device space has been released, end; if all device space has not been released, return to step S91.
[0201] The device driver executes in the device space. If the execution is successful, it returns normally and sets the device space status to the terminated state. The device space management engine then reclaims the device space and remaps the addresses. If the execution fails, the device space status is set to failed and the device space management engine reclaims the space, reducing the space occupied by the device space.
[0202] The method provided in this application provides a fine-grained management, control, and isolation of driver execution by providing each device driver with an independent device execution space (i.e., device space). The device driver executes within the device space, and upon successful execution, the device space management engine remaps the driver. The operating system or other software then calls the interface provided by the device. The device space focuses on managing device drivers during the initialization and configuration of bus interface devices, optimizing the uncertainty and security of driver behavior, reducing system security and instability issues caused by device drivers, protecting computer firmware, software, and data, and improving the reliability and security of the computer system. It also reduces system crashes and security incidents caused by single device problems, greatly improving system security, reliability, and compatibility. It is worth noting that the device processing method provided in this application 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 ideas of this application and is within the scope of protection of this application.
[0203] In the above embodiments, the device processing method has been described in detail. This application also provides embodiments corresponding to the processing device and the server. It should be noted that this application describes the embodiments of the device part from two perspectives: one is based on the functional module, and the other is based on the hardware.
[0204] One embodiment of this application provides a processing apparatus, which, from the perspective of functional modules, includes:
[0205] The first acquisition module is used to acquire information about the driver to be called for 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; wherein, the device space is the space in the boot system; the information of the storage space includes at least the storage address;
[0206] The storage module is used to store the driver to be called in the storage space corresponding to the device space according to the storage space information;
[0207] The first execution module is used to execute the driver to be invoked located in the storage space within the device space;
[0208] The mapping module is used to map the address of the driver to be called to the target address when the execution result is detected as successful; the target address is the address in the boot system.
[0209] The second execution module is used to execute the driver to be called at the target address to complete the initialization process of the bus interface device to be initialized.
[0210] In some embodiments, the processing apparatus further includes:
[0211] The second acquisition module is used to acquire entries of the device space control block; wherein the entries of the device space control block include at least entries corresponding to device information and entries corresponding to driver information;
[0212] The third acquisition module is used to acquire the data corresponding to the table entries of the device space control block when a bus interface device is detected and when the information of the storage space corresponding to the device space is acquired.
[0213] The update and settings module is used to update the device space control block according to the data corresponding to the table entries of the device space control block, and set the status of the device space to the creation status.
[0214] In some embodiments, the processing apparatus further includes:
[0215] The first judgment module is used to determine whether the storage address corresponding to the device space exists; if the storage address corresponding to the device space exists, the storage module is triggered; if the storage address corresponding to the device space does not exist, the first acquisition submodule is triggered.
[0216] The first acquisition submodule is used to acquire information about the storage space corresponding to the device space.
[0217] In some embodiments, the processing apparatus further includes:
[0218] The first update module is used to update the state of the device space from the created state to the ready state.
[0219] The processing device also includes:
[0220] The read module is used to read the status of the device space;
[0221] The inspection module is used to trigger the first execution module if the device space is detected to be in a ready state; if the device space is detected to be in a non-ready state, it returns to trigger the reading module.
[0222] In some embodiments, the processing apparatus further includes:
[0223] The second judgment module is used to determine whether the storage address corresponding to the device space exists; if the storage address corresponding to the device space does not exist, the second update module is triggered; if the storage address corresponding to the device space exists, the read and update module is triggered.
[0224] The second update module is used to update the state of the device space to a failure state.
[0225] The read and update module is used to read the driver entry address recorded in the device space control block, update the device space status from the ready state to the running state, and trigger the first execution module.
[0226] The first execution module is specifically used to execute the driver to be called, located in the storage space, within the device space and at the driver entry address.
[0227] In some embodiments, the processing apparatus further includes:
[0228] The startup module is used to start the timer;
[0229] The processing device also includes:
[0230] The stop and get module is used to stop the timer and get the current count value of the timer;
[0231] The recording and updating module is used to record the timing of the timer in the device space control block as the current count value and to update the device space status from running status to ending status.
[0232] In some embodiments, the processing apparatus further includes:
[0233] The `get` and `use` module is used to obtain the current instruction position and the data generated by executing the current instruction, and to use the current instruction position and the data generated by executing the current instruction as the data corresponding to the pointer backup table entry;
[0234] The detection and execution module is used to return the current instruction to be executed based on the data corresponding to the table entry backed up by the pointer, in the case of success or failure of the detection and execution result.
[0235] In some embodiments, the processing apparatus further includes:
[0236] The acquire and update module is used to acquire the interrupt service routine triggered by the timer timeout and update the device space status from running status to failure status.
[0237] 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 entries backed up by the pointer; it returns to trigger the read and update module and triggers the exit module.
[0238] The exit module is used to exit the interrupt service routine.
[0239] In some embodiments, the processing apparatus further includes:
[0240] The third update module is used to update the status of the device space that failed to execute from the running status to the failed status.
[0241] The fourth acquisition module is used to acquire device space that is in a ready state;
[0242] As a module, it is used to designate device spaces in the ready state as device spaces to be scheduled and to trigger the first execution module.
[0243] In some embodiments, the processing apparatus further includes:
[0244] The fifth acquisition module is used to acquire the status of the execution driver in the preset device space within the boot system; wherein, the status of the execution driver includes whether the driver is executed or not.
[0245] The detection module is used to trigger the first execution module when it detects that there is a device space in the preset device space where no driver has been executed.
[0246] In some embodiments, the processing apparatus further includes:
[0247] The sixth acquisition module is used to acquire the current status of each device space; wherein, the current status of the device space includes the end status or the failure status;
[0248] The 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 the device space is detected to be in the end state.
[0249] The second release and removal module is used to output a prompt message indicating that the device space is in a failed state when the device space is detected to be in a failed state; release the device space and the storage space corresponding to the device space; and remove the device space control block.
[0250] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0251] This application also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the device processing method described above.
[0252] Figure 10 is a structural diagram of a server provided in another embodiment of this application. This embodiment is based on a hardware perspective, and as shown in Figure 10, the server includes:
[0253] Memory 20 is used to store computer programs;
[0254] The processor 21 is configured to implement the steps of the device processing method as described in the above embodiments when executing a computer program.
[0255] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU, which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0256] The memory 20 may include one or more computer-defined non-volatile readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the device processing method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary storage or permanent storage. The operating system 202 may include Windows (Microsoft Windows), Unix (Uniplexed Information and Computing System), Linux, etc. The data 203 may include, but is not limited to, the data involved in the aforementioned device processing method.
[0257] 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.
[0258] Those skilled in the art will understand that the structure shown in Figure 10 does not constitute a limitation on the server and may include more or fewer components than shown.
[0259] The server provided in this application embodiment includes a memory and a processor. When the processor executes a program stored in the memory, it can implement the following method: device processing method, with the same effect as above.
[0260] Finally, this application also provides an embodiment corresponding to a computer non-volatile readable storage medium. The computer non-volatile readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.
[0261] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0262] The computer non-volatile readable storage medium provided in this application includes the device processing method mentioned above, and has the same effect.
[0263] The foregoing has provided a detailed description of a device processing method, product, server, and medium provided in this application. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of this application.
[0264] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
Claims
A device processing method, characterized in that, include: Obtain information about the driver to be called for 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; wherein, the device space is the space in the boot system; the information of the storage space includes at least the storage address; The driver to be invoked is stored in the storage space corresponding to the device space according to the information of the storage space; Execute the driver to be invoked located in the storage space within the device space; If the execution result is successful, the address corresponding to the driver to be called is mapped to the target address; wherein, the target address is the address corresponding to the boot system; The driver to be invoked is executed at the target address to complete the initialization process of the bus interface device to be initialized. The equipment processing method according to claim 1 is characterized in that, Before executing the driver to be invoked located in the storage space within the device space, the method further includes: Obtain the entries of the device space control block; wherein the entries of the device space control block include at least the entries corresponding to device information and the entries corresponding to drive information; If a bus interface device is detected and if information about the storage space corresponding to the device space is obtained, the data corresponding to the table entry of the device space control block is obtained; The device space control block is updated based on the data corresponding to the table entries of the device space control block, and the status of the device space is set to the creation status. The equipment processing method according to claim 2 is characterized in that, The step of updating the device space control block according to the data corresponding to the table entries of the device space control block, and setting the state of the device space to the creation state, includes: Discover the device, create the device space control block, fill in the device information, driver information, interaction data and timer timeout, and add the device space control block to the device space control table; To allocate memory space for the driver, the address of the first byte of memory is filled into the device space control block. The equipment processing method according to claim 2 is characterized in that, After obtaining 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 if the storage address corresponding to the device space exists; If a storage address corresponding to the device space exists, proceed to the step of storing the driver to be called in the storage space corresponding to the device space based on the information of the storage space; If no storage address corresponding to the device space exists, the system returns information about obtaining the storage space corresponding to the device space. The equipment processing method according to claim 2 is characterized in that, After storing the driver to be invoked in the storage space corresponding to the device space according to the information of the storage space, the method further includes: Update the state of the device space from the created state to the ready state; Before executing the driver to be invoked located in the storage space within the device space, the method further includes: Read the state of the device space; If the device space is detected to be in the ready state, proceed to the step of executing the driver to be invoked located in the storage space within the device space; If the state of the device space is not detected to be the ready state, then return to the step of reading the state of the device space. The equipment processing method according to claim 5 is characterized in that, The step of updating the state of the device space from the created state to the ready state includes: Read the device space control block; Query and check memory space addresses; 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; Update the device space control block and set the device space status to ready. The equipment processing method according to claim 5 is characterized in that, When multiple drivers to be invoked exist, executing the driver to be invoked located in the storage space within the device space includes: Obtain the device space control block corresponding to each driver to be called from the device space control table, and determine the number of drivers to be called based on the device information recorded in the device space control table; If the number of drivers to be invoked is greater than a preset number, the addresses of each device driver are queried in parallel, the device drivers are copied to the memory area pointed to by the device space corresponding to each driver to be invoked, and the driver entry address in the device space control block is set. The equipment processing method according to claim 5 is characterized in that, After obtaining the device space status as the ready state, before proceeding to the step of executing the driver to be invoked located in the storage space within the device space, the method further includes: Determine if the storage address corresponding to the device space exists; If there is no storage address corresponding to the device space, then the status of the device space is updated to a failure status; If a storage address corresponding to the device space exists, the driver entry address recorded in the device space control block is read, the state of the device space is updated from the ready state to the running state, and the step of executing the driver to be called in the storage space within the device space is entered. The execution of the driver to be invoked located in the storage space within the device space includes: The driver to be invoked, located in the storage space, is executed within the device space and at the driver entry address. The equipment processing method according to claim 8 is characterized in that, The table entries in the device space control block also include entries corresponding to timers; after reading the driver entry address recorded in the device space control block, and before proceeding to the step of executing the driver to be invoked located in the storage space within the device space, the method further includes: Start the timer; After detecting a successful execution result, the following is also included: Stop the timer and get the current count value of the timer; Record the timing of the timer in the device space control block as the current count value and update the device space status from the running state to the finished state. The equipment processing method according to claim 9 is characterized in that, The table entries of the device space control block also include pointer backup entries; Before starting the timer, the following is also included: 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; If the execution result is successful or unsuccessful, the current instruction will be executed based on the data corresponding to the table entry backed up by the pointer. The equipment processing method according to claim 10 is characterized in that, If the execution result is failure, and the error occurred during execution, the method further includes: Obtain the interrupt service routine triggered by the timer timeout, and update the state of the device space from the running state to the failure state; The current instruction position and the data generated by executing the current instruction are restored 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 routine. The equipment processing method according to claim 10 is characterized in that, If the execution result is failure, and it is not due to an error during execution, the method further includes: The status of the device space that failed to execute will be updated from the running status to the failed status; Obtain the device space whose status is the ready state; The device space in the ready state is designated as the device space to be scheduled. Enter the step of executing the driver to be invoked located in the storage space within the device space. The equipment processing method according to claim 10 is characterized in that, The success or failure of the test result includes at least one of the following: Method 1: Once the timer starts counting down, it checks whether the execution has been completed within the preset time period; if the execution is completed within the preset time period, the execution result is considered successful. If the execution is not completed within the preset time period, the execution result is determined to be a failure; Method 2: Receive information returned during driver execution that represents the execution status; The success or failure of the execution result is determined based on the information used to characterize the execution status. The equipment processing method according to claim 9 is characterized in that, After the stop timer starts counting, the following is also included: The status of the execution driver in the preset device space within the boot system is obtained; wherein, the status of the execution driver includes whether the driver is executed or not. If it is detected that there is a device space in the preset device space where no driver has been executed, the process returns to the step of executing the driver to be invoked located in the storage space within the device space. The equipment processing method according to any one of claims 2 to 14 is characterized in that, After detecting that all the device spaces have been executed, the method further includes: Obtain the current state of each device space; wherein the current state of the device space includes an end state or a failure state; if the state of the device space is detected to be an end state, release the device space and the storage space corresponding to the device space, and remove the device space control block; If the device space is detected to be in a failed state, output a prompt message indicating that the device space is in a failed state; release the device space and the storage space corresponding to the device space, and remove the device space control block. The equipment processing method according to claim 15 is characterized in that, The step of releasing the device space and its corresponding storage space, and removing the device space control block when the device space is detected to be in an "end" state includes: Allocate memory and copy device drivers; Map device address; Reclaim the device space control block, device space, and the memory space corresponding to the device space; Determine if all device space has been released; if all device space has been released, end the process; if all device space has not been released, reacquire the device space control block. The equipment processing method according to claim 15 is characterized in that, The step of releasing the device space and its corresponding storage space, and removing the device space control block when the device space is detected to be in an "end" state includes: The device space engine selects devices in the "complete" state for recycling. Before recycling, the driver-returned data is mapped to provide a device control interface for the operating system or other upper-layer software. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the device processing method according to any one of claims 1 to 17. A server, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the device processing method as described in any one of claims 1 to 17. A computer non-volatile readable storage medium, characterized in that, The computer non-volatile readable storage medium stores a computer program that, when executed by a processor, implements the steps of the device processing method as described in any one of claims 1 to 17.