Apple Darwin Bedienungsanleitung

Stöbern Sie online oder laden Sie Bedienungsanleitung nach Server Apple Darwin herunter. Apple`s 64-Bit Transition Guide Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken

Inhaltsverzeichnis

Seite 1 - 64-Bit Transition Guide

64-Bit Transition Guide

Seite 2 - Contents

“Huge” Data ObjectsIf your application may need random access to exceptionally large (>2GB) data sets, it is easier to support thesedata sets in a

Seite 3 - Performance Optimization 54

As a special exception, the System Preferences application provides a 32-bit fallback mode. If the user selectsa system preferences pane without a 64-

Seite 4 - Document Revision History 67

There are many differences between 32-bit and 64-bit environments in OS X, including tool usage changes,changes to the size and alignment of data type

Seite 5 - Tables and Listings

While almost all UNIX and Linux implementations use LP64, other operating systems use various data models.Windows, for example, uses LLP64, in which l

Seite 6 - Organization of This Document

Note: Floating-point data type sizes are the same whether you are generating a 32-bit or 64-bitexecutable. However, the size of long double is 128 bi

Seite 7 - See Also

Finally, never underestimate the convenience of a generic exchange format such as XML. ●LibrariesAll libraries used by 64-bit applications or kernel e

Seite 8 - Executable?

Before you begin to update your code, you should familiarize yourself with the document Mac TechnologyOverview . After reading that document, the firs

Seite 9

For code that is truly architecture-specific (such as assembly language code), you should continue to usearchitecture-specific tests. Be aware, howeve

Seite 10 - Plug-in Compatibility

#endifAvoid casting pointers to non pointers. You should generally avoid casting a pointer to a non-pointer typefor any reason (particularly when perf

Seite 11 - Memory Requirements

Format stringTypePRIuNuintN _tPRIdLEASTNint_leastN _tPRIuLEASTNuint_leastN _tPRIdFASTNint_fastN _tPRIuFASTNuint_fastN _tPRIdPTRintptr_tPRIuPTRuintptr_

Seite 12 - Major 64-Bit Changes

ContentsIntroduction to 64-Bit Transition Guide 6What Is 64-Bit Computing? 6Who Should Read This Document? 6Organization of This Document 6See Also 7S

Seite 13 - Data Type Changes

For the most part, if you always use the sizeof function when allocating data structures and avoid assigningpointers to non-pointer types, the size an

Seite 14 - Data Type Impact on Code

int foo0;int foo1;int foo2;long long bar;};#pragma options align=resetYou should use this option only when absolutely necessary, because there is a pe

Seite 15 - Security Changes

Use 64-bit types for pointer arithmetic results. Because the size of pointers is a 64-bit value, the result ofpointer arithmetic is also a 64-bit valu

Seite 16 - Making Code 64-Bit Clean

A more common problem is storing a pointer temporarily in a variable of type int. In most cases, the compilerwill warn you that a pointer is being ass

Seite 17

●If you want the mask value to contain zeros in the upper 32 bits on a 64-bit architecture, the usualfixed-width mask will work as expected, because

Seite 18 - General Programming Tips

There is a performance cost associated with pragmas, however; memory accesses to unaligned data fieldsresult in a performance penalty. Because there a

Seite 19 - Data Type and Alignment Tips

5.Constants (unless modified by a suffix, such as 0x8L) are treated as the smallest size that will hold thevalue. Numbers written in hexadecimal may b

Seite 20

Problem: The expected result (and the result from a 32-bit executable) is 0x80000000. The result generatedby a 64-bit executable, however, is 0xffffff

Seite 21

On Intel-based Macintosh computers, 64-bit code uses the Intel 64 (formerly EM64T) extensions to the Intelassembly language ISA. This section summariz

Seite 22

DescriptionIntel 64 Architecture 64-bit variantIA32 32-bit registerRegister 13 (new)R13 *----Register 14 (new)R14 *----Register 15 (new)R15 *----All o

Seite 23

Instruction Changes 29For More Information 29Compiling 64-Bit Code 31Compiling 64-Bit Code Using GCC 31New Flags and Features for 64-Bit Architectures

Seite 24 - Alignment Pragmas

●http://developer.intel.com/technology/intel64/index.htm—Intel 64 Architecture technology page (Intel). ●http://software.intel.com/en-us/parallel/—In

Seite 25

The first part of this document describes issues you should consider when bringing code to a 64-bit architecture.You should read through those chapter

Seite 26

-WconversionAlthough not technically new for 64-bit architectures, this option is mostly useful when transitioning32-bit code to 64-bit. This flag cau

Seite 27 - #include <stdint.h>

With Xcode 1.0 and later, you can build multiarchitecture binaries (MABs). Because each target can define theset of architectures for the target being

Seite 28 - Register Changes

If you want to specify additional per-architecture compiler flags, you can use the PER_ARCH_CFLAGS_<arch>family of build settings, where <arc

Seite 29 - For More Information

Beginning in OS X v10.5, most OS X APIs are available to 64-bit applications. Going forward, Apple plans tomake new APIs 64-bit-compatible unless othe

Seite 30

These data types go by many names in various technology areas, but in terms of their underlying representation,the affected data types are one of thos

Seite 31 - Compiling 64-Bit Code

In certain technology areas (Carbon particularly), a few APIs have been deprecated for 32-bit use beginningin OS X v10.5. Most of these APIs are not a

Seite 32

Kernel and I/O Kit APIsAs of v10.8, 32-bit kernel extensions are no longer supported. Drivers and other kernel extensions for earlierversions of OS X

Seite 33

Other C Application APIsIn general, most C API changes are in the use of int and long within function prototypes. Similarly, manydata types based on i

Seite 34 - PER_ARCH_CFLAGS_<arch>

Additional Tips For 64-Bit KEXTs 61Document Revision History 672012-12-13 | Copyright © 2004, 2012 Apple Inc. All Rights Reserved.4Contents

Seite 35 - High-Level 64-Bit API Support

In some cases, you may find it useful to support plug-ins written for an architecture other than the one yourapplication is running on at the time. Yo

Seite 36 - New/Replaced/Deprecated APIs

In general, the sheer number of exceptions and edge cases involved makes programmatic function-callmarshaling highly impractical, and thus it should g

Seite 37

Because the scope of the supported API is limited, it is much more practical for you to support them throughfunction-call marshaling, because you can

Seite 38 - QuickTime

The biggest change you must make to support remote hosting is to maintain the state of your plug-in supportengine through function calls instead of va

Seite 39 - Other C Application APIs

●Create a communication thread in the helper host to transmit message entries from the buffer andstore the responses in some other part of the same m

Seite 40

Mach RPCMach RPC is not considered a public interface, and its direct use is not generally recommended. However, ifyou decide to use it, you can find

Seite 41

BSD socket API (described in socket)Each of these APIs implements the same underlying message, a bidirectional stream of bytes between bothends. Strea

Seite 42 - Remote Hosting

Standard Input and OutputAnother common API for interprocess communication is standard input and output. This API provides a pairof unidirectional str

Seite 43

goto error_exit;}if (childpid) {/* Parent process */channel->in_fd = in_descriptors[0];close(in_descriptors[1]);channel->out_fd = out_descriptor

Seite 44 - Remote Procedure Call APIs

}Note: If you use a function like this one, you should always specify an absolute path to your helperapplication.Message QueuesMessage queues provide

Seite 45 - Client/Server Messaging APIs

Tables and ListingsMajor 64-Bit Changes 12Table 2-1 Size and alignment of base data types in OS X 13Making Code 64-Bit Clean 16Table 3-1 Standard form

Seite 46

/* Create the map file and fill it with bytes. */char *create_shm_file(char *progname, int length){int fd, i;char *filename=malloc(MAXNAMLEN+1);char *

Seite 47 - Standard Input and Output

If you intend to work with page-sized regions, you should also take note of the functions described in thempool manual page. However, for most purpose

Seite 48

the writepos must not be allowed to overtake the readposition, so subtract one from the final value.*/#define BYTES_TO_WRITE(ringbuffer) (ringbuffer-&

Seite 49 - Message Queues

The next step is to execute the helper host, choosing the appropriate architecture in the process. In OS X v10.5and later, the recommended way to laun

Seite 50

When transitioning your application, kernel extension, or other code to 64-bit, you may notice a performancedecrease, depending on your code. While in

Seite 51

Because member_two is a pointer, it must be aligned on an 8-byte boundary. Thus, its address must be divisibleby 8. Because 4 is not divisible by 8, t

Seite 52 - Launching the Helper Host

Cache-Line MissesChanges in data structure alignment can cause differences in cache-line hits and misses. While this usuallydoes not have a significan

Seite 53

Avoiding Unaligned AccessesIf you create data structures with packed alignment, you may see a performance regression caused by unalignedaccess penalti

Seite 54 - Performance Optimization

In OS X v10.8 and later, the kernel is 64-bit (and some hardware used a 64-bit kernel as far back as v10.6). Thischapter describes the rationale for t

Seite 55

For a computer with 64 GB of RAM, given a 4 KB page size, the OS must manage almost 17 million pages ofphysical RAM, each of which has a page table en

Seite 56 - Cache-Line Misses

This document describes the 64-bit features that are available in OS X v10.4 and v10.5. You should read it tohelp you determine which of these feature

Seite 57 - Avoiding Unaligned Accesses

Update user-client codeDevice drivers that talk directly to a user-space application without using I/O Kit families (such as userclients and the I/O K

Seite 58 - Kernel Extensions and Drivers

First, these changes affect format strings for printf and IOLog calls. When printing these values, you caneither modify your code to use %ld when comp

Seite 59 - What You Must Do

Use the Large Zero Page FlagTo help debug pointer truncation issues, pass the -no_shared_cr3 flag as part of your boot arguments.(See Building and Deb

Seite 60

running in v10.6, this includes 32-bit PowerPC (Rosetta). For apps running in older versions of OS X, thismay even include 64-bit PowerPC.Here are som

Seite 61

If you are communicating in some way other than a user client, you can determine the byte orderof the remote application using a magic number, and wit

Seite 62

// Application is built for the same// architecture as this code, but may// be either 32-bit or 64-bit on Intel.magic++if (*magic == 0x00000000) {// r

Seite 63

struct mystruct mystruct_instance;mystruct_instance.order = HOST_ORDER;This still puts the burden of reading the field squarely on the code receiving

Seite 64

This table describes the changes to 64-Bit Transition Guide .NotesDateMade minor editorial revisions.2012-12-13Revised to update positioning of 64-bit

Seite 65

Apple Inc.Copyright © 2004, 2012 Apple Inc.All rights reserved.No part of this publication may be reproduced,stored in a retrieval system, or transmit

Seite 66

●Making Code 64-Bit Clean (page 16)—explains the general changes needed to make an application 64-bitclean. ●Compiling 64-Bit Code (page 31)—explains

Seite 67 - Document Revision History

As a general rule, in OS X v10.7 and later, the answer is probably yes. A 64-bit executable can provide manybenefits to users and to programmers, depe

Seite 68

I/O Kit Drivers and Other Kernel ExtensionsBecause a 64-bit kernel cannot load 32-bit kernel extensions, it is imperative that all kernel extensions b

Kommentare zu diesen Handbüchern

Keine Kommentare