windows ce 6.0 architecture douglas boling president boling consulting inc. douglas boling...
TRANSCRIPT
Windows CE 6.0 ArchitectureWindows CE 6.0 Architecture
Douglas BolingPresidentBoling Consulting Inc.www.bolingconsulting.com
Douglas BolingPresidentBoling Consulting Inc.www.bolingconsulting.com
SpeakerSpeaker
Douglas Boling dbolingmedc @ bolingconsulting.com
Author – “Programming MicrosoftWindows CE 3rd Edition”
Trainer – Classes on Windows CE App DevelopmentWindows CE OAL Development
.NET Compact Framework
Consultant – Work with companies to help their Windows CE application and
platform development efforts
Douglas Boling dbolingmedc @ bolingconsulting.com
Author – “Programming MicrosoftWindows CE 3rd Edition”
Trainer – Classes on Windows CE App DevelopmentWindows CE OAL Development
.NET Compact Framework
Consultant – Work with companies to help their Windows CE application and
platform development efforts
AgendaAgenda
Overview - IntroductionWindows CE 6 Memory ModelNew FeaturesCompatibilityBSP Changes
Overview - IntroductionWindows CE 6 Memory ModelNew FeaturesCompatibilityBSP Changes
SP1 SP1 2.112.11
SP2 SP2 2.122.12
JamesonJameson 4.1 4.1
McKendricMcKendric 4.2 4.2
TomatinTomatin NMD FP NMD FP
Brief HistoryBrief HistoryWhat we’ve been doingWhat we’ve been doingBrief HistoryBrief HistoryWhat we’ve been doingWhat we’ve been doing
Pegasus/AlderPegasus/AlderWindows CE 1.0Windows CE 1.0
11/199611/1996
BirchBirch Windows CE 2.0Windows CE 2.0
11/199711/1997
Cedar Cedar Windows CE 3.0Windows CE 3.0
4/20004/2000
TaliskerTalisker Windows CE Windows CE
.NET 4.0.NET 4.01/20021/2002
MacallanMacallan Windows CE 5.0Windows CE 5.0
8/20048/2004
YamazakiYamazaki Windows CE 6Windows CE 6
H2/2006H2/2006
Windows CE LimitsWindows CE Limits
From Windows CE 1 to Windows CE 5, Windows CE has always had limits
32 processes at any one time
32 MB Virtual Memory per process
From Windows CE 1 to Windows CE 5, Windows CE has always had limits
32 processes at any one time
32 MB Virtual Memory per process
::::
Windows CE 5.0 Memory ModelWindows CE 5.0 Memory Model
Shared MemoryShared Memory
KernelKernel
32 Slots for 32 Slots for ProcessesProcesses
SingleSingle2 GB VM2 GB VM
for allfor allProcessesProcesses
Execution Slot and Execution Slot and
Shared DLL SlotShared DLL SlotSlot 0 – ExecutionSlot 0 – ExecutionSlot 1 – ROM DLLsSlot 1 – ROM DLLs
Slot 2 – FileSys.exeSlot 2 – FileSys.exeSlot 3 – Device.exeSlot 3 – Device.exeSlot 4 – GWES.exeSlot 4 – GWES.exe
Slot 5 – Services.exeSlot 5 – Services.exe
Slot 31Slot 31Slot 32Slot 32
Slot 6 – Explorer.exeSlot 6 – Explorer.exe
2 GB2 GBKernelKernelSpaceSpace
Slot 7Slot 7
Windows CE 5.0 Memory ModelWindows CE 5.0 Memory Model
Virtual Memory Map2 GB for Kernel
Single 2 GB mapping for all processesDivided up into 32 MB “slots”
32 Process LimitEach process has one 32 MB slot
32 slots for processes
Shared memoryUpper half of user space is shared memory
Read / Write by all processes
Virtual Memory Map2 GB for Kernel
Single 2 GB mapping for all processesDivided up into 32 MB “slots”
32 Process LimitEach process has one 32 MB slot
32 slots for processes
Shared memoryUpper half of user space is shared memory
Read / Write by all processes
Windows CE 6.0 Memory ModelWindows CE 6.0 Memory Model
32 KProcess
2 GB2 GBperper
ProcessProcess
2 GBKernelSpace
Windows CE Memory ModelWindows CE Memory Model
Process CodeProcess CodeUser VMUser VM
KernelKernelFilesystemFilesystem
GWESGWESDriversDrivers
. . .
. . .
Introducing the New KernelIntroducing the New Kernel
2 GB of Virtual Memory per process
32,000 processes
Unified KernelCritical OS components moved into kernel space
Improved system performance
Increased security and robustness
High degree of backwards compatibility
2 GB of Virtual Memory per process
32,000 processes
Unified KernelCritical OS components moved into kernel space
Improved system performance
Increased security and robustness
High degree of backwards compatibility
Application Virtual Memory SpaceApplication Virtual Memory Space
Shared User DLLsShared User DLLs512 MB512 MB
RAM Backed RAM Backed MapfilesMapfiles256 MB256 MB
Shared System Shared System HeapHeap
255 MB255 MB
Process spaceProcess space1 GB per 1 GB per processprocess
User Space 2 Gigabytes
Each process has its own mapping
R/W for OS componentsRead only for user process
RAM Backed MapfilesMapped at fixed location for better
backwards compatibility
All DLLs – code and dataSame mapping across all processes
Data pages are unique physical pagesCode pages are shared
Executable code and dataVM Allocation
File Back Mapfiles
0x00000000
0x40000000
0x80000000
0x80000000
Kernel Virtual Memory SpaceKernel Virtual Memory Space
Kernel Space2 Gigabytes
Fixed mapping independent of
user space
0xFFFFFFFF
All XIP DLLs in kernel
Cached access to physical memory
Uncached access to physical memory
Ram file system & ram registry
Kernel Virtual MemoryShared by all kernelServers and drivers
System Trap AreaCPU Specific VMCPU Specific VM
Kernel VMKernel VM256 / 512 MB256 / 512 MB
Object Store (128MB)Object Store (128MB)
Kernel XIP DLLs (128 MB)Kernel XIP DLLs (128 MB)
Static Mapped Static Mapped UncachedUncached512 MB512 MB
Static Mapped Static Mapped CachedCached512 MB512 MB
New OS LayoutNew OS Layout
Moving critical drivers, file system, and graphical window manager into the kernel
Kernel version of Coredll.dll Same APIs without the thunks
BenefitGreatly reduces the overhead of system calls between these components
Reduces overhead of all calls from user space to kernel space
Increase code sharing between base OS services
Moving critical drivers, file system, and graphical window manager into the kernel
Kernel version of Coredll.dll Same APIs without the thunks
BenefitGreatly reduces the overhead of system calls between these components
Reduces overhead of all calls from user space to kernel space
Increase code sharing between base OS services
New OS LayoutNew OS Layout
OAL.DLLFILESYS NETWORK
DEVICE.DLLKERNEL.DLL
Applications
SHELL
Drivers
Hardware
Boot Loader
COREDLL / WINSOCK / COMMCTRL / WININET / COMMDLG
KernelSpace
UserSpace
KCOREDLL.DLL
ServicesServicesServicesUser Mode
Drivers
GWES
SERVICES.EXE ServicesServicesServicesServices UDEVICE.EXE
OAL (NK.EXE)
Performance & SizePerformance & Size
Improvements expected in process switching
Same performance Thread Switching
Memory Allocation
System Calls
Some slow down with interprocess callsNow involves data marshalling
Size increase is less then 5%
Improvements expected in process switching
Same performance Thread Switching
Memory Allocation
System Calls
Some slow down with interprocess callsNow involves data marshalling
Size increase is less then 5%
Windows CE 5.0 System CallsWindows CE 5.0 System Calls
Application makes callPSL jump
Kernel Validates parametersMaps Service into Slot 0
Possible Cache FlushCalls into to the service
Service Runs Returns to Kernel
KernelMaps App into Slot 0
Possible cache flushReturns to App
Application makes callPSL jump
Kernel Validates parametersMaps Service into Slot 0
Possible Cache FlushCalls into to the service
Service Runs Returns to Kernel
KernelMaps App into Slot 0
Possible cache flushReturns to App
ApplicatioApplicationn
ServiceService(FileSys)(FileSys)(Device)(Device)(GWES)(GWES)
Kernel
Windows CE 6.0 Beta System CallsWindows CE 6.0 Beta System Calls
Application makes callSame call to coredll.dll
App stays mapped during the call
Kernel Validates parameters
Calls into to the service
Service Runs
Returns directly to the app
Application makes callSame call to coredll.dll
App stays mapped during the call
Kernel Validates parameters
Calls into to the service
Service Runs
Returns directly to the app
ApplicationApplication
ServiceServiceKernelKernel
New FeaturesNew Features
New FeaturesNew Features
New Security Model“Trust / Run / No Load” model gone
New: “Trust / No Load”
Prepares operating system for ACL securityWindows XP-like Access Control List security to be implemented in the future
New Security Model“Trust / Run / No Load” model gone
New: “Trust / No Load”
Prepares operating system for ACL securityWindows XP-like Access Control List security to be implemented in the future
New FeaturesNew Features
New File SystemsExFAT
Large file support
Large volume support
UDFS 2.5 read only support
Large Memory Mapped File SupportSupport for mapping views into very large files
Up to 64-bit files
Big benefit for in car navigation and multimedia
New File SystemsExFAT
Large file support
Large volume support
UDFS 2.5 read only support
Large Memory Mapped File SupportSupport for mapping views into very large files
Up to 64-bit files
Big benefit for in car navigation and multimedia
New FeaturesNew FeaturesNew FeaturesNew Features
New driver supportNew driver supportUSB On-the-go (OTG)USB On-the-go (OTG)
New USB Function / Host class driversNew USB Function / Host class drivers
Enhanced VoIP supportEnhanced VoIP supportVoIP support over wired and WLAN networks
Full-featured phone application
Updated SIP signaling and Media stack (RTC 1.5)
New driver supportNew driver supportUSB On-the-go (OTG)USB On-the-go (OTG)
New USB Function / Host class driversNew USB Function / Host class drivers
Enhanced VoIP supportEnhanced VoIP supportVoIP support over wired and WLAN networks
Full-featured phone application
Updated SIP signaling and Media stack (RTC 1.5)
New FeaturesNew Features
WWireless LAN enhancementsireless LAN enhancementsMultiple radio support and faster AP-AP roamingMultiple radio support and faster AP-AP roaming
Added 802.11i support for WPA2 complianceAdded 802.11i support for WPA2 compliance
Added 802.11e support for QoSAdded 802.11e support for QoS
Bluetooth enhancements Bluetooth enhancements BT protocol stack performance optimizationsBT protocol stack performance optimizations
Enhanced BT profiles: A2DP, AVRCPEnhanced BT profiles: A2DP, AVRCP
WWireless LAN enhancementsireless LAN enhancementsMultiple radio support and faster AP-AP roamingMultiple radio support and faster AP-AP roaming
Added 802.11i support for WPA2 complianceAdded 802.11i support for WPA2 compliance
Added 802.11e support for QoSAdded 802.11e support for QoS
Bluetooth enhancements Bluetooth enhancements BT protocol stack performance optimizationsBT protocol stack performance optimizations
Enhanced BT profiles: A2DP, AVRCPEnhanced BT profiles: A2DP, AVRCP
CompatibilityCompatibility
Compatibility Compatibility
Binary compatibility for applications is the key goal
Well behaved applications will work w/ little/no changes
Compatibility maintained through CoreDLL Minimize impact on Win32 APIsChanges hidden in API libraries
Apps using undocumented techniques… Will likely have to be modifiedSuch as passing handles or pointers between processes
Main changes will be in drivers and servicesSome drivers will migrate with little work
Binary compatibility for applications is the key goal
Well behaved applications will work w/ little/no changes
Compatibility maintained through CoreDLL Minimize impact on Win32 APIsChanges hidden in API libraries
Apps using undocumented techniques… Will likely have to be modifiedSuch as passing handles or pointers between processes
Main changes will be in drivers and servicesSome drivers will migrate with little work
Application Porting Test CasesApplication Porting Test Cases
WM 5.0 ported to Windows CE 6.0 Beta
Running Windows CE 5.0 commercial applications on Windows CE 6.0 Beta
WM 5.0 ported to Windows CE 6.0 Beta
Running Windows CE 5.0 commercial applications on Windows CE 6.0 Beta
Compatibility TesterCompatibility Tester
Identifies removed / deprecated / changed APIs
Supports both static and runtime analysis
Produces a detail report of any issues it finds
Includes documentation and suggestions
We will release it before Windows CE 6.0 RTM
Will allow customers to prepare ahead of time
Identifies removed / deprecated / changed APIs
Supports both static and runtime analysis
Produces a detail report of any issues it finds
Includes documentation and suggestions
We will release it before Windows CE 6.0 RTM
Will allow customers to prepare ahead of time
BSP ChangesBSP Changes
Family BSP KernelWill be in the beta release
(Yes/No)
ARM
Intel Mainstone III (C-Step)
ARMv4i Yes
Plato VoIP Reference Platform
ARMv4i Yes
Device Emulator ARMv4i Yes
Aruba Board ARMv4i No
TI OMAP 2420 ARMv6 Yes
MIPSNEC Rockhopper SG2 Vr5500
MIPSII & II_PF, MIPSIV & IV_FP
Yes
SH4Hitachi/Renesas Aspen
SH4 Yes
x86 x86 (CEPC) X86 Yes
Windows CE 6 Beta BSPsWindows CE 6 Beta BSPs
CodeCode TitleTitle SpeakersSpeakers
EMB321EMB321Porting a Windows CE 5.0 BSP to the next release Porting a Windows CE 5.0 BSP to the next release of Windows CEof Windows CE
Travis Hobrla; Travis Hobrla; Don WeberDon Weber
EMB308EMB308 Windows CE Secure Boot LoaderWindows CE Secure Boot Loader Steve Maillet; Steve Maillet; Glen LangerGlen Langer
OAL ChangesOAL Changes
OAL split from kernelBecomes “NK.EXE”
Kernel code becomes “Kernel.DLL”
Enables separate updates
Overall OAL structure remains the sameSame OEM functions
OAL / kernel interface through shared structures
OAL split from kernelBecomes “NK.EXE”
Kernel code becomes “Kernel.DLL”
Enables separate updates
Overall OAL structure remains the sameSame OEM functions
OAL / kernel interface through shared structures
Windows CE 5.0 OAL DesignWindows CE 5.0 OAL DesignWindows CE 5.0 OAL DesignWindows CE 5.0 OAL Design
KernelKernel
OALOAL
HardwareHardwareRTCRTC
Cach
e
Cach
e
libra
rylib
rary
Inte
rrup
t In
terru
pt
libra
rylib
rary
IOC
TL
IOC
TL
libra
rylib
rary
Sta
rtup
S
tartu
p
libra
rylib
rary
RTC
RTC
libra
rylib
rary
KIT
LK
ITL
libra
rylib
rary
OS
Tim
er
OS
Tim
er
libra
rylib
rary
TimersTimers CachesCaches SerialSerialportport
EthernetEthernetportport
USBUSBportport
kernel.dllkernel.dll
oal.exeoal.exe
RTCRTCC
ach
e
Cach
e
libra
rylib
rary
Inte
rrup
t In
terru
pt
libra
rylib
rary
IOC
TL
IOC
TL
libra
rylib
rary
Sta
rtup
S
tartu
p
libra
rylib
rary
RTC
RTC
libra
rylib
rary
kitl.dllkitl.dllOS
Tim
er
OS
Tim
er
libra
rylib
rary
TimersTimers CachesCaches SerialSerialportport
EthernetEthernetportport
USBUSBportportHardwareHardware
NKGLOBALNKGLOBAL
KITL IOCTLKITL IOCTL
Windows CE 6.0 OAL DesignWindows CE 6.0 OAL DesignWindows CE 6.0 OAL DesignWindows CE 6.0 OAL Design
OEMGLOBALOEMGLOBALNKStub.lNKStub.libib
(nk.exe)(nk.exe)
DriversDrivers
Two types of drivers will be supportedKernel Mode for performance
User Mode for robustness
The overall structure of the drivers remains
Main changes are in how the drivers access client memory
Drivers are still DLLs
Same Stream interface
Two types of drivers will be supportedKernel Mode for performance
User Mode for robustness
The overall structure of the drivers remains
Main changes are in how the drivers access client memory
Drivers are still DLLs
Same Stream interface
Kernel Mode DriversKernel Mode Drivers
Operate in kernel’s address spaceCalls to operating system functions very fast
ISRs and ISTs operate in the same process space
Thunking layer available for user interface services
Drivers needing the best performance should be kernel mode
Such as those with lots of quick API calls
Operate in kernel’s address spaceCalls to operating system functions very fast
ISRs and ISTs operate in the same process space
Thunking layer available for user interface services
Drivers needing the best performance should be kernel mode
Such as those with lots of quick API calls
User Mode DriversUser Mode Drivers
Loaded by udevices.exeNo access to kernel structures or memory
Same API support as applications
Examples:Expansion buses like USB and SDIO
Drivers where performance is not a factor should consider moving to user mode
Called less often and do more work
Loaded by udevices.exeNo access to kernel structures or memory
Same API support as applications
Examples:Expansion buses like USB and SDIO
Drivers where performance is not a factor should consider moving to user mode
Called less often and do more work
Porting Drivers to the New Windows CE OSPorting Drivers to the New Windows CE OS
Most drivers become kernel mode drivers Driver writers must focus on security and stability
Maximum backward-compatibility is maintained
Though, some driver modifications are required
Deprecated APIs
Asynchronous buffer access
User Interface Handling
Most drivers become kernel mode drivers Driver writers must focus on security and stability
Maximum backward-compatibility is maintained
Though, some driver modifications are required
Deprecated APIs
Asynchronous buffer access
User Interface Handling
Caller Process Mapping (5.0)Caller Process Mapping (5.0)
Slot 31 CloneSlot 31 Clone
Slot 2Slot 2
Slot 3Slot 3
.
.
.
0000 00000200 00000400 0000
0600 0000
3E00 0000
4000 00004200 0000
FileSys
Device Mgr
Slot 32Slot 32
Application (Slot Application (Slot 31)31)
Slot 3 CloneSlot 3 Clone
Slot 2Slot 2
Slot 3Slot 3
.
.
.
FileSys
Device Mgr
Slot 32Slot 32
Slot 31Slot 31
At call to DeviceIoControl When DeviceIoControl processed
Caller Process Mapping (6.0)Caller Process Mapping (6.0)
Application
Kernel
Application
Kernel
KernelDrivers
KernelDrivers
Before Call During Call
Applicationspace visibleto application
ApplicationSpace visible
to driver
Kernelspace visible
to driver
Kernelspace hidden
from application
Handling CallsHandling Calls
App memory already mapped correctlyCan access it without re-mapping pointers
Marshalling Helper LibraryProvides APIs for handling user data
Deprecated APIs:SetProcPermissions, MapPtrToProcess, MapCallerPointer, …
App memory already mapped correctlyCan access it without re-mapping pointers
Marshalling Helper LibraryProvides APIs for handling user data
Deprecated APIs:SetProcPermissions, MapPtrToProcess, MapCallerPointer, …
Driver Pointer SafetyDriver Pointer Safety
OS checks buffers referenced by caller parameters
Buffers are accessed checked
Embedded pointers are valid but not access checked
Safe drivers should use CeMapCallerPointer / CeCloseCallerBuffer
Paranoid drivers should force duplication of buffer
OS checks buffers referenced by caller parameters
Buffers are accessed checked
Embedded pointers are valid but not access checked
Safe drivers should use CeMapCallerPointer / CeCloseCallerBuffer
Paranoid drivers should force duplication of buffer
Asynchronous AccessAsynchronous Access
Windows CE 6 forces new treatment of asynchronous access from driver to application
Old: SetProcPermissions to change thread access rights
New: CeAllocAsynchronousBuffer / CeFreeAsynchronousBuffer to marshal data
Windows CE 6 forces new treatment of asynchronous access from driver to application
Old: SetProcPermissions to change thread access rights
New: CeAllocAsynchronousBuffer / CeFreeAsynchronousBuffer to marshal data
SummarySummary
Great new architectureRemoves the old limits
Performance expected as good as current
Memory footprint similar
OAL / Driver porting fairly straightforward
Great new architectureRemoves the old limits
Performance expected as good as current
Memory footprint similar
OAL / Driver porting fairly straightforward
QuestionsQuestions
dbolingmedc @ bolingconsulting.comdbolingmedc @ bolingconsulting.com
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.