ch 1. windows 2000 driver 개요
DESCRIPTION
Ch 1. Windows 2000 Driver 개요. 한국외국어대학교 정보통신공학과 2004.11.01 박성환 ( [email protected] ). Contents. 종합적인 System Architecture Kernel Mode I/O 구성요소 특별한 Driver Architecture Summary. 1. 종합적인 System Architecture. Windows 3.1. Windows 2000, XP, 2003. Windows 운영체제의 변화. Windows 9x. - PowerPoint PPT PresentationTRANSCRIPT
Database & Information System Laboratory Database & Information System Laboratory
Ch 1. Windows 2000 Driver Ch 1. Windows 2000 Driver 개요개요
한국외국어대학교 정보통신공학과2004.11.01
박성환 ([email protected])
DISLab DISLab
Made By Hackereyes
ContentsContents
1. 종합적인 System Architecture
2. Kernel Mode I/O 구성요소
3. 특별한 Driver Architecture
4. Summary
Database & Information System Laboratory Database & Information System Laboratory
1. 1. 종합적인 종합적인 System ArchitectureSystem Architecture
DISLab DISLab
Made By Hackereyes
Windows Windows 운영체제의 변화운영체제의 변화
운영환경 Driver 확장자 특 징
16 Bits .DRV .VxD 보호모드
32 bits(16 Bits 지원 )
.DRV, .VXD
.MPD, .PDR .WDM
16 bits 지원으로 불안
순수 32 Bits.WDM
( 그외 특수한 경우 )
Driver 방식통일
Windows 3.1
Windows 9x
Windows 2000, XP, 2003
DISLab DISLab
Made By Hackereyes
Windows 2000Windows 2000 의 설계 목표의 설계 목표
호환성호환성 견고성신뢰성
견고성신뢰성
이식성이식성 확장성확장성
성 능성 능
DISLab DISLab
Made By Hackereyes
실행 실행 ModeMode
• User mode– System 에 나쁜영향을 미칠 수 없는 user application code
• Trap (system call)– 실행중인 프로그램 내에 테스트를 위해 특별한 조건을 걸어 놓은 것
• Kernel mode– System 에 있는 모든 code
User Mode
Kernel ModeTrap
DISLab DISLab
Made By Hackereyes
호환성 호환성 & & 확장성확장성
• 호환성– Layer 구조를 통해 상호
의존적인 부분을 줄임 ( 추상화 )
• 확장성– 모듈화를 통해 다른
Layer 와 독립성을 유지한다 . ( 이식성 )
User ModeKernel Mode
I/O Manager
DeviceDriver
Executive
Kernel
HAL (Hardware Abstraction Layer)
Hardware Platform
Windows 2000 운영체제의 계층적 구조
DISLab DISLab
Made By Hackereyes
성능성능
• 모든 계층을 kernel mode 에서 수행 – kernel 내에서의 호출은 CALL 정도의 명령만 수반– HAL routine 을 사용해 , inline 함수 정도의 수행 속도
• 서로 다른 작업의 단위를 thread 로 병렬수행– Busy-waiting 을 최소화
• 주의 : device driver code 는 결코 block 되어서는 안됨
DISLab DISLab
Made By Hackereyes
ExcutiveExcutive
• System Service Interface• Object Manager• Configuration Manager• Process Manager• Virtual Memory Manager• Local Procedure Call• I/O Manager• Active Directory Service• Environment SubSystem• Win32 SubSystem• 필수 SubSystem
DISLab DISLab
Made By Hackereyes
System Service InterfaceSystem Service Interface
• User mode 에서 kernel mode 로의 전이– 단순한 CPU 명령어– 정교한 context switching
User Mode
SSI
Kernel Mode
DISLab DISLab
Made By Hackereyes
Object ManagerObject Manager
• Kernel 은 항상 object 단위로 관리– User mode 는 handle 을 통해서만 access 가능
User Mode
Handle
Kernel Mode
Mutex Thread Register file ProcessMemory
DISLab DISLab
Made By Hackereyes
Configuration ManagerConfiguration Manager
• Registry– Hardware 에 설치된 software 의 configuration value 를 저장하는
database
• Device driver 가 실행될 때 정보 제공
• Windows 2000 부터 제공하는 plug & play 등장으로 역할이 급격한 감소
DISLab DISLab
Made By Hackereyes
Process ManagerProcess Manager
• : Process– 소유단위– 각각의 주소공간 소유– 보안 식별자 소유 (security identity)
• : Thread– 실행단위– 각각 process 주소공간 내에 stack 소유
Process (Thread 소유 )
DISLab DISLab
Made By Hackereyes
Virtual Memory ManagerVirtual Memory Manager
• Process 별로 4G 의 virtual memory 공간을 소유함– Thread 는 4G 안에서 공유함
KernelCode
UserCode
2G
2G
… … …
KernelCode
UserCode
Process Process
32bits Addr
DISLab DISLab
Made By Hackereyes
Virtual Memory ManagerVirtual Memory Manager
KernelCode
2G
2G
DLL CodeCodeStackHeap…
Device Driver Code
DISLab DISLab
Made By Hackereyes
Virtual Memory ManagerVirtual Memory Manager
KernelCode
UserCode
2G
2G
Frame………………
Frame
128M
Page………………
Page
Page………………
Page
Page………………
Page
Kernel Page Table
Page Table
Virtaul MemoryPhysical Memory
DISLab DISLab
Made By Hackereyes
Local Procedure CallLocal Procedure Call
• Process 간에 호출 기법– Memory 공간이 다르기 때문에 보호를 받음
• Interprocess call 이라고도 함
• Device driver code 는 이를 이용하지 않음
DISLab DISLab
Made By Hackereyes
I/O ManagerI/O Manager
• User mode process 가 I/O 를 수행할 수 있게 추상화 시킨 kernel 의 code
• 목적 : User mode code 의 I/O 접근을 device 와 무관하게 동작
• IRP(I/O Request Packet) 을 통해 user mode 에서 kernel mode 로 요청
DISLab DISLab
Made By Hackereyes
I/O ManagerI/O Manager
• I/O manager 는 하나의 layer 역할을 함
User Mode Code
I/O Manager(IRP)
Kernel Mode Code
DISLab DISLab
Made By Hackereyes
Active Directory ServiceActive Directory Service
• Windows 2000 에서 새롭게 등장한 개념
• Network 전반에 걸친 namespace 를 제공– 자기의 directory 뿐만 아니라 network 상의 directory 를 관리– DNS 같은 directory object 까지도 관리 가능
• 보안에 주의해야 함
DISLab DISLab
Made By Hackereyes
Environment SubSystemEnvironment SubSystem
• Win32 SubSystem
• Virtual DOS Machine SubSystem– 32Bits 환경에서 16Bits 를 직접실행 시 신뢰성에 문제– 이를 중간에서 신뢰성을 보장해줌
• Windows On Windows SubSystem– 16 Bits Windows app 를 실행 시 개별적인 thread 공간 할당– 각 Thread 간의 정보 공유는 불가
• POSIX SubSystem– Unix style 의 API 제공을 위함이지만 , 제대로 동작하지 않음– 오히려 win32 style 로 바꾸어 실행
• OS/2 SubSystem– Intel 의 x86 버전만을 지원
DISLab DISLab
Made By Hackereyes
Win32 SubSystemWin32 SubSystem
• Windows 2000 의 native API – GUI (Graphical User Interface)
– Console I/O
– Win32 API
DISLab DISLab
Made By Hackereyes
Win32 SubSystemWin32 SubSystem
Win32Application
Win32SubSystem
Kernel Service(kernel32.dll Function)
User Mode
Kernel Mode
WindowsManager
(user32.dll function)
GDI(GDI32.dllFunction)
실행부 서비스
다른 실행부 구성 요소들
User 와 GDI 의 Kernel 구성 요소
Win32k.sys
DISLab DISLab
Made By Hackereyes
필수 필수 SubSystemSubSystem
• Security SubSystem
• Service Control Manager
• RPC Locator (Remote Procedure call)
Database & Information System Laboratory Database & Information System Laboratory
Kernel Mode I/O Kernel Mode I/O 구성 요소구성 요소
DISLab DISLab
Made By Hackereyes
I/O SubSystemI/O SubSystem 의 설계 목표의 설계 목표
• Platform 간의 호환성
• Sofeware 와 hardware 모두에게 관련된 설정성
• Preemption 과 interrupt 가 가능
• Multiprocessor 환경에서의 안전한 code
• Object 기반
• Packet 구동
• Asynchronous I/O 지원
DISLab DISLab
Made By Hackereyes
Windows 2000 DriverWindows 2000 Driver 의 종류의 종류
• 상위 Level driver : ex) FSD• 하위 Level driver : ex) Disk driver
Windows 2000Driver
User ModeDriver
Kernel ModeDriver
레거시Driver
WDMDriver
상위 LevelDriver
인터미디엇드라이버
하위 LevelDriver
상위 LevelDriver
인터미디엇드라이버
하위 LevelDriver
Database & Information System Laboratory Database & Information System Laboratory
특별한 특별한 Driver ArchitectureDriver Architecture
DISLab DISLab
Made By Hackereyes
특별한 특별한 Driver ArchitectureDriver Architecture
• Video Driver
• Print Driver
• MultiMedia Driver
• Network Driver
DISLab DISLab
Made By Hackereyes
Video DriverVideo Driver
• Graphic card 에 있는 graphic 가속기 유무– 이러한 hardware 를 지원해야만 함– 가속기가 없는 경우 또한 호환성을 유지해야 함
• Standard I/O architecture 는 I/O manager 와 직접 통신
• Video driver 는 GDI (Graphic Device Interface) 와 통신
• GDI– 화면에 선을 그리고 글자를 출력– Display driver 와 직접 통신 (DDI)
DISLab DISLab
Made By Hackereyes
Video Driver ArchitectureVideo Driver Architecture
Application
Video Adaptor
User Mode
Kernel Mode
GraphicsEngine(GDI)
I/O Manager
Video Port
Video Mini Port
DisplayDriver
NT
실행
부 DDI 호출
Eng호출
IRP 전송
VRP 전송
DISLab DISLab
Made By Hackereyes
Print DriverPrint Driver
• 실제 device 에 전송전에 spooling mechanism 을 거침• RPC 이 spooling 에 대한 처리를 함
Application
GDI
Winspool.drvClient
ServerWinspoolsv.drv
Winspoolss.drv
Print Provider
Job 을 File처리
Serialize 된 Job 을
전송
Job 에 대한Serialize
DISLab DISLab
Made By Hackereyes
MultiMedia DriverMultiMedia Driver
• Win2k 가 kernel streaming(KS) 을 지원– Function streaming– Filter streaming
• Application 은 마치 COM 처럼 kernel streaming 과 통신– Method , properties , event
• Kernel streaming 의 4 가지 object– Fliter object– Pin object– Clock object– Allocator object
• Windows 2000 은 stream.sys 를 제공하기에 multimedia device driver 를 작성하려면 Mini Driver 만을 작성함
DISLab DISLab
Made By Hackereyes
Network DriverNetwork Driver
• OSI (Open Systems Interconnection) model 을 따름– Transport layer 은 개별적인 protocol driver 에 의해 제공
NDISProtocol Driver
NDIS인터미디엇 Driver
NDISMini Port
Network Hardware(NIC)
NIC Driver 를 지원하는 Library
제공
Hardware 를 제어하기 위해
NDIS Lib 를 이용
DISLab DISLab
Made By Hackereyes
SummarySummary
• Windows 2000 은 application 을 위해 다양한 구조와 library 를 제공함
• Device driver 는 절대 kernel 영역에 변화를 주는 영향을 미쳐서는 안됨
• 호환성 , 견고성 & 신뢰성 , 이식성 , 확장성 , 성능을 고려해 device driver 를 작성해야 함
• Device driver 를 level 별로 잘 고려해서 구조를 잡아야 함