AIX Version 7.2: Kernel Extensions and Device Support Programming Concepts Kernel Extensions and Device Support Programming Concepts
Total Page:16
File Type:pdf, Size:1020Kb
AIX Version 7.2 Kernel Extensions and Device Support Programming Concepts IBM Note Before using this information and the product it supports, read the information in “Notices” on page 427. This edition applies to AIX Version 7.2 and to all subsequent releases and modifications until otherwise indicated in new editions. © Copyright International Business Machines Corporation 2015, 2018. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents About this document............................................................................................vii How to Use This Document........................................................................................................................ vii Highlighting.................................................................................................................................................vii Case-sensitivity in AIX................................................................................................................................vii ISO 9000.....................................................................................................................................................vii Kernel Extensions and Device Support Programming Concepts............................... 1 Kernel Environment..................................................................................................................................... 1 Understanding Kernel Extension Symbol Resolution............................................................................1 Understanding Execution Environments............................................................................................... 5 Understanding Kernel Threads.............................................................................................................. 6 Using Kernel Processes.......................................................................................................................... 8 Accessing User-Mode Data While in Kernel Mode.............................................................................. 11 Understanding Locking.........................................................................................................................12 Understanding Exception Handling..................................................................................................... 14 Using Kernel Extensions for 64–bit Processes....................................................................................18 64-bit Kernel Extension Programming Environment.......................................................................... 18 System Calls...............................................................................................................................................20 Differences Between a System Call and a User Function................................................................... 21 Understanding Protection Domains.....................................................................................................21 Understanding System Call Execution.................................................................................................22 Accessing Kernel Data While in a System Call.....................................................................................22 Passing Parameters to System Calls................................................................................................... 23 Preempting a System Call.................................................................................................................... 27 Handling Signals While in a System Call..............................................................................................27 Handling Exceptions While in a System Call........................................................................................29 Understanding Nesting and Kernel-Mode Use of System Calls.......................................................... 29 Page Faulting within System Calls....................................................................................................... 29 Returning Error Information from System Calls..................................................................................30 System Calls Available to Kernel Extensions.......................................................................................30 Virtual File Systems................................................................................................................................... 32 Logical File System Overview...............................................................................................................33 Virtual File System Overview............................................................................................................... 34 Understanding Data Structures and Header Files for Virtual File Systems........................................36 Configuring a Virtual File System......................................................................................................... 36 Kernel Services.......................................................................................................................................... 37 I/O Kernel Services...............................................................................................................................38 Block I/O Buffer Cache Kernel Services: Overview............................................................................. 49 Understanding Interrupts.................................................................................................................... 50 Understanding DMA Transfers............................................................................................................. 51 Kernel Extension and Device Driver Management Services................................................................60 Locking Kernel Services....................................................................................................................... 62 File Descriptor Management Services................................................................................................. 65 Logical File System Kernel Services.................................................................................................... 65 Programmed I/O (PIO) Kernel Services...............................................................................................67 Memory Kernel Services...................................................................................................................... 68 Understanding Virtual Memory Manager Interfaces...........................................................................72 Message Queue Kernel Services..........................................................................................................76 Network Kernel Services......................................................................................................................76 Process and Exception Management Kernel Services........................................................................ 78 iii RAS Kernel Services............................................................................................................................. 82 Security Kernel Services...................................................................................................................... 83 Timer and Time-of-Day Kernel Services..............................................................................................84 Using Fine Granularity Timer Services and Structures....................................................................... 85 Using Multiprocessor-Safe Timer Services..........................................................................................87 Virtual File System (VFS) Kernel Services........................................................................................... 88 Asynchronous I/O Subsystem................................................................................................................... 88 Understanding AIO...............................................................................................................................89 Functions of Asynchronous I/O............................................................................................................91 Asynchronous I/O Subroutines............................................................................................................93 Subroutines Affected by Asynchronous I/O........................................................................................ 93 64-bit Enhancements...........................................................................................................................93 LEGACY AIO Extended Functionality................................................................................................... 94 Device Configuration Subsystem...............................................................................................................96 Scope of Device Configuration Support............................................................................................... 97 Device Configuration Subsystem Overview......................................................................................... 97 General Structure of the Device Configuration Subsystem.................................................................98 Device Configuration