Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Mac OS Runtime Architectures /
Chapter 10 - Classic 68K Runtime Architecture / Bypassing MC68000 Addressing Limitations


32-Bit Everything

The 32-bit everything method allows you to remove limitations on segment size, global data size, and jump-table size by using compiler and linker -model far options instead of the default value, which is -model near. For each compilation unit, the compiler allows you to choose

You can link any combination of near and far model compiled modules, but if any of the modules are compiled with the -model far, -model farData, or -model farCode options, you must specify the -model far linker option.

WARNING
Because the 32-bit everything solution is implemented by modifications to the LoadSeg, UnloadSeg, Launch, Chain, and ExitToShell traps, it will not work if your application patches these traps without calling the original traps when your patch completes. If you need to use _LoadSeg or _UnloadSeg in the 32-bit everything environment, you must use the routines in the RTLib.o library. For details, see Appendix B.
In assembly language, the use of a 32-bit reference for the target address of an instruction must be explicitly demanded by use of the absolute long address syntax (expr).L, where expr is a relocatable expression. Two other requirements must be met:

Global data references, references to code in the same segment, and references to code in a different segment all cause the assembler to produce similar records that tell the linker that a 32-bit patch is needed. The linker determines whether the references are to code or data. If the reference is to code, the linker can also determine whether the reference is internal or external.

The example shown in Listing 10-1 illustrates using 32-bit references for the target address of an instruction.

Listing 10-1 Using 32-bit references for the target address of an instruction

            MAIN
            IMPORT STUFF               ; Symbols from other
            IMPORT THERE               ; modules must be
            IMPORT ELSEWHERE           ; imported.
            JSR (THERE).L              ; Symbols are written using
            JSR (ELSEWHERE).L          ; (xxx).L syntax.
            ADD.W (STUFF).L,DO
            ENDMAIN

            PROC                       ; Note that THERE is in the MAIN
            EXPORT            THERE    ; segment
THERE       NOP                        
            ENDPROC
            SEG               'SG1 '   ; Note that ELSEWHERE
            PROC                       ; is in a different segment
            EXPORT            ELSEWHERE
ELSEWHERE   NOP      
            ENDPROC
            PROC
            DATA
            EXPORT            STUFF    
STUFF       DS                1
            ENDPROC
            END

Previous Book Contents Book Index Next

© Apple Computer, Inc.
11 MARCH 1997