1 / 43

Drivers and Kernel-Mode Objects: Understanding Win2K Architecture

This article explains the architecture of Windows 2000, focusing on drivers and kernel-mode objects such as I/O request packets (IRPs) and driver objects. It covers topics such as the layers of Win2K, IRP processing, and manipulating IRPs and device objects.

Download Presentation

Drivers and Kernel-Mode Objects: Understanding Win2K Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ch 4. Drivers and Kernel-Mode Objects

  2. Contents • Data Objects and Windows 2000 • I/O Request Packets (IRPs) • Objects of Kernel-Mode • Summary Ch 4. Drivers and Kernel-Mode Objects

  3. 1. Data Objects and Windows 2000

  4. Data Objects and Windows 2000 • Object-Oriented Programming 기반의 Win2K • 객체(Object) 단위 • 운영체제는 객체(Object) 단위로 관리 • 캡슐화, 은닉화, 추상화, 재사용성, 신뢰성, 견고함 제공 User mode Handle Kernel mode … Driver Object Device Object Controller Object Adapter Object Interrupt Object Object manager Figure 1.1 Object-Oriented Programming 기반의 Win2K Ch 4. Drivers and Kernel-Mode Objects

  5. Windows 2000 Objects and Win32 Objects • User-mode 객체 / 실제 OS내부 객체 • User-mode 객체 : 커널 객체를 Handle로 간접적으로 참조 • Kernel 객체 : External Name을 가지지 않음 메모리 Pointer를 직접 이용 Ch 4. Drivers and Kernel-Mode Objects

  6. The Layers of Win2K Operating System Applications Win32 API calls Win32 Subsystem User mode System service interface Handle Kernel mode I/O Manager Execution Object Manager IRP IRP Device Driver IRP passed to driver dispatch routine Kernel IRP Object IRP HAL calls Hardware Abstraction Layer Platform-specific operations Hardware Figure 1.2 Win2K의 계층적 시스템 구조 Ch 4. Drivers and Kernel-Mode Objects

  7. 2. I/O Request Packet (IRPs)

  8. I/O Request Packets (IRPs) • Win2K에서 패킷 구동 방식으로 I/O요청을 처리 • I/O 서브시스템의 설계목표 중 하나 • IRP는 I/O system이 I/O요청에서 필요한 정보를 저장하는 장소 Ch 4. Drivers and Kernel-Mode Objects

  9. Simplified Model of IRP Processing User Space Request 완료 후, IRP 최종 상태 리턴 I/O Request I/O Manager nonpaged 시스템 메모리 IRP IRP 할당 DEVICE 디바이스 동작 IRP 전달 DpcForIsr IRP 최종 상태 저장 디바이스 동작 완료 Interrupt Figure 2.1 IRP Processing Simple Model Ch 4. Drivers and Kernel-Mode Objects

  10. Layout of an IRP • IRP Header • I/O Stack Locations Figure 2.2 Structure of an IRP Ch 4. Drivers and Kernel-Mode Objects

  11. IRP Header • IRP Header Table 2.1Externally Visible Fields of an IRP Header Ch 4. Drivers and Kernel-Mode Objects

  12. I/O Stack Locations(1) • I/O Stack Locations Table 2.2.1 Selected Contents of IRP Stack Location Ch 4. Drivers and Kernel-Mode Objects

  13. I/O Stack Locations(2) • I/O Stack Locations Table 2.2.2 Selected Contents of IRP Stack Location Ch 4. Drivers and Kernel-Mode Objects

  14. Manipulating IRPs • IRPs as a whole • IRP Stack Locations Ch 4. Drivers and Kernel-Mode Objects

  15. IRPs as a whole • IRPs as a whole Table 2.3 Functions that Work with the Whole IRP Ch 4. Drivers and Kernel-Mode Objects

  16. IRP Stack Locations • IRP Stack Locations Table 2.4 IO_STACK_LOCATION Access Functions Ch 4. Drivers and Kernel-Mode Objects

  17. 3. Objects of Kernel-Mode

  18. Driver Objects • Driver Object :Driver의 여러 함수들에 대한 포인터를 갖는 목록 • I/O Manager는 Driver의 함수들을 찾을 필요가 있을 때 특정 Device와 관련되는 Driver Object를 이용한다. Ch 4. Drivers and Kernel-Mode Objects

  19. The Life of Driver Objects I/O Manager Call DriverEntry Drivers Driver Object Drivers Drivers Load Create object Driver Object의 역할 DEVICE Driver Object 동작 IRP I/O Manager Dispatch Routine (*) call Figure 3.1 The life of deriver object Ch 4. Drivers and Kernel-Mode Objects

  20. Layout of a Driver Object(1) Figure 3.2 The driver object Ch 4. Drivers and Kernel-Mode Objects

  21. Layout of a Driver Object(2) Table 3.1 Externally Visible Fields of a Driver Object Ch 4. Drivers and Kernel-Mode Objects

  22. Device Objects and Device Extensions • Device Object : 디바이스의 특성과 상태에 대한 정보를 유지 Driver Object Device Object HAL Physical DEVICE Virtual DEVICE Figure 4.1 The device object and driver object Ch 4. Drivers and Kernel-Mode Objects

  23. The Life of Device Objects I/O Manager I/O Request Packet I/O Manager Call DriverEntry Device Object DEVICE Driver Object Device Object WDM Driver AddDevice Plug and Play (*) (*) Create object HAL DEVICE Dispatch Routine (a) (b) Figure 4.2 The life of device objects Ch 4. Drivers and Kernel-Mode Objects

  24. Layout of a Device Object(1) Figure 4.3 The device object Ch 4. Drivers and Kernel-Mode Objects

  25. Layout of a Device Object(2) Table 4.1 Externally Visible Fields of a Device Object Ch 4. Drivers and Kernel-Mode Objects

  26. Manipulating Device Objects Table 4.2 Access Functions for a Device Object Ch 4. Drivers and Kernel-Mode Objects

  27. Device Extensions • Device Object에 대한 Back Pointer • Device의 상태나 Driver Context 정보 • Interrupt Object와 Interrupt 예상 플래그에 대한 Pointer • Controller Object에 대한 포인터 • Adapter Object와 Mapping 레지스터들의 카운터에 대한 Pointer ※ Device Extensions은 Driver 전용이므로, Extension의 구조체는 Driver의 헤더 파일 상에 정의 Table 4.3 Device Extension Ch 4. Drivers and Kernel-Mode Objects

  28. Controller Objects and Controller Extensions • Driver가 하나 이상의 Device들에 병렬적인 작업 수행에 있어서 공유된 레지스터 공간의 동기화 문제를 해결하기 위한 객체 • Controller Object는 한번에 하나의 디바이스를 소유하는 Mutex를 유지해야 함. Driver Object1 소유권 요청 I/O Manager Device Object1 Controller Object Driver Object2 Block Device Object2 Figure 5.1 The outline of controller object Ch 4. Drivers and Kernel-Mode Objects

  29. The Life of Controller Objects Driver Object Driver Object DriverEntry (or AddDevice) DriverEntry (or AddDevice) Device Object Device Object unload ControllerControl Device Ext. Device Ext. Controller Object Start I/O 소유권 요청 Block DpcForIsr Figure 5.2 The life of controller objects Ch 4. Drivers and Kernel-Mode Objects

  30. Layout of a Controller Object Figure 5.3 The controller object Ch 4. Drivers and Kernel-Mode Objects

  31. Manipulating Controller Objects Table 5.1 Access Functions fro a Controller Object Ch 4. Drivers and Kernel-Mode Objects

  32. Controller Extensions • Interrupt와 Adapter Object의 객체에 대한 포인터 ※ ControllerExtensions은 Driver 전용이므로, Extension의 구조체는 Driver의 헤더 파일 상에 정의 Table 5.2 Controller extension Ch 4. Drivers and Kernel-Mode Objects

  33. Adapter Objects • I/O Manager는 Adapter Object를 이용하여 DMA 하드웨어에 대한 디바이스간의 분쟁을 막는다. • 만약 Device가 Programmed I/O만을 지원하면 Adapter Object는 필요 없다. • Mapping 레지스터를 관리 Ch 4. Drivers and Kernel-Mode Objects

  34. The Life of Adapter Objects Memory Device or Controller Extension Adapter Object DMA Channel DriverEntry (or AddDevice) I/O Manager Address Mapping HAL DMA DEVICE Figure 6.1 The life of adapter object Ch 4. Drivers and Kernel-Mode Objects

  35. Layout of an Adapter Object Figure 6.2 The adapter object Ch 4. Drivers and Kernel-Mode Objects

  36. Manipulating Adapter Objects Table 6.1 Access Functions fro a Adapter Object Ch 4. Drivers and Kernel-Mode Objects

  37. Interrupt Objects • Kernel Interrupt Dispatcher에게 Interrupt 발생시 정확한 Service Routine을 찾을 수 있는 방법을 제공 Kernel Interrupt Dispatcher Interrupt Interrupt Object Interrupt Routine Figure 7.1 The outline of interrupt object Ch 4. Drivers and Kernel-Mode Objects

  38. The Life of Interrupt Objects DriverEntry or AddDevice Kernel Interrupt Dispatcher Interrupt Interrupt Object Interrupt Routine Unload or RemoveDevice Figure 7.2 The life of interrupt object Ch 4. Drivers and Kernel-Mode Objects

  39. Layout of an Interrupt Object Figure 7.2 The Interrupt object Ch 4. Drivers and Kernel-Mode Objects

  40. Manipulating Interrupt Objects Table 7.1 Access Functions fro a Interrupt Object Ch 4. Drivers and Kernel-Mode Objects

  41. 종합적인 Device의 I/O 과정 User-mode Handle I/O Request Kernel-mode I/O Manager Object Manager Memory I/O Request Packet(IRPs) Device Driver Driver Object DriverEntry Start I/O DMA Channel Dev Object Dev Extension Controller Object Controller Extension Adapter Object Interrupt Object DriverEntry or AddDevice HAL Hardware Abstraction Layer Set or PnP Hardware Device Ch 4. Drivers and Kernel-Mode Objects

  42. 4. Summary

  43. Summary • OOP 기반의 Win2K • Win2K 의 I/O에서의 Packet(IRPs) 구동 방식 • I/O Manager는 Device의 대부분의 일이 I/O인 만큼 중요하다. • I/O Manager는 I/O를 하기 위한 객체를 관리한다. Ch 4. Drivers and Kernel-Mode Objects

More Related