CN114281431A - Function calling method, device, medium, embedded equipment and operating system - Google Patents
Function calling method, device, medium, embedded equipment and operating system Download PDFInfo
- Publication number
- CN114281431A CN114281431A CN202011042662.7A CN202011042662A CN114281431A CN 114281431 A CN114281431 A CN 114281431A CN 202011042662 A CN202011042662 A CN 202011042662A CN 114281431 A CN114281431 A CN 114281431A
- Authority
- CN
- China
- Prior art keywords
- callback function
- operating system
- relevant information
- storage container
- system kernel
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 70
- 230000006870 function Effects 0.000 claims description 315
- 230000004044 response Effects 0.000 claims description 37
- 230000001960 triggered effect Effects 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 10
- 230000002618 waking effect Effects 0.000 claims 1
- 230000008569 process Effects 0.000 description 12
- 238000010586 diagram Methods 0.000 description 10
- 238000004891 communication Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000004590 computer program Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The embodiment of the invention provides a function calling method, a device, a medium, embedded equipment and an operating system, wherein the function calling method comprises the following steps: the method comprises the steps that an operating system kernel receives related information of a callback function registered by a user mode application program through a first system call instruction, and stores the related information of the callback function, wherein the callback function corresponds to a set event in the operating system kernel; and responding to the trigger of the setting event, and sending the relevant information of the callback function to the application program by the operating system kernel so that the application program executes the callback function in a user mode.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a function calling method, a function calling device, a function calling medium, embedded equipment and an operating system.
Background
A callback function is a function called by a function pointer. If the party providing the function implementation is called the callee, the callee may define a callback function and register the function pointer of the callback function to the caller. When a particular event or condition occurs, the caller uses the function pointer to call a callback function to respond to the event or condition.
Currently, many electronic devices use embedded operating systems, which typically include hardware such as processors, memory, and general device interfaces, as well as software such as operating system kernels and user applications.
In the embedded operating system, a space that a user can operate and access is referred to as a user space, and an application program, data, and the like of the user are stored in the user space. The space in which the kernel of the operating system operates is referred to as kernel space, and functions, interfaces, and the like of the kernel of the operating system are stored in the kernel space. The embedded operating system provides two levels of execution: user mode and kernel mode. When the process executes the user's own code in the user space, this state is called the user state; this state is referred to as kernel mode when a process executing a system call is trapped in kernel code for execution.
In application program design, registration of a callback function is often involved, and the callback function is called to be executed after a specific event occurs. However, in the embedded operating system, if the application registers the callback function to the operating system kernel, after a specific event occurs in the operating system kernel, the operating system kernel calls back the callback function registered by the application in the user mode, which is not allowed by the embedded operating system.
Disclosure of Invention
The embodiment of the invention provides a function calling method, a function calling device, a function calling medium, embedded equipment and an operating system, which are used for calling back a callback function of an execution application program registered in an operating system kernel in a user mode.
In a first aspect, an embodiment of the present invention provides a function call method, which is applied to an operating system kernel running in a kernel state, where the method includes:
receiving related information of a callback function registered by an application program of a user mode through a first system call instruction, wherein the callback function corresponds to a set event in an operating system kernel;
storing the relevant information of the callback function;
and responding to the trigger of the setting event, and sending the relevant information of the callback function to the application program so as to enable the application program to execute the callback function corresponding to the relevant information in a user mode.
In a second aspect, an embodiment of the present invention provides a function call apparatus, which is deployed in an operating system kernel running in a kernel state, and includes:
the receiving module is used for receiving related information of a callback function registered by an application program of a user mode through a first system call instruction, wherein the callback function corresponds to a set event in an operating system kernel;
the storage module is used for storing the relevant information of the callback function;
and the processing module is used for responding to the trigger of the set event, and sending the relevant information of the callback function to the application program so as to enable the application program to execute the callback function corresponding to the relevant information in a user mode.
In a third aspect, an embodiment of the present invention provides an embedded device, including a processor, a memory, and an operating system kernel, where the memory stores executable code corresponding to the operating system kernel, and when the executable code is executed by the processor, the processor is enabled to implement at least the function call method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an embedded device, causes the processor to implement at least the function call method of the first aspect.
In a fifth aspect, an embodiment of the present invention provides a function call method, which is applied to an application program running in a user mode, and the method includes:
registering relevant information of a callback function to an operating system kernel by triggering a first system call instruction, wherein the callback function corresponds to a set event in the operating system kernel;
acquiring relevant information of the callback function sent by the operating system kernel, wherein the operating system kernel sends the relevant information of the callback function in response to the trigger of the set event;
and executing the callback function according to the relevant information of the callback function.
In a sixth aspect, an embodiment of the present invention provides a function calling apparatus, which is deployed in an application program running in a user mode, and includes:
the registration module is used for registering relevant information of a callback function into an operating system kernel by triggering a first system call instruction, wherein the callback function corresponds to a set event in the operating system kernel;
the obtaining module is used for obtaining the relevant information of the callback function sent by the operating system kernel, wherein the operating system kernel sends the relevant information of the callback function in response to the triggering of the setting event;
and the execution module is used for executing the callback function according to the relevant information of the callback function.
In a seventh aspect, an embodiment of the present invention provides an embedded device, including a processor, a memory, and an application program running in a user mode, where the memory stores executable code corresponding to the application program, and when the executable code is executed by the processor, the processor is enabled to implement at least the function call method in the fifth aspect.
In an eighth aspect, an embodiment of the present invention provides a non-transitory machine-readable storage medium having stored thereon executable code, which, when executed by a processor of an embedded device, causes the processor to implement at least the function call method of the fifth aspect.
In a ninth aspect, an embodiment of the present invention provides an operating system, including:
the system comprises an operating system kernel running in a kernel mode and an application program running in a user mode;
the application program is used for registering relevant information of a callback function in the kernel of the operating system by triggering a first system call instruction, acquiring the relevant information of the callback function sent by the kernel of the operating system, and executing the callback function according to the relevant information of the callback function, wherein the callback function corresponds to a set event in the kernel of the operating system;
and the operating system kernel is used for storing the relevant information of the callback function and responding to the trigger of the set event to send the relevant information of the callback function to the application program.
In a tenth aspect, an embodiment of the present invention provides a function calling method, which is applied to an operating system, where the operating system includes an operating system kernel running in a kernel mode and an application running in a user mode; the method comprises the following steps:
the user mode application program registers relevant information of a callback function to the kernel of the operating system through a first system call instruction, wherein the callback function corresponds to a set event in the kernel of the operating system;
the kernel of the operating system stores the relevant information of the callback function;
the operating system kernel responds to the trigger of the set event and sends the relevant information of the callback function to the application program;
and the application program executes the callback function corresponding to the related information in a user mode.
In the embodiment of the invention, the embedded operating system comprises an operating system kernel running in a kernel mode and an application program running in a user mode. The application program may register the callback function with the operating system kernel by means of a system call (e.g., triggering a first system call instruction), so that the operating system kernel stores information about the callback function, such as a function pointer and other parameters. When a specific event occurs in the kernel of the operating system, the kernel of the operating system provides the stored related information of the callback function to the application program in the user mode, so that the application program executes the callback function in the user mode.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic diagram of a function calling process in an operating system according to an embodiment of the present invention;
fig. 2 is a schematic diagram of another function call process in the operating system according to an embodiment of the present invention;
FIG. 3 is a flowchart of a function call method according to an embodiment of the present invention;
FIG. 4 is a flowchart of a function call method according to another embodiment of the present invention;
FIG. 5 is an interaction diagram of a function call method according to an embodiment of the present invention
Fig. 6 is a schematic structural diagram of a function calling device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an embedded device according to an embodiment of the present invention;
FIG. 8 is a block diagram illustrating a function call apparatus according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an embedded device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and "a plurality" typically includes at least two.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
The function calling method provided by the embodiment of the invention is suitable for the following situations: in an operating system (the operating system in this document may be an embedded operating system), an application running in a user mode registers a callback function to an operating system kernel, and when a setting event occurs in the operating system kernel, how to call execution of the callback function.
As previously described, the operating system kernel cannot directly call callback functions that perform application registration in user-mode, in a manner that is not allowed by the embedded operating system. Because the kernel of the operating system runs in the kernel mode, the kernel mode is a privileged mode, and the application program runs in the user mode, the user mode is a non-privileged mode, and the embedded operating system is a program that is not allowed to execute the non-privileged mode in the privileged mode, which will cause the problem of access security, for example, the application program in the user mode will have a larger access authority to maliciously access and tamper some key data and functions of the operating system.
Based on this, in order to solve the problem that the kernel of the operating system cannot directly call the callback function of the application program in the user mode, which is registered in the kernel of the operating system, the embodiment of the present invention provides a method for calling the callback function between the kernel of the operating system and the application program in the user mode, so that when a setting event occurs in the kernel of the operating system, the callback function of the application program in the kernel of the operating system, which is registered in the kernel of the user mode, is called and executed in the user mode.
The implementation of this scheme is described below with reference to some of the following embodiments.
Fig. 1 is a schematic diagram illustrating a principle of a method for executing a function call by an operating system according to an embodiment of the present invention, as shown in fig. 1, the embedded operating system includes: an operating system kernel running in a kernel mode, and an application running in a user mode.
The application program is used for registering relevant information of the callback function in the kernel of the operating system by triggering the first system call instruction, acquiring the relevant information of the callback function sent by the kernel of the operating system, and executing the callback function according to the relevant information of the callback function. The callback function corresponds to a setting event in an operating system kernel.
And the operating system kernel is used for storing the related information of the callback function and responding to the trigger of the set event to send the related information of the callback function to the application program.
Specifically, an application running in a user mode may register a callback function with an operating system kernel in a system call manner, where the callback function corresponds to a setting event in the operating system kernel, that is, when the setting event is triggered, the callback function needs to be called.
The operating system may provide a system call instruction for registering the callback function for the application program, which is called a first system call instruction, and the user-mode application program traps in a kernel mode by calling the first system call instruction, thereby completing the registration of the relevant information of the callback function to the operating system kernel.
The registration of the callback function to the operating system kernel by the application program means that the application program registers the relevant information of the callback function to the operating system kernel, and the relevant information may include a function pointer and a function parameter of the callback function.
And the kernel of the operating system locally stores the relevant information of the callback function based on the registration of the application program to the relevant information of the callback function.
When a setting event in the kernel of the operating system is triggered, a callback function corresponding to the setting event, that is, a callback function registered by the application program, needs to be called and executed. Therefore, in summary, the operating system kernel needs to send the stored relevant information of the callback function to the application program, so that the application program running in the user mode executes the corresponding callback function based on the information after acquiring the information sent by the operating system kernel, thereby implementing the execution of the callback function in the user mode and avoiding the security problem caused by the direct call of the callback function by the operating system kernel.
In an alternative embodiment, the information about the callback function registered by the user-mode application program to the operating system kernel may be stored in a table, for example, where the information about a plurality of callback functions may be stored.
In addition, a preset function may be set in the kernel of the operating system, where the preset function may correspond to the set event one to one, or correspond to one to many (where the one to many correspondence indicates that the preset function may correspond to other events besides the set event), and the function of the preset function is: and inquiring the related information of the callback function corresponding to a certain set event stored in the kernel of the operating system in a certain mode.
Assuming that, as described above, the relevant information of the callback function corresponding to a certain setting event registered by an application program to the operating system kernel is stored in a table, it can be understood that the corresponding relationship between the relevant information of the callback function and the setting event can be reflected in the table, and thus, the role of the above-mentioned preset function can be understood as: and inquiring the relevant information of the callback function corresponding to the identifier of the set event in the table by taking the identifier of the set event as an inquiry keyword.
That is, in response to the trigger of a setting event in the operating system kernel, the related information of the locally stored target callback function (the target callback function refers to the callback function corresponding to the setting event) may be queried through the preset function corresponding to the setting event, and the related information of the callback function is sent to the application program.
In summary, the preset function provides a query function for querying information related to a callback function corresponding to a setting event.
It should be noted that, the implementation manner of the operating system kernel obtaining the locally stored relevant information of the callback function corresponding to the setting event in response to the occurrence of the setting event is not limited to the above-described implementation manner.
Several alternative implementations of sending the queried callback function related information to the user mode application by the operating system kernel are described below.
In an alternative embodiment, when the application program is started, one process a may be started to execute the application program, and when a setting event occurs in the operating system kernel, another process B may be started to execute a response process to the setting event. At this time, the relevant information of the callback function can be sent to the process a through the process B in an inter-process communication mode, so that the process a executes the callback function in a user mode based on the relevant information.
In another alternative embodiment, as shown in fig. 2, the operating system kernel may create a storage container in the operating system kernel, where the storage container corresponds to the application program, that is, the storage container is used for accommodating information related to the callback function registered by the application program. Based on this, in response to the trigger of the setting event, the operating system kernel may store the acquired relevant information of the callback function in the storage container, and the user-mode application program may acquire the relevant information of the callback function stored in the storage container from the storage container, thereby implementing the transfer of the relevant information of the callback function from the operating system kernel to the user-mode application program.
The storage container may be, for example, a queue (e.g., buffer queue), a shared memory, or a container such as an array.
In addition, optionally, as shown in fig. 2, taking a storage container as an example of a queue, the application program may obtain the relevant information of the callback function from the storage container in the following manner:
when the application program starts, the application program creates a task (task) and makes the task in a dormant state. And when the kernel of the operating system stores the relevant information of the callback function into the queue, the task is awakened, so that the application program reads the relevant information of the callback function from the queue through the task.
Briefly, a user-mode application program creates a task, the user-mode task blocks a queue for waiting for a message stored therein, and once the operating system kernel writes information related to a callback function into the queue, the task is immediately wakened to read the information related to the callback function from the queue and execute the callback function based on the read information related to the callback function.
It should be noted that the task in the user mode is not obtained directly from the queue, but obtained by means of a system call.
Specifically, optionally, the application may trigger a second system call instruction through the task to enable the operating system kernel to return an identifier of the queue (an identifier of the storage container), and after obtaining the identifier of the queue, may then trigger a third system call instruction corresponding to the identifier of the queue through the task to enable the operating system kernel to return the relevant information of the callback function stored in the queue. That is, the task may successively trigger two system calls to obtain the relevant information of the callback function stored in the queue. Of course, the above two ways of the system call instruction are only examples, and are not limited thereto.
Fig. 3 is a flowchart of a function call method according to an embodiment of the present invention, where the function call method may be executed by an operating system kernel running in a kernel state. As shown in fig. 3, the method may include the steps of:
301. and the operating system kernel receives the relevant information of a callback function registered by the user mode application program through the first system call instruction, wherein the callback function corresponds to a set event in the operating system kernel.
302. The kernel of the operating system stores the relevant information of the callback function.
303. And the operating system kernel responds to the trigger of the set event and sends the related information of the callback function to the application program so that the application program executes the callback function corresponding to the related information in a user mode.
As described above, optionally, the operating system kernel may query the relevant information of the locally stored callback function through the preset function corresponding to the setting event, so as to send the relevant information of the callback function to the application program.
In addition, optionally, the operating system kernel may further create a storage container corresponding to the application program in the operating system kernel, so as to store the obtained relevant information of the callback function in the storage container, so that the application program acquires the relevant information of the callback function stored in the storage container from the storage container. Optionally, the storage container comprises: queues, or shared memory.
In addition, as described above, optionally, the application program may create a task to obtain the information related to the callback function from the storage container. Specifically, the task may be created when the application starts, and after the task is created, the task may be put into a sleep state. And immediately awakening the task created by the application program after the operating system kernel stores the related information of the callback function in the storage container, so that the application program acquires the related information of the callback function from the storage container through the task.
In the process that the application program acquires the relevant information of the callback function from the storage container through the task, firstly, the task can trigger a second system call instruction to trap into a kernel state, and at the moment, the operating system kernel sends the identifier of the storage container to the task based on the second system call instruction. And then, the task triggers a third system call instruction according to the identifier of the storage container, namely the third system call instruction containing the identifier of the storage container, and at the moment, the operating system kernel sends the related information of the callback function stored in the storage container to the task based on the third system call instruction. And then, the task executes the callback function in a user mode based on the acquired related information of the callback function.
For the content not described in detail in this embodiment, reference may be made to the related description in the foregoing other embodiments, which is not repeated herein.
Fig. 4 is a flowchart of a function calling method according to another embodiment of the present invention, where the function calling method may be executed by an application program running in a user mode. As shown in fig. 4, the method may include the steps of:
401. the application program registers relevant information of a callback function to an operating system kernel by triggering a first system call instruction, wherein the callback function corresponds to a set event in the operating system kernel.
402. The application program acquires the related information of the callback function sent by the operating system kernel, wherein the operating system kernel sends the related information of the callback function in response to the trigger of the setting event.
403. And the application program executes the callback function according to the related information of the callback function.
Optionally, the operating system kernel may store, in response to the trigger of the setting event, the relevant information of the callback function in a storage container, where the storage container is created in the operating system kernel, and the storage container corresponds to the application program and is used for storing the relevant information of the callback function registered by the application program. At this time, the application program may acquire the relevant information of the callback function from the storage container.
Optionally, the application program may obtain the relevant information of the callback function from the storage container by:
creating a task and enabling the task to be in a dormant state;
responding to the awakening of the task checked in the operating system, triggering a second system call instruction through the task to enable an operating system kernel to return the identifier of the storage container, wherein the operating system kernel awakens the task after storing the relevant information of the callback function in the storage container;
and triggering a third system call instruction corresponding to the identifier of the storage container through the task so as to enable the operating system kernel to return the relevant information of the callback function stored in the storage container.
Finally, the user-mode task executes the callback function in the user mode based on the related information of the callback function obtained from the storage container.
Fig. 5 is a flowchart of a function calling method according to another embodiment of the present invention, and as shown in fig. 5, the method may include the following steps:
501. and the application program in the user mode registers the relevant information of the callback function to the kernel of the operating system through the first system call instruction.
502. The kernel of the operating system stores the relevant information of the callback function.
503. And the operating system kernel responds to the trigger of the setting event corresponding to the callback function in the operating system kernel and sends the relevant information of the callback function to the application program.
504. And the application program of the user mode executes the callback function corresponding to the related information in the user mode.
Optionally, the related information of the callback function may include a callback function pointer and a callback function parameter.
Optionally, the kernel of the operating system sends, in response to the trigger of the setting event, the relevant information of the callback function to the application program, which may be specifically implemented as:
the operating system kernel locally creates a storage container, and the storage container corresponds to the application program;
the kernel of the operating system responds to the trigger of the set event and stores the relevant information of the callback function into the storage container;
and the user-mode application program acquires the relevant information of the callback function from the storage container.
In order to obtain the relevant information of the callback function from the storage container, the user-mode application program may create a task for obtaining the relevant information when the user-mode application program is started, and make the task in a dormant state. And after the kernel of the operating system stores the relevant information of the callback function into a storage container, awakening the task. Based on the above, the application program in the user mode responds to the awakening of the task by the operating system kernel, and triggers a second system call instruction through the task so as to enable the operating system kernel to return the identifier of the storage container; and then triggering a third system call instruction corresponding to the identifier of the storage container through the task so as to enable the kernel of the operating system to return the relevant information of the callback function stored in the storage container.
For the detailed implementation process of the scheme provided in this embodiment, reference may be made to the related descriptions in the foregoing other embodiments, which are not described herein again.
The function calling apparatus of one or more embodiments of the present invention will be described in detail below. Those skilled in the art will appreciate that these function call devices can each be constructed by configuring the steps taught in the present solution using commercially available hardware components.
Fig. 6 is a schematic structural diagram of a function call device according to an embodiment of the present invention, where the function call device may be located in an operating system, and specifically may be located in an operating system kernel. As shown in fig. 6, the function calling apparatus includes: the device comprises a receiving module 11, a storage module 12 and a processing module 13.
The receiving module 11 is configured to receive relevant information of a callback function registered by a user mode application program through a first system call instruction, where the callback function corresponds to a set event in an operating system kernel.
And the storage module 12 is configured to store relevant information of the callback function.
The processing module 13 is configured to send, in response to the trigger of the setting event, the relevant information of the callback function to the application program, so that the application program executes the callback function corresponding to the relevant information in a user mode.
Optionally, the processing module 13 may be specifically configured to: and inquiring the related information of the locally stored callback function through a preset function corresponding to the set event.
Optionally, the apparatus further comprises: and the creating module is used for creating a storage container in the operating system kernel, and the storage container corresponds to the application program. Thus, the processing module 13 is specifically configured to: and storing the relevant information of the callback function into the storage container so that the application program acquires the relevant information of the callback function from the storage container.
Optionally, the storage container comprises: queues, and/or shared memory.
Optionally, the apparatus further comprises: and the awakening module is configured to awaken the task created by the application program after the processing module 13 stores the relevant information of the callback function in the storage container, so that the application program acquires the relevant information of the callback function from the storage container through the task.
Based on this, optionally, the processing module 13 is further configured to: responding to a second system calling instruction triggered by the task, and sending the identification of the storage container to the task; and responding to a third system call instruction triggered by the task according to the identifier of the storage container, and sending the relevant information of the callback function stored in the storage container to the task.
The function calling device shown in fig. 6 may execute the steps executed by the operating system kernel in the embodiments shown in fig. 1 to fig. 5, and a part not described in detail in this embodiment may refer to the related description of the embodiments, which is not described herein again.
In one possible design, the structure of the function calling apparatus shown in fig. 6 may be implemented as an embedded device. As shown in fig. 7, the embedded device may include: a processor 21, a memory 22, and an operating system kernel 23. The memory 22 stores executable code corresponding to the os kernel, and when the executable code is executed by the processor 21, at least the processor 21 is enabled to implement the steps performed by the os kernel in the embodiments shown in fig. 1 to 5.
The embedded device may also include interfaces such as I/O interfaces, communication interfaces, and the like, as well as various registers and applications running in a user mode.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an embedded device, the processor is caused to perform the steps performed by the operating system kernel in the embodiments shown in fig. 1 to 5.
Fig. 8 is a schematic structural diagram of a function call device according to an embodiment of the present invention, where the function call device may be located in an operating system, and specifically may be located in an application running in a user mode. As shown in fig. 8, the function calling apparatus includes: a registration module 31, an acquisition module 32, and an execution module 33.
The registration module 31 is configured to register, by triggering the first system call instruction, relevant information of a callback function to an operating system kernel, where the callback function corresponds to a set event in the operating system kernel.
An obtaining module 32, configured to obtain relevant information of the callback function sent by the operating system kernel, where the operating system kernel sends the relevant information of the callback function in response to the trigger of the setting event.
And the execution module 33 is configured to execute the callback function according to the relevant information of the callback function.
Optionally, the operating system kernel stores the relevant information of the callback function in a storage container in response to the trigger of the setting event, where the storage container is created in the operating system kernel, and the storage container corresponds to the application program. At this time, the obtaining module 32 is specifically configured to: and acquiring the relevant information of the callback function from the storage container.
Optionally, the apparatus further comprises: and the creating module is used for creating a task and enabling the task to be in a dormant state. Based on this, the obtaining module 32 is specifically configured to: responding to the awakening of the task by the operating system kernel, triggering a second system call instruction through the task to enable the operating system kernel to return the identifier of the storage container, wherein the operating system kernel awakens the task after storing the relevant information of the callback function in the storage container; and triggering a third system call instruction corresponding to the identifier of the storage container through the task, so that the operating system kernel returns the relevant information of the callback function stored in the storage container.
The function calling device shown in fig. 8 may execute the steps executed by the application programs in the embodiments shown in fig. 1 to fig. 5, and parts not described in detail in this embodiment may refer to the related descriptions of the embodiments, which are not described herein again.
In one possible design, the structure of the function calling apparatus shown in fig. 8 may be implemented as an embedded device. As shown in fig. 9, the embedded device may include: processor 41, memory 42, application 43. In which the memory 42 stores executable code corresponding to the application 43 running in the user mode, which when executed by the processor 41, at least makes the processor 41 implement the steps performed by the application in the embodiments of fig. 1 to 5 described above.
The embedded device may also include interfaces such as I/O interfaces, communication interfaces, and the like, as well as various registers and an operating system kernel.
In addition, an embodiment of the present invention provides a non-transitory machine-readable storage medium, on which executable code is stored, and when the executable code is executed by a processor of an embedded device, the processor is caused to execute the steps performed by the application program in the embodiments shown in fig. 1 to 5.
The above-described apparatus embodiments are merely illustrative, wherein the various modules illustrated as separate components may or may not be physically separate. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course, can also be implemented by a combination of hardware and software. With this understanding in mind, the above-described aspects and portions of the present technology which contribute substantially or in part to the prior art may be embodied in the form of a computer program product, which may be embodied on one or more computer-usable storage media having computer-usable program code embodied therein, including without limitation disk storage, CD-ROM, optical storage, and the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (28)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011042662.7A CN114281431A (en) | 2020-09-28 | 2020-09-28 | Function calling method, device, medium, embedded equipment and operating system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011042662.7A CN114281431A (en) | 2020-09-28 | 2020-09-28 | Function calling method, device, medium, embedded equipment and operating system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114281431A true CN114281431A (en) | 2022-04-05 |
Family
ID=80868144
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011042662.7A Pending CN114281431A (en) | 2020-09-28 | 2020-09-28 | Function calling method, device, medium, embedded equipment and operating system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114281431A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114625452A (en) * | 2022-05-12 | 2022-06-14 | 支付宝(杭州)信息技术有限公司 | Method for calling host machine function by program and program running system |
CN114816914A (en) * | 2022-04-21 | 2022-07-29 | 阿里巴巴(中国)有限公司 | Data processing method, equipment and medium based on Kubernetes |
CN115840938A (en) * | 2023-02-21 | 2023-03-24 | 山东捷讯通信技术有限公司 | File monitoring method and device |
CN116204336A (en) * | 2023-02-16 | 2023-06-02 | 中国人民解放军61660部队 | User state core state synchronization method and system based on registry callback mechanism |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5526485A (en) * | 1994-10-13 | 1996-06-11 | Microsoft Corporation | Just-in-time debugging system and methods under the windows 3.0 and windows 3.1 operating systems |
US6047356A (en) * | 1994-04-18 | 2000-04-04 | Sonic Solutions | Method of dynamically allocating network node memory's partitions for caching distributed files |
US20050033766A1 (en) * | 2003-06-27 | 2005-02-10 | Microsoft Corporation | Method and framework for providing system performance information |
CN103218264A (en) * | 2013-03-26 | 2013-07-24 | 广东威创视讯科技股份有限公司 | Multi-thread finite state machine switching method and multi-thread finite state machine switching device based on thread pool |
CN107491350A (en) * | 2017-09-05 | 2017-12-19 | 武汉斗鱼网络科技有限公司 | Interface task call method and device |
CN108712459A (en) * | 2018-03-30 | 2018-10-26 | 深圳市风云实业有限公司 | Protocol massages cross-layer communication method, device and electronic equipment |
CN109978482A (en) * | 2017-12-27 | 2019-07-05 | 华为技术有限公司 | Workflow processing method, device, equipment and storage medium |
CN110826099A (en) * | 2019-10-30 | 2020-02-21 | 上海华元创信软件有限公司 | Safe storage method and system suitable for embedded real-time operating system |
-
2020
- 2020-09-28 CN CN202011042662.7A patent/CN114281431A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6047356A (en) * | 1994-04-18 | 2000-04-04 | Sonic Solutions | Method of dynamically allocating network node memory's partitions for caching distributed files |
US5526485A (en) * | 1994-10-13 | 1996-06-11 | Microsoft Corporation | Just-in-time debugging system and methods under the windows 3.0 and windows 3.1 operating systems |
US20050033766A1 (en) * | 2003-06-27 | 2005-02-10 | Microsoft Corporation | Method and framework for providing system performance information |
CN103218264A (en) * | 2013-03-26 | 2013-07-24 | 广东威创视讯科技股份有限公司 | Multi-thread finite state machine switching method and multi-thread finite state machine switching device based on thread pool |
CN107491350A (en) * | 2017-09-05 | 2017-12-19 | 武汉斗鱼网络科技有限公司 | Interface task call method and device |
CN109978482A (en) * | 2017-12-27 | 2019-07-05 | 华为技术有限公司 | Workflow processing method, device, equipment and storage medium |
CN108712459A (en) * | 2018-03-30 | 2018-10-26 | 深圳市风云实业有限公司 | Protocol massages cross-layer communication method, device and electronic equipment |
CN110826099A (en) * | 2019-10-30 | 2020-02-21 | 上海华元创信软件有限公司 | Safe storage method and system suitable for embedded real-time operating system |
Non-Patent Citations (1)
Title |
---|
刘星星: "基于AP-SOC的掌上实时频谱分析仪设计与实现", 《中国优秀硕士学位论文全文数据库工程科技Ⅱ辑》, no. 02, 15 February 2017 (2017-02-15), pages 042 - 3116 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114816914A (en) * | 2022-04-21 | 2022-07-29 | 阿里巴巴(中国)有限公司 | Data processing method, equipment and medium based on Kubernetes |
CN114625452A (en) * | 2022-05-12 | 2022-06-14 | 支付宝(杭州)信息技术有限公司 | Method for calling host machine function by program and program running system |
CN114625452B (en) * | 2022-05-12 | 2022-07-29 | 支付宝(杭州)信息技术有限公司 | Method for calling host machine function by program and program running system |
CN116204336A (en) * | 2023-02-16 | 2023-06-02 | 中国人民解放军61660部队 | User state core state synchronization method and system based on registry callback mechanism |
CN116204336B (en) * | 2023-02-16 | 2023-09-22 | 中国人民解放军61660部队 | User state core state synchronization method and system based on registry callback mechanism |
CN115840938A (en) * | 2023-02-21 | 2023-03-24 | 山东捷讯通信技术有限公司 | File monitoring method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114281431A (en) | Function calling method, device, medium, embedded equipment and operating system | |
KR102509384B1 (en) | Method, apparatus and system for implementing multi-core parallel to TEE side | |
US6848046B2 (en) | SMM loader and execution mechanism for component software for multiple architectures | |
US8387075B1 (en) | Common scheduling and synchronization primitives | |
WO2018161812A1 (en) | User interface rendering method and device | |
US10802875B2 (en) | Multithread framework for use in pre-boot environment of a system-on-chip | |
JP2002517034A (en) | Emulation coprocessor | |
JP2011134321A (en) | Operating system independent network event handling | |
TW200525365A (en) | Optimization of SMI handling and initialization | |
CN114625545A (en) | Process lock holding detection method, electronic device and readable medium thereof | |
CN105094811B (en) | A kind of method and apparatus of event handling | |
US10649823B2 (en) | Notifications | |
CN117369888A (en) | Electronic equipment awakening method and device, electronic equipment and readable storage medium | |
CN105701409B (en) | A kind of method and device for realizing file virtualization | |
CN105303114A (en) | Windows based system service function calling method and apparatus | |
CN115668157A (en) | Secure booting of a computing device | |
CN109062624B (en) | Processing method for interrupt wakeup of automobile electronic control unit | |
US7797473B2 (en) | System for executing system management interrupts and methods thereof | |
CN111783090A (en) | An information processing method and device, equipment, and storage medium | |
CN109951591B (en) | Method and equipment for monitoring abnormity of mobile phone device | |
CN117667421A (en) | Implementation method, device, computer equipment and storage medium of distributed lock | |
CN117573355A (en) | Task processing method, device, electronic equipment and storage medium | |
CN109426563B (en) | Process management method and device | |
JPWO2006001051A1 (en) | Multiprocessor device and control method thereof | |
CN107632893B (en) | Message queue processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |