]> git.saurik.com Git - apple/libc.git/blob - pthreads.subproj/stack.s
Libc-186.tar.gz
[apple/libc.git] / pthreads.subproj / stack.s
1 /*
2 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
3 * All Rights Reserved
4 *
5 * Permission to use, copy, modify, and distribute this software and
6 * its documentation for any purpose and without fee is hereby granted,
7 * provided that the above copyright notice appears in all copies and
8 * that both the copyright notice and this permission notice appear in
9 * supporting documentation.
10 *
11 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
12 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
13 * FOR A PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
16 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
18 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
19 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 *
21 */
22 /*
23 * MkLinux
24 */
25
26 .text
27
28 #if defined(__ppc__)
29 #import <architecture/ppc/asm_help.h>
30 #import <architecture/ppc/pseudo_inst.h>
31
32 /*
33 * void *_sp(void)
34 */
35
36 LEAF(__sp)
37 mr r3,r1
38 blr
39
40 /*
41 * void *_adjust_sp(void *sp)
42 */
43 LEAF(__adjust_sp)
44 subi r3,r3,0x100 /* Stack frame padding */
45 blr
46
47 #elif defined(__i386__)
48
49 #import <architecture/i386/asm_help.h>
50 /*
51 * void *_sp(void)
52 */
53
54 LEAF(__sp,0)
55 movl %esp,%eax
56 ret
57
58 /*
59 * void *_adjust_sp(void *sp)
60 */
61 LEAF(__adjust_sp,0)
62 movl 4(%esp),%eax
63 subl $0x100,%eax
64 ret
65
66 #else
67 #error sp functions not defined for this architecture
68 #endif
69