]> git.saurik.com Git - apple/objc4.git/blob - runtime/Auto.subproj/objc-auto-i386.s
objc4-437.tar.gz
[apple/objc4.git] / runtime / Auto.subproj / objc-auto-i386.s
1 /*
2 * Copyright (c) 2004, 2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifdef __i386__
25
26 /*
27 This file defines the non-GC variants of objc_assign_* on a dedicated
28 page in the (__DATA,__data) section. At load time under GC, each
29 routine is overwritten with a jump to its GC variant. It is necessary
30 for these routines to exist on a dedicated page for vm_protect to
31 work properly in the GC case. The page exists in the data segment to
32 reduce the kernel's page table overhead.
33
34 Note: To avoid wasting more space than necessary at runtime, this file
35 must not contain anything other than the objc_assign_* routines.
36 */
37
38 .section __IMPORT, __objctext, regular, pure_instructions + self_modifying_code
39
40 .align 12 // align to page boundary
41
42 LNonGCAssigns$Begin:
43
44 // id objc_assign_ivar(id value, id dest, ptrdiff_t offset);
45 .globl _objc_assign_ivar
46 _objc_assign_ivar:
47 pushl %ebp
48 movl %esp,%ebp
49 movl 0x08(%ebp),%eax // value
50 movl 0x0c(%ebp),%ecx // dest
51 movl 0x10(%ebp),%edx // offset
52 movl %eax,(%ecx,%edx) // return (*(dest + offset) = value);
53 leave
54 ret
55
56 // id objc_assign_global(id value, id *dest);
57 .globl _objc_assign_global
58 _objc_assign_global:
59 pushl %ebp
60 movl %esp,%ebp
61 movl 0x08(%ebp),%eax // value
62 movl 0x0c(%ebp),%edx // dest
63 movl %eax,(%edx) // return (*dest = value);
64 leave
65 ret
66
67 // As of OS X 10.5, objc_assign_strongCast_non_gc is identical to
68 // objc_assign_global_non_gc.
69
70 // id objc_assign_strongCast(id value, id *dest);
71 .globl _objc_assign_strongCast
72 _objc_assign_strongCast:
73 pushl %ebp
74 movl %esp,%ebp
75 movl 0x08(%ebp),%eax // value
76 movl 0x0c(%ebp),%edx // dest
77 movl %eax,(%edx) // return (*dest = value);
78 leave
79 ret
80
81 LNonGCAssigns$End:
82
83 // Claim the remainder of the page.
84 .set L$set$assignsSize,LNonGCAssigns$End-LNonGCAssigns$Begin
85 .space 4096-L$set$assignsSize
86
87 #endif