Interface processing method and device

By giving priority to calling the user-mode interface in the microkernel operating system, the problem that the existing technology cannot achieve interface coverage across user-mode and kernel-mode is solved, and flexible interface coverage and function expansion are achieved.

CN115145699BActive Publication Date: 2025-09-12ALIBABA CLOUD COMPUTING CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110343755.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-30
Publication Date
2025-09-12
Estimated Expiration
2041-03-30

AI Technical Summary

Technical Problem

Existing technologies cannot achieve interface coverage across user mode and kernel mode, and high-level programming languages ​​can only achieve interface coverage between user modes or between kernel modes.

Method used

By responding to the execution operations of user-mode programs in the microkernel operating system, obtaining the preset interface to be called, and judging whether the interface exists in the user mode, if so, the user-mode interface is called first, otherwise the kernel-mode interface is called, thus achieving interface coverage across user mode and kernel mode.

Benefits of technology

The interface coverage between user state and kernel state can be achieved without the support of high-level programming languages, which improves the flexibility and functional expansion capability of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115145699B_ABST
    Figure CN115145699B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides an interface processing method and device, which is applied to a microkernel operating system, wherein the microkernel operating system includes a user state for executing a user state program, and the method includes: responding to the execution operation of the user state program, obtaining a preset interface required to be called by the executed user state program; judging whether the preset interface required to be called exists in the user state; and calling the preset interface required to be called from the user state based on the judgment result. By judging whether the preset interface required to be called exists in the user state to achieve priority calling of the user state interface, it does not require the support of high-level programming languages ​​to cover the interface in the microkernel operating system, and can achieve interface coverage between the user state and kernel state, that is, achieve interface coverage across the user state and kernel state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer application technology, and in particular to an interface processing method and an interface processing device. Background Art

[0002] Usually the system service layer and the kernel layer are integrated together, and the microkernel is a streamlined form of the kernel. The microkernel in the microkernel system separates the system service layer, making the separated system service layer an option that can be added according to demand. The server selected by the system service layer runs in user mode, and the microkernel is used to provide multi-process scheduling and multi-process communication as a connection between applications and user-mode system services.

[0003] Overriding refers to the ability to use one of the same processing flows within a system and override another. Overriding is typically used in high-level programming languages. In high-level programming languages, overriding means that when an instance object created through a subclass calls a method of the parent class, the method defined in the subclass will be called, thereby achieving polymorphism in object-oriented programming. However, using high-level programming languages ​​in microkernel systems can only achieve interface coverage between user states or between kernel states, but not across user and kernel states. Summary of the Invention

[0004] In view of the above problems, the embodiments of the present application are proposed to provide an interface processing method and a corresponding interface processing device that overcome the above problems or at least partially solve the above problems.

[0005] In order to solve the above problems, an embodiment of the present application discloses an interface processing method, which is applied to a microkernel operating system, wherein the microkernel operating system includes a user state for executing user state programs. The method includes:

[0006] In response to the execution operation of the user mode program, obtaining a preset interface required to be called by the executed user mode program;

[0007] Determine whether the preset interface to be called exists in the user state;

[0008] The preset interface required to be called is called from the user state according to the judgment result.

[0009] Optionally, a function pointer data structure exists in the user state, and the method further includes:

[0010] Obtaining a user-defined function; the user-defined function is a user-defined interface function;

[0011] Register the user-state defined function to the user-state function pointer data structure.

[0012] Optionally, registering the user-state defined function to the user-state function pointer data structure includes:

[0013] Obtain a function pointer of the user-state function pointer data structure, and assign the user-state defined function to the function pointer.

[0014] Optionally, the microkernel operating system further includes a kernel state; the user state defined function is the same as the interface function existing in the kernel state.

[0015] Optionally, calling the preset interface to be called from the user state according to the judgment result includes:

[0016] If the preset interface to be called exists in the user state, the preset interface in the user state is acquired, and the preset interface in the user state is called.

[0017] Optionally, the preset interface to be called includes an interface function to be called by the executed user-mode program, and the acquiring of the preset interface in the user-mode and the calling of the preset interface in the user-mode include:

[0018] Obtaining a function pointer data structure of the executed user-mode program in the user-mode;

[0019] Determine whether there is a user-state defined function that is the same as the interface function to be called in the user-state function pointer data structure;

[0020] If it exists, the user-state defined function is called from the user-state function pointer data structure.

[0021] Optionally, calling the user-state defined function from the user-state function pointer data structure includes:

[0022] Determine the function pointer corresponding to the interface function to be called in the function pointer data structure in the user state;

[0023] Get the value pointed to by the determined function pointer;

[0024] The pointed value is used as the currently called user-defined function, and the user-defined function is called.

[0025] Optionally, the microkernel operating system further includes a kernel state; and calling the user-state defined function from the function pointer data structure in the user state further includes:

[0026] If the user-state defined function identical to the interface function to be called does not exist in the function pointer data structure in the user state, the interface function to be called is called from the kernel state.

[0027] Optionally, calling the required interface function from the kernel state includes:

[0028] Obtaining a user-state calling function in the user state;

[0029] The user state calling function is used to call the interface function required to be called from the kernel state.

[0030] Optionally, the adopting the user state calling function to call the required interface function from the kernel state includes:

[0031] The user-state calling function is used to obtain the kernel-state function pointer data structure, and the interface function required to be called by the executed user-state program is called from the kernel-state function pointer data structure.

[0032] Optionally, the method further includes:

[0033] In response to the execution operation of the user state program, a user state defined function located in the user state is acquired through the user state program, and the user state defined function is executed.

[0034] The present application also discloses an interface processing method, which relates to a microkernel operating system including a user state. The method is applied to a user state program executed in the microkernel operating system, and the method includes:

[0035] When the user state program is executed, the user state program determines whether there is a user state defined function in the user state; the user state defined function is a user-defined interface function;

[0036] If the user state defined function exists in the user state, the user state defined function is executed.

[0037] Optionally, the microkernel operating system further includes a kernel state; and the method further includes:

[0038] If the user-state defined function does not exist in the user state, a kernel-state function located in the kernel state is obtained and executed.

[0039] The embodiment of the present application further discloses an interface processing device, which is applied to a microkernel operating system, wherein the microkernel operating system includes a user state for executing user state programs, and the device includes:

[0040] A user-mode program response module is configured to respond to the execution operation of the user-mode program and obtain a preset interface required to be called by the executed user-mode program;

[0041] A preset interface determination module is used to determine whether the user state has the preset interface to be called;

[0042] A preset interface calling module is used to call the preset interface to be called from the user state according to the judgment result.

[0043] Optionally, a function pointer data structure exists in the user state, and the device further includes:

[0044] A user-defined function acquisition module is used to acquire a user-defined function; the user-defined function is a user-defined interface function;

[0045] The user-state defined function registration module is used to register the user-state defined function to the user-state function pointer data structure.

[0046] Optionally, the user-defined function registration module includes:

[0047] The user-state defined function assignment submodule is used to obtain the function pointer of the user-state function pointer data structure and assign the user-state defined function to the function pointer.

[0048] Optionally, the microkernel operating system further includes a kernel state; the user state defined function is the same as the interface function existing in the kernel state.

[0049] Optionally, the preset interface calling module includes:

[0050] The preset interface calling submodule is used to obtain the preset interface in the user state if the preset interface to be called exists in the user state, and call the preset interface in the user state.

[0051] Optionally, the preset interface to be called includes an interface function to be called by the executed user mode program, and the preset interface calling submodule includes:

[0052] A function pointer data structure acquisition unit, configured to acquire a function pointer data structure of the executed user-mode program in the user-mode;

[0053] A user-state defined function determination unit, configured to determine whether there is a user-state defined function identical to the interface function to be called in the user-state function pointer data structure;

[0054] The user-state defined function calling unit is configured to call the user-state defined function from the user-state function pointer data structure if the function exists.

[0055] Optionally, the user-defined function calling unit includes:

[0056] A function pointer determination subunit, configured to determine a function pointer corresponding to the interface function to be called in the function pointer data structure in the user state;

[0057] A pointer assignment acquisition subunit, used to acquire the assignment pointed to by the determined function pointer;

[0058] The user-state defined function calling subunit is used to use the pointed assignment as the currently called user-state defined function and call the user-state defined function.

[0059] Optionally, the microkernel operating system further includes a kernel state; and the preset interface calling submodule further includes:

[0060] The kernel state function calling unit is used to call the interface function to be called from the kernel state if there is no user state defined function identical to the interface function to be called in the function pointer data structure of the user state.

[0061] Optionally, the kernel state function calling unit includes:

[0062] A user state call function acquisition subunit, used to acquire the user state call function in the user state;

[0063] The kernel state function calling subunit is used to call the interface function required to be called from the kernel state using the user state calling function.

[0064] Optionally, the device further comprises:

[0065] The user-state defined function execution module is used to respond to the execution operation of the user-state program, obtain the user-state defined function in the user state through the user-state program, and execute the user-state defined function.

[0066] The present application also discloses an interface processing device, which relates to a microkernel operating system including a user state and is applied to a user state program executed in the microkernel operating system. The device includes:

[0067] A user-state defined function determination module, configured to determine, when the user-state program is executed, whether a user-state defined function exists in the user state; the user-state defined function is a user-defined interface function;

[0068] The user state defined function execution module is used to execute the user state defined function if the user state defined function exists in the user state.

[0069] Optionally, the microkernel operating system further includes a kernel state, and the device further includes:

[0070] The kernel state function execution module is used to obtain the kernel state function located in the kernel state and execute the kernel state function if the user state defined function does not exist in the user state.

[0071] An embodiment of the present application further discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements the steps of any one of the interface processing methods when executed by the processor.

[0072] An embodiment of the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the interface processing methods are implemented.

[0073] The embodiments of the present application include the following advantages:

[0074] In an embodiment of the present application, applied to a microkernel operating system, by responding to the execution operation of a user-mode program and obtaining the preset interface required to be called by the executed user-mode program, when calling the preset interface required to be called, it is first possible to determine whether the preset interface required to be called exists in the user mode, and then, based on the determination result, call the preset interface required to be called by the executed user-mode program from the user mode to execute the called user-mode preset interface. By determining whether the preset interface required to be called exists in the user mode to implement preferential calling of the user-mode interface, it does not require the support of a high-level programming language to cover the interface in the microkernel operating system, and can achieve interface coverage between the user mode and kernel mode, that is, achieve interface coverage across the user mode and kernel mode. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 This is a flowchart of the steps of an embodiment of an interface processing method of the present application;

[0076] Figure 2 This is a flowchart of another embodiment of the interface processing method of the present application;

[0077] Figure 3 This is a flowchart of another embodiment of the interface processing method of the present application;

[0078] Figure 4 This is an application scenario diagram of interface processing in an embodiment of the present application;

[0079] Figure 5 This is a structural block diagram of an embodiment of an interface processing device of the present application;

[0080] Figure 6 This is a structural block diagram of another embodiment of the interface processing device of the present application. DETAILED DESCRIPTION

[0081] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0082] Override can mean that when there are identical processing flows in the system, one of the processing flows can be adopted and overwritten by another. The processing flow not only refers to the processing method, but also refers to the functions called during the processing, the parameters involved, etc.

[0083] For high-level programming languages, overriding means that a method in a subclass can have the same name and parameters as a method in the parent class. When this method is called through an instance object created by the subclass, the method defined in the subclass will be called. This is equivalent to overriding the method defined in the parent class with a method in the subclass that is exactly the same as the method defined in the parent class. This allows polymorphism in object-oriented programming to be achieved by calling a subclass method to overwrite the parent class method. However, overriding a parent class method by calling a subclass method requires support from a high-level programming language and can only achieve interface coverage between user states or between kernel states, not across user and kernel states.

[0084] One of the core ideas of the embodiments of the present application is that when there are two completely identical interface function implementations in the operating system, the interface function in the user state will be called first, and the interface function in the kernel state will not be called, so as to achieve interface coverage across the user state and kernel state.

[0085] Reference Figure 1 , shows a flowchart of the steps of an embodiment of an interface processing method of the present application, which is applied to a microkernel operating system, wherein the microkernel operating system includes a user state for executing user state programs, and specifically may include the following steps:

[0086] Step 101, in response to the execution operation of the user-mode program, obtaining a preset interface required to be called by the executed user-mode program;

[0087] The embodiments of the present application can be applied to a microkernel operating system. The difference between this microkernel operating system and other operating systems is that other operating systems usually integrate the system service layer and the kernel layer together, while the microkernel operating system separates the system service layer as an option that can be added according to demand. Specifically, it can be based on the C (Client) / S (Server) model, placing the most basic part of the operating system into the kernel, and implementing most of the operating system functions in a group of servers outside the microkernel. These servers run in user mode, and the client used by the user and the server need to communicate with each other through the message passing mechanism provided by the microkernel.

[0088] Among them, the multi-process scheduling and multi-process communication provided by the kernel can serve as a bridge connecting client applications and user-mode system services, and all servers run in user mode. Then the message passing mechanism provided by the microkernel (such as multi-process scheduling, multi-process communication, etc.) is also used between servers.

[0089] In one embodiment of the present application, it is possible to respond to the execution operation of a user-mode program and obtain the preset interface required to be called by the executed user-mode program, so that in the subsequent process of determining whether there is a preset interface required to be called in the user mode to implement priority calling of the user-mode interface, the interface object to be determined can be clearly identified.

[0090] Step 102: determine whether the user state has the preset interface to be called;

[0091] In one embodiment of the present application, when the interface object to be determined is clear, it is determined whether there is a preset interface in the user state that is required to be called by the executed user state program.

[0092] In actual applications, the microkernel operating system may include kernel state and user state. The microkernel operating system may provide a set of interface implementations in kernel state by default, and allow users to customize interfaces and place the customized interface implementations in user state, so that when there are two completely identical interface function implementations in the microkernel operating system in the future, one of the interface functions can be called first, and the other interface function will not be called, where the interface function located in the user state is specifically called.

[0093] Step 103: Call the preset interface required to be called from the user state according to the judgment result.

[0094] In actual applications, in order to achieve interface coverage between user state and kernel state in a microkernel operating system, when the system calls an interface implementation that is the same as a user-defined interface, the system will call the user-defined interface instead of the system default interface. Specifically, this can be achieved based on the judgment result of whether the preset interface to be called exists in the user state.

[0095] Specifically, calling the preset interface in the user state according to the judgment result can be manifested as if there is a preset interface in the user state to be called, then the preset interface in the user state can be obtained and called.

[0096] The preset interface to be called may specifically be an interface function to be called by the executed user-mode program, that is, an interface function to be called or executed when the user-mode program is executed.

[0097] In one embodiment of the present application, for a method of calling a preset interface in user mode, the method may first obtain a function pointer data structure in user mode of the executed user mode program, and determine whether a user mode-defined function identical to the interface function to be called exists in the user mode function pointer data structure; if so, the user mode-defined function may be called from the user mode function pointer data structure. The user mode-defined function may refer to an interface function that is user-defined and placed in user mode.

[0098] In actual applications, calling a user-defined function can be done by determining the function pointer corresponding to the interface function to be called in the user-defined function pointer data structure, obtaining the assignment pointed to by the determined function pointer, and using the assigned value as the currently called user-defined function implementation.

[0099] As an example, a user-defined interface function (i.e., a user-defined function) will be registered in the function pointer data structure of the user-state program. At this time, if the corresponding function determined in the user-state function pointer data structure is not empty, it means that there is a user-defined function that is the same as the interface function to be called, that is, there is a user-defined interface. If the user-defined function is not registered in the user-state program, the function pointed to by the function pointer in the data structure of the corresponding user-state program is empty.

[0100] In another case, if there is no user-mode defined function in the user-mode function pointer data structure that is the same as the interface function to be called, then it is necessary to call the interface function to be called from the kernel mode, that is, call the default kernel mode interface implementation.

[0101] In actual applications, the interface provided by the kernel state to the outside world will have a one-to-one corresponding user state interface function. The user's application first calls the user state interface function and then calls the kernel state interface through the system call Syscall (a thread call function of the operating system).

[0102] In a specific implementation, for the method of calling the interface function required to be called from the kernel state, a user state calling function in the user state can be obtained. This user state calling function can be used to call the user state interface function required to be used when calling the interface function required to be called in the kernel state in the user state. At this time, the user state calling function can be used to call the interface function required to be called from the kernel state.

[0103] In a preferred embodiment, when it is necessary to modify the interface implemented by the user-mode program, there is no need to modify the kernel-mode interface. A new user-mode program can be directly developed in the user-mode for calling. Specifically, it can be manifested as responding to the execution operation of the user-mode program, obtaining the user-mode defined function located in the user-mode through the user-mode program, and executing the user-mode defined function.

[0104] In an embodiment of the present application, applied to a microkernel operating system, by responding to the execution operation of a user-mode program and obtaining the preset interface required to be called by the executed user-mode program, when calling the preset interface required to be called, it is first possible to determine whether the preset interface required to be called exists in the user mode, and then, based on the determination result, call the preset interface required to be called by the executed user-mode program from the user mode to execute the called user-mode preset interface. By determining whether the preset interface required to be called exists in the user mode to implement preferential calling of the user-mode interface, it does not require the support of a high-level programming language to cover the interface in the microkernel operating system, and can achieve interface coverage between the user mode and kernel mode, that is, achieve interface coverage across the user mode and kernel mode.

[0105] Reference Figure 2 , shows a flowchart of another embodiment of the interface processing method of the present application, focusing on the process of implementing a user-defined interface and placing it in user mode, which may specifically include the following steps:

[0106] Step 201: Obtain a user-defined function; the user-defined function is a user-defined interface function;

[0107] In one embodiment of the present application, the microkernel operating system can provide a set of interface implementations in kernel state by default, and allow users to customize interfaces and place the customized interface implementations in user state. At this time, the user state defined function can be obtained as a user-defined interface function to be placed in user state.

[0108] Among them, the interface implementation in the microkernel operating system can be located in user mode and kernel mode respectively. The system-level interface overloading it implements cannot be achieved by overlay in high-level programming languages.

[0109] It should be noted that the timing for implementing the user-defined interface and placing it in user mode may be before executing the user mode program or at other times, and this is not limited in the embodiments of the present application.

[0110] Step 202: Register the user-state defined function to the user-state function pointer data structure.

[0111] In one embodiment of the present application, a function pointer data structure may exist in the user state. Registering a user-state-defined function to the user-state function pointer data structure may be manifested as pointing the function pointer to a user-defined interface function, or assigning the interface function to the function pointer, so that the relevant interface function can be called subsequently through the function pointed to by the function pointer or assigned by the function pointer.

[0112] Specifically, a function pointer of a user-state function pointer data structure may be obtained, and the user-state defined function may be assigned to the function pointer. The function pointer data structure in the user state may be empty by default.

[0113] In an embodiment of the present application, the microkernel operating system also includes a kernel state, and the user-defined interface can be exactly the same as the interface function existing in the kernel state. In fact, the user-defined interface implements a batch of operation functions (which can refer to user-state defined functions). At this time, these functions can be assigned to the function pointer in the structure.

[0114] In actual applications, in order to give priority to calling user-defined interfaces, the user-defined interfaces can be registered in this default empty function pointer data structure. That is, when the function pointer in this structure is called first, if the function pointer points to empty, the interface provided by the kernel will be called through the system; on the contrary, if a user-defined implementation has been registered in this structure before, then the corresponding function pointer points to something that is not empty, and the user-defined function implementation will be called through the function pointer.

[0115] In an embodiment of the present application, a user customizes a set of interface implementations in user mode so that the subsequent microkernel operating system can call the user-defined interface when implementing the same interface, and does not use the interface implementation provided by the system by default; and the operating system has a complete set of functional interfaces. When the user customizes a part of the interface, not only can the user-defined interface be used first, but also when the user-defined interface is missing, the system will automatically enable the original interface provided by the system by default to ensure that the basic functional interface can be used normally.

[0116] Reference Figure 3 , shows a flowchart of steps of another embodiment of an interface processing method of the present application, involving a microkernel operating system including a user state, wherein the method is applied to a user state program executed in the microkernel operating system, and specifically may include the following steps:

[0117] Step 301: When the user state program is executed, the user state program determines whether there is a user state defined function in the user state; the user state defined function is a user-defined interface function;

[0118] In the embodiments of the present application, emphasis is placed on application processes that are processed using user-defined interface functions in user mode.

[0119] Step 302: If the user state defined function exists in the user state, execute the user state defined function.

[0120] In the specific implementation, the application process can be that when the user-state program is executed, the system will determine whether there is a user-defined interface implementation in user-state. If there is a user-state interface implementation, the user-state interface implementation will be called first; if there is no user-state interface implementation, the default kernel-state interface implementation will be called.

[0121] That is, in one case, if there is a user-state defined function (i.e., a user-defined interface) in the user state, the user-state defined function can be executed directly; in another case, the microkernel operating system can also include a kernel state. If there is no user-state defined function in the user state, the kernel state function located in the kernel state can be obtained and executed, that is, a set of interface implementations provided by default in the kernel state can be called and executed.

[0122] In the embodiments of the present application, in order to facilitate those skilled in the art to understand the application of the interface processing method proposed in the embodiments of the present application, the following is an illustration with reference to examples:

[0123] As an example, assuming that the executed user-mode program is a user application, when the user application is executed, its serial port driver is in kernel mode by default. In this case, the user application needs to operate the serial port driver through system calls. When a serial port driver in user mode exists, the user-mode serial port driver will be pre-registered with a function pointer associated with the user application. When the user program accesses it, it will find that the corresponding function pointer is not empty, indicating that the function pointer associated with this serial port driver has a user-mode serial port driver function pointed to. In this case, the registered user-mode serial port driver function will be called, thereby implementing the call of the user-mode serial port driver.

[0124] Reference Figure 4 , shows an application scenario diagram of interface processing in an embodiment of the present application. The interface processing method proposed in the embodiment of the present application can be applied to IoT devices that support a microkernel operating system, such as smart speakers, network cameras, etc. The supported microkernel operating system separates the system service layer and implements most of the operating system functions in a group of servers outside the microkernel, which run in user mode.

[0125] In a specific example, assuming that the IoT device is a smart speaker, in order to be able to cross platforms and terminals and smoothly use rich applications of systems such as Windows, Linux, and Android, the smart speaker can support a microkernel operating system, allowing users to play computer games, take online classes, and experience 3D (Three Dimensions) rendering through the smart speaker.

[0126] Among them, users experience operations through the 3D rendering software installed on the smart speaker. The installed 3D rendering software can provide related services based on the communication connection established with the corresponding server, and the microkernel operating system supported by the smart speaker can provide all basic functions for 3D rendering by default, that is, the default operating system kernel can have a serial port driver for 3D rendering.

[0127] In actual applications, when the user starts the installed software for 3D rendering to execute related user programs, the user program will use its own kernel driver by default. When the user needs to make modifications based on the basic functions for 3D rendering provided by the kernel, such as adding custom functions to the basic functions, the traditional way to modify the kernel driver is to directly modify the functions and parameters in the related kernel driver in the kernel state. After applying the interface processing method of the embodiment of the present application, the microkernel operating system supported by the smart speaker can develop a custom driver in the user state instead of modifying the kernel's own driver to implement the custom functions required to implement the basic functions based on 3D rendering. At this time, the user application executed will call the newly developed user-state driver.

[0128] It should be noted that the custom driver developed in user mode may only be a related program based on the custom function to be implemented. The operating system can provide all basic functions by default. If there is no user-defined function, the basic function of the operating system will be called. When there is a user-defined function, the user-defined function will be called to ensure that the custom function is implemented while the functional interface can be used normally.

[0129] In an embodiment of the present application, by determining whether there is a preset interface to be called in the user state to implement priority calling of the user state interface, it does not require the support of high-level programming languages ​​to cover the interface in the high-level programming language, and can achieve interface coverage between the user state and the kernel state in the microkernel operating system, that is, to achieve interface coverage across the user state and the kernel state.

[0130] It should be noted that for the method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present application are not limited by the order of the actions described, because according to the embodiments of the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present application.

[0131] Reference Figure 5 , shows a structural block diagram of an embodiment of an interface processing device of the present application, which is applied to a microkernel operating system. The microkernel operating system includes a user state for executing user state programs, and specifically may include the following modules:

[0132] The user mode program response module 501 is used to respond to the execution operation of the user mode program and obtain the preset interface required to be called by the executed user mode program;

[0133] The preset interface determination module 502 is used to determine whether the user state has the preset interface to be called;

[0134] The preset interface calling module 503 is configured to call the preset interface to be called from the user state according to the judgment result.

[0135] In one embodiment of the present application, a function pointer data structure exists in the user state, and the apparatus may further include the following modules:

[0136] A user-defined function acquisition module is used to acquire a user-defined function; the user-defined function is a user-defined interface function;

[0137] The user-state defined function registration module is used to register the user-state defined function to the user-state function pointer data structure.

[0138] In one embodiment of the present application, the user-defined function registration module may include the following submodules:

[0139] The user-state defined function assignment submodule is used to obtain the function pointer of the user-state function pointer data structure and assign the user-state defined function to the function pointer.

[0140] In one embodiment of the present application, the microkernel operating system further includes a kernel state; the user state defined function is the same as the interface function existing in the kernel state.

[0141] In one embodiment of the present application, the preset interface calling module 503 may include the following submodules:

[0142] The preset interface calling submodule is used to obtain the preset interface in the user state if the preset interface to be called exists in the user state, and call the preset interface in the user state.

[0143] In one embodiment of the present application, the preset interface to be called includes an interface function to be called by the executed user-mode program, and the preset interface calling submodule may include the following units:

[0144] A function pointer data structure acquisition unit, configured to acquire a function pointer data structure of the executed user-mode program in the user-mode;

[0145] A user-state defined function determination unit, configured to determine whether there is a user-state defined function identical to the interface function to be called in the user-state function pointer data structure;

[0146] The user-state defined function calling unit is configured to call the user-state defined function from the user-state function pointer data structure if the function exists.

[0147] In one embodiment of the present application, the user-defined function calling unit may include the following subunits:

[0148] A function pointer determination subunit, configured to determine a function pointer corresponding to the interface function to be called in the function pointer data structure in the user state;

[0149] A pointer assignment acquisition subunit, used to acquire the assignment pointed to by the determined function pointer;

[0150] The user-state defined function calling subunit is used to use the pointed assignment as the currently called user-state defined function and call the user-state defined function.

[0151] In one embodiment of the present application, the microkernel operating system further includes a kernel state; the preset interface calling submodule may further include the following units:

[0152] The kernel state function calling unit is used to call the interface function to be called from the kernel state if there is no user state defined function identical to the interface function to be called in the function pointer data structure of the user state.

[0153] In one embodiment of the present application, the kernel-mode function calling unit may include the following subunits:

[0154] A user state call function acquisition subunit, used to acquire the user state call function in the user state;

[0155] The kernel state function calling subunit is used to call the interface function required to be called from the kernel state using the user state calling function.

[0156] In one embodiment of the present application, the apparatus may further include the following modules:

[0157] The user-state defined function execution module is used to respond to the execution operation of the user-state program, obtain the user-state defined function in the user state through the user-state program, and execute the user-state defined function.

[0158] Reference Figure 6 , shows a structural block diagram of another embodiment of the interface processing device of the present application, involving a microkernel operating system including a user state, and applied to a user state program executed in the microkernel operating system, which may specifically include the following modules:

[0159] A user-state defined function determination module 601 is configured to determine, when the user-state program is executed, whether a user-state defined function exists in the user state; the user-state defined function is a user-defined interface function;

[0160] The user state defined function execution module 602 is configured to execute the user state defined function if the user state defined function exists in the user state.

[0161] In one embodiment of the present application, the microkernel operating system further includes a kernel state; the device may further include the following modules:

[0162] The kernel state function execution module is used to obtain the kernel state function located in the kernel state and execute the kernel state function if the user state defined function does not exist in the user state.

[0163] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0164] An embodiment of the present application further provides an electronic device, including:

[0165] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned interface processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0166] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned interface processing method embodiment are implemented and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0167] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0168] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0169] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0170] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0171] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0172] Although preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they become aware of the basic inventive concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

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

[0174] The above is a detailed introduction to an interface processing method and an interface processing device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An interface processing method, characterized in that: Applied to a microkernel operating system, the microkernel operating system includes a user state and a kernel state for executing user state programs, the user state having a function pointer data structure, the method comprising: Obtaining a user-state defined function; the user-state defined function is a user-defined interface function, and the user-state defined function is the same as the interface function existing in the kernel state; Registering the user-state defined function to the user-state function pointer data structure; In response to the execution operation of the user state program, a preset interface required to be called by the executed user state program is obtained; the preset interface required to be called includes an interface function required to be called by the executed user state program; Determine whether the preset interface to be called exists in the user state; If the preset interface to be called exists in the user state, obtaining a function pointer data structure of the executed user state program in the user state; Determine whether there is a user-state defined function that is the same as the interface function to be called in the user-state function pointer data structure; If a user-state defined function identical to the interface function to be called exists in the user-state function pointer data structure, calling the user-state defined function from the user-state function pointer data structure; If the user-state defined function identical to the interface function to be called does not exist in the function pointer data structure in the user state, the interface function to be called is called from the kernel state.

2. The method according to claim 1, characterized in that The step of registering the user-state defined function to the user-state function pointer data structure includes: Obtain a function pointer of the user-state function pointer data structure, and assign the user-state defined function to the function pointer.

3. The method according to claim 1, characterized in that The calling of the user-state defined function from the user-state function pointer data structure includes: Determine the function pointer corresponding to the interface function to be called in the function pointer data structure in the user state; Get the value pointed to by the determined function pointer; The pointed value is used as the currently called user-defined function, and the user-defined function is called.

4. The method according to claim 1, wherein The calling of the required interface function from the kernel state includes: Obtaining a user-state calling function in the user state; The user state calling function is used to call the interface function required to be called from the kernel state.

5. The method according to claim 4, characterized in that The step of calling the required interface function from the kernel state by using the user state calling function includes: The user-state calling function is used to obtain the kernel-state function pointer data structure, and the interface function required to be called by the executed user-state program is called from the kernel-state function pointer data structure.

6. The method according to claim 1, characterized in that The method further comprises: In response to the execution operation of the user state program, a user state defined function located in the user state is acquired through the user state program, and the user state defined function is executed.

7. An interface processing method, characterized in that: A microkernel operating system including user state and kernel state is provided. The method is applied to a user state program executed in the microkernel operating system. A function pointer data structure exists in the user state. The method comprises: When the user state program is executed, the user state program determines whether there is a preset interface to be called in the user state; the preset interface to be called includes an interface function to be called by the user state program; If the preset interface to be called exists in the user state, obtaining the function pointer data structure in the user state; If a user-state defined function identical to the interface function to be called exists in the user-state function pointer data structure, the user-state defined function is executed; the user-state defined function is a user-defined interface function; the user-state defined function is identical to the interface function existing in the kernel state; the user-state defined function is registered in the user-state function pointer data structure; If the user-state defined function identical to the interface function to be called does not exist in the user-state function pointer data structure, a kernel-state function in the kernel state is obtained and executed.

8. An interface processing device, characterized in that: Applied to a microkernel operating system, the microkernel operating system includes a user state and a kernel state for executing user state programs, the user state has a function pointer data structure, and the device includes: A user-state defined function acquisition module, configured to acquire a user-state defined function; the user-state defined function is a user-defined interface function; the user-state defined function is identical to the interface function existing in the kernel state; A user-state defined function registration module, configured to register the user-state defined function to the user-state function pointer data structure; A user-mode program response module is configured to respond to an execution operation of the user-mode program and obtain a preset interface required to be called by the executed user-mode program; the preset interface required to be called includes an interface function required to be called by the executed user-mode program; A preset interface determination module is used to determine whether the user state has the preset interface to be called; a function pointer data structure acquisition unit, configured to acquire a function pointer data structure of the executed user state program in the user state if the preset interface to be called exists in the user state; A user-state defined function determination unit, configured to determine whether there is a user-state defined function identical to the interface function to be called in the user-state function pointer data structure; A user-state defined function calling unit, configured to call the user-state defined function from the user-state function pointer data structure if a user-state defined function identical to the interface function to be called exists in the user-state function pointer data structure; The kernel state function calling unit is used to call the interface function to be called from the kernel state if there is no user state defined function identical to the interface function to be called in the function pointer data structure of the user state.

9. The device according to claim 8, characterized in that The user-defined function registration module includes: The user-state defined function assignment submodule is used to obtain the function pointer of the user-state function pointer data structure and assign the user-state defined function to the function pointer.

10. The device according to claim 8, characterized in that The user-defined function calling unit includes: A function pointer determination subunit, configured to determine a function pointer corresponding to the interface function to be called in the function pointer data structure in the user state; A pointer assignment acquisition subunit, used to acquire the assignment pointed to by the determined function pointer; The user-state defined function calling subunit is used to use the pointed assignment as the currently called user-state defined function and call the user-state defined function.

11. The device according to claim 8, characterized in that The kernel state function calling unit includes: A user state call function acquisition subunit, used to acquire the user state call function in the user state; The kernel state function calling subunit is used to call the interface function required to be called from the kernel state using the user state calling function.

12. The device according to claim 8, characterized in that The device further comprises: The user-state defined function execution module is used to respond to the execution operation of the user-state program, obtain the user-state defined function in the user state through the user-state program, and execute the user-state defined function.

13. An interface processing device, characterized in that: A microkernel operating system including user state and kernel state is provided, and the device is applied to a user state program executed in the microkernel operating system, wherein the user state has a function pointer data structure. The device comprises: A user-state defined function judgment module is used to, when the user-state program is executed, determine whether the user state has a preset interface to be called; the preset interface to be called includes an interface function to be called by the user-state program; A user-state defined function execution module is configured to execute a user-state defined function if a user-state defined function identical to the interface function to be called exists in the function pointer data structure of the user state; the user-state defined function is a user-defined interface function; the user-state defined function is identical to the interface function existing in the kernel state; the user-state defined function is registered with the function pointer data structure of the user state; and if the preset interface to be called exists in the user state, obtain the function pointer data structure in the user state; The kernel state function execution module is used to obtain the kernel state function located in the kernel state and execute the kernel state function if there is no user state defined function identical to the interface function to be called in the user state function pointer data structure.

14. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the interface processing method according to any one of claims 1 to 6 or 7 are implemented.

15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the interface processing method according to any one of claims 1 to 6 or 7 are implemented.

Citation Information

Patent Citations

  • Driving function user state debugging system and method

    CN105094910A

  • Kernel function call method, device and operation system

    CN105204937A