vortragstitel stc 02. – 03. juni 2004 portierung von applikationen auf 64 bit windows mike becker,...

59
Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Portierung von Applikationen auf 64 Bit Windows Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft Services, Custom Development [email protected]

Upload: sieglinde-stram

Post on 05-Apr-2015

105 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portierung von Applikationen auf 64 Portierung von Applikationen auf 64 Bit WindowsBit Windows

Mike Becker, Microsoft Deutschland GmbH

Senior ConsultantMicrosoft Services, Custom Development

[email protected]

Page 2: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 3: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 4: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

64 Bit Hardware64 Bit Hardware

• CPU– Intel Itanium Architektur (IA64)

• Itanium 2 (1,5 GHz, 6MB L3C)• Montecito, Deerfield…

– Extended Architecture • AMD x86-64

– Athlon 64 (1,6 GHz, 1MB L2C)» Athlon 64 FX

– Opteron (1,4 – 2,2 GHz, 1MB L2C)– Athens, Egypt, San Diego, Toledo, Trinidad…

• Intel– Xeon, Prescott...

• Rechner– Dell, IBM, HP, Unisys, Angstrom Microsystems, NEC,

RackSaver, HPC Systems,…

Page 5: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Microsoft 64 Bit ProdukteMicrosoft 64 Bit Produkte

• Betriebssysteme– Microsoft Windows XP 64 Bit Edition– Microsoft Windows Server 2003 64 Bit

Editions (SP1)•Enterprise Edition•Datacenter

– Longhorn, …• WOW64 für Win32 Applikationen• Datenbank

– Microsoft SQL Server 2000 Enterprise Edition (64 Bit)

64-Bit Edition 64-Bit Edition Version 2003Version 2003

Page 6: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Microsoft Windows 64 und 32 Bit Microsoft Windows 64 und 32 Bit

Address Space 64-bit Windows32-bit Windows

Virtual Memory 16 TB 4GB

Paging File 512 TB 16TB

Paged Pool 128 GB 470 MB

Non-Paged Pool 128 GB 256 MB

System Cache 1 TB 1 GB

Page 7: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Unterstützt in 64 Bit WindowsUnterstützt in 64 Bit Windows

• Funktionalität und Produkteigenschaften– Installation– Internet Information Server, Clustering, Active Directory,

Terminal Server, etc.– Win32 Applikationen und Komponenten werden

unterstützt– Multilingual User Interface für deutsch, französisch,

spanisch, italienisch, japanisch and koreanisch

• OEM Pre-Installation Kit, WinPE• SDK (Software Development Kit)• DDK (Driver Development Kit)

Page 8: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Nicht unterstützt in 64 Bit WindowsNicht unterstützt in 64 Bit Windows

• Subsysteme: DOS, 16-Bit, POSIX, OS/2• .NET Framework, CLR, ASP.NET (ab 2.0 - Whidbey)• Windows Product Activation• Jet RED• Netmeeting, Windows Media Player, Windows Media

Server• Power Management • System Restore• Fax • Information: “Features unavailable on 64-bit

versions of the Windows Server 2003 family” (TechNet, ProdInfo)

http://www.microsoft.com/technet/prodtechnol/winxppro/reskit/prka_fea_tfiu.asphttp://www.microsoft.com/technet/prodtechnol/windowsserver2003/Default.asp

Page 9: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 10: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Gründe zur PortierungGründe zur Portierung

• Mehr Speicher– 4GB Grenze -> 16 TB Grenze

• Mehr Präzision– Fließkomma Kalkulationen

• Bessere Performanzwerte– Durch neue Prozessoreigenschaften

• VLIW, EPIC auf Itanium• x64 auf Extended Architecture• Intelligente Befehlausführung

• „High-End“ Rechner erreichen Massenmarkt• 64 Bit Softwarestrategie von Microsoft

– Synchrone Auslieferung von 32 und 64 Bit Versionen– Eine Codequelle für beide Plattformen

Page 11: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Kandidaten zur PortierungKandidaten zur Portierung

• CRM, ERP • Wissenschaftliche Anwendungen

mit Fließkommakalkulationen• Datenmodellierung• Systememulation• CAD• Ton-, Bild- und Videobearbeitung• “Data mining”-basierte Software

Page 12: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

PortierungswegePortierungswege

• Generelle Portierung– für monolytischen Anwendungen– für Anwendungen, wo alle Komponenten portiert

können (technisch und wirtschaftlich)

• Inkrementelle Portierung– Win32 und Win64 Komponenten arbeiten

zusammen: WOW64– Nicht alle Komponenten/Dienste sind verfügbar

für Win64– Quellcode verloren, Bibliotheken fehlen etc.

• Wichtig: ein Quellcodebasis für alle Plattformen!

Page 13: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 14: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Microsoft Windows SDK (32+64)Microsoft Windows SDK (32+64)

• Werkzeuge:– Compiler (C++)– Linker– Profiler– Debugger– Hilfswerkzeuge

• Bibliotheken– CRT, MFC, ATL

• Dokumentation– +Beispiele

• Entwicklungsumgebungen für alle unterstützte Plattformen:– Windows 2000, Windows XP, Windows Server 2003– Debug und Release, 32 und 64 Bit (außer Windows 2000)

http://www.microsoft.com/msdownload/platformsdk/sdkupdate/

Page 15: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Visual Studio 6.0Visual Studio 6.0

• C++ Unterstützung• SDK vorausgesetzt

– Zielplattform wählen– VS Integration– msdev.exe starten

• Beide Plattformen unterstützt:– Win32: Windows 2000, Windows XP, Windows

Server 2003– Win64 (WOW64): Windows XP 64 Bit Edition

2003, Windows Server 2003 64 Bit Editions

Page 16: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Visual Studio .NETVisual Studio .NET

• C++ Unterstützung• SDK vorausgesetzt

– Zielplattform wählen– Pfadanpassungen erforderlich– devenv.exe starten

• Nur auf Win32 Plattform– kann nicht auf Win64 installiert werden– erstellt Win32 und Win64 Komponenten

Page 17: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Whidbey (2004)Whidbey (2004)

• C++ Support• .NET Support

– .NET Framework 2.0 Voraussetzung• Beide Plattformen unterstützt

– Win32: Windows 2000, Windows XP, Windows Server 2003

– Win64 (native): Windows XP 64 Bit Edition 2003, Windows Server 2003 Editions

• Native und plattformunabhängige (.NET) Softwaremodule

Page 18: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Softwareentwicklung mit WhidbeySoftwareentwicklung mit Whidbey

Quellcode In MSIL kompilieren

AMD64

x86

IA64

Page 19: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

OS

API

Werkzeuge

DB

Windows XP, Windows Server 2003 64-bit editions

Windows API (Win32/Win64)

Platform SDK

SQL Server 2000 64-bit Edition

.NET Framework “Whidbey”

Visual Studio “Whidbey”

SQL Server “Yukon”

Aktuell “Whidbey”

64 Bit Zeitplan für Entwickler64 Bit Zeitplan für Entwickler

Visual Studio 6.0/.NET

.NET Framework 1.1

Page 20: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

64-bit Entwicklungsszenarien64-bit Entwicklungsszenarien

Entwicklungsumgebung Entwicklungs-plattform

Zielplattform

32-bit

IPF x64 IPF x64

Command Line

SDK

SDK SP1

Visual Studio 6 w/Service Pack 5

with SDK SP1

Visual Studio .NET 2003

with SDK SP1

SP3 + SDK SP1

Visual Studio .NET 2005 (future)

Supported Scenarios Unsupported

Page 21: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 22: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Datenmodell (1)Datenmodell (1)

• Win32: ILP32– 32 Bit: Integer, Long, Pointer (plus Derivate:

HANDLE, HMODULE etc.)

• Win64: LLP64– 64 Bit: LongLong, Pointer (plus Derivate:

HANDLE, HMODULE etc.)– 32 Bit: Integer, Long

• Neue Datentypen in Win64– fixed precision: DWORD32, INT64, …– pointer precision: DWORD_PTR, LONG_PTR,

…– specific pointer precision: POINTER_32,

POINTER_64

Page 23: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Datenmodell (2)Datenmodell (2)

• Einige Datentypen waren 32 Bit, jetzt 64 Bit LRESULT HANDLE LPARAM WPARAM

size_t intptr_t uintptr_t

• Neu sind SIZE VARIANT Typen INT_PTR (“an INT the size of a Pointer”) Also: UINT_PTR, DWORD_PTR, LONG_PTR

ULONG_PTR, etc.

• Tip: – Identifizieren Deklaration von Typen, die sich

geändert haben– Neudeklarieren als SIZE VARIANT

Page 24: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

KonstantenKonstanten

• Hexadezimale Konstanten– 0xFFFFFFFF ist nicht mehr -1– 0xFFFFFFFF ist nicht mehr

INVALID_HANDLE_VALUE– 0x80000000 ist keine Maske mehr für

Systemadressen

• #define – Compiler kann Typen nicht prüfen

• Bitoperationen, Bitmasken• Tip: const statt #define

Page 25: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Pointer (1)Pointer (1)

• DAS PROBLEM !• Win32 – 32 Bit, Win64 – 64 Bit

– plus Derivate: HANDLE, HMODULE, HWND, …• „Truncation“ Problembereich:

– Cast: int x;x = (int) &y;SendMessage ( a, b, wParam, (LONG) hWnd );

– Assignment: int iSize = cArray.GetSize(); // GetSize() liefert intptr_t

• Tip: – Alle Casts zwischen POINTER und INT, LONG

etc. – implizit oder explizit – entfernen– unions, structs überprüfen

Page 26: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Pointer (2)Pointer (2)

• Fixed byte offsets:int * pThree;struct { int iCount; int * iArray [ 6 ] } ptrS;pThree = (char*)ptrS + 16; // faktisch pTwo// Alignment!!!

• Sized offsets:pThree = ( char* ) ptrS.iArray + 3 * sizeof ( int );

• Tip: Immer sizeof(), offsetof() benutzen.

Page 27: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AlignmentAlignment

• CPU erwartet Daten „ausgerichtet“ im Speicher

• Win64: Ausrichtung auf 64 Bit Grenzen• Alternativ: „data packing“:

– Probleme mit Disk I/O, IPC, …

• _unaligned: macht Code langsam– ohne – Exception!!!

• Tips: – auf _unaligned und #pragma pack

verzichten– TYPE_ALIGNMENT(type) nutzen

Page 28: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Alignment BeispielAlignment Beispiel

4 8 12 16 20

4 8 12 16 20 24 28 32 36

paddingpadding

Win64

Win32

struct node { char *l; char s; struct tnode *prev; int i; struct node *next;}

Page 29: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Windows API (1)Windows API (1)

• Geringe Änderungen– Kompatibilität zu Win32

• Get/SetClassLongPtr() zusätzlich zu Get/SetClassLong()

• Get/SetWindowLongPtr() zusätzlich zu Get/SetWindowLong()

• Einige Konstanten wurden angepasst• Typen beachten: HWND ist nicht DWORD*• Tip: SIZE VARIANT verwenden:

– LONG -> LONG_PTR

Page 30: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Windows API (2)Windows API (2)

• Umgebungserkennung– IsWow64Process() – läuft Prozess in WOW64?– GetNativeSystemInfo() – welche Architektur hat

der Rechner:• 32 / 64 Bit• CPU Type: x86, IA64, AMD64, …• CPU Zusatzinfo: prozessor-spezifisch (Revision etc.)

• Ab Windows XP – GetProcAddress() benutzen

• Tip: Für Win32 Applikationen, die auf 32 Bit und (diversen) 64 Bit Plattformen laufen sollen

Page 31: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

InterProcess Communication (IPC)InterProcess Communication (IPC)

• Win32 und Win64 Code – nicht in einem Prozess!

• COM: 32 64: nur out-of-process– Win32 COM Objekte für Win64:

• Portieren auf Win64• COM+ OOP Applikationen

• Unterstützt: Sockets, SyncObjs*, Windows Messages*, Files, Shared Memory*– *Pointerkalkulationen beachten!

• Tip: Portierung oder OOP COM

Page 32: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Weitere PortierungsaspekteWeitere Portierungsaspekte

• #ifdef Win32– früher für Win16 Code Abgrenzung– #ifdef ALPHA für 64 Bit Code

• printf(…) Formatspezifikationen– %p - pointers, %x – 32 Bit– %I (polymorph) und %I64 (64 Bit)

• Inline Assembly Code• Alle Bibliotheken und Komponenten prüfen

– Win64 oder Win32, keine Mischung

• Dateisystem und Registrierungsdatenbank für Win32 unter WOW64– c:\windows\syswow64 als c:\windows\system32– HKLM\Software\Wow6432Node

Page 33: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

.NET auf Windows 64 Bit.NET auf Windows 64 Bit

• .NET Framework 2.0 (Whidbey)– aktuell Mai `04 Beta (MSDN)

• Plattform: ab Windows Server 2003 SP1• VisualStudio „Whidbey“

– 64 Bit – native– 32 Bit – in WOW64

• Assemblies markiert für „Bitness“– 32 Bit, 64 Bit (ia64 oder amd64), Neutral

(„portable code“)

• .NET Framework 1.1 ab VS.NET SP3 in WOW64

Page 34: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portable Managed CodePortable Managed Code

• Verifizierbar– Nur MSIL Code (kein native Code)– Keine Pointerkalkulationen

• Interop-Regeln– Signaturen, System.IntPtr,

StructLayoutAttribute, Marshal.SizeOf

• Architekturunabhängig: ia64, amd64• Keine Fließkommaoperationen• Bitoperationen vermeiden

Page 35: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 36: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Treiberportierung von 32 Bit auf 64 BitTreiberportierung von 32 Bit auf 64 Bit

• Windows 64 Bit - NUR 64 Bit Treiber !– IA64, AMD64 – architekturabhängig

• Microsoft Windows DDK • Treibermodel hat sich nicht geändert (W2K)• 64 Bit Treiber muss signiert werden• 64 Bit Treiber muss PnP sein• 64 Bit Treiber muss u.U. 32 Bit

Anwendungen unterstützen:– IOCTL / FSCTL– I/O Puffer enthält Pointer oder Derivate

• DriverVerifier geprüft

Page 37: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Treiberentwicklung für 64 BitTreiberentwicklung für 64 Bit

• Neue Datentypen (LLP64 Datenmodell)• Viele neue Funktionen

– DMA Zugriff (+ neue Konventionen)– IoIs32bitProcess(), …

• Alignment– wie in User-Level Anwendungen

• TYPE_ALIGNMENT()

– Kernel SPI: ProbeForRead(), ProbeForWrite()

• STATUS_DATATYPE_MISALIGNMENT

– Kernel Kernel, Kernel User (32/64)

Page 38: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 39: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portierung von UNIX auf Win64Portierung von UNIX auf Win64

• Schlüsselpunkte– Zugriffe auf OS Funktionen– Zugriffe auf OS Eigenschaften– Zugriffe auf Komponente von

Drittanbieter– Evtl. Abweichungen vom C++

Standard

Page 40: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

PortierungsbereichePortierungsbereiche

• Speichermodell– Unix32 -> ILP32, Unix64 -> LP64, Win64 ->

LLP64

• Prozesse und Threads– Unix –> Prozesse, Windows -> Threads

• System calls, APIs– Treiber, Signale, …

• GUI– Windows, .NET

• Makefiles– Projektaufbau, Komponenten, …

Page 41: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Weitere PortierungsaspekteWeitere Portierungsaspekte

• Semantik von Dateideskriptoren • Unterstützung für Peripheriegeräte• Pfadnamen: UNIX -> Windows • UNIX Namensgebung • UNIX ids vs. Windows SIDs • UNIX Fifo's • Abweichungen vom C++ Standard • UNIX Sicherheitsmodell • Interpretierung von Makros

Page 42: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 43: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

ProduktinformationProduktinformation

• Microsoft SQL Server 2000 64 Bit Edition– Enterprise Edition– 64-bit SQL Server,

64-bit SQL Server Agent, und 64-bit analysis server

• 64 Bit Datenmodell– Bis 18 Exabytes adressierbarer Speicher– Getestet mit 512 GB– Virtueller Speicher 8 TB

• Basiert auf SQL Server 2000 Quellcode

Page 44: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

PortierungsaspektePortierungsaspekte

• Aufwand minimal– Skripte werden weiterhin unterstützt – Extended Stored Procedures müssen neu

kompiliert werden:• 64-bit Compiler von Platform SDK

• Dateiformat ungeändert– Datenbank vom 32 Bit Server trennen (DETACH)– Dateien auf 64 Bit Server kopieren– Datenbank auf 64 Bit server einbinden

(ATTACH)

• Interoperabilität mit anderen SQL Server Installationen– Enterprise Manager ist Win32

Page 45: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Nicht vorhandene FunktionenNicht vorhandene Funktionen

• Migration von SQL Server 6.5 und 7.0• Remote Installation• English Query• Jet engine• Einige Module sind noch 32 Bit:

– EM, QA, DTS Designer, Wizards, Development Tools

– Man kann aber vom 32 Bit Client den 64 Bit Server verwalten

• Weitere– DBLib– ESQL– Alle Access-basierte Provider und Treiber

Page 46: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 47: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portierungsorganisation (1)Portierungsorganisation (1)

• „Single codebase“– Eine Codequelle für alle Plattformen

• Ablauf– 64 Bit Plattform kennen lernen– Projekt analysieren (was, wann und wie portiert

werden soll)– Quellcode überprüfen– (Teil)Projekt erstellen– Fehler und Warnungen beheben– Testen: beide Plattformen getrennt– Stabilisieren / Optimieren

Page 48: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portierungsorganisation (2)Portierungsorganisation (2)

x86 Rechnerx86 Rechner 64 Bit Rechner64 Bit Rechner

Entwicklung, erste TestsEntwicklung, erste Tests

Kompilieren für 32 Bit und Kompilieren für 32 Bit und 64 Bit64 Bit

Erstellte Projektkomponenten Erstellte Projektkomponenten auf 64 Bit Rechner übertragenauf 64 Bit Rechner übertragen

Projekt testenProjekt testen

Restliche Restliche FehlerbehebungFehlerbehebung

OptimierungOptimierung

Page 49: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Portierungsorganisation (3)Portierungsorganisation (3)

• Wichtige Projekteigenschaften:– Konfigurationen zum Erstellen– Umgebung Konfigurationen– Werkzeuge (mit Versionen!)– Argumente für Aufrufe von Werkzeugen– Anforderungen zum Starten von 64 Bit

Komponenten (+Abhängigkeiten) – Komponenten von Drittanbieter– Interaktionen mit 32 Bit Komponenten– Auf Warnungen von Compiler / Linker

achten!

Page 50: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

AgendaAgenda

•64 Bit Plattform

•Portierungsziele und -wege

•Entwicklungswerkzeuge

•Portierung von Win32 auf Win64

•Portierung von Treiber

•Portierung von UNIX auf Win64

•MS SQL Datenbankportierung

•Portierungsorganisation

•Softwareoptimierung

Page 51: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

SoftwareoptimierungSoftwareoptimierung

• Optimierung von portierten Komponenten und Projekten

• Quellcode– Konventionen, Checklisten– FxCop für .NET

• Compiler, Linker– neue Funktionen– LTCG (Link Time Code Generation)– PoGO (Profile Guided Optimization)

Page 52: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

OptimierungsschlüsselOptimierungsschlüssel

• Compiler– /Wp64 – 64 Bit Portierungswarnungen (!)– /O1 – Größeoptimierung– /O2 – Geschwindigkeitsoptimierung– /GL – Globale Optimierung

• Linker– /OPT:REF – Entfernen der nicht-referenzierten

Funktionen und Daten• inkl. /OPT:ICF

– /OPT:ICF – Zusammenführen von Funktionsduplikaten

Page 53: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Link Time Code GenerationLink Time Code Generation

• Wichtig für Projekte mir mehreren Modulen

• Compiler generiert IL in .obj-Datei – (kein .NET!)

• Link ruft Codegenerierung beim Linken auf

• Behält Daten womöglich in Registers• Optimierte Speichernutzung

Page 54: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Profile Guided OptimizationProfile Guided Optimization

• Ablauf– Code Instrumentieren– Kompilieren– Ausführen– Information sammeln– Neu kompilieren

• Iterativ• Optimiert:

– „switch“, „inline“, „block layout“, „dead blocks“

Page 55: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

PortierungswerkzeugePortierungswerkzeuge

• Microsoft– SDK, DDK, Debugger, VS6.0, VS.NET– .NET Fx, Whidbey, FxCop

• Intel– Compiler, Optimierungswerkzeuge

• AMD– Compiler, Optimierungswerkzeuge

• Compuware– DevPartner64: Treiberentwicklung

• Sysinternals– Filemon, Regmon

• OSR– Bibliotheken, Werkzeuge

Page 56: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Mehr InformationenMehr Informationen

• http://www.route64.net• http://www.microsoft.com/windowsserver2003/64bit• http://www.microsoft.com/net• http://www.gotdotnet.com• http://msdn.microsoft.com• http://www.intel.com/products/server/processors/• http://www.amd.com/us-en/Processors/

Page 57: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

FragenFragen

Vielen Dank für die Aufmerksamkeit!

Haben Sie noch Fragen?

Page 58: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

Wie geht es weiter auf der Wie geht es weiter auf der STC…?STC…?

Page 59: Vortragstitel STC 02. – 03. Juni 2004 Portierung von Applikationen auf 64 Bit Windows Mike Becker, Microsoft Deutschland GmbH Senior Consultant Microsoft

VortragstitelSTC 02. – 03. Juni 2004

© 2002, 2004 Microsoft Corporation. All rights reserved.© 2002, 2004 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.