Apple Darwin Manual do Utilizador

Consulte online ou descarregue Manual do Utilizador para Servidores Apple Darwin. Apple`s 64-Bit Transition Guide Manual do Utilizador

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir

Resumo do Conteúdo

Página 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

Página 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-

Página 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

Página 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

Página 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

Página 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

Página 8 - Executable?

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

Página 9

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

Página 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

Página 11 - Memory Requirements

Format stringTypePRIuNuintN _tPRIdLEASTNint_leastN _tPRIuLEASTNuint_leastN _tPRIdFASTNint_fastN _tPRIuFASTNuint_fastN _tPRIdPTRintptr_tPRIuPTRuintptr_

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 21

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

Página 22

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

Página 23

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

Página 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

Página 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

Página 26

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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 41

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

Página 42 - Remote Hosting

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

Página 43

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

Página 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

Página 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

Página 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 *

Página 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

Página 48

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

Página 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

Página 50

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

Página 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

Página 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

Página 53

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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 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

Página 63

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

Página 64

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

Página 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

Página 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

Página 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

Página 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

Comentários a estes Manuais

Sem comentários