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