Privileged API Hardware Access Bypassing Kernel Traps
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing operating systems incur excessive overhead and decreased processing efficiency due to frequent switching between user and kernel modes when user programs access hardware resources, necessitating a method to reduce these overheads.
Innovation Solution
Configuring permission for privileged instructions to allow direct access to hardware resources without kernel trapping, using a privileged API in user mode that encapsulates these instructions, and executing them based on kernel permission and policy determination.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If user programs call APIs to access hardware resources through the existing operating system kernel interface, then hardware access can be performed with kernel management and control, but frequent switching between user space and kernel mode increases system overhead and decreases processing efficiency
Solution Approach 1:
The patent segments the hardware access path into two parts: privileged instructions that can be executed directly in user space (with configured permissions) and kernel management functions that handle higher-level operations. This segmentation allows frequent hardware accesses to bypass the kernel, reducing mode switching overhead while maintaining kernel control for critical operations.
Solution Approach 2:
The patent introduces privileged instructions as an intermediary mechanism between user programs and hardware resources. These instructions are configured with special permissions allowing direct hardware access from user space, acting as a mediator that eliminates the need for frequent kernel mode transitions while still providing controlled hardware access.
2Productivity
If privileged instructions are configured to allow direct user mode access to hardware resources, then system overhead is reduced and processing efficiency improves, but system security and access control may be compromised
Solution Approach 1:
The patent applies local quality by configuring permissions selectively for specific privileged instructions rather than granting universal access. Each privileged instruction can be individually enabled or disabled based on security requirements, allowing direct hardware access for approved instructions while maintaining security controls for others.
Solution Approach 2:
The patent changes the permission parameters of privileged instructions through configuration mechanisms. By modifying the permission state of specific privileged instructions, the system enables direct user-mode access for authorized instructions while maintaining security restrictions for unauthorized ones, thus balancing efficiency and security.
Data Source
Figure 1
Figure 2
Figure 3~4
AI summary
Embodiments of the present invention provide a method and an apparatus for accessing a hardware resource, and an operating system. The method of the present invention includes: configuring permission for one or more privileged instructions that are used for hardware access, so that when the one or more privileged instructions are used by a user mode application program, the application program can access a hardware resource without trapping into a kernel, where the application program calls, at a code level, a privileged application programming interface API that is in user mode and has the one or more privileged instructions encapsulated therein; and executing the one or more privileged instructions that are encapsulated in the privileged API that is called at the code level by the application program, so that the application program can access the hardware resource without trapping into the kernel. In the embodiments of the present invention, a privileged instruction for direct access to a hardware resource is set and encapsulated into an API, which is deployed in user space, so as to reduce system overheads for accessing the hardware resource and improve processing efficiency.