]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/valgrind/src/valgrind-3.6.0-svn/coregrind/m_start-x86-darwin.S
10e7e13ae2d6198a72f56f8342fd80b412d81f04
[l4.git] / l4 / pkg / valgrind / src / valgrind-3.6.0-svn / coregrind / m_start-x86-darwin.S
1
2 /*--------------------------------------------------------------------*/
3 /*--- Darwin x86 bootstrap.                   m_start-x86-darwin.S ---*/
4 /*--------------------------------------------------------------------*/
5
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9
10    Copyright (C) 2007 Apple Inc.
11       Greg Parker  gparker@apple.com
12
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License as
15    published by the Free Software Foundation; either version 2 of the
16    License, or (at your option) any later version.
17
18    This program is distributed in the hope that it will be useful, but
19    WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    General Public License for more details.
22
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
26    02111-1307, USA.
27
28    The GNU General Public License is contained in the file COPYING.
29 */
30
31 #if defined(VGP_x86_darwin)
32
33 #include "pub_core_basics_asm.h"
34
35         .text
36         .align  2,0x90
37 Ldyld_stub_binding_helper:
38         pushl   $__mh_execute_header
39         jmpl    *Ldyld_lazy_symbol_binding_entry_point
40
41         .dyld
42         .align  2
43 Ldyld_lazy_symbol_binding_entry_point:
44         .long   0
45         .long   0
46         .long   0
47         .long   0
48         .long   0
49         .long   Ldyld_stub_binding_helper
50         .long   0
51
52                 
53         // Memory layout established by kernel:
54         //
55         //        0
56         //        executable_name
57         //        0
58         //        envp[n]
59         //        ...
60         //        envp[0]
61         //        0
62         //        argv[argc-1]
63         //        ...
64         // sp+4-> argv[0]
65         // sp  -> argc
66         
67         .text
68         .align 2,0x90
69         .globl __start
70 __start:
71         movl    %esp, %eax      // save &argc
72         andl    $-16, %esp      // align stack
73         pushl   $0              // push NULL "return address" for backtraces
74         pushl   $0              // push fake saved ebp
75         movl    %esp, %ebp      // save frame pointer
76         pushl   $0              // align stack
77         pushl   %eax            // start_in_C_darwin(&argc)
78         call    __start_in_C_darwin
79         
80         // should not reach here
81         int $3
82         int $3
83
84 #endif // defined(VGP_x86_darwin)
85
86 /*--------------------------------------------------------------------*/
87 /*--- end                                                          ---*/
88 /*--------------------------------------------------------------------*/