ISLab Flash Team Ch 3 KernelMode IO Processing
ISLab Flash Team Ch 3. Kernel-Mode I/O Processing. Windows 2000 Device
Contents 1. 커널모드의 코드 수행 2. 인터럽트 Priority 3. Deferred Procedure Calls(DPCs) 4. Access to User Buffers 5. Structure of a Kernel-Mode Driver 6. I/O Processing Sequence 7. Summary ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 2 Made By Povolon
How Kernel-Mode Code Executes • CPU Context – Trap or Exception Context • User mode -> Kernel Mode (System Call) • Direct I/O요청 시 I/O Manager의 Dispatch routine – Interrupt Context • Interrupt 발생시 – Kernel-Mode Thread Context • Device polling or Time out ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 3 Made By Povolon
Use of Interrupt Priorities by Windows 2000 • CPU Priority level – Interrupt Request Level (IRQL) • • Interrupt Processing Sequence 1. 2. 3. 4. • Priority를 정의하는 숫자 현재 명령의 수행 중지 상태정보 저장 현재 CPU의 IRQL을 요청된 IRQL값과 같게 함 적절한 Interrupt service routine 수행 Software-generated Interrupt ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 4 Made By Povolon
Deferred Procedure Calls (DPCs) • DPC의 동작 – 높은 IRQL작업을 지연 수행을 함 Schedules DPC Object DIRQL Interrupt Service Routine DPC 1 DPC 2 … DPC Software Interrupt 꺼내온 DPC객체 의 DPC Routine을 호출 System DPC Queue DPC 3 DPC객체 를 꺼내옴 DPC Dispatcher DPC Routine n … DPC Routine 2 DPC Routine 1 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 5 Made By Povolon
Deferred Procedure Calls (DPCs) • DPC의 특성 – 오직 한 개의 DPC객체의 인스턴스가 존재해야 함 • • DPC큐에 이미 존재하는 DPC객체를 중복으로 Schedule 불가 DPC요청에 대한 카운트를 유지 or 개별적인 큐의 구현 – Multiprocessor 상에서 작업의 동기화 • 병렬적인 processor의 interrupt routine ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 6 Made By Povolon
Access to User Buffers • Buffer Access Mechanisms – I/O manager에게 User buffer를 RAM에 복사 요청 (Buffered I/O) • RAM의 내용을 Write하거나 I/O를 통한 Read내용을 저장시킴 – Driver가 User buffer를 직접 접근 (Direct I/O) • I/O Manager : User buffer 에 Lock 을 설정함 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 7 Made By Povolon
Structure of a Kernel-Mode Driver • I/O Manager의 Driver routine 호출 시점 – Driver load – Driver Unload or System shutting sown – Device insert or remove – User-Mode에서의 I/O요청 (System Call) – 공유 hardware resource의 사용 가능 시점 – 실제 Device가 동작시 여러 상황 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 8 Made By Povolon
Structure of a Kernel-Mode Driver • Driver Initialization and Cleanup Routine – Driver Entry routine • Driver load시, 자원할당-조정-수락 – Reinitialize routine • 부팅 시 초기화가 불가능한 Driver의 초기화 – Unload routine • Driver의 동적 Unload – Shutdown routine • System 종료 – Bug-check Call-Back routine • System Crash발생시 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 9 Made By Povolon
Structure of a Kernel-Mode Driver • I/O System Service Dispatch Routine – I/O Manager가 I/O요청에 알맞은 Driver와 routine을 찾음 – Open and Close Operation • File – Device Operation • Device ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 10 Made By Povolon
Structure of a Kernel-Mode Driver • Data Transfer Routine – Start I/O routine • Device의 데이터 전송 – Interrupt Service Routine (ISR) • Interrupt 생성 – DPC routine • Device 동작의 완료 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 11 Made By Povolon
Structure of a Kernel-Mode Driver • Resource Synchronization Callback – 자원 공유시 동기화 (Kernel-Mode) – Controller Control routine • Controller Register 공유 – Adapter Control routine • DMA Hardware (DMAC) 공유 – Synchronize Critical Section routine • 공유 버퍼 or 자원 ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 12 Made By Povolon
Structure of a Kernel-Mode Driver • Other Driver Routine – Timer routine – I/O completion routine – Cancel I/O routine ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 13 Made By Povolon
I/O Processing Sequence I/O Request from User-Mode Preprocessing by I/O Manager Driver – Start I/O Device Start and Interrupt Service Win 32 Subsystem Driver - ISR I/O Manager IRP Passed Driver - DPC Postprocessing by the Driver Preprocessing by Device Driver. Dispatch I/O Manager Postprocessing by the I/O Manager ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 14 Made By Povolon
Summary • Windows 2000 의 Sub. System • Device Driver Architecture • I/O Processing Sequence ISLab Flash Team Ch 3. Kernel-Mode I/O Processing 15 Made By Povolon
- Slides: 15