A method for calling user mode functions from kernel mode
A technology for calling functions and kernel mode, applied in the field of Linux kernel, to achieve the effect of satisfying special operations, flexible development, and unified deployment
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0027] The invention provides a method for invoking user mode functions in kernel mode, which converts the invocation of user mode functions in kernel mode into blocking and waking up of kernel mode threads: realizing parameter encapsulation of called user mode functions in kernel mode, The kernel mode thread is blocked and ioctl message communication is used to complete the user mode function call. When the user mode function returns the call result, the user mode function return result 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 method for calling a user mode function in the kernel mode in the embodiment of the present invention, including two parts of the design of the user mode and the kernel mode. The function of the kernel mode is the main part, and the user mode part completes the function by ...
Embodiment 2
[0032] figure 2 is a schematic flowchart of a method for calling a user-mode function in the kernel mode in the embodiment of the present invention, as shown in figure 2 As shown, the method for calling a user mode function in the kernel mode of the present invention includes the following steps:
[0033] S1. Implement the encapsulation function of the original user mode 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. The name of the state function is used as a parameter, and the parameters of the encapsulation function should also include the parameters passed by the upper-level calling function. In order for user-mode threads to distinguish calls from different kernel-mode threads, the parameters of the encapsulation function should also include the id of the kernel-mode thread. information, and save the param...
Embodiment 3
[0043] The following demonstrates the implementation process of the solution of the present invention with a specific example, such as image 3 and Figure 4 As shown, in this example: the kernel mode thread kprocB calls the user mode function funA, the user mode function funA is implemented in the user mode thread procA, and the prototype of the procA function in the user mode thread is int procA(int arg). The implementation process includes:
[0044] S11. Implement 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). The internal implementation of the encapsulation function kfunA is to put the parameters arg and the function name of procA and the thread id of kprocB. into a data structure;
[0045] S12. The kernel state thread kprocB calls the kernel state encapsulation function kfunA to complete the parameter encapsulation in step 1. Afte...
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