Hardware simulation method and device, electronic device and storage medium

By loading and storing system call data in advance in hardware simulation, generating a path information table, and directly obtaining kernel space data in user space, it solves the problem of large and complex hardware simulation calculations in the existing technology, and achieves high efficiency and low cost. Hardware simulation improves the consistency and accuracy of results.

CN112328472BActive Publication Date: 2024-10-15HYGON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011165059.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-27
Publication Date
2024-10-15
Estimated Expiration
2040-10-27

AI Technical Summary

Technical Problem

When building an operating system corresponding to system call instructions, the existing hardware simulation method requires a large amount of calculations, is complex, and takes a long time, resulting in high cost and low efficiency. It also requires the establishment of a full-system simulation environment, which increases the requirements for the simulation environment.

Method used

By loading the system call data into the kernel space and storing its data structure, a path information table is generated. The system call instructions are executed in the user space to obtain the data in the kernel space, and the stored system call data is directly called to avoid building an operating system and simplify Data movement operations.

Benefits of technology

It reduces the amount of calculations and running time in the hardware simulation process, reduces costs, improves efficiency, simplifies the requirements of the simulation environment, improves the accuracy and consistency of results, and reduces program failures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112328472B_ABST
    Figure CN112328472B_ABST
Patent Text Reader

Abstract

A hardware simulation method and device, an electronic device and a storage medium, the hardware simulation method comprising: loading at least one system call data into a kernel space, and storing a data structure including at least one system call data in the kernel space; loading user-mode simulation data including a system call instruction into a user space; and executing the system call instruction in the user space, obtaining the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and calling the system call data into the user space for hardware simulation supporting the system call instruction in the user space. The hardware simulation method can load and store the required system call data in advance before executing the system call instruction, so that when performing hardware simulation supporting the system call instruction in the user space, it is not necessary to build an operating system corresponding to the system call instruction, thereby reducing the amount of calculation in the hardware simulation process and reducing costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to a hardware simulation method and device, an electronic device, and a storage medium. Background Art

[0002] Hardware emulation refers to the simulation performed by downloading a program to a microcontroller or other hardware device, which can reflect the actual running of the program in the microcontroller or other hardware device. Summary of the invention

[0003] At least one embodiment of the present disclosure provides a hardware simulation method, comprising: loading at least one system call data into a kernel space, and storing a data structure including the at least one system call data in the kernel space; loading user-mode simulation data including a system call instruction into a user space; and executing the system call instruction in the user space, obtaining system call data corresponding to the system call instruction in a data structure in the kernel space based on the system call instruction, and calling the system call data into the user space for use in the user space to support hardware simulation of the system call instruction.

[0004] For example, in a hardware simulation method provided in an embodiment of the present disclosure, the system call data includes environment effect parameters under the operation of the operating system and path information corresponding to the environment effect parameters.

[0005] For example, in the hardware simulation method provided in an embodiment of the present disclosure, the at least one system call data is loaded into the kernel space, and the data structure including the at least one system call data is stored in the kernel space, including: loading the at least one system call data into the kernel space and storing it, and generating a path information table based on the path information stored in the at least one system call data; wherein the data structure also includes the path information table, and the path information table is used to index the at least one system call data in the data structure.

[0006] For example, in the hardware simulation method provided by an embodiment of the present disclosure, the path information table includes the name, starting address information and cache space information of the system call data.

[0007] For example, the hardware simulation method provided by an embodiment of the present disclosure also includes: loading a system call handler into the kernel space to respond to the system call instruction in the user space through the system call handler, thereby being used for calling the system call data from the kernel space to the user space.

[0008] For example, in the hardware simulation method provided in an embodiment of the present disclosure, the system call instruction is executed in the user space, the system call data corresponding to the system call instruction in the data structure in the kernel space is obtained based on the system call instruction, and the system call data is called into the user space, including: executing the system call instruction in the user space to jump to the kernel space, the system call handler in the kernel space obtains the system call data corresponding to the system call instruction based on the path information table and transfers the system call data to the user space.

[0009] For example, in the hardware simulation method provided in an embodiment of the present disclosure, the system call instruction is executed in the user space, the system call data corresponding to the system call instruction in the data structure in the kernel space is obtained based on the system call instruction, and the system call data is called into the user space, and it also includes: storing the called system call data in a data cache area in the user space, and running the user-state simulation data based on the data stored in the data cache area to perform hardware simulation.

[0010] For example, the hardware simulation method provided by an embodiment of the present disclosure further includes: obtaining the at least one system call data.

[0011] For example, in the hardware simulation method provided in an embodiment of the present disclosure, obtaining the at least one system call data includes: generating the at least one system call data by using software simulation.

[0012] For example, in a hardware simulation method provided in an embodiment of the present disclosure, software simulation is used to generate the at least one system call data, including: performing software simulation through a software emulator or a virtual machine to obtain a processing result under the operation of an operating system, and obtaining the at least one system call data based on the processing result.

[0013] For example, the hardware simulation method provided by an embodiment of the present disclosure further includes: loading kernel-state simulation data into the kernel space.

[0014] For example, the hardware simulation method provided by an embodiment of the present disclosure further includes: running the kernel-state simulation data in the kernel space, and jumping to the user space to run the user-state simulation data to execute the system call instruction in the user space.

[0015] At least one embodiment of the present disclosure also provides a hardware simulation device, which includes a kernel space data loading module, a user space data loading module and a data running module; the kernel space data loading module is configured to load at least one system call data into the kernel space, and store a data structure including the at least one system call data in the kernel space; the user space data loading module is configured to load user-state simulation data including a system call instruction into the user space; the data running module is configured to execute the system call instruction in the user space, obtain the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and call the system call data into the user space for hardware simulation supporting the system call instruction in the user space.

[0016] For example, the hardware simulation device provided by an embodiment of the present disclosure further includes a system call data acquisition module, and the system call data acquisition module is configured to acquire the at least one system call data.

[0017] At least one embodiment of the present disclosure also provides an electronic device, which includes a processor, a memory and one or more computer program modules; the one or more computer program modules are stored in the memory and are configured to be executed by the processor, and the one or more computer program modules include instructions for executing the hardware simulation method described in any embodiment of the present disclosure.

[0018] At least one embodiment of the present disclosure further provides a storage medium that non-temporarily stores computer-readable instructions. When the computer-readable instructions are executed by a computer, the hardware simulation method according to any embodiment of the present disclosure can be executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly introduced below. Obviously, the drawings in the following description only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure.

[0020] Figure 1 A flowchart of a hardware simulation method provided for some embodiments of the present disclosure;

[0021] Figure 2 A schematic diagram of a kernel space and a user space provided for some embodiments of the present disclosure;

[0022] Figure 3 A schematic diagram of a path information table in a data structure in a kernel space provided for some embodiments of the present disclosure;

[0023] Figure 4A flowchart of another hardware simulation method provided for some embodiments of the present disclosure;

[0024] Figure 5 A flowchart of another hardware simulation method provided for some embodiments of the present disclosure;

[0025] Figure 6 A flowchart of another hardware simulation method provided for some embodiments of the present disclosure;

[0026] Fig. 7A A schematic block diagram of a hardware simulation device provided for some embodiments of the present disclosure;

[0027] Figure 7B A schematic block diagram of another hardware simulation device provided for some embodiments of the present disclosure;

[0028] Figure 8 A schematic block diagram of an electronic device provided for some embodiments of the present disclosure;

[0029] Fig. 9 A schematic block diagram of another electronic device provided for some embodiments of the present disclosure; and

[0030] Fig.10 A schematic diagram of a storage medium provided for some embodiments of the present disclosure. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present disclosure.

[0032] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure should be understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, similar words such as "one", "one" or "the" do not indicate quantity restrictions, but indicate that there is at least one. Similar words such as "include" or "comprise" mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Similar words such as "connect" or "connected" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0033] Currently, when hardware simulation is performed based on a downloaded program, since the source code of the program usually contains system call instructions, it is necessary to build an operating system corresponding to the system call instructions and implement hardware simulation based on data such as effect parameters or processing results obtained when the operating system is running.

[0034] When hardware simulation is performed based on source code containing system call instructions, it is necessary to obtain environmental data such as effect parameters or processing results under the operation of the operating system corresponding to the system call instruction, so it is necessary to build and run a full system simulation environment that supports, for example, a system on chip (SoC). However, the amount of calculation required to build and run the full system simulation environment is large, the calculation is complex, and it takes a long time, resulting in a greatly increased cost of implementing hardware simulation and low efficiency.

[0035] At least one embodiment of the present disclosure provides a hardware simulation method and device, an electronic device and a storage medium. The hardware simulation method includes: loading at least one system call data into the kernel space, and storing a data structure including at least one system call data in the kernel space; loading user-mode simulation data including a system call instruction into the user space; and executing the system call instruction in the user space, obtaining the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and calling the system call data into the user space for hardware simulation supporting the system call instruction in the user space.

[0036] The above-mentioned hardware simulation method provided by the embodiment of the present disclosure can load and store the required system call data in advance before executing the system call instruction, so that when obtaining the system call data in response to the system call instruction in the user space, it is not necessary to build and run the operating system corresponding to the system call instruction in the kernel space, and the process of obtaining the system call data from the kernel space to the user space in response to the system call instruction can be converted into a relatively simple data movement operation. In this way, the amount of calculation and running time in the hardware simulation process can be reduced, the cost of implementing hardware simulation can be reduced, and the efficiency of hardware simulation can be improved. For example, the above-mentioned hardware simulation method provided by the embodiment of the present disclosure can enable the hardware simulation process supporting the system call instruction to be carried out in, for example, a bare metal environment or an emulator environment, without the need to build and run, for example, a full-system simulation environment supporting the system-on-chip, which improves the convenience of hardware simulation and reduces the requirements for the simulation environment.

[0037] In addition, the above-mentioned hardware simulation method provided by the embodiment of the present disclosure can also make the system call data obtained in the user space consistent each time the system call instruction is executed, thereby improving the accuracy and consistency of the hardware simulation results obtained in the user space based on the obtained system call data. At the same time, it can also reduce program failures (bugs) that may be caused by different system call data during the hardware simulation process, and further optimize the hardware simulation process.

[0038] Hereinafter, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. It should be noted that the same reference numerals in different drawings will be used to refer to the same elements that have been described.

[0039] Figure 1 A flowchart of a hardware simulation method provided by some embodiments of the present disclosure is shown in FIG. Figure 1 As shown, the hardware simulation method includes the following operations.

[0040] Step S10: loading at least one system call data into the kernel space, and storing a data structure including at least one system call data in the kernel space.

[0041] Step S20: Loading user-mode simulation data including system call instructions into the user space.

[0042] Step S30: execute the system call instruction in the user space, obtain the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and call the system call data into the user space for hardware simulation supporting the system call instruction in the user space.

[0043] For example, the above steps S10-S30 are all performed by a device with hardware simulation capabilities, such as a single-chip microcomputer, a field programmable gate array (FPGA) chip, a complex programmable logic device (CPLD) and the like, to achieve hardware simulation.

[0044] For example, combined with Figure 2 As shown, in step S10, the system call data is loaded and stored in the kernel space. Then, in the subsequent steps, when responding to the system call instruction and needing to obtain the required system call data from the kernel space, the system call data stored in the kernel space can be directly called without rebuilding the operating system corresponding to the system call instruction to generate the required system call data.

[0045] Furthermore, since the system call data called from the kernel space in subsequent operations is the system call data stored in the kernel space in step S10, the system call data obtained in the user space can remain consistent each time the system call instruction is executed, thereby improving the accuracy and consistency of the hardware simulation results obtained in the user space based on the obtained system call data in subsequent operations. At the same time, it can also reduce program failures (bugs) that may be caused by inconsistencies in system call data during the process of running user-mode simulation data in the user space, thereby further optimizing the hardware simulation process in the user space.

[0046] For example, the system call data may include environment effect parameters under the operation of the operating system and path information corresponding to the environment effect parameters. For example, the environment effect parameters may include data such as effect parameters or processing results under the operation of the operating system, such as the impact or effect on the hardware simulation under the environment of the operation of the operating system, such as register impact, memory impact, etc. Therefore, after executing the system call instruction in step S30 to call the system call data stored in the kernel space to the user space, hardware simulation can be implemented based on the environment effect parameters such as effect parameters or processing results in the system call data.

[0047] For example, the above step S10 may include the following operations.

[0048] Step S110: Load at least one system call data into the kernel space and store it, and generate a path information table based on the path information stored in the at least one system call data. For example, the path information table is included in the data structure, and the path information table is used to index at least one system call data in the data structure.

[0049] Therefore, the location information of the system call data in the data structure of the kernel space, such as storage address and storage space, can be determined through the path information table, so that when responding to the system call instruction in the subsequent steps, the system call data corresponding to the system call instruction in the data structure can be obtained according to the path information table.

[0050] For example, the path information table may include the name, starting address information, and cache space information of the system call data, so that the indexing of the system call data corresponding to the system call instruction in the data structure is implemented through the path information table.

[0051] For example, the specific operation of generating the path information table in the above step S110 may be implemented by the following kernel code.

[0052] struct syscall_data_info{

[0053] uint32_t index; / / syscall index

[0054] uint64_t start_addr; / / syscall data buffer start address

[0055] uint32_t size; / / syscall data buffer size

[0056] }

[0057] For example, the uint32_t index instruction is used to establish the name of the system call data in the data structure, the uint64_t start_addr instruction is used to establish the starting address information of the system call data in the data structure, and the uint32_t size instruction is used to establish the cache space information of the system call data in the data structure. Thus, after the path information table is generated based on the name, starting address information and cache space information of the established system call data in the data structure, the path information table can be used to determine the location information of the system call data stored in the data structure, thereby realizing the indexing of the system call data stored in the data structure.

[0058] Figure 3 A schematic diagram of a path information table in a data structure in a kernel space provided for some embodiments of the present disclosure.

[0059] For example, Figure 3As shown, the path information table can be used to index multiple system call data stored in the data structure. For example, Syscall_0 to Syscall_n respectively represent the name of each system call data in the multiple system call data, Start_addr_0 to Start_addr_n respectively represent the starting address information of each system call data in the multiple system call data, and size_0 to size_n respectively represent the cache space information of each system call data in the multiple system call data. Figure 3 The path information table shown obtains storage location information of multiple system call data in the data structure, such as the storage location and storage space of each system call data in the data structure, and then implements indexing of the system call data stored in the data structure.

[0060] For example, combined with Figure 2 As shown, in step S20, the user-state simulation data is loaded and stored in the user space, so that in subsequent operations, the stored user-state simulation data is run in the user space to implement hardware simulation.

[0061] For example, in step S30, during the process of running the user-state simulation data in the user space, when a system call instruction in the user-state simulation data is executed, it is necessary to obtain corresponding system call data from the kernel space according to the system call instruction to support the running of the user-state simulation data in the user space. For example, when a system call instruction in the user-state simulation data is executed in the user space, the running of the user-state simulation data in the user space is interrupted, and the user space jumps to the kernel space to call the system call data stored in the kernel space. After the system call data to be obtained is called into the user space, the user-state simulation data continues to run in the user space to complete the hardware simulation.

[0062] Figure 4 A flowchart of another hardware simulation method provided in some embodiments of the present disclosure. For example, Figure 4 The step S110 shown in FIG. Figure 1 An example of step S10 is shown in FIG. Figure 4 The step S120 shown in FIG. 1 corresponds to Figure 1 In step S20 shown in FIG. Figure 4 The steps S130 and S140 shown in FIG. Figure 1 The step S30 shown in FIG. 1 is repeated and will not be described in detail.

[0063] like Figure 4 As shown, the hardware simulation method includes the following operations.

[0064] Step S100: Load the system call processing program into the kernel space, so as to respond to the system call instruction in the user space through the system call processing program, thereby being used for calling the system call data from the kernel space to the user space.

[0065] Step S110: loading at least one system call data into the kernel space and storing it, and generating a path information table based on the path information stored in the at least one system call data.

[0066] Step S120: Loading user-mode simulation data including system call instructions into the user space.

[0067] Step S130: Execute the system call instruction in the user space to jump to the kernel space, and in the kernel space, the system call handler obtains the system call data corresponding to the system call instruction based on the path information table and transmits the system call data to the user space.

[0068] Step S140: storing the called system call data in a data buffer area in the user space, and running user-mode simulation data based on the data stored in the data buffer area to perform hardware simulation.

[0069] For example, combined with Figure 2 and Figure 4 As shown, in step S100, the system call handler can be loaded and stored in the kernel space. When the system call instruction is subsequently executed to jump to the kernel space to obtain the system call data stored in the kernel space, the system call handler stored in the kernel space can be used to implement the call of the system call data from the kernel space to the user space.

[0070] For example, in step S130, when the system call instruction in the user-mode emulation data is executed in the user space, the operation of the user-mode emulation data in the user space is interrupted, and the system call handler stored in the kernel space is executed by jumping from the user space to the kernel space. The system call handler responds to the system call instruction to determine the system call data that needs to be called from the data structure of the kernel space corresponding to the system call instruction, and determines the storage location of the system call data that needs to be called (such as the name of the system call data in the data structure, the starting address information and the cache space information, etc.) through the path information table in the data structure, and transmits (such as copies) the system call data stored in the storage location to the user space, thereby realizing the call of the system call data from the kernel space to the user space.

[0071] For example, in step S140, after the required system call data is called into the user space through the system call handler, the called system call data is stored in the data cache area of ​​the user space, and then the system call data can be extracted from the data cache area of ​​the user space to cooperate with the operation of the user-mode simulation data in the user space.

[0072] For example, the specific operations of using the system call handler to obtain the system call data and storing the obtained system call data in the data buffer area of ​​the user space in the above steps S130 and S140 can be implemented by the following kernel code.

[0073]

[0074] For example, the Syscall_handler instruction is used to run the system call handler stored in the kernel space; curr_syscall_index represents the system call data stored in the data structure that needs to be called currently; the tracking_table[curr_syscall_index].start_addr function is used to obtain the starting address information of the system call data stored in the data structure in the kernel space; the tracking_table[curr_syscall_index].size function is used to obtain the cache space information of the system call data in the data structure; out_buffer represents the target address information of the system call data stored in the user space after being called into the user space, that is, the address information stored in the data cache area in the user space; the memcopy function is used to determine the storage location of the system call data in the data structure based on the obtained starting address information and cache space information of the system call data in the data structure, and copy and transfer the data stored at the storage location (that is, the required system call data) to the data cache area in the user space, thereby realizing the call of the system call data from the kernel space to the user space.

[0075] Figure 5 A flowchart of another hardware simulation method provided in some embodiments of the present disclosure. It should be noted that: Figure 5 Steps S210, S230 and S250 in the hardware simulation method shown are respectively Figure 1 Steps S10, S20 and S30 in the hardware simulation method shown are substantially the same or similar, and the repeated parts are not repeated here.

[0076] like Figure 5 As shown, the hardware simulation method includes the following operations.

[0077] Step S210: loading at least one system call data into the kernel space, and storing a data structure including at least one system call data in the kernel space.

[0078] Step S220: Load kernel-mode simulation data into kernel space.

[0079] Step S230: Loading user-mode simulation data including system call instructions into the user space.

[0080] Step S240: running kernel-mode simulation data in kernel space, and jumping to user space to run user-mode simulation data to execute system call instructions in user space.

[0081] Step S250: Execute the system call instruction in the user space, obtain the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and call the system call data into the user space for hardware simulation supporting the system call instruction in the user space.

[0082] For example, combined with Figure 2 and Figure 5 As shown, in step S220, kernel-mode simulation data is loaded and stored in kernel space to support the implementation of hardware simulation in user space.

[0083] For example, combined with Figure 2 and Figure 5 As shown, in step S240, kernel-mode simulation data is run in kernel space to implement the initialization operation of the hardware simulation process in kernel space, and then jumps to user space to run user-mode simulation data in user space to implement hardware simulation in user space.

[0084] Figure 6 A flowchart of another hardware simulation method provided in some embodiments of the present disclosure. It should be noted that: Figure 6 In the hardware simulation method shown in FIG. 1 , except step S310, steps S320 to S340 are respectively Figure 1 Steps S10 to S30 in the hardware simulation method shown are substantially the same or similar, and the repeated parts are not repeated here.

[0085] like Figure 6 As shown, the hardware simulation method further includes step S310: obtaining at least one system call data.

[0086] For example, step S310 may include: generating the at least one system call data by software simulation. For example, software simulation may be performed by a device such as a software simulator or a virtual machine.

[0087] For example, the above step S310 may specifically include: performing software simulation through a software simulator or a virtual machine to obtain a processing result under the operation of the operating system, and obtaining the above at least one system call data according to the processing result. It should be noted that in the embodiments of the present disclosure, the method of obtaining the system call data is not limited to the method described above, and the system call data may also be obtained in any other applicable manner, such as collecting data generated by the actual operation of the operating system, or querying and obtaining from a database, and the embodiments of the present disclosure are not limited to this.

[0088] At least one embodiment of the present disclosure further provides a hardware emulation device. Fig. 7A A schematic block diagram of a hardware simulation device provided in some embodiments of the present disclosure. Fig. 7A As shown, in some examples, the hardware simulation device 200 includes a kernel space data loading module 210 , a user space data loading module 220 , and a data execution module 230 .

[0089] The kernel space data loading module 210 is configured to load at least one system call data into the kernel space and store a data structure including at least one system call data in the kernel space. For example, the kernel space data loading module 210 may execute Figure 1 Step S10 in the hardware simulation method shown.

[0090] The user space data loading module 220 is configured to load the user state simulation data including the system call instruction into the user space. For example, the user space data loading module 220 may execute Figure 1 Step S20 in the hardware simulation method shown.

[0091] The data operation module 230 is configured to execute the system call instruction in the user space, obtain the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and call the system call data into the user space for hardware simulation supporting the system call instruction in the user space. For example, the data operation module 230 may execute Figure 1 Step S30 in the hardware simulation method shown.

[0092] Figure 7B A schematic block diagram of another hardware simulation device provided in some embodiments of the present disclosure. Figure 7B As shown, in some examples, the hardware simulation device 200 further includes a system call data acquisition module 240. The system call data acquisition module 240 is configured to acquire at least one system call data. For example, the system call data acquisition module 240 may execute Figure 6 Step S310 in the hardware simulation method shown.

[0093] For example, the kernel space data loading module 210, the user space data loading module 220, the data running module 230 and the system call data acquisition module 240 can be hardware, software, firmware and any feasible combination thereof. For example, the kernel space data loading module 210, the user space data loading module 220, the data running module 230 and the system call data acquisition module 240 can be dedicated or general circuits, chips or devices, etc., or can be a combination of a processor and a memory. The embodiments of the present disclosure do not limit the specific implementation forms of the above-mentioned modules.

[0094] It should be noted that in the embodiment of the present disclosure, each module of the hardware simulation device 200 corresponds to each step of the aforementioned hardware simulation method. For the specific functions of the hardware simulation device 200, reference can be made to the relevant description of the hardware simulation method, which will not be repeated here. Fig. 7A and Figure 7B The components and structures of the hardware simulation device 200 shown are merely exemplary and non-limiting. The hardware simulation device 200 may further include other components and structures as required.

[0095] At least one embodiment of the present disclosure also provides an electronic device, which includes a processor, a memory and one or more computer program modules. One or more computer program modules are stored in the memory and configured to be executed by the processor, and one or more computer program modules include instructions for executing the hardware simulation method provided by any embodiment of the present disclosure. When performing hardware simulation, the electronic device can load and store the required system call data in advance before implementing the hardware simulation, thereby converting the execution process of the system call instruction in the user mode and the kernel mode into a relatively simple data movement operation, thereby supporting the hardware simulation of the system call instruction in the user space. When implementing the hardware simulation, there is no need to rebuild the operating system corresponding to the system call instruction, for example, the source code including the system call instruction used to implement the hardware simulation can be performed in, for example, a bare metal environment or an emulator environment, thereby reducing the amount of calculation and running time in the hardware simulation process, and reducing the cost of implementing the hardware simulation.

[0096] Figure 8 A schematic block diagram of an electronic device provided in some embodiments of the present disclosure. Figure 8 As shown, the electronic device 300 includes a processor 310 and a memory 320. The memory 320 is used to store non-transitory computer-readable instructions (e.g., one or more computer program modules). The processor 310 is used to run non-transitory computer-readable instructions, and when the non-transitory computer-readable instructions are run by the processor 310, one or more steps in the hardware simulation method described above can be executed. The memory 320 and the processor 310 can be interconnected through a bus system and / or other forms of connection mechanisms (not shown).

[0097] For example, the processor 310 may be a central processing unit (CPU), a graphics processing unit (GPU), or other forms of processing units having data processing capabilities and / or program execution capabilities. For example, the central processing unit (CPU) may be an X86 or ARM architecture, etc. The processor 310 may be a general-purpose processor or a dedicated processor, and may control other components in the electronic device 300 to perform desired functions.

[0098] For example, the memory 320 may include any combination of one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disk read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules may be stored on the computer-readable storage medium, and the processor 310 may run one or more computer program modules to implement various functions of the electronic device 300. Various applications and various data, as well as various data used and / or generated by the application, etc. may also be stored in the computer-readable storage medium.

[0099] It should be noted that, in the embodiment of the present disclosure, the specific functions and technical effects of the electronic device 300 can refer to the above description of the hardware simulation method and the hardware simulation device, which will not be repeated here.

[0100] Fig. 9 This is a schematic block diagram of another electronic device provided in some embodiments of the present disclosure. The electronic device 400 is suitable for implementing the hardware simulation method provided in the embodiments of the present disclosure. The electronic device 400 may be a terminal device, etc. It should be noted that: Fig. 9 The electronic device 400 shown is merely an example and does not impose any limitation on the functions and scope of use of the embodiments of the present disclosure.

[0101] like Fig. 9As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 410, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 420 or a program loaded from a storage device 480 to a random access memory (RAM) 430. In the RAM 430, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 410, the ROM 420, and the RAM 430 are connected to each other via a bus 440. An input / output (I / O) interface 450 is also connected to the bus 440.

[0102] Typically, the following devices may be connected to the I / O interface 450: an input device 460 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 470 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 480 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 490. The communication device 490 may allow the electronic device 400 to communicate with other electronic devices wirelessly or by wire to exchange data. Although Fig. 9 The electronic device 400 is shown to have various devices, but it should be understood that it is not required to implement or possess all the devices shown, and the electronic device 400 may alternatively implement or possess more or fewer devices.

[0103] For example, according to an embodiment of the present disclosure, the above-mentioned hardware simulation method can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the above-mentioned hardware simulation method. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 490, or installed from the storage device 480, or installed from the ROM 420. When the computer program is executed by the processing device 410, the functions defined in the hardware simulation method provided in the embodiment of the present disclosure can be implemented.

[0104] Fig.10 A schematic diagram of a storage medium provided in some embodiments of the present disclosure. Fig.10 As shown, the storage medium 500 may be a non-transitory computer-readable storage medium, and one or more computer-readable instructions 501 may be non-transitory stored on the storage medium 500. For example, when the computer-readable instructions 501 are executed by a processor, one or more steps in the hardware simulation method described above may be executed.

[0105] For example, the storage medium 500 may be applied to the above-mentioned electronic device. For example, the storage medium 500 may include a memory in the electronic device.

[0106] For example, the storage medium may include a memory card of a smart phone, a storage component of a tablet computer, a hard disk of a personal computer, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), flash memory, or any combination of the above storage media, or other applicable storage media.

[0107] For example, the description of the storage medium 500 can refer to the description of the memory in the embodiment of the electronic device, and the repeated parts are not repeated. The specific functions and technical effects of the storage medium 500 can refer to the description of the hardware simulation method and the hardware simulation device above, and are not repeated here.

[0108] There are a few points to note:

[0109] (1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to the general design.

[0110] (2) In the absence of conflict, the embodiments of the present disclosure and the features therein may be combined with each other to obtain new embodiments.

[0111] The above description is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. The protection scope of the present disclosure shall be based on the protection scope of the claims.

Claims

1. A hardware simulation method, comprising: Loading at least one system call data into a kernel space, and storing a data structure including the at least one system call data in the kernel space; Loading user-mode simulation data including system call instructions into the user space; Executing the system call instruction in the user space, acquiring system call data corresponding to the system call instruction in a data structure in the kernel space based on the system call instruction, and calling the system call data into the user space for hardware emulation supporting the system call instruction in the user space; as well as Loading a system call processing program into the kernel space, so as to respond to the system call instruction in the user space through the system call processing program, thereby being used for calling the system call data from the kernel space to the user space; Wherein, the data structure further includes a path information table, and the path information table is used to index the at least one system call data in the data structure; Executing the system call instruction in the user space, acquiring the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and calling the system call data into the user space, including: The system call instruction is executed in the user space to jump to the kernel space, and in the kernel space, the system call handler obtains the system call data corresponding to the system call instruction based on the path information table and transfers the system call data to the user space.

2. The hardware simulation method according to claim 1, wherein: The system call data includes environment effect parameters under the operation of the operating system and path information corresponding to the environment effect parameters.

3. The hardware simulation method according to claim 2, wherein: Loading the at least one system call data into the kernel space, and storing the data structure including the at least one system call data in the kernel space, comprises: The at least one system call data is loaded into the kernel space and stored, and the path information table is generated based on the path information stored in the at least one system call data.

4. The hardware simulation method according to claim 1, wherein: The path information table includes the name of the system call data, the starting address information and the cache space information.

5. The hardware simulation method according to claim 1, wherein: Executing the system call instruction in the user space, acquiring the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and calling the system call data into the user space, further comprising: The called system call data is stored in a data cache area in the user space, and the user-mode simulation data is run based on the data stored in the data cache area to perform hardware simulation.

6. The hardware simulation method according to any one of claims 1 to 5, further comprising: Obtain the at least one system call data.

7. The hardware simulation method according to claim 6, wherein: Acquiring the at least one system call data includes: The at least one system call data is generated by software simulation.

8. The hardware simulation method according to claim 7, wherein: Generating the at least one system call data by software simulation includes: The processing result under the operation of the operating system is obtained by performing software simulation through a software simulator or a virtual machine, and the at least one system call data is obtained according to the processing result.

9. The hardware simulation method according to any one of claims 1 to 5, further comprising: The kernel state simulation data is loaded into the kernel space.

10. The hardware simulation method according to claim 9, further comprising: The kernel-mode simulation data is run in the kernel space, and the kernel space is jumped to run the user-mode simulation data to execute the system call instruction in the user space.

11. A hardware simulation device, comprising a kernel space data loading module, a user space data loading module and a data running module, in, The kernel space data loading module is configured to load at least one system call data into the kernel space, and store a data structure including the at least one system call data in the kernel space; The user space data loading module is configured to load user state simulation data including system call instructions into the user space; The data execution module is configured to execute the system call instruction in the user space, obtain system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and call the system call data into the user space for hardware emulation supporting the system call instruction in the user space; The data execution module is further configured to load a system call processing program into the kernel space, so as to respond to the system call instruction in the user space through the system call processing program, thereby being used for calling the system call data from the kernel space to the user space; Wherein, the data structure further includes a path information table, and the path information table is used to index the at least one system call data in the data structure; Executing the system call instruction in the user space, acquiring the system call data corresponding to the system call instruction in the data structure in the kernel space based on the system call instruction, and calling the system call data into the user space, including: The system call instruction is executed in the user space to jump to the kernel space, and in the kernel space, the system call handler obtains the system call data corresponding to the system call instruction based on the path information table and transfers the system call data to the user space.

12. The hardware simulation device according to claim 11, further comprising a system call data acquisition module, in, The system call data acquisition module is configured to acquire the at least one item of system call data.

13. An electronic device comprising: processor; Memory; One or more computer program modules, wherein the one or more computer program modules are stored in the memory and configured to be executed by the processor, and the one or more computer program modules include instructions for executing the hardware simulation method described in any one of claims 1-10.

14. A storage medium that non-temporarily stores computer-readable instructions, which, when executed by a computer, can execute the hardware emulation method according to any one of claims 1 to 10.