]>
git.saurik.com Git - apple/objc4.git/blob - runtime/objc-rtp.h
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 2004 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
27 Copyright 2004, Apple Computer, Inc.
30 Layout of the "objc runtime pages", an fixed area
31 in high memory that can be reached via an absolute branch.
32 Basic idea is that, on ppc, a single "bla" instruction
33 (branch & link to absolute address)
34 can be issued by the compiler to get to high-value routines
35 in the runtime, including the basic messenger and to the
36 assignment helper intrinsics issued under -fobjc-gc.
37 The implementation of the intrinsics is optimized based
38 on whether the application (process) is running with GC enabled
45 /*********************************************************************
46 Layout of the runtime page.
48 Some of these values must NEVER BE CHANGED, including:
53 kRTSize_objc_assign_ivar
54 kRTAddress_objc_msgSend ppc 0xfffeff00
55 kRTAddress_objc_assign_ivar ppc 0xfffefec0
57 *********************************************************************/
64 #define OBJC_SIZE_T(x) (x)
65 #define OBJC_INTPTR_T(x) (x)
66 #define OBJC_UINTPTR_T(x) (x)
68 #define OBJC_SIZE_T(x) ((size_t)(x))
69 #define OBJC_INTPTR_T(x) ((intptr_t)(x))
70 #define OBJC_UINTPTR_T(x) ((uintptr_t)(x))
73 // Size of RTP area, in bytes (0x1000 = 4k bytes = 1 page)
74 #define kRTPagesMaxSize OBJC_SIZE_T(4 * 0x1000) // size reserved for runtime
75 #define kRTPagesSize OBJC_SIZE_T(1 * 0x1000) // size actually used
77 // Address of RTP area: [kRTPagesLo..kRTPagesHi)
78 // These are defined in negative numbers to reflect an offset from the highest address,
79 // which is what the ppc "bla" instruction is defined to do with "negative" addresses.
80 // This definition will establish the correct entry points for 64-bit if this mechanism
81 // is adopted for that architecture as well.
83 # define kRTPagesLo OBJC_UINTPTR_T(-20 * 0x1000) // ppc 0xfffec000
84 #elif defined(__i386__)
85 # define kRTPagesLo OBJC_UINTPTR_T(-24 * 0x1000) // i386 0xfffe8000
87 #error unknown architecture
89 #define kRTPagesHi OBJC_UINTPTR_T(kRTPagesLo + kRTPagesMaxSize) // ppc 0xffff0000
91 // Sizes reserved for functions in the RTP area, in bytes
92 #define kRTSize_objc_msgSend OBJC_SIZE_T(0x0100)
93 #define kRTSize_objc_assign_ivar OBJC_SIZE_T(0x0040)
94 #define kRTSize_objc_assign_global OBJC_SIZE_T(0x0010)
95 #define kRTSize_objc_assign_strongCast OBJC_SIZE_T(0x0010)
97 // Absolute address of functions in the RTP area
98 // These count backwards from the hi end of the RTP area.
99 // New additions are added to the low side.
100 #define kRTAddress_objc_msgSend OBJC_UINTPTR_T(kRTPagesHi - kRTSize_objc_msgSend) // ppc 0xfffeff00
101 #define kRTAddress_objc_assign_ivar OBJC_UINTPTR_T(kRTAddress_objc_msgSend - kRTSize_objc_assign_ivar) // ppc 0xfffefec0
102 #define kRTAddress_objc_assign_global OBJC_UINTPTR_T(kRTAddress_objc_assign_ivar - kRTSize_objc_assign_global) // ppc 0xfffefeb0
103 #define kRTAddress_objc_assign_strongCast OBJC_UINTPTR_T(kRTAddress_objc_assign_global - kRTSize_objc_assign_strongCast) // ppc 0xfffefea0
105 // Sizes reserved for data in the RTP area, in bytes
106 #define kRTSize_ignoredSelector OBJC_SIZE_T(19) // 1+strlen("<ignored selector>")
108 // Absolute address of data in the RTP area
109 // These count forwards from the lo end of the RTP area.
110 // These are not locked down and can be moved if necessary.
111 #define kRTAddress_ignoredSelector OBJC_UINTPTR_T(kRTPagesHi-kRTPagesSize)
113 #define kIgnore kRTAddress_ignoredSelector // ppc 0xfffef000
115 /*********************************************************************
116 End of runtime page layout.
117 *********************************************************************/