Method for calling user mode function by kernel mode
A technology for calling functions and kernel state, applied in the field of Linux kernel, to achieve the effect of increasing convenience, improving kernel development efficiency, and satisfying flexible development
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0027] The present invention provides a method for calling user-mode functions from the kernel mode, which converts the calling of the user-mode functions from the kernel mode into blocking and waking up the kernel-mode threads: realizing the encapsulation of the parameters of the called user-mode functions in the kernel mode, Kernel mode thread blocking, ioctl message communication to complete the call of the user mode function, when the user mode function returns the call result, the return result of the user mode function is sent to the kernel mode through ioctl message communication, and then the blocked kernel mode thread is woken up to complete the function The entire process of calling.
[0028] figure 1 It is a schematic diagram of the principle of the method for the kernel state to call the user state function in the embodiment of the present invention, including the user state and the kernel state two-part design, the function of the kernel state is the main part, an...
Embodiment 2
[0032] figure 2 It is a schematic flow diagram of the method for calling user mode functions from the kernel mode in the embodiment of the present invention, as shown in figure 2 As shown, the method for calling the user mode function from the kernel mode of the present invention comprises the following steps:
[0033] S1. Implement the encapsulation function of the user mode original function in the kernel mode. For each user mode function that needs to be called, it is first necessary to implement an encapsulation function with the same prototype as the user mode function in the kernel mode. In the encapsulation function, the user mode The name of the encapsulation function is used as a parameter. The parameters of the encapsulation function should also include the parameters passed by the upper-level calling function. In order for the user-mode thread to be able to distinguish calls from different kernel-mode threads, the parameters of the encapsulation function should al...
Embodiment 3
[0043] Demonstrate the implementation process of the scheme of the present invention below with a specific example, as image 3 and Figure 4 As shown, in this example: the kernel state thread kprocB calls the user state function funA, the user state function funA is implemented in the user state thread procA, and the prototype of the procA function in the user state thread is int procA (int arg), and the implementation process includes:
[0044] S11. Realize the encapsulation function kfunA of the user mode function funA in the kernel mode (this function is an encapsulation function, and the prototype is the same as the user mode thread procA). into a data structure;
[0045] S12. The kernel state thread kprocB calls the kernel state encapsulation function kfunA to complete the parameter encapsulation of step 1. After kfunA completes the parameter encapsulation, the parameter data structure is added to a call queue (the call queue is a global queue of a linked list structure...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com