WO2022166553A1 - 一种实现批量系统调用的方法及装置 - Google Patents

一种实现批量系统调用的方法及装置 Download PDF

Info

Publication number
WO2022166553A1
WO2022166553A1 PCT/CN2022/071747 CN2022071747W WO2022166553A1 WO 2022166553 A1 WO2022166553 A1 WO 2022166553A1 CN 2022071747 W CN2022071747 W CN 2022071747W WO 2022166553 A1 WO2022166553 A1 WO 2022166553A1
Authority
WO
WIPO (PCT)
Prior art keywords
batch system
kernel
call
system calls
instruction
Prior art date
Application number
PCT/CN2022/071747
Other languages
English (en)
French (fr)
Inventor
高欣
文羽中
方彬
何海
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202110163179.2A external-priority patent/CN114879962B/zh
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP22748832.7A priority Critical patent/EP4276603A1/en
Publication of WO2022166553A1 publication Critical patent/WO2022166553A1/zh
Priority to US18/365,312 priority patent/US20230376289A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/47Retargetable compilers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software
    • G06F21/121Restricting unauthorised execution of programs
    • G06F21/125Restricting unauthorised execution of programs by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/441Register allocation; Assignment of physical memory space to logical memory space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/45Exploiting coarse grain parallelism in compilation, i.e. parallelism between groups of instructions
    • G06F8/457Communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space

Definitions

  • the embodiments of the present application relate to the technical field of operating systems, and in particular, to a method and apparatus for implementing batch system calls.
  • Microkernel is a kernel architecture widely used in the field of real-time operating systems. It is characterized by less complexity, higher security, and real-time performance.
  • system programs are similar to applications and also run in user mode. Therefore, the application program running in the user mode needs to call the system program running in the user mode through Inter-Process Communication (IPC).
  • IPC Inter-Process Communication
  • the system program running in the user mode is often called multiple times, and the multiple calls to the system program will lead to frequent context switching, thereby degrading the performance of the operating system.
  • the main solution is to package multiple system calls (System Calls) into batch system calls (Batch System Calls), and implement multiple system calls at one time through batch system calls, thereby reducing the number of IPCs and improving the operating system. performance.
  • the binary code for implementing batch system calls is first registered in the kernel; when batch system calls are required, the binary code is executed by the kernel.
  • Embodiments of the present application provide a method and related apparatus for implementing batch system calls, which can improve the security of batch system calls.
  • a first aspect of the embodiments of the present application provides a method for implementing batch system calls, including: a compiler compiling source code of batch system calls into an executable program, where the source code may be C source code or Domain Specific Language (DSL) ) source code, the executable program contains the abstract syntax tree AST data of batch system calls, wherein, AST is an abstract representation of the source code syntax structure; the loader loads the executable program into the virtual address space of the user mode, and the executable program is loaded into the virtual address space of the user mode.
  • DSL Domain Specific Language
  • the execution program is compiled from the source code of the batch system call, and contains the abstract syntax tree AST data of the batch system call; the loader calls the first instruction, and the first instruction is used to call the kernel to read the description from the virtual address space of the user mode.
  • AST data and generate binary codes stored in the virtual address space of the kernel state based on the AST data for implementing the batch system calls; in this way, when batch system calls are made, the binary code can be executed by the kernel to realize batch system calls. system call.
  • the executable program also includes the call pile code of the batch system call, wherein the call pile code can be understood as the code that replaces the binary code of the batch system call; based on this, the method further includes: calling the call The second instruction in the stub code is used to call the kernel to execute the binary code for implementing batch system calls.
  • batch system calls are implemented by calling stub codes.
  • the method further includes: receiving a calling result for the first instruction, where the calling result includes an identifier of the binary code of the batch system call; the identifier can indicate the binary code of the batch system call Therefore, the identifier can be used as a parameter of the second instruction, that is, the identifier carried in the second instruction is used to call the binary code corresponding to the kernel execution identifier and used to implement batch system calls.
  • the identifier of the binary code for implementing the batch system call is added to the second instruction, so that the kernel can search for the binary code for implementing the batch system call according to the identifier, so as to complete the batch system call.
  • the source code of the batch system call contains the delay information of the batch system call
  • the AST data contains the batch of the delay information of the batch system call, wherein the delay information of the system call is usually implied in the AST data
  • An instruction is also used to call the kernel to calculate the worst execution time of the batch system call based on the latency information in the AST data.
  • AST data can well retain delay information.
  • the first instruction can call the kernel to calculate the worst execution time of batch system calls based on the delay information in AST data, so as to ensure that batch system calls are deterministic time delay.
  • the first instruction is also used to call the kernel to store the worst execution time in the virtual address space of the kernel mode.
  • the kernel is called by the first instruction, so that the kernel stores the worst execution time in the virtual address space of the kernel mode, so that the worst execution time can be read during batch system calls, so as to achieve the purpose of obtaining deterministic delay.
  • a second aspect of an embodiment of the present application provides a method for implementing batch system calls, including: in response to a first instruction, the kernel reads abstract syntax tree AST data of batch system calls from a virtual address space in user mode, wherein the AST It is an abstract representation of the grammatical structure of the source code; the kernel generates binary code for implementing batch system calls based on AST data; the kernel stores the generated binary code in the virtual address space of kernel mode, so that when batch system calls are made, the kernel The binary code can then be executed to implement batch system calls.
  • the method further includes: in response to the second instruction, the kernel executes the binary code for implementing the batch system call.
  • the kernel executes the binary code used to implement the batch system call, thereby implementing the batch system call.
  • the second instruction carries an identifier of the binary code used to implement the batch system call, and the identifier enables the kernel to find the binary code of the current batch system call from the binary codes of multiple batch system calls;
  • the second instruction, the kernel executing the binary code for implementing the batch system call includes: in response to the second instruction, the kernel executing the identification corresponding binary code for implementing the batch system call.
  • the kernel can search for the binary code of the batch system call according to the identifier, so as to complete the batch system call.
  • the AST data contains the delay information of the batch system calls
  • the method further includes: the kernel calculates the worst execution time of the batch system calls based on the delay information in the AST data.
  • AST data can well retain delay information; based on the delay information of batch system calls contained in AST data, the kernel can calculate the worst execution time of batch system calls, thus ensuring that batch system calls are deterministic time delay.
  • the method further includes: the kernel stores the worst execution time in the virtual address space of the kernel mode.
  • the worst execution time is stored in the virtual address space of kernel mode, so that the worst execution time can be read during batch system calls, so as to achieve the purpose of obtaining deterministic latency.
  • a third aspect of the embodiments of the present application provides an apparatus for implementing batch system calls, including: a compilation unit configured to compile source code of batch system calls into an executable program, and the executable program includes abstract syntax tree AST data of batch system calls ;Loading unit, used to load the executable program into the virtual address space of the user mode, the executable program is compiled from the source code of the batch system call, and contains the abstract syntax tree AST data of the batch system call;
  • the calling unit is used to call the first An instruction, the first instruction is used to call the kernel to read AST data from the virtual address space of the user mode, and based on the AST data, generate a binary code stored in the virtual address space of the kernel mode for implementing batch system calls.
  • the executable program also includes the call stub code of the batch system call, and the calling unit is also used to call the second instruction when executing the call stub code of the batch system call, and the second instruction is used to call the kernel execution function.
  • the calling unit is further configured to receive a calling result for the first instruction, where the calling result includes an identifier of the binary code used to implement the batch system call; the second instruction carries an identifier that is used to invoke the kernel execution identifier The corresponding binary code for implementing batch system calls.
  • the source code of the batch system call includes the delay information of the batch system call
  • the AST data includes the delay information of the batch system call
  • the first instruction is also used to call the kernel to calculate the batch based on the delay information in the AST data. The worst execution time of the system call.
  • the first instruction is also used to call the kernel to store the worst execution time in the virtual address space of the kernel mode.
  • a fourth aspect of the embodiments of the present application provides an apparatus for implementing batch system calls, including: a reading unit, configured to, in response to a first instruction, read an abstract syntax tree AST for batch system calls from a virtual address space in user mode data; registration unit, used to generate binary code for implementing batch system calls based on AST data; registration unit, also used to store the generated binary code in the virtual address space of kernel mode.
  • the registration unit is further configured to execute binary codes for implementing batch system calls in response to the second instruction.
  • the second instruction carries an identifier of binary code for implementing batch system calls; the registration unit is further configured to execute the binary code corresponding to the identifier for implementing batch system calls in response to the second instruction.
  • the AST data contains the delay information of the batch system calls, and the registration unit is also used to calculate the worst execution time of the batch system calls based on the delay information in the AST data.
  • the registration unit is also used to store the worst execution time in the virtual address space of the kernel mode.
  • a fifth aspect of an embodiment of the present application provides a computer device, including: one or more processors and a memory; wherein, the memory stores computer-readable instructions; the one or more processors read the Computer readable instructions to cause the computer device to implement the method according to any implementation of the first aspect.
  • the computer device may be a terminal device, such as a smart phone, a smart speaker, a large-screen device, a tablet computer, a vehicle-mounted smart device, an artificial intelligence device, a virtual reality/augmented reality/mixed reality device, and the like.
  • a sixth aspect of an embodiment of the present application provides a terminal device, including: one or more processors and a memory; wherein, the memory stores computer-readable instructions; the one or more processors read the Computer readable instructions to cause the computer device to implement the method according to any implementation of the second aspect.
  • a seventh aspect of the embodiments of the present application provides a computer-readable storage medium, including computer-readable instructions, when the computer-readable instructions are executed on a computer, the computer is made to perform any of the first aspect or the second aspect. An implementation of the method described.
  • An eighth aspect of the embodiments of the present application provides a chip, including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method in any possible implementation manner of the first aspect or the second aspect.
  • the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface.
  • the communication interface is used for receiving data and/or information to be processed, the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface.
  • the communication interface may be an input-output interface.
  • some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
  • the methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
  • a ninth aspect of an embodiment of the present application provides a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be executed by one or more processors to implement any one of the first aspect or the second aspect above method described in an implementation.
  • a tenth aspect of the embodiments of the present application provides a compilation method, and the method can be completed offline, for example, before a computer device (eg, a smart phone) leaves the factory.
  • the compiling method includes: compiling the source code of batch system calls into an executable program, and the executable program includes abstract syntax tree AST data of batch system calls. The AST data will then be used to generate binary code stored in the virtual address space of kernel mode for implementing batch system calls.
  • the source code of the batch system call is compiled into an executable program, and the executable program contains the abstract syntax tree AST data of the batch system call, and the AST data structure is difficult to be inserted into malicious data, so the executable program generated based on the executable program is used for The binary code that implements batch system calls is difficult to be inserted into malicious code, thereby improving the security of batch system calls.
  • an eleventh aspect of the embodiments of the present application provides a compiling apparatus, including:
  • the compilation unit is used to compile the source code of the batch system call into an executable program.
  • the executable program contains the abstract syntax tree AST data of the batch system call, and is used to generate the virtual address space stored in the kernel mode for realizing the batch system call. binary code.
  • the twelfth aspect and the thirteenth aspect of the embodiments of the present application respectively provide a runtime compilation method and a runtime compiler.
  • the compiling method includes compiling abstract syntax tree AST data in an executable program to generate binary code stored in a virtual address space in kernel mode for implementing batch system calls, and the executable program is compiled by compiling the batch system calls obtained from the source code.
  • the runtime compiler includes a compiling unit for compiling the abstract syntax tree AST data in the executable program to generate binary code stored in the virtual address space of the kernel mode for implementing batch system calls.
  • the embodiments of the present application at least have the following advantages:
  • the source code of batch system calls is compiled into AST data of batch system calls, and then the AST data is loaded into the virtual address space of user mode; the kernel reads AST data from the virtual address space of user mode, and based on the AST data The AST data generates the binary code of the batch system call, and finally stores the binary code of the batch system call in the virtual address space of the kernel mode, thereby completing the registration of the batch system call. Since it is difficult to insert malicious data into the AST data structure, it is difficult to insert malicious code into the binary code that implements batch system calls generated by AST data based on batch system calls, so as to avoid malicious code causing the kernel to run for batch system calls. The binary code of the system call is wrong or the delay is too long, thus improving the security of batch system calls.
  • FIG. 1 is a schematic diagram of a microkernel architecture in an embodiment of the present application.
  • FIG. 2 is a schematic diagram of an embodiment of a method for implementing batch system calls in an embodiment of the present application
  • FIG. 3 is a schematic diagram of the AST data of batch system calls in the embodiment of the application.
  • FIG. 4 is a schematic diagram of calculating the worst execution time in an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a software system architecture diagram in an embodiment of the application.
  • FIG. 6 is a schematic diagram of stages of a method for implementing batch system calls in an embodiment of the present application
  • FIG. 7 is a schematic diagram of an embodiment of a compilation process in an embodiment of the present application.
  • FIG. 8 is a schematic diagram of an embodiment of an apparatus for implementing batch system calls in an embodiment of the present application.
  • FIG. 9 is a schematic diagram of another embodiment of an apparatus for implementing batch system calls in an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a terminal device in an embodiment of the present application.
  • the operating system refers to the system software that manages computer hardware and software resources, and is also the cornerstone of the computer system.
  • the operating system needs to handle basic tasks such as managing and configuring memory, prioritizing the supply and demand of system resources, controlling input and output devices, operating the network, and managing the file system.
  • the operating system can also provide an interface for the user to interact with the system.
  • microkernel architecture a microkernel architecture
  • macrokernel architecture a microkernel architecture
  • the embodiments of the present application may be applied to a microkernel architecture.
  • the microkernel architecture is characterized by running as few functions as possible in the kernel space and providing the necessary mechanisms to implement the operating system. These mechanisms include virtual address space management, thread management, inter-process communication, and more.
  • the micro-kernel puts many components, such as the file system and network protocol stack, in the user mode to run, and reduces its real kernel functions to very few.
  • the microkernel architecture applied in the embodiments of the present application may be as shown in FIG. 1 , and the microkernel architecture includes a kernel running in kernel mode, an application program running in user mode, and a system program running in user mode.
  • the kernel refers to the program used to manage the data input and output requirements issued by the software. These requirements are translated into data processing instructions and processed by the processor and/or other electronic components in the computer. It is the most basic of modern operating systems. part.
  • System program refers to a system that controls and coordinates computer equipment and external equipment, supports the development and operation of application software, and is a collection of various programs that do not require user intervention.
  • System programs include, but are not limited to, file system programs, memory management programs, network programs, and drivers.
  • the application program corresponds to the system program and is a collection of various programs that the user can use.
  • Kernel state and user state are two working states of the processor (the central processing unit CPU is used as an example to be introduced below). If the CPU executes the system call and executes the kernel code, the CPU (or the current process) is said to be in the kernel mode; if the CPU executes the user code, the CPU (or the current process) is said to be in the user mode.
  • the kernel state can also be called a privileged state, and the user state can also be called an unprivileged state. The following description will use the kernel state and the user state.
  • Context refers to the execution information of a process within the operating system.
  • Context Switch Context Switch
  • Context Switch refers to the kernel switching processes on the CPU. For example, in the process of switching from process A to process B, the CPU will read the execution information of process A from the register and save it in the process control block (Process Control Block) of process A, which is located in the memory; , the CPU restores the execution information of process B to the register, and then executes process B.
  • Process Control Block Process Control Block
  • a process is the running entity of a program, and a program is a description of instructions, data, and their organization.
  • a process can have multiple threads concurrently, and each thread executes different tasks in parallel.
  • a thread can be the actual unit of operation of a process.
  • the binary code used to implement batch system calls in the application will be registered into the kernel.
  • the kernel executes the binary code to realize batch system calls. .
  • the process of registering the binary code to the kernel includes: first storing the binary code in the virtual address space of the user state, then the kernel reads the binary code from the virtual address space stored in the user state, and stores the read binary code in the virtual address space. Enter the virtual address space of kernel mode.
  • the binary code is a line of code, it is easy to insert malicious code between lines; if the binary code of batch system calls is stored in the virtual address space of user mode for the kernel to read and complete the registration, once Malicious code is inserted into the binary code of batch system calls in the virtual address space of user mode, which will cause the malicious code to be registered into the kernel.
  • malicious code will be executed by the kernel and cause errors, so the security is poor.
  • the embodiments of the present application provide a method for implementing batch system calls, which is different from directly storing the binary code of batch system calls in the virtual address space of user mode. Convert it into abstract syntax tree AST data, and then store the AST data in the virtual address space of user mode; after the kernel reads the AST data from the virtual address space of user mode, convert the AST data into binary code and complete the registration. Compared with binary code, the data structure of AST data is difficult to be inserted into malicious data, so the binary code of batch system calls registered in the kernel is difficult to be inserted into malicious code, so the security is higher.
  • the present application provides an embodiment of a method for implementing batch system calls, which includes:
  • the source code of the batch system call is compiled into an executable program, where the executable program includes the abstract syntax tree AST data of the batch system call.
  • the source code for implementing batch system calls can be either C source code or Domain Specific Language (DSL) source code.
  • DSL Domain Specific Language
  • the domain-specific language is a computer language specially designed to solve a certain type of task, which is opposite to the General Purpose Language (GPL).
  • GPL General Purpose Language
  • An executable program usually contains two parts, a program and a data.
  • the program part can be called a program segment, and the data part can be called a data segment.
  • the data segment is used to save the global variables and static variables of the program.
  • syntax tree is an abstract representation of the syntax structure of source code. It expresses the grammatical structure of the programming language in the form of a tree, each node on the tree represents a structure in the source code, and the node can be an expression.
  • the AST data of the batch system call belongs to the data segment in the executable program of the batch system call, so in this embodiment, the executable program mainly refers to the data segment containing the AST data; it should be noted that when compiling the batch system call In the process of source code, other codes may also be generated, and this part of the code belongs to the program segment. For example, in the process of compiling the source code of batch system calls, the call pile code of batch system calls can be generated, and the call piles of batch system calls can be generated.
  • the code belongs to the program segment part, and the call stub code of the batch system call will be introduced in detail below.
  • Figure 3 shows the AST data of a batch system call. It can be seen that the data structure of AST data is different from binary code, and it is difficult to insert malicious data into the data structure of AST data.
  • the executable program may be included in an executable linkable format (Executable and Linkable Format, ELF) file, and the executable linkable format is the binary file format standard of the Unix-like operating system on the x86 architecture. Because of its scalability and flexibility, it can also be applied to operating systems of other processors and computer system architectures.
  • ELF Executable and Linkable Format
  • a compiler is usually used to compile the source code into an executable program, but the compiler usually compiles the source code into binary code. Therefore, a compiler plug-in can be added for compiling the source code of batch system calls into an executable program containing AST data.
  • the executable program is loaded into the virtual address space of the user mode.
  • the executable program is obtained by compiling the source code of the batch system call, and includes the abstract syntax tree AST data of the batch system call.
  • the executable program is usually stored in an external memory such as a disk.
  • the executable program needs to be loaded into the virtual address space of the user mode first.
  • the virtual address space of the operating system includes the virtual address space of user mode and the virtual address space of kernel mode.
  • its virtual address space also called addressing space or linear virtual address space
  • the maximum virtual address space corresponding to the kernel, the process of the application program and the process of the system program is 4G.
  • the highest 1G byte from virtual address 0xC0000000 to virtual address 0xFFFFFF
  • the kernel which is called the virtual address space of kernel mode.
  • the lower 3G bytes from virtual address 0x00000000 to virtual address 0xBFFFFFFFFF) are used by other processes, called the virtual address space of user mode.
  • the executable program can be included in the ELF file, and when the executable program is included in the ELF file, the ELF loader can be used to load the executable program. Specifically, the ELF loader loads the ELF file into the virtual address space of the user mode, and then decompresses it to obtain an executable program.
  • a first instruction is invoked, where the first instruction is used to invoke the kernel to read AST data from the virtual address space of user mode, and generate binary codes of batch system calls stored in the virtual address space of kernel mode based on the AST data.
  • the system call is called by calling the first instruction, and the system call can be understood as a system call for registering batch system calls; by calling the system call for registering batch system calls, the kernel completes the registration of batch system calls.
  • the address of the virtual address space of the user mode can be used as a parameter of the first instruction, the parameter is passed to the kernel, and then the kernel reads the AST data in the virtual address space of the user mode according to the parameter, and then according to the AST data Complete the registration of batch system calls.
  • the operation of calling the first instruction can be implemented by various programs; for example, the code of the ELF loader can be modified, so that the ELF loader can call the first instruction after loading the executable program; or a new component can be added, The component is used to invoke the first instruction after the executable program is loaded.
  • the kernel reads the abstract syntax tree AST data of the batch system call from the virtual address space of the user mode.
  • the kernel can freely access the entire virtual address space without any restrictions (for example, it can include virtual address 0xC0000000 to virtual address 0xFFFFFF, and from virtual address 0x00000000 to virtual address 0xBFFFFFFF), so the kernel can access the virtual address space of user mode.
  • the AST data can be read from the virtual address space of the user mode.
  • the kernel In operation 105, the kernel generates binary codes for implementing batch system calls based on the AST data.
  • the kernel can convert the AST data into binary code; since the process of generating binary code based on AST data is a relatively mature technology, it will not be described in detail here.
  • the kernel stores the generated binary code in the virtual address space of the kernel mode.
  • the kernel may establish a batch system call table in the virtual address space, where the batch system call table is used to store the binary codes of the batch system calls.
  • the source code of the batch system call is compiled into the AST data of the batch system call, and then the AST data is loaded into the virtual address space of the user mode; the kernel reads from the virtual address space of the user mode. Take the AST data, generate the binary code of the batch system call based on the AST data, and finally store the binary code of the batch system call in the virtual address space of the kernel mode, thus completing the registration of the batch system call.
  • the binary code of the batch system call can be executed by the kernel to complete the batch system call.
  • the call stub code (Call Stub) of the batch system call can also be obtained.
  • the aforementioned executable program also includes call stub codes for batch system calls.
  • the stub code is the code used to replace some codes; in the embodiment of the present application, the calling stub code can be understood as the code that replaces the binary code of the batch system call.
  • the methods provided in the embodiments of the present application may also include:
  • the call pile code of the batch system call belongs to the program segment of the executable program; in the process of running the executable program, the call pile code of the batch system call will be executed, and the second instruction belongs to an instruction in the call pile code. .
  • the process of calling the second instruction occurs in the user mode; the system call to the batch system call is implemented by calling the second instruction.
  • the methods provided in the embodiments of the present application may further include:
  • Operation 108 in response to the second instruction, the kernel executes binary code for implementing the batch system call.
  • the source code of the batch system call is compiled into two parts, the call pile code and the AST data, and the call pile code is used to replace the code of the batch system call; when the call pile code is executed, the call pile code will be called.
  • the kernel executes the code for the batch system call, thereby completing the batch system call.
  • the executable program may contain AST data of multiple batch system calls, and accordingly, the kernel will store the binary codes of multiple batch system calls in the virtual address space of the kernel mode.
  • the kernel needs to first determine which batch system call needs to be called.
  • the method provided in this embodiment further includes: in the user mode, receiving a call result for the first instruction, where the call result includes an identifier of the binary code used to implement the batch system call.
  • the identifier of the binary code used to implement the batch system call can be used as a parameter of the second instruction, and it can also be understood that the identifier of the binary code used to implement the batch system call is carried in the second instruction, and the second instruction carrying the identifier Used to call the binary code corresponding to the kernel execution identifier and used to implement batch system calls.
  • operation 108 specifically includes:
  • the kernel executes the binary code corresponding to the identification for implementing the batch system call.
  • the batch system call table in the virtual address space of the kernel mode stores the binary codes of three batch system calls.
  • the identifiers of the binary codes of these three batch system calls are batch system call 0, batch system call 1 and batch system call respectively.
  • Call 2; the identifier of the binary code of the batch system call carried in the second instruction is the batch system call 1, then the kernel can find the binary code of the batch system call 1 from the batch system call table and execute the binary code, thereby completing the batch system call System call that invokes 1.
  • connection code may be added, and the function of the connection code is to judge the next system call and the parameters of the system call according to the return value of one system call.
  • complex connection code will make batch system calls without deterministic latency.
  • Latency refers to the execution time of the service, and deterministic latency means that the fluctuation of the execution time of the service needs to be guaranteed within a limited range. For example, for unmanned driving or assisted driving systems, there are obstacles in front of them that need to be identified, and the time to identify the obstacles should be controlled within the fluctuation range. Otherwise, the perception business will not be able to plan, and the control business after the perception will not be able to be determined at a certain time. Gives a mechanical response, such as braking. The deterministic delay of the entire system is jointly determined by all components of the system. The deterministic latency of the operating system is the foundation of the deterministic latency of the entire system, which requires the kernel to respond to the user-mode process within a certain time range.
  • the following provides a method to ensure that batch system calls have deterministic latency.
  • semantics describing the delay information are added to the source code of the batch system call, that is, the source code of the batch system call contains the delay information of the batch system call, and correspondingly, the AST data contains the delay information of the batch system call.
  • the latency information of batch system calls is usually implied in the AST data.
  • the for-each loop traverses the elements in the array to obtain the required elements. Therefore, the length of the array can be used as the delay information. For example, if there are 100 elements in the array, the number of 100 can be used as the delay information of the for-each loop, that is, the required elements can be obtained by traversing at most 100 times.
  • code For binary code, delay information is often not preserved.
  • codes such as go to, br, and beq are often used to construct loops; taking the code go to as an example, it can only indicate jumping to a certain line of code, but cannot indicate how many times it needs to jump.
  • the delay information will be lost.
  • the source code of the call is compiled into the AST data of the batch system call, and the delay information will be well preserved for the calculation of the delay.
  • the first instruction is further used to call the kernel to calculate the worst execution time of the batch system call based on the delay information in the AST data.
  • the method provided by the embodiment of the present application further includes: the kernel calculates the worst execution time of the batch system call based on the delay information in the AST data.
  • the required elements can be obtained by traversing at least 100 times; therefore, the worst execution time can be calculated based on the traversal times of 100 and the delay of each traversal.
  • the batch system call includes system call 1, system call 2 and system call 3, and a schematic diagram of calculating the worst execution time can be shown in Figure 4.
  • semantics describing the delay information are added to the source code of the batch system call, and then the source code of the batch system call is compiled into AST data containing the delay information; after the kernel reads the AST data, it can be based on The delay information in the AST data is used to calculate the worst execution time of the batch system call, thus ensuring that the batch system call has a deterministic delay.
  • the kernel stores the binary code of batch system calls in the virtual address space of kernel mode; similarly, after calculating the worst execution time, the worst execution time can also be The time is stored in the virtual address space of the kernel mode.
  • the first instruction is further used to call the kernel to store the worst execution time in the virtual address space of the kernel mode.
  • the method provided by the embodiment of the present application further includes: the kernel stores the worst execution time in the virtual address space of the kernel state. Similar to the binary code of batch system calls, the kernel can also store the worst execution time in the batch system call table.
  • the software system architecture diagram of the method for implementing batch system calls provided by the embodiments of the present application may be as shown in FIG. 5 .
  • the software system framework may include a newly added compiler plug-in, user mode code, an application program loader after the code is modified, and a kernel.
  • the newly added compiler plug-in is used to perform operation 101, that is, to compile the source code of the application program into user-mode code (also referred to as an executable program).
  • the user mode code includes a code segment and a data segment.
  • the code segment includes the calling stub code err_no batch_syscall_stub(args) syscall new_id and the binary code int service_api(args) of the application program for calling batch system calls, data
  • the segment contains regular data segments and AST data batch_syscall_ast(args).
  • the application loader is used to perform operation 102 and operation 103 .
  • the kernel contains a runtime compiler, which specifically includes a worst execution time accounting component (wcet accounting component) and a code generation component.
  • the worst execution time accounting component is used to calculate the worst execution time based on the delay information in the AST data.
  • the code generation component is used to perform operation 104 , operation 105 and operation 106 .
  • the kernel also includes a batch system call table Batch syscall table.
  • the batch system call table shown in Figure 5 specifically includes batch system call 1 batch_syscall_1 and batch system call 2 batch_syscall_2.
  • the method provided by the embodiment of the present application includes a compilation phase, a program startup phase, and a program execution phase.
  • the source code of the script of the application program is firstly defined, and the source code includes the delay information; then operation 101 is executed to compile the source code into AST data, and the AST data includes the delay information.
  • the source code includes caller code and batch system call Batch Syscall code.
  • the caller code can be compiled into binary code int service_api(args) by using a general compiler.
  • Syscall code is compiled into calling stub code err_no batch_syscall_stub(args) syscall new_id and AST data batch_syscall_ast(args); among them, binary code int service_api(args) and calling stub code err_no batch_syscall_stub(args) syscall new_id constitute the executable connection format ELF Code segment, AST data batch_syscall_ast(args) belongs to the data segment in the executable connection format ELF.
  • the user-mode program loader (such as the ELF loader) is used to load the AST data; then the kernel is used to calculate the worst execution time and compile the AST data into binary code; finally the binary code is registered to the batch system call
  • the system call table includes batch system call 0, batch system call 1 and batch system call 2.
  • the user-mode code is executed; in the process of executing the user-mode code, the call stub code is executed, thereby initiating batch system calls; the kernel-mode system call dispatcher selects the batch system call from the batch system according to the identification of the binary code of the batch system call.
  • the batch system call is searched in the call table, and then the batch system call is found by the kernel execution; after the batch system call, the user mode code continues to be executed.
  • an embodiment of the present application further provides an embodiment of an apparatus for implementing batch system calls, including:
  • the compiling unit 201 is used for compiling the source code of the batch system call into an executable program, and the executable program includes the abstract syntax tree AST data of the batch system call.
  • the loading unit 202 is configured to load an executable program into the virtual address space of the user mode, where the executable program is obtained by compiling the source code of the batch system call, and includes the abstract syntax tree AST data of the batch system call.
  • the calling unit 203 is used to call a first instruction, where the first instruction is used to call the kernel to read AST data from the virtual address space of the user state, and generate a batch system based on the AST data stored in the virtual address space of the kernel state for implementing a batch system Called binary code.
  • the executable program also includes the call pile code of the batch system call.
  • the calling unit 203 is further configured to call the second instruction when executing the call pile code of the batch system call, and the second instruction is used for Invoke the kernel to execute the generated binary code.
  • the calling unit 203 is further configured to receive a calling result for the first instruction, where the calling result includes an identifier of the binary code used to implement batch system calls; the second instruction carries an identifier for calling the kernel to execute Identifies the corresponding binary code for implementing batch system calls.
  • the source code of the batch system call includes the delay information of the batch system call
  • the AST data includes the delay information of the batch system call
  • the first instruction is also used to call the kernel to calculate the batch based on the delay information in the AST data. The worst execution time of the system call.
  • the first instruction is also used to call the kernel to store the worst execution time in the virtual address space of the kernel mode.
  • an embodiment of the present application also provides another embodiment of an apparatus for implementing batch system calls, including:
  • the reading unit 301 is configured to, in response to the first instruction, read the abstract syntax tree AST data of batch system calls from the virtual address space of the user state.
  • the registration unit 302 is configured to generate binary codes for implementing batch system calls based on the AST data.
  • the registration unit 302 is further configured to store binary codes for implementing batch system calls into the virtual address space of the kernel mode.
  • the registration unit 302 is further configured to execute binary codes for implementing batch system calls in response to the second instruction.
  • the second instruction carries an identifier of binary code for implementing batch system calls; the registration unit 302 is further configured to execute the binary code corresponding to the identifier for implementing batch system calls in response to the second instruction.
  • the AST data contains the delay information of the batch system calls
  • the registration unit 302 is further configured to calculate the worst execution time of the batch system calls based on the delay information in the AST data.
  • the registration unit 302 is further configured to store the worst execution time in the virtual address space of the kernel mode.
  • the terminal can be any terminal device including mobile phone, tablet computer, personal digital assistant (full name in English: Personal Digital Assistant, English abbreviation: PDA), sales terminal (full name in English: Point of Sales, English abbreviation: POS), vehicle-mounted computer, etc. Take the terminal as a mobile phone as an example:
  • FIG. 10 is a block diagram showing a partial structure of a mobile phone related to a terminal provided by an embodiment of the present application.
  • the mobile phone includes: a radio frequency (full name in English: Radio Frequency, English abbreviation: RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (full name in English: wireless fidelity) , English abbreviation: WiFi) module 1070, processor 1080, power supply and other components.
  • RF radio frequency
  • the RF circuit 1010 can be used to receive and transmit signals during information transmission and reception or during a call. In particular, after receiving the downlink information of the base station, it is processed by the processor 1080; in addition, the designed uplink data is sent to the base station.
  • the RF circuit 1010 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (full name in English: Low Noise Amplifier, English abbreviation: LNA), a duplexer, and the like.
  • the RF circuit 1010 can also communicate with networks and other devices via wireless communication.
  • the above wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communication (English full name: Global System of Mobile communication, English abbreviation: GSM), General Packet Radio Service (English full name: General Packet Radio Service, GPRS ), Code Division Multiple Access (English full name: Code Division Multiple Access, English abbreviation: CDMA), Wideband Code Division Multiple Access (English full name: Wideband Code Division Multiple Access, English abbreviation: WCDMA), Long Term Evolution (English full name: Long Term Evolution, English abbreviation: LTE), e-mail, short message service (full name in English: Short Messaging Service, SMS) and so on.
  • GSM Global System for Mobile Communication
  • GSM Global System of Mobile communication
  • GPRS General Packet Radio Service
  • CDMA Code Division Multiple Access
  • WCDMA Wideband Code Division Multiple Access
  • LTE Long Term Evolution
  • SMS short message service
  • the memory 1020 can be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 1020 .
  • the memory 1020 may mainly include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; Data created by the use of the mobile phone (such as audio data, phone book, etc.), etc. Additionally, memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 1030 can be used for receiving inputted number or character information, and generating key signal input related to user setting and function control of the mobile phone.
  • the input unit 1030 may include a touch panel 1031 and other input devices 1032 .
  • the touch panel 1031 also referred to as a touch screen, can collect the user's touch operations on or near it (such as the user's finger, stylus, etc., any suitable object or accessory on or near the touch panel 1031). operation), and drive the corresponding connection device according to the preset program.
  • the touch panel 1031 may include two parts, a touch detection device and a touch controller.
  • the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the touch controller.
  • the touch panel 1031 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 1030 may also include other input devices 1032 .
  • other input devices 1032 may include, but are not limited to, one or more of physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 1040 may be used to display information input by the user or information provided to the user and various menus of the mobile phone.
  • the display unit 1040 may include a display panel 1041.
  • a liquid crystal display (English full name: Liquid Crystal Display, English abbreviation: LCD), an organic light-emitting diode (English full name: Organic Light-Emitting Diode, English abbreviation: OLED), etc. form to configure the display panel 1041.
  • the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near it, it transmits it to the CPU 1080 to determine the type of the touch event, and then the processor 1080 selects the type of the touch event according to the type of the touch event.
  • Corresponding visual outputs are provided on the display panel 1041 .
  • the touch panel 1031 and the display panel 1041 are used as two independent components to realize the input and input functions of the mobile phone, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to form Realize the input and output functions of the mobile phone.
  • the cell phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1041 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 1041 and/or when the mobile phone is moved to the ear. or backlight.
  • the accelerometer sensor can detect the magnitude of acceleration in all directions (usually three axes), and can detect the magnitude and direction of gravity when it is stationary. games, magnetometer attitude calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc. Repeat.
  • the audio circuit 1060, the speaker 1061, and the microphone 1062 can provide an audio interface between the user and the mobile phone.
  • the audio circuit 1060 can convert the received audio data into an electrical signal, and transmit it to the speaker 1061, and the speaker 1061 converts it into a sound signal and outputs it; After receiving, it is converted into audio data, and then the audio data is output to the processor 1080 for processing, and then sent to, for example, another mobile phone through the RF circuit 1010, or the audio data is output to the memory 1020 for further processing.
  • WiFi is a short-distance wireless transmission technology.
  • the mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the WiFi module 1070, which provides users with wireless broadband Internet access.
  • FIG. 10 shows the WiFi module 1070, it can be understood that it is not a necessary component of the mobile phone, and can be completely omitted as required within the scope of not changing the essence of the invention.
  • the processor 1080 is the control center of the mobile phone, and uses various interfaces and lines to connect various parts of the entire mobile phone, by running or executing the software programs and/or modules stored in the memory 1020, and calling the data stored in the memory 1020. Various functions of the mobile phone and processing data, so as to monitor the mobile phone as a whole.
  • the CPU 1080 may include one or more processing units; preferably, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc.
  • the demodulation processor mainly handles wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the CPU 1080.
  • the mobile phone also includes a power source (such as a battery) for supplying power to various components.
  • a power source such as a battery
  • the power source can be logically connected to the processor 1080 through a power management system, so that functions such as charging, discharging, and power consumption management are implemented through the power management system.
  • the mobile phone may also include a camera, a Bluetooth module, and the like, which will not be repeated here.
  • the processor 1080 included in the terminal may run the user mode process and the kernel in the foregoing embodiments.
  • the user-mode process is used to perform the user-mode operations in FIG. 2
  • the kernel is used to perform the operations performed by the kernel in FIG. 2 .
  • Embodiments of the present application further provide a chip including one or more processors. Part or all of the processor is used to read and execute the computer program stored in the memory, so as to execute the method of the embodiment corresponding to FIG. 2 .
  • the chip includes a memory, and the memory and the processor are connected to the memory through a circuit or a wire. Further optionally, the chip further includes a communication interface, and the processor is connected to the communication interface.
  • the communication interface is used for receiving data and/or information to be processed, the processor obtains the data and/or information from the communication interface, processes the data and/or information, and outputs the processing result through the communication interface.
  • the communication interface may be an input-output interface.
  • some of the one or more processors may also implement some steps in the above method by means of dedicated hardware, for example, the processing involving the neural network model may be performed by a dedicated neural network processor or graphics processor.
  • the methods provided in the embodiments of the present application may be implemented by one chip, or may be implemented collaboratively by multiple chips.
  • Embodiments of the present application also provide a computer storage medium, where the computer storage medium is used for storing computer software instructions used by the above-mentioned computer device, which includes a program for executing a program designed for the computer device.
  • the computer equipment may include the means for implementing batch system calls as described in the aforementioned FIG. 8 and FIG. 9 .
  • Embodiments of the present application further provide a computer program product, where the computer program product includes computer software instructions, and the computer software instructions can be loaded by a processor to implement the process in the method shown in FIG. 2 .
  • the solution provided in this embodiment may be applied to a terminal device or a server or the like.
  • the terminal devices here include but are not limited to smartphones, in-vehicle devices (such as autonomous driving devices), personal computers, artificial intelligence devices, tablet computers, personal digital assistants, smart wearable devices (such as smart watches or bracelets, smart glasses), Smart voice devices (such as smart speakers, etc.), virtual reality/mixed reality/augmented display devices, or network access devices (such as gateways, etc.), etc.
  • Servers may include storage servers or computing servers, among others.
  • a plurality means two or more, or “at least two” unless otherwise specified.
  • A/B in this application includes three cases: “A”, “B” and “A and B”.
  • the "identification (id)” of an object in this application refers to information that uniquely identifies the object.
  • the “identity” can directly identify the object, such as the name of the object, or indirectly indicate the object, such as the storage address of the object. In this application, "first”, “second”, “third”, etc.
  • first object and the second object may be combined or refer to the same object in some cases ; Furthermore, since there is no limited order, there is no first, and there may be a second or third.
  • the device embodiments described above are only illustrative, wherein the modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed over multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art can understand and implement it without creative effort.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

一种实现批量系统调用的方法及相关装置,该方法包括:将可执行程序加载到用户态的虚拟地址空间,该可执行程序是由批量系统调用的源码编译得到,且包含批量系统调用的抽象语法树AST数据,然后通过调用第一指令调用内核,使得内核根据用户态的虚拟地址空间中的AST数据生成二进制代码,以供批量系统调用。由于AST这种数据结构难以被插入恶意的数据,所以供批量系统调用的二进制代码中难以被插入恶意的代码,从而避免恶意的代码造成内核在运行批量系统调用的二进制代码时出现错误或时延过长,提高了批量系统调用的安全性。

Description

一种实现批量系统调用的方法及装置
本申请要求于2021年02月05日提交的、中国申请号为202110163179.2、发明名称为“一种实现批量系统调用的方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及操作系统技术领域,尤其涉及一种实现批量系统调用的方法及装置。
背景技术
微内核是目前实时操作系统领域广泛使用的内核架构。其特点是复杂性较小,安全性较高,且具备实时性。
在微内核架构中,系统程序与应用程序类似,也运行在用户态。因此,运行在用户态的应用程序需要通过内部进程通信(Inter-Process Communication,IPC)来调用运行在用户态的系统程序。应用程序在运行过程中,往往会多次调用运行在用户态的系统程序,而对系统程序的多次调用会导致频繁的上下文切换,进而使得操作系统的性能下降。
目前,主要的解决方法主要是将多个系统调用(System Call)打包成批量系统调用(Batch System Call),通过批量系统调用一次性实现多次系统调用,从而减少IPC的次数,提高操作系统的性能。
为了实现批量系统调用,会先将实现批量系统调用的二进制代码注册到内核中;当需要进行批量系统调用时,则由内核执行该二进制代码。
由于二进制代码容易中容易被插入恶意的代码,所以安全性较差。
发明内容
本申请实施例提供了一种实现批量系统调用的方法及相关装置,该方法能够提高批量系统调用的安全性。
本申请实施例第一方面提供了一种实现批量系统调用的方法,包括:编译器将批量系统调用的源码编译成可执行程序,该源码可以是C源码或领域特定语言(Domain Specific Language,DSL)源码,该可执行程序包含批量系统调用的抽象语法树AST数据,其中,AST是源代码语法结构的一种抽象表示;加载器将该可执行程序加载到用户态的虚拟地址空间,该可执行程序是由批量系统调用的源码编译得到,且包含批量系统调用的抽象语法树AST数据;加载器调用第一指令,第一指令用于调用内核从用户态的虚拟地址空间中读取所述AST数据,并基于所述AST数据生成存储在内核态的虚拟地址空间的,用于实现所述批量系统调用的二进制代码;这样,在批量系统调用时,便可以由内核执行二进制代码以实现批量系统调用。
由于AST这种数据结构难以被插入恶意的数据,所以基于批量系统调用的AST数据生成的批量系统调用的二进制代码中难以被插入恶意的代码,避免恶意的代码造成内核在运 行批量系统调用的二进制代码出现错误或时延过长,从而提高了批量系统调用的安全性。
作为一种实现的方式,可执行程序还包含批量系统调用的调用桩代码,其中,调用桩代码可以理解为代替批量系统调用的二进制代码的代码;基于此,该方法还包括:调用所述调用桩代码中的第二指令,该第二指令用于调用内核执行用于实现批量系统调用的二进制代码。
在该实现方式中,通过调用桩代码实现对实现批量系统调用。
作为一种实现的方式,在调用第一指令之后,方法还包括:接收对于第一指令的调用结果,调用结果中包含批量系统调用的二进制代码的标识;通过该标识能够指示批量系统调用的二进制代码,所以可以将该标识作为第二指令的参数,即第二指令中携带标识,用于调用内核执行标识对应的用于实现批量系统调用的二进制代码。
在第二指令中添加用于实现批量系统调用的二进制代码的标识,使得内核可以根据该标识查找用于实现批量系统调用的二进制代码,以完成批量系统调用。
作为一种实现的方式,批量系统调用的源码包含批量系统调用的时延信息,AST数据包含批量系统调用的时延信息批量,其中,系统调用的时延信息通常隐含于AST数据中;第一指令还用于调用内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
相比于二进制代码,AST数据可以很好地保留时延信息,通过第一指令可以调用内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间,从而确保批量系统调用具备确定性时延。
作为一种实现的方式,第一指令还用于调用内核将最坏执行时间存入内核态的虚拟地址空间。
通过第一指令调用内核,使得内核将最坏执行时间存入内核态的虚拟地址空间,这样在批量系统调用时便可以读取到最坏执行时间,以达到获取确定性时延的目的。
本申请实施例第二方面提供了一种实现批量系统调用的方法,包括:响应于第一指令,内核从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据,其中,AST是源代码语法结构的一种抽象表示;内核基于AST数据生成用于实现批量系统调用的二进制代码;内核将生成的二进制代码存入内核态的虚拟地址空间,这样,在批量系统调用时,内核便可以执行二进制代码以实现批量系统调用。
由于AST这种数据结构难以被插入恶意的数据,所以基于批量系统调用的AST数据生成的批量系统调用的二进制代码中难以被插入恶意的代码,避免恶意的代码造成内核在运行批量系统调用的二进制代码出现错误或时延过长,从而提高了批量系统调用的安全性。
作为一种实现的方式,方法还包括:响应于第二指令,内核执行用于实现批量系统调用的二进制代码。
内核执行用于实现批量系统调用的二进制代码,从而实现批量系统调用。
作为一种实现的方式,第二指令中携带用于实现批量系统调用的二进制代码的标识,该标识使得内核可以从多个批量系统调用的二进制代码从查找当前批量系统调用的二进制代码;响应于第二指令,内核执行用于实现批量系统调用的二进制代码包括:响应于第二指令,内核执行标识对应的用于实现批量系统调用的二进制代码。
由于第二指令中携带批量系统调用的二进制代码的标识,所以内核可以根据该标识查找批量系统调用的二进制代码,以完成批量系统调用。
作为一种实现的方式,AST数据包含批量系统调用的时延信息,方法还包括:内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
相比于二进制代码,AST数据可以很好地保留时延信息;基于AST数据包含的批量系统调用的时延信息,内核可以计算批量系统调用的最坏执行时间,从而确保批量系统调用具备确定性时延。
作为一种实现的方式,方法还包括:内核将最坏执行时间存入内核态的虚拟地址空间。
将最坏执行时间存入内核态的虚拟地址空间,使得在批量系统调用时可以读取到最坏执行时间,以达到获取确定性时延的目的。
本申请实施例第三方面提供了一种实现批量系统调用的装置,包括:编译单元,用于将批量系统调用的源码编译成可执行程序,可执行程序包含批量系统调用的抽象语法树AST数据;加载单元,用于将可执行程序加载到用户态的虚拟地址空间,执行程序是由批量系统调用的源码编译得到,且包含批量系统调用的抽象语法树AST数据;调用单元,用于调用第一指令,第一指令用于调用内核从用户态的虚拟地址空间中读取AST数据,并基于AST数据生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码。
作为一种实现的方式,可执行程序还包含批量系统调用的调用桩代码,调用单元还用于在执行批量系统调用的调用桩代码时,调用第二指令,第二指令用于调用内核执行用于实现批量系统调用的二进制代码。
作为一种实现的方式,调用单元还用于接收对于第一指令的调用结果,调用结果中包含用于实现批量系统调用的二进制代码的标识;第二指令中携带标识,用于调用内核执行标识对应的用于实现批量系统调用的二进制代码。
作为一种实现的方式,批量系统调用的源码包含批量系统调用的时延信息,AST数据包含批量系统调用的时延信息;第一指令还用于调用内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
作为一种实现的方式,第一指令还用于调用内核将最坏执行时间存入内核态的虚拟地址空间。
其中,以上各单元的具体实现、相关说明以及技术效果请参考本申请实施例第一方面的描述。
本申请实施例第四方面提供了一种实现批量系统调用的装置,包括:读取单元,用于响应于第一指令,从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据;注册单元,用于基于AST数据生成用于实现批量系统调用的二进制代码;注册单元,还用于将生成的二进制代码存入内核态的虚拟地址空间。
作为一种实现的方式,注册单元还用于响应于第二指令,执行用于实现批量系统调用的二进制代码。
作为一种实现的方式,第二指令中携带用于实现批量系统调用的二进制代码的标识;注册单元还用于响应于第二指令,执行标识对应的用于实现批量系统调用的二进制代码。
作为一种实现的方式,AST数据包含批量系统调用的时延信息,注册单元还用于基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
作为一种实现的方式,注册单元还用于将最坏执行时间存入内核态的虚拟地址空间。
其中,以上各单元的具体实现、相关说明以及技术效果请参考本申请实施例第二方面的描述。
本申请实施例第五方面提供了一种计算机设备,包括:一个或多个处理器和存储器;其中,所述存储器中存储有计算机可读指令;所述一个或多个处理器读取所述计算机可读指令,以使所述计算机设备实现如第一方面任一实现方式所述的方法。该计算机设备可以是终端设备,例如智能手机、智能音箱、大屏设备、平板电脑、车载智能装置、人工智能设备、虚拟现实/增强现实/混合现实设备等。
本申请实施例第六方面提供了一种终端设备,包括:一个或多个处理器和存储器;其中,所述存储器中存储有计算机可读指令;所述一个或多个处理器读取所述计算机可读指令,以使所述计算机设备实现如第二方面任一实现方式所述的方法。
本申请实施例第七方面提供了一种计算机可读存储介质,包括计算机可读指令,当所述计算机可读指令在计算机上运行时,使得所述计算机执行如第一方面或第二方面任一实现方式所述的方法。
本申请实施例第八方面提供了一种芯片,包括一个或多个处理器。所述处理器中的部分或全部用于读取并执行存储器中存储的计算机程序,以执行上述第一方面或第二方面任意可能的实现方式中的方法。
可选地,该芯片该包括存储器,该存储器与该处理器通过电路或电线与存储器连接。进一步可选地,该芯片还包括通信接口,处理器与该通信接口连接。通信接口用于接收需要处理的数据和/或信息,处理器从该通信接口获取该数据和/或信息,并对该数据和/或信息进行处理,并通过该通信接口输出处理结果。该通信接口可以是输入输出接口。
在一些实现方式中,所述一个或多个处理器中还可以有部分处理器是通过专用硬件的方式来实现以上方法中的部分步骤,例如涉及神经网络模型的处理可以由专用神经网络处理器或图形处理器来实现。
本申请实施例提供的方法可以由一个芯片实现,也可以由多个芯片协同实现。
本申请实施例第九方面提供了一种计算机程序产品,该计算机程序产品包括计算机软件指令,该计算机软件指令可被一个或多个处理器执行从而实现上述第一方面或第二方面中任意一种实现方式所述的方法。
本申请实施例第十方面提供了一种编译方法,该方法可以在线下完成,比如计算机设备(例如智能手机)出厂前完成。该编译方法包括:将批量系统调用的源码编译成可执行程序,可执行程序包含批量系统调用的抽象语法树AST数据。所述AST数据在之后会被用来生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码。
由于将批量系统调用的源码编译成可执行程序,且可执行程序包含批量系统调用的抽象语法树AST数据,而AST这种数据结构难以被插入恶意的数据,所以基于可执行程序生成的用于实现批量系统调用的二进制代码难以被插入恶意的代码,从而提高了批量系统调 用的安全性。
相应的,本申请实施例第十一方面提供了一种编译装置,包括:
编译单元,用于将批量系统调用的源码编译成可执行程序,可执行程序包含批量系统调用的抽象语法树AST数据,且用于生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码。
本申请实施例第十二方面和第十三方面分别提供一种运行时编译方法以及运行时编译器。其中该编译方法包括将可执行程序中的抽象语法树AST数据编译生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码,所述可执行程序是通过编译所述批量系统调用的源码得到的。相应的,该运行时编译器包括编译单元,用于将可执行程序中的抽象语法树AST数据编译生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码。
从以上技术方案可以看出,本申请实施例至少具有以下优点:
在用户态,将批量系统调用的源码编译成批量系统调用的AST数据,然后将该AST数据加载到用户态的虚拟地址空间;内核从用户态的虚拟地址空间中读取AST数据,并基于该AST数据生成批量系统调用的二进制代码,最终将批量系统调用的二进制代码存储到内核态的虚拟地址空间,从而完成对批量系统调用的注册。由于AST这种数据结构难以被插入恶意的数据,所以基于批量系统调用的AST数据生成的实现批量系统调用的二进制代码中难以被插入恶意的代码,避免恶意的代码造成内核在运行用于实现批量系统调用的二进制代码出现错误或时延过长,从而提高了批量系统调用的安全性。
附图说明
图1为本申请实施例中的微内核架构的示意图;
图2为本申请实施例中实现批量系统调用的方法的一个实施例示意图;
图3为本申请实施例中批量系统调用的AST数据的示意图;
图4为本申请实施例中计算最坏执行时间的示意图;
图5为本申请实施例中软件系统架构图的示意图;
图6为本申请实施例中实现批量系统调用的方法的阶段示意图;
图7为本申请实施例中编译过程的实施例示意图;
图8为本申请实施例中实现批量系统调用的装置的一个实施例示意图;
图9为本申请实施例中实现批量系统调用的装置的另一个实施例示意图;
图10为本申请实施例中终端设备的结构示意图。
具体实施方式
操作系统是指管理计算机硬件与软件资源的系统软件,同时也是计算机系统的基石。操作系统需要处理如管理与配置内存、决定系统资源供需的优先次序、控制输入与输出设备、操作网络与管理文件系统等基本事务。操作系统还可以提供让用户与系统交互的操作 界面。
目前,存在至少两种操作系统架构:微内核架构和宏内核架构。本申请实施例可以应用于微内核架构中。微内核架构的特点是将尽可能少的功能运行在内核空间(kernel space),并提供必要的机制来实现操作系统。这些机制包括虚拟地址空间管理、线程管理、进程间通信等。相比于宏内核架构,微内核将众多的组件,比如文件系统和网络协议栈等都放在用户态运行,而将自己真正的内核功能减少到非常少。
具体地,本申请实施例应用的微内核架构可以如图1所示,该微内核架构包括运行在内核态的内核、运行在用户态的应用程序以及运行在用户态的系统程序。
内核是指用来管理软件发出的数据输入与输出要求的程序,将这些要求转译为数据处理的指令并交由处理器和/或计算机中其他电子组件进行处理,是现代操作系统中最基本的部分。
系统程序是指控制和协调计算机设备及外部设备,支持应用软件开发和运行的系统,是无需用户干预的各种程序的集合。系统程序包括但不限于文件系统程序、内存管理程序、网络程序和驱动程序。应用程序是和系统程序相对应的,是用户可以使用的各种程序的集合。
内核态和用户态是处理器(下述以中央处理器CPU为例介绍)的两种工作状态。若CPU执行系统调用而执行内核代码,则称该CPU(或当前进程)处于内核态;若CPU执行用户代码,则称该CPU(或当前进程)处于用户态。其中内核态又可以称为特权态,用户态又可以称为非特权态,下文将统一采用内核态和用户态进行说明。
在用户态,由于应用程序和系统程序是相互隔离的,所以应用程序无法直接调用系统程序,而需要通过内部进程通信(Inter-Process Communication,IPC)调用系统程序。应用程序在运行过程中,通常需要多次调用系统程序。而对系统程序的多次调用会导致频繁的上下文切换,导致操作系统性能下降。因此,会将多个系统调用(System Call)打包成批量系统调用(Batch System Call),这样,通过批量系统调用便可以一次性实现多次系统调用,从而减少IPC的次数,提高操作系统的性能。
上下文是指操作系统内进程的执行信息。上下文切换(Context Switch)指的是内核在CPU上对进程进行切换。例如,在进程A到进程B的切换过程中,CPU会将进程A的执行信息从寄存器中读取并保存在进程A的进程控制块(Process Control Block)中,进程控制块位于内存中;之后,CPU把进程B的执行信息恢复到寄存器中,然后执行进程B。可见,上下文切换的过程中涉及到进程执行信息的保存和恢复,如果频繁发生进程切换,则会频繁进行执行信息的保存和恢复,从而影响操作系统的性能。
进程是程序的运行实体,程序是指令、数据及其组织形式的描述。一个进程中可以并发多个线程,每条线程并行执行不同的任务。线程可以是进程的实际运作单位。
为了实现批量系统调用,在应用程序运行前,会先将应用程序中用于实现批量系统调用的二进制代码注册到内核中,在进行批量系统调用时,内核执行该二进制代码即可实现批量系统调用。
将二进制代码注册到内核的过程包括:先将二进制代码存入用户态的虚拟地址空间, 然后内核从存入用户态的虚拟地址空间中读取该二进制代码,并将读取到的二进制代码存入内核态的虚拟地址空间。
然而,由于二进制代码是一行行的代码,所以行与行之间容易被插入恶意的代码;如果将批量系统调用的二进制代码存入用户态的虚拟地址空间以供内核读取并完成注册,一旦用户态的虚拟地址空间中的批量系统调用的二进制代码中被插入恶意的代码,那么将导致恶意的代码被注册到内核。在进行批量系统调用时,恶意的代码会被内核执行而导致错误,所以安全性较差。
例如,用户态的虚拟地址空间中批量系统调用的二进制代码被插入无限循环的恶意代码,那么内核在执行批量系统调用的二进制代码时,将陷入无限循环的情况,导致批量系统调用的时延无限长。
为此,本申请实施例提供了一种实现批量系统调用的方法,与直接将批量系统调用的二进制代码存入用户态的虚拟地址空间不同,该方法是将用于实现批量系统调用的二进制代码转换成抽象语法树AST数据,然后将该AST数据存入用户态的虚拟地址空间;内核从用户态的虚拟地址空间读取该AST数据后,将该AST数据转换为二进制代码并完成注册。相比于二进制代码,AST数据这种数据结构难以被插入恶意的数据,所以注册到内核中的批量系统调用的二进制代码难以被插入恶意的代码,因此安全性较高。
具体地,请参阅图2,本申请实施提供了一种实现批量系统调用的方法的一个实施例,该实施例包括:
操作101,将批量系统调用的源码编译成可执行程序,该可执行程序包含批量系统调用的抽象语法树AST数据。
实现批量系统调用的源码可以是C源码,也可以是领域特定语言(Domain Specific Language,DSL)源码。
其中,领域特定语言是为了解决某一类任务而专门设计的计算机语言,其与通用编程语言(General Purpose Language,简称GPL)相对。
可执行程序通常包含程序和数据两部分,程序部分又可以称为程序段,数据部分又可以称为数据段,数据段用于保存程序的全局变量和静态变量。
抽象语法树(Abstract Syntax Tree,AST),简称语法树(Syntax tree),是源代码语法结构的一种抽象表示。它以树状的形式表现编程语言的语法结构,树上的每个节点都表示源代码中的一种结构,该节点具体可以为表达式。
批量系统调用的AST数据属于批量系统调用的可执行程序中的数据段,所以在该实施例中,可执行程序主要是指包含AST数据的数据段;需要说明的是,在编译批量系统调用的源码的过程中,还可能生成其他的代码,这一部分代码则属于程序段部分,例如,在编译批量系统调用的源码的过程中可以生成批量系统调用的调用桩代码,而批量系统调用的调用桩代码则属于程序段部分,下文会对批量系统调用的调用桩代码进行具体介绍。
为了便于理解AST数据,下面提供了一具体示例。
如图3所示,图3示出了一种批量系统调用的AST数据。可以看出,AST数据的这种数据结构与二进制代码不同,AST数据这种数据结构难以被插入恶意的数据。
可执行程序可以包含于可执行连接格式(Executable and Linkable Format,ELF)文件中,可执行连接格式为x86架构上的类Unix操作系统的二进制文件格式标准。因其可扩展性与灵活性,也可应用在其它处理器、计算机系统架构的操作系统上。
需要说明的是,通常使用编译器将源码编译成可执行程序,但编译器通常将源码编译成二进制代码。因此,可以新增编译器插件,该编译器插件用于将批量系统调用的源码编译成包含AST数据的可执行程序。
操作102,将可执行程序加载到用户态的虚拟地址空间。
其中,可执行程序是由批量系统调用的源码编译得到,且包含批量系统调用的抽象语法树AST数据。
可以理解的是,可执行程序通常存储在磁盘等外部存储器中,要运行可执行程序,则需要先将可执行程序加载到用户态的虚拟地址空间。
操作系统的虚拟地址空间包括用户态的虚拟地址空间和内核态的虚拟地址空间。以32位的Linux操作系统为例,其虚拟地址空间(也称为寻址空间或线性虚拟地址空间)为4G。理论上,内核、应用程序的进程和系统程序的进程各自对应的最大虚拟地址空间为4G。然而为了保证内核的安全,在Linux操作系统中,最高的1G字节(从虚拟地址0xC0000000到虚拟地址0xFFFFFFFF)由内核使用,称为内核态的虚拟地址空间。而较低的3G字节(从虚拟地址0x00000000到虚拟地址0xBFFFFFFF)由其他进程使用,称为用户态的虚拟地址空间。
基于前述说明可知,可执行程序可以包含于ELF文件中,当可执行程序包含于ELF文件中时,可以使用ELF加载器loader加载该可执行程序。具体地,ELF加载器将ELF文件加载到用户态的虚拟地址空间,然后解压得到可执行程序。
操作103,调用第一指令,第一指令用于调用内核从用户态的虚拟地址空间中读取AST数据,并基于AST数据生成存储在内核态的虚拟地址空间的批量系统调用的二进制代码。
在本申请实施例中,通过调用第一指令调用系统调用,该系统调用可以理解为注册批量系统调用的系统调用;通过调用注册批量系统调用的系统调用,使得内核完成对批量系统调用的注册。
具体地,可以将用户态的虚拟地址空间的地址作为第一指令的参数,将该参数传递给内核,然后由内核根据该参数读取用户态的虚拟地址空间中的AST数据,进而根据AST数据完成对批量系统调用的注册。
需要说明的是,调用第一指令的操作可以由多种程序实现;例如,可以修改ELF加载器的代码,使得ELF加载器在加载可执行程序后调用第一指令;也可以新增一个组件,该组件用于在加载可执行程序后调用第一指令。
操作104,响应于第一指令,内核从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据。
由于内核可以不受任何的限制,自由地访问整个虚拟地址空间(例如可以包括虚拟地址0xC0000000到虚拟地址0xFFFFFFFF,以及从虚拟地址0x00000000到虚拟地址0xBFFFFFFF),所以内核可以访问用户态的虚拟地址空间。
这样,内核在获取到第一指令的参数后,便可以从用户态的虚拟地址空间中读取AST数据。
操作105,内核基于AST数据生成用于实现批量系统调用的二进制代码。
在获取AST数据后,内核便可以将AST数据转换成二进制代码;由于基于AST数据生成二进制代码的过程是较为成熟的技术,故在此不做详述。
操作106,内核将生成的二进制代码存入内核态的虚拟地址空间。
具体地,内核可以在虚拟地址空间中建立一个批量系统调用表,该批量系统调用表用于存储批量系统调用的二进制代码。
在本申请实施例中,在用户态,将批量系统调用的源码编译成批量系统调用的AST数据,然后将该AST数据加载到用户态的虚拟地址空间;内核从用户态的虚拟地址空间中读取AST数据,并基于AST数据生成批量系统调用的二进制代码,最终将批量系统调用的二进制代码存储到内核态的虚拟地址空间,从而完成对批量系统调用的注册。
由于AST这种数据结构难以被插入恶意的数据,所以基于批量系统调用的AST数据生成的批量系统调用的二进制代码中难以被插入恶意的代码,避免恶意的代码造成内核在运行批量系统调用的二进制代码出现错误或时延过长,从而提高了批量系统调用的安全性。
可以理解的是,在将批量系统调用的二进制代码存入内核态的虚拟地址空间后,当需要进行批量系统调用时,便可以由内核执行批量系统调用的二进制代码,以完成批量系统调用。
下面介绍批量系统调用的具体过程。
作为一种实现方式,在编译批量系统调用的源码的过程中,除了编译得到批量系统调用的AST数据,还可以得到批量系统调用的调用桩代码(Call Stub)。具体地,前述可执行程序还包含批量系统调用的调用桩代码。
其中,桩代码是用来代替某些代码的代码;在本申请实施例中,调用桩代码可以理解为代替批量系统调用的二进制代码的代码。
基于此,本申请实施例提供的方法还可以包括:
操作107,当执行批量系统调用的调用桩代码时,调用第二指令,第二指令用于调用内核执行用于实现批量系统调用的二进制代码。
可以理解的是,批量系统调用的调用桩代码属于可执行程序的程序段;在运行可执行程序的过程中,会执行批量系统调用的调用桩代码,第二指令属于调用桩代码中的一个指令。
其中,调用第二指令的过程发生在用户态;通过调用第二指令实现对批量系统调用的系统调用。
相应地,本申请实施例提供的方法还可以包括:
操作108,响应于第二指令,内核执行用于实现批量系统调用的二进制代码。
在本申请实施例中,在编译过程中,将批量系统调用的源码编译为调用桩代码和AST数据两部分,采用调用桩代码代替批量系统调用的代码;当执行调用桩代码时,便会调用内核执行批量系统调用的代码,从而完成批量系统调用。
可以理解的是,可执行程序中可以包含多个批量系统调用的AST数据,相应地,内核会将多个批量系统调用的二进制代码存入内核态的虚拟地址空间。
这种情况下,当需要调用多个批量系统调用中的一个批量系统调用时,内核需要先确定需要调用的是哪一个批量系统调用。作为一种实现方式,在操作103之后,本实施例提供的方法还包括:在用户态,接收对于第一指令的调用结果,调用结果中包含用于实现批量系统调用的二进制代码的标识。
这样,便可以将用于实现批量系统调用的二进制代码的标识作为第二指令的参数,也可以理解为第二指令中携带用于实现批量系统调用的二进制代码的标识,携带标识的第二指令用于调用内核执行标识对应的用于实现批量系统调用的二进制代码。
基于此,操作108具体包括:
响应于第二指令,内核执行标识对应的用于实现批量系统调用的二进制代码。
下面以一具体示例对上述过程进行说明。
例如,内核态的虚拟地址空间中的批量系统调用表存储了三个批量系统调用的二进制代码,这三个批量系统调用的二进制代码的标识分别为批量系统调用0、批量系统调用1和批量系统调用2;第二指令中携带的批量系统调用的二进制代码的标识为批量系统调用1,则内核可以从批量系统调用表中查找批量系统调用1的二进制代码并执行该二进制代码,从而完成批量系统调用1的系统调用。
应理解,相比于单个系统调用,批量系统调用往往会牵扯到返回值依赖和错误处理。例如,在批量系统调用中,可能会添加衔接代码,该衔接代码的作用是根据一个系统调用的返回值判断下一个系统调用以及系统调用的参数。显然,复杂的衔接代码会使得批量系统调用不具有确定性时延。
确定性时延:时延是指业务的执行时间,确定性时延是指业务的执行时间的波动需保证在有限范围内。比如对于无人驾驶或辅助驾驶系统,前面有障碍物需要识别,识别障碍物的时间要控制在波动范围,否则,感知业务就没办法做规划,感知之后的控制业务就没办法在确定的时间内给出机械反应,比如,刹车。整个系统的确定性时延,由系统各组件共同来决定。操作系统的确定性时延是整个系统确定性时延的根基,这要求内核要在确定的时间范围内给用户态进程响应。
下面提供一种保证批量系统调用具有确定性时延的方法。
作为一种实现方式,在批量系统调用的源码中添加描述时延信息的语义,即批量系统调用的源码包含批量系统调用的时延信息,相应地,AST数据包含批量系统调用的时延信息。
需要说明的是,批量系统调用的时延信息通常隐含于AST数据中。例如,以for-each循环为例,for-each循环是通过对数组内的元素进行遍历,以获取所需要的元素,因此,数组的长度便可以作为时延信息。例如,数组内存在100个元素,数量100便可以作为for-each循环的时延信息,即最多遍历100次,即可获取到所需要的元素。
而对于二进制代码来说,往往无法保留时延信息。例如,在二进制代码中,往往用go to、br以及beq等代码构造循环;以代码go to为例,其仅能表示跳转到某一行代码,而 不能指示具体需要跳转多少次。
因此,在批量系统调用的源码中添加描述时延信息的语义后,若将批量系统调用的源码编译为批量系统调用的二进制代码,则会造成时延信息丢失,而本申请实施例将批量系统调用的源码编译为批量系统调用的AST数据,将很好地保留时延信息,以用于时延的计算。基于此,第一指令还用于调用内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
相应地,本申请实施例提供的方法还包括:内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
以上述示例为例,数组内存在100个元素,所以至少遍历100次便可以获取到所需要的元素;因此,便可以基于遍历次数100及每次遍历的时延计算最坏执行时间。
以图3所示的AST数据为例,批量系统调用包括系统调用1、系统调用2和系统调用3,计算最坏执行时间的示意图可以如图4所示。具体地,系统调用1仅需执行一次,时延为200个中央处理器CPU的执行周期cycles,系统调用3也仅需执行一次,时延为50个执行周期;系统调用2需执行的次数至多为n次,每次执行的时延为100个执行周期,那么最坏执行时间=100*n+250个执行周期,其中n为正整数。
在本申请实施例中,在批量系统调用的源码中添加描述时延信息的语义,然后将批量系统调用的源码编译为包含时延信息的AST数据;内核在读取AST数据后,便可以基于AST数据中的时延信息计算得到该批量系统调用的最坏执行时间,从而保证了批量系统调用具备确定性时延。
在前述实施例中,在注册批量系统调用的过程中,内核将批量系统调用的二进制代码存入内核态的虚拟地址空间;类似的,在计算得到最坏执行时间后,也可以将最坏执行时间存入内核态的虚拟地址空间。作为一种实现方式,第一指令还用于调用内核将最坏执行时间存入内核态的虚拟地址空间。相应地,本申请实施例提供的方法还包括:内核将最坏执行时间存入内核态的虚拟地址空间。与批量系统调用的二进制代码类似,内核也可以将最坏执行时间存入批量系统调用表中。
基于前述各个实施例的说明,本申请实施例提供的实现批量系统调用的方法的软件系统架构图可以如图5所示。
具体地,该软件系统框架可以包括新增的编译器插件、用户态代码、修改代码后的应用程序加载器以及内核。
新增的编译器插件用于执行操作101,即将应用程序的源码编译成用户态代码(也可称为可执行程序)。
如图5所示,该用户态代码包括代码段和数据段,代码段包含调用桩代码err_no batch_syscall_stub(args)syscall new_id以及应用程序的用于调用批量系统调用的二进制代码int service_api(args),数据段包含常规数据段和AST数据batch_syscall_ast(args)。
应用程序加载器用于执行操作102和操作103。
内核中包含运行时编译器,该运行时编译器具体包括最坏执行时间核算组件(wcet核 算组件)和代码生成组件,最坏执行时间核算组件用于基于AST数据中的时延信息计算最坏执行时间,代码生成组件用于执行操作104、操作105和操作106。
内核中还包含批量系统调用表Batch syscall table,图5所示的批量系统调用表具体包括批量系统调用1batch_syscall_1和批量系统调用2batch_syscall_2。
上面从软件系统架构的角度对本申请实施例提供的方法进行了说明,下面从不同的阶段对本申请实施例提供的方法进行进一步说明。
如图6所示,本申请实施例提供的方法包含编译阶段、程序启动阶段和程序执行阶段。
在编译阶段,首先定义了应用程序的脚本的源码,该源码包含时延信息;然后执行操作101将源码编译成AST数据,该AST数据包含时延信息。
下面以一具体示例对编译过程进行说明。
如图7所示,源代码包括调用者代码和批量系统调用Batch Syscall代码,利用通用的编译器可以将调用者代码编译成二进制代码int service_api(args),通过新增的编译器插件可以将Batch Syscall代码编译成调用桩代码err_no batch_syscall_stub(args)syscall new_id以及AST数据batch_syscall_ast(args);其中,二进制代码int service_api(args)和调用桩代码err_no batch_syscall_stub(args)syscall new_id构成可执行连接格式ELF中的代码段,AST数据batch_syscall_ast(args)属于可执行连接格式ELF中的数据段。
在程序启动阶段,先利用用户态的程序加载器(例如ELF加载器)加载AST数据;然后利用内核计算最坏执行时间并将AST数据编译成二进制代码;最终将该二进制代码注册到批量系统调用表中,如图6所示,该系统调用表中包含批量系统调用0、批量系统调用1和批量系统调用2。
在程序执行阶段,执行用户态代码;在执行用户态代码的过程中,会执行调用桩代码,从而发起批量系统调用;内核态的系统调用分发器根据批量系统调用的二进制代码的标识从批量系统调用表中查找批量系统调用,然后由内核执行查找到批量系统调用;在批量系统调用后,继续执行用户态代码。
需要说明的是,以上实施例涉及到的代码仅为本申请提供的方案的一种具体表示的示例,不能作为对本申请的限定,使用其他编程语言或其它代码形式也可以实现本申请提供的方案。
如图8所示,本申请实施例还提供了一种实现批量系统调用的装置的一个实施例,包括:
编译单元201,用于将批量系统调用的源码编译成可执行程序,可执行程序包含批量系统调用的抽象语法树AST数据。
加载单元202,用于将可执行程序加载到用户态的虚拟地址空间,可执行程序是由批量系统调用的源码编译得到,且包含批量系统调用的抽象语法树AST数据。
调用单元203,用于调用第一指令,第一指令用于调用内核从用户态的虚拟地址空间中读取AST数据,并基于AST数据生成存储在内核态的虚拟地址空间的用于实现批量系统调用的二进制代码。
作为一种实现的方式,可执行程序还包含批量系统调用的调用桩代码,基于此,调用单元203还用于在执行批量系统调用的调用桩代码时,调用第二指令,第二指令用于调用内核执行生成的二进制代码。
作为一种实现的方式,调用单元203还用于接收对于第一指令的调用结果,调用结果中包含用于实现批量系统调用的二进制代码的标识;第二指令中携带标识,用于调用内核执行标识对应的用于实现批量系统调用的二进制代码。
作为一种实现的方式,批量系统调用的源码包含批量系统调用的时延信息,AST数据包含批量系统调用的时延信息;第一指令还用于调用内核基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
作为一种实现的方式,第一指令还用于调用内核将最坏执行时间存入内核态的虚拟地址空间。
其中,以上各单元的具体实现、相关说明以及技术效果请参考本申请实施例第一方面的描述。
如图9所示,本申请实施例还提供了一种实现批量系统调用的装置的另一个实施例,包括:
读取单元301,用于响应于第一指令,从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据。
注册单元302,用于基于AST数据生成用于实现批量系统调用的二进制代码。
注册单元302,还用于将用于实现批量系统调用的二进制代码存入内核态的虚拟地址空间。
作为一种实现的方式,注册单元302还用于响应于第二指令,执行用于实现批量系统调用的二进制代码。
作为一种实现的方式,第二指令中携带用于实现批量系统调用的二进制代码的标识;注册单元302还用于响应于第二指令,执行标识对应的用于实现批量系统调用的二进制代码。
作为一种实现的方式,AST数据包含批量系统调用的时延信息,注册单元302还用于基于AST数据中的时延信息计算批量系统调用的最坏执行时间。
作为一种实现的方式,注册单元302还用于将最坏执行时间存入内核态的虚拟地址空间。
其中,以上各单元的具体实现、相关说明以及技术效果请参考本申请实施例第二方面的描述。
本申请实施例还提供了另一种终端设备,如图10所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该终端可以为包括手机、平板电脑、个人数字助理(英文全称:Personal Digital Assistant,英文缩写:PDA)、销售终端(英文全称:Point of Sales,英文缩写:POS)、车载电脑等任意终端设备,以终端为手机为例:
图10示出的是与本申请实施例提供的终端相关的手机的部分结构的框图。参考图10, 手机包括:射频(英文全称:Radio Frequency,英文缩写:RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、无线保真(英文全称:wireless fidelity,英文缩写:WiFi)模块1070、处理器1080以及电源等部件。本领域技术人员可以理解,图10中示出的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
下面结合图10对手机的各个构成部件进行具体的介绍:
RF电路1010可用于收发信息或通话过程中,信号的接收和发送,特别地,将基站的下行信息接收后,给处理器1080处理;另外,将设计上行的数据发送给基站。通常,RF电路1010包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(英文全称:Low Noise Amplifier,英文缩写:LNA)、双工器等。此外,RF电路1010还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(英文全称:Global System of Mobile communication,英文缩写:GSM)、通用分组无线服务(英文全称:General Packet Radio Service,GPRS)、码分多址(英文全称:Code Division Multiple Access,英文缩写:CDMA)、宽带码分多址(英文全称:Wideband Code Division Multiple Access,英文缩写:WCDMA)、长期演进(英文全称:Long Term Evolution,英文缩写:LTE)、电子邮件、短消息服务(英文全称:Short Messaging Service,SMS)等。
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1031以及其他输入设备1032。触控面板1031,也称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1031上或在触控面板1031附近的操作),并根据预先设定的程式驱动相应的连接装置。可选的,触控面板1031可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1080,并能接收处理器1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1031。除了触控面板1031,输入单元1030还可以包括其他输入设备1032。具体地,其他输入设备1032可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆等中的一种或多种。
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜 单。显示单元1040可包括显示面板1041,可选的,可以采用液晶显示器(英文全称:Liquid Crystal Display,英文缩写:LCD)、有机发光二极管(英文全称:Organic Light-Emitting Diode,英文缩写:OLED)等形式来配置显示面板1041。进一步的,触控面板1031可覆盖显示面板1041,当触控面板1031检测到在其上或附近的触摸操作后,传送给CPU1080以确定触摸事件的类型,随后处理器1080根据触摸事件的类型在显示面板1041上提供相应的视觉输出。虽然在图10中,触控面板1031与显示面板1041是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1031与显示面板1041集成而实现手机的输入和输出功能。
手机还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1041的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1041和/或背光。作为运动传感器的一种,加速计传感器可检测各个方向上(一般为三轴)加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换、相关游戏、磁力计姿态校准)、振动识别相关功能(比如计步器、敲击)等;至于手机还可配置的陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器,在此不再赘述。
音频电路1060、扬声器1061,传声器1062可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1061,由扬声器1061转换为声音信号输出;另一方面,传声器1062将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010以发送给比如另一手机,或者将音频数据输出至存储器1020以便进一步处理。
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于手机的必须构成,完全可以根据需要在不改变发明的本质的范围内而省略。
处理器1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。可选的,CPU1080可包括一个或多个处理单元;优选的,处理器1080可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到CPU1080中。
手机还包括给各个部件供电的电源(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。
尽管未示出,手机还可以包括摄像头、蓝牙模块等,在此不再赘述。
在本申请实施例中,该终端所包括的处理器1080中可以运行前述实施例中用户态进程和内核。
其中,用户态进程用于执行图2中用户态的操作,内核用于执行图2中内核所执行的操作。
本申请实施例还提供一种芯片,包括一个或多个处理器。所述处理器中的部分或全部用于读取并执行存储器中存储的计算机程序,以执行图2对应的实施例的方法。
可选地,该芯片该包括存储器,该存储器与该处理器通过电路或电线与存储器连接。进一步可选地,该芯片还包括通信接口,处理器与该通信接口连接。通信接口用于接收需要处理的数据和/或信息,处理器从该通信接口获取该数据和/或信息,并对该数据和/或信息进行处理,并通过该通信接口输出处理结果。该通信接口可以是输入输出接口。
在一些实现方式中,所述一个或多个处理器中还可以有部分处理器是通过专用硬件的方式来实现以上方法中的部分步骤,例如涉及神经网络模型的处理可以由专用神经网络处理器或图形处理器来实现。
本申请实施例提供的方法可以由一个芯片实现,也可以由多个芯片协同实现。
本申请实施例还提供了一种计算机存储介质,该计算机存储介质用于储存为上述计算机设备所用的计算机软件指令,其包括用于执行为计算机设备所设计的程序。
该计算机设备可以包括前述图8和图9所描述的实现批量系统调用的装置。
本申请实施例还提供了一种计算机程序产品,该计算机程序产品包括计算机软件指令,该计算机软件指令可通过处理器进行加载来实现前述图2所示的方法中的流程。
需要说明的是,为了方便应用和理解,本申请实施例为提到的一些系统、模块、器件、元素、数据结构以及指令等进行了命名,这些命名的大写或小写在无特殊说明的情况下均是相同的含义。同时,这些命名可以根据需求变更,不应作为对本申请所提供方案的限定。
需要说明的是,本实施例提供的方案可以应用于终端设备或服务器等。这里的终端设备包括但不限于智能手机、车载装置(例如自动驾驶设备)、个人计算机、人工智能设备、平板电脑、个人数字助理、智能穿戴式设备(例如智能手表或手环、智能眼镜)、智能语音设备(例如智能音箱等)、虚拟现实/混合现实/增强显示设备或网络接入设备(例如网关等)等。服务器可以包括存储服务器或计算服务器等。
需要说明的是,前述实施例中提出模块或单元的划分仅作为一种示例性的示出,所描述的各个模块的功能仅是举例说明,本申请并不以此为限。本领域普通技术人员可以根据需求合并其中两个或更多模块的功能,或者将一个模块的功能拆分从而获得更多更细粒度的模块,以及其他变形方式。
以上描述的各个实施例之间相同或相似的部分可相互参考。本申请中的“多个”若无特殊说明,指两个或两个以上,或“至少两个”。本申请中的“A/B”包括三种情况:“A”、“B”和“A和B”。本申请中一个对象的“标识(id)”指的是唯一标识该对象的信息,该“标识”可以直接标识该对象,例如对象的名称,也可以间接指示该对象,例如对象的存储地址。本申请中“第一”、“第二”、“第三”等仅为了区分表述,没有限定顺序的意思;另外,第一对象和第二对象在某些情况下有可能合并或指同一对象;再者,由于没有限定顺序,所以没有第一,也可以有第二或第三。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是 或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
以上所述,仅为本申请的一些具体实施方式,但本申请的保护范围并不局限于此。

Claims (17)

  1. 一种实现批量系统调用的方法,其特征在于,包括:
    将可执行程序加载到用户态的虚拟地址空间,所述可执行程序是由批量系统调用的源码编译得到,且所述可执行程序包含所述批量系统调用的抽象语法树AST数据;
    调用第一指令,所述第一指令用于调用内核从所述用户态的虚拟地址空间中读取所述AST数据,并基于所述AST数据生成存储在内核态的虚拟地址空间的用于实现所述批量系统调用的二进制代码。
  2. 根据权利要求1所述的方法,其特征在于,所述可执行程序还包含所述批量系统调用的调用桩代码,所述方法还包括:
    当执行所述批量系统调用的调用桩代码时,调用第二指令,所述第二指令用于调用所述内核执行用于实现所述批量系统调用的二进制代码。
  3. 根据权利要求2所述的方法,其特征在于,在所述调用第一指令之后,所述方法还包括:
    接收对于所述第一指令的调用结果,所述调用结果中包含用于实现所述批量系统调用的二进制代码的标识;
    所述第二指令中携带所述标识,用于调用所述内核执行所述标识对应的用于实现所述批量系统调用的二进制代码。
  4. 根据权利要求1至3中任意一项所述的方法,其特征在于,所述批量系统调用的源码包含所述批量系统调用的时延信息,所述AST数据包含所述批量系统调用的时延信息;
    所述第一指令还用于调用所述内核基于所述AST数据中的所述时延信息计算所述批量系统调用的最坏执行时间。
  5. 根据权利要求4所述的方法,其特征在于,所述第一指令还用于调用所述内核将所述最坏执行时间存入所述内核态的虚拟地址空间。
  6. 一种实现批量系统调用的方法,其特征在于,包括:
    响应于第一指令,内核从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据;
    所述内核基于所述AST数据生成用于实现所述批量系统调用的二进制代码;
    所述内核将生成的二进制代码存入内核态的虚拟地址空间。
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:
    响应于第二指令,所述内核执行用于实现所述批量系统调用的二进制代码。
  8. 根据权利要求7所述的方法,其特征在于,所述第二指令中携带用于实现所述批量系统调用的二进制代码的标识;
    所述响应于第二指令,所述内核执行用于实现所述批量系统调用的二进制代码包括:
    响应于第二指令,所述内核执行所述标识对应的用于实现所述批量系统调用的二进制代码。
  9. 根据权利要求6至8中任意一项所述的方法,其特征在于,所述AST数据包含所述 批量系统调用的时延信息,所述方法还包括:
    所述内核基于所述AST数据中的所述时延信息计算所述批量系统调用的最坏执行时间。
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:
    所述内核将所述最坏执行时间存入所述内核态的虚拟地址空间。
  11. 一种编译方法,其特征在于,包括:
    将批量系统调用的源码编译成可执行程序,所述可执行程序包含所述批量系统调用的抽象语法树AST数据,所述AST数据用于生成存储在内核态的虚拟地址空间的用于实现所述批量系统调用的二进制代码。
  12. 一种实现批量系统调用的装置,其特征在于,包括:
    加载单元,用于将可执行程序加载到用户态的虚拟地址空间,所述可执行程序是由批量系统调用的源码编译得到,且包含所述批量系统调用的抽象语法树AST数据;
    调用单元,用于调用第一指令,所述第一指令用于调用内核从所述用户态的虚拟地址空间中读取所述AST数据,并基于所述AST数据生成存储在内核态的虚拟地址空间的用于实现所述批量系统调用的二进制代码。
  13. 一种实现批量系统调用的装置,其特征在于,包括:
    读取单元,用于响应于第一指令,从用户态的虚拟地址空间中读取批量系统调用的抽象语法树AST数据;
    注册单元,用于基于所述AST数据生成用于实现所述批量系统调用的二进制代码;
    所述注册单元,还用于将生成的二进制代码存入内核态的虚拟地址空间。
  14. 一种编译装置,其特征在于,包括:
    编译单元,用于将批量系统调用的源码编译成可执行程序,所述可执行程序包含所述批量系统调用的抽象语法树AST数据,所述AST数据用于生成存储在内核态的虚拟地址空间的用于实现所述批量系统调用的二进制代码。
  15. 一种计算机设备,其特征在于,所述计算机设备包括存储器和处理器,所述存储器用于存储计算机可读指令,所述处理器用于读取所述计算机可读指令并实现权利要求1-11中任意一项所述的方法。
  16. 一种计算机存储介质,其特征在于,所述计算机存储介质用于存储计算机程序,当所述计算机程序被一个或多个处理器执行时实现如权利要求1-11任意一项所述的方法。
  17. 一种计算机程序产品,其特征在于,所述计算机程序产品计算机可读指令,当所述计算机可读指令被一个或多个处理器运行时实现权利要求1-11中任意一项所述的方法。
PCT/CN2022/071747 2021-02-05 2022-01-13 一种实现批量系统调用的方法及装置 WO2022166553A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22748832.7A EP4276603A1 (en) 2021-02-05 2022-01-13 Method and apparatus for implementing batch system calls
US18/365,312 US20230376289A1 (en) 2021-02-05 2023-08-04 Method and apparatus for implementing batch system call

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110163179.2 2021-02-05
CN202110163179.2A CN114879962B (zh) 2021-02-05 一种实现批量系统调用的方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/365,312 Continuation US20230376289A1 (en) 2021-02-05 2023-08-04 Method and apparatus for implementing batch system call

Publications (1)

Publication Number Publication Date
WO2022166553A1 true WO2022166553A1 (zh) 2022-08-11

Family

ID=82667477

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/071747 WO2022166553A1 (zh) 2021-02-05 2022-01-13 一种实现批量系统调用的方法及装置

Country Status (3)

Country Link
US (1) US20230376289A1 (zh)
EP (1) EP4276603A1 (zh)
WO (1) WO2022166553A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468400A (zh) * 2015-08-03 2016-04-06 汉柏科技有限公司 一种基于linux用户态调用定时器的方法及系统
CN105677493A (zh) * 2016-01-04 2016-06-15 汉柏科技有限公司 用户态和内核间的通信方法及系统
WO2017036376A1 (zh) * 2015-09-06 2017-03-09 华为技术有限公司 一种数据访问方法、代码调用方法及虚拟机监视器
CN107729159A (zh) * 2017-09-29 2018-02-23 华为技术有限公司 一种共享内存的地址映射方法及装置
CN108062253A (zh) * 2017-12-11 2018-05-22 北京奇虎科技有限公司 一种内核态与用户态的通信方法、装置及终端
CN112199217A (zh) * 2020-10-23 2021-01-08 无锡江南计算技术研究所 一种软硬协同的线程私有数据访问优化方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105468400A (zh) * 2015-08-03 2016-04-06 汉柏科技有限公司 一种基于linux用户态调用定时器的方法及系统
WO2017036376A1 (zh) * 2015-09-06 2017-03-09 华为技术有限公司 一种数据访问方法、代码调用方法及虚拟机监视器
CN105677493A (zh) * 2016-01-04 2016-06-15 汉柏科技有限公司 用户态和内核间的通信方法及系统
CN107729159A (zh) * 2017-09-29 2018-02-23 华为技术有限公司 一种共享内存的地址映射方法及装置
CN108062253A (zh) * 2017-12-11 2018-05-22 北京奇虎科技有限公司 一种内核态与用户态的通信方法、装置及终端
CN112199217A (zh) * 2020-10-23 2021-01-08 无锡江南计算技术研究所 一种软硬协同的线程私有数据访问优化方法

Also Published As

Publication number Publication date
EP4276603A1 (en) 2023-11-15
US20230376289A1 (en) 2023-11-23
CN114879962A (zh) 2022-08-09

Similar Documents

Publication Publication Date Title
US11829787B2 (en) Multi-process model for cross-platform applications
US9575652B2 (en) Instantiable gesture objects
WO2022199111A1 (zh) 应用程序中功能的实现方法、装置、电子设备和存储介质
CN109408136B (zh) 信息处理方法、装置、存储介质及电子设备
CN106502703B (zh) 一种函数调用方法和装置
CN110058850B (zh) 一种应用的开发方法、装置以及存储介质
CN109933381B (zh) 一种内核的加载方法及装置
CN109213613B (zh) 图像信息的传输方法、装置、存储介质及电子设备
JP2015506020A (ja) センサデータを処理するための方法およびコンピューティングノード
CN111723002A (zh) 一种代码调试方法、装置、电子设备及存储介质
US9535668B2 (en) Method, device, and storage medium for setting up application runtime environment
WO2021027772A1 (zh) 一种应用切换运行的方法及设备
CN113867848A (zh) 图形接口的调用方法、装置、设备及可读存储介质
CN107423291B (zh) 一种数据翻译方法以及客户端设备
US10599444B2 (en) Extensible input stack for processing input device data
WO2022166553A1 (zh) 一种实现批量系统调用的方法及装置
CN109145598B (zh) 脚本文件的病毒检测方法、装置、终端及存储介质
WO2019139738A1 (en) Extensible input stack for processing input device data
US11875035B2 (en) Electronic device and method for managing memory using the same
CN114879962B (zh) 一种实现批量系统调用的方法及装置
CN114995970A (zh) 任务处理方法、装置、存储介质及电子设备
CN110032394B (zh) 一种无源码文件的分析方法、装置和存储介质
CN114070892A (zh) 数据传输方法和装置
US20240094992A1 (en) Non-disruptive servicing components of a user mode process
WO2022083477A1 (zh) 一种mvvm架构的应用的开发方法及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22748832

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022748832

Country of ref document: EP

Effective date: 20230809

NENP Non-entry into the national phase

Ref country code: DE