-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplesim3_OSX.patch
280 lines (247 loc) · 8.12 KB
/
simplesim3_OSX.patch
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
Common subdirectories: ../simplesim-3.0/config and simplesim-3.0/config
Common subdirectories: ../simplesim-3.0/libexo and simplesim-3.0/libexo
diff -c ../simplesim-3.0/syscall.c simplesim-3.0/syscall.c
*** ../simplesim-3.0/syscall.c 2011-03-11 23:57:48.000000000 -0600
--- simplesim-3.0/syscall.c 2012-02-18 19:21:52.000000000 -0600
***************
*** 95,101 ****
#ifndef _MSC_VER
#include <sys/ioctl.h>
#endif
! #if defined(__FreeBSD__)
#include <utime.h>
#include <dirent.h>
#endif
--- 95,104 ----
#ifndef _MSC_VER
#include <sys/ioctl.h>
#endif
! #if (__FreeBSD__ == 1 || __APPLE__ == 1)
! #ifdef __DARWIN_64_BIT_INO_T
! #undef __DARWIN_64_BIT_INO_T
! #endif
#include <utime.h>
#include <dirent.h>
#endif
***************
*** 123,133 ****
#include <netinet/in.h>
#endif /* linux */
! #ifdef __FreeBSD__
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/in.h>
! #endif /* __FreeBSD__ */
#if defined(__svr4__)
#include <sys/dirent.h>
--- 126,136 ----
#include <netinet/in.h>
#endif /* linux */
! #if (__FreeBSD__ == 1 || __APPLE__ == 1)
#include <netinet/tcp.h>
#include <netinet/udp.h>
#include <netinet/in.h>
! #endif /* __FreeBSD__ && __APPLE__ */
#if defined(__svr4__)
#include <sys/dirent.h>
***************
*** 184,190 ****
#undef CR0
#endif
! #ifdef __FreeBSD__
#include <termios.h>
/*#include <sys/ioctl_compat.h>*/
#else
--- 187,193 ----
#undef CR0
#endif
! #if (__FreeBSD__ == 1 || __APPLE__ == 1)
#include <termios.h>
/*#include <sys/ioctl_compat.h>*/
#else
***************
*** 834,840 ****
struct xlate_table_t socklevel_map[] =
{
! #if defined(__svr4__) || defined(__osf__) || defined(__FreeBSD__)
{ OSF_SOL_SOCKET, SOL_SOCKET },
{ OSF_SOL_IP, IPPROTO_IP },
{ OSF_SOL_TCP, IPPROTO_TCP },
--- 837,843 ----
struct xlate_table_t socklevel_map[] =
{
! #if defined(__svr4__) || defined(__osf__) || defined(__FreeBSD__) || defined(__APPLE__)
{ OSF_SOL_SOCKET, SOL_SOCKET },
{ OSF_SOL_IP, IPPROTO_IP },
{ OSF_SOL_TCP, IPPROTO_TCP },
***************
*** 927,932 ****
--- 930,936 ----
md_inst_t inst, /* system call inst */
int traceable) /* traceable system call? */
{
+ FILE *err_stream = stdout;
qword_t syscode = regs->regs_R[MD_REG_V0];
/* fix for syscall() which uses CALL_PAL CALLSYS for making system calls */
***************
*** 1412,1425 ****
addr = ld_brk_point + delta;
if (verbose)
! myfprintf(stderr, "SYS_sbrk: delta: 0x%012p (%ld)\n", delta, delta);
ld_brk_point = addr;
regs->regs_R[MD_REG_V0] = ld_brk_point;
regs->regs_R[MD_REG_A3] = 0;
if (verbose)
! myfprintf(stderr, "ld_brk_point: 0x%012p\n", ld_brk_point);
#if 0
/* check whether heap area has merged with stack area */
--- 1416,1429 ----
addr = ld_brk_point + delta;
if (verbose)
! myfprintf(err_stream, "SYS_sbrk: delta: 0x%012p (%ld)\n", delta, delta);
ld_brk_point = addr;
regs->regs_R[MD_REG_V0] = ld_brk_point;
regs->regs_R[MD_REG_A3] = 0;
if (verbose)
! myfprintf(err_stream, "ld_brk_point: 0x%012p\n", ld_brk_point);
#if 0
/* check whether heap area has merged with stack area */
***************
*** 1448,1461 ****
addr = /*base*/regs->regs_R[MD_REG_A0];
if (verbose)
! myfprintf(stderr, "SYS_obreak: addr: 0x%012p\n", addr);
ld_brk_point = addr;
regs->regs_R[MD_REG_V0] = ld_brk_point;
regs->regs_R[MD_REG_A3] = 0;
if (verbose)
! myfprintf(stderr, "ld_brk_point: 0x%012p\n", ld_brk_point);
}
break;
--- 1452,1465 ----
addr = /*base*/regs->regs_R[MD_REG_A0];
if (verbose)
! myfprintf(err_stream, "SYS_obreak: addr: 0x%012p\n", addr);
ld_brk_point = addr;
regs->regs_R[MD_REG_V0] = ld_brk_point;
regs->regs_R[MD_REG_A3] = 0;
if (verbose)
! myfprintf(err_stream, "ld_brk_point: 0x%012p\n", ld_brk_point);
}
break;
***************
*** 1751,1757 ****
&arg, sizeof(arg));
#ifdef NOTNOW
! fprintf(stderr, "FIONBIO: %d, %d\n",
(int)regs->regs_R[MD_REG_A0],
arg);
#endif
--- 1755,1761 ----
&arg, sizeof(arg));
#ifdef NOTNOW
! fprintf(err_stream, "FIONBIO: %d, %d\n",
(int)regs->regs_R[MD_REG_A0],
arg);
#endif
***************
*** 2256,2262 ****
mem_bcopy(mem_fn, mem, Write, /*rusage*/regs->regs_R[MD_REG_A1],
&rusage, sizeof(struct osf_rusage));
}
! #elif defined(__unix__)
{
struct rusage local_rusage;
struct osf_rusage rusage;
--- 2260,2266 ----
mem_bcopy(mem_fn, mem, Write, /*rusage*/regs->regs_R[MD_REG_A1],
&rusage, sizeof(struct osf_rusage));
}
! #elif (__unix__ == 1 || __APPLE__ == 1)
{
struct rusage local_rusage;
struct osf_rusage rusage;
***************
*** 2333,2339 ****
#elif defined(_MSC_VER)
/* no utimes() in MSC, use utime() instead */
/*result*/regs->regs_R[MD_REG_V0] = utime(buf, NULL);
! #elif defined(__svr4__) || defined(__USLC__) || defined(unix) || defined(_AIX) || defined(__alpha)
/*result*/regs->regs_R[MD_REG_V0] = utimes(buf, NULL);
#elif defined(__CYGWIN32__)
warn("syscall: called utimes\n");
--- 2337,2343 ----
#elif defined(_MSC_VER)
/* no utimes() in MSC, use utime() instead */
/*result*/regs->regs_R[MD_REG_V0] = utime(buf, NULL);
! #elif defined(__APPLE__) || defined(__svr4__) || defined(__USLC__) || defined(unix) || defined(_AIX) || defined(__alpha)
/*result*/regs->regs_R[MD_REG_V0] = utimes(buf, NULL);
#elif defined(__CYGWIN32__)
warn("syscall: called utimes\n");
***************
*** 2380,2386 ****
/* result */regs->regs_R[MD_REG_V0] = utime(buf, &ubuf);
}
! #elif defined(__USLC__) || defined(unix) || defined(_AIX) || defined(__alpha)
/* result */regs->regs_R[MD_REG_V0] = utimes(buf, tval);
#elif defined(__CYGWIN32__)
warn("syscall: called utimes\n");
--- 2384,2390 ----
/* result */regs->regs_R[MD_REG_V0] = utime(buf, &ubuf);
}
! #elif defined(__APPLE__) || defined(__USLC__) || defined(unix) || defined(_AIX) || defined(__alpha)
/* result */regs->regs_R[MD_REG_V0] = utimes(buf, tval);
#elif defined(__CYGWIN32__)
warn("syscall: called utimes\n");
***************
*** 2618,2624 ****
base = lseek ((int)fd, (off_t)0, SEEK_CUR);
regs->regs_R[MD_REG_V0] =
getdents((int)fd, (struct dirent *)buf, (size_t)osf_nbytes);
! #else /* !__svr4__ */
regs->regs_R[MD_REG_V0] =
getdirentries((int)fd, buf, (size_t)osf_nbytes, &base);
#endif
--- 2622,2628 ----
base = lseek ((int)fd, (off_t)0, SEEK_CUR);
regs->regs_R[MD_REG_V0] =
getdents((int)fd, (struct dirent *)buf, (size_t)osf_nbytes);
! #else/* !__svr4__ */
regs->regs_R[MD_REG_V0] =
getdirentries((int)fd, buf, (size_t)osf_nbytes, &base);
#endif
***************
*** 3445,3451 ****
case OSF_SYS_usleep_thread:
#if 0
! fprintf(stderr, "usleep(%d)\n", (unsigned int)regs->regs_R[MD_REG_A0]);
#endif
#ifdef alpha
regs->regs_R[MD_REG_V0] = usleep((unsigned int)regs->regs_R[MD_REG_A0]);
--- 3449,3455 ----
case OSF_SYS_usleep_thread:
#if 0
! fprintf(err_stream, "usleep(%d)\n", (unsigned int)regs->regs_R[MD_REG_A0]);
#endif
#ifdef alpha
regs->regs_R[MD_REG_V0] = usleep((unsigned int)regs->regs_R[MD_REG_A0]);
***************
*** 3514,3520 ****
}
if (verbose)
! fprintf(stderr, "syscall(%d): returned %d:%d...\n",
(int)syscode, (int)regs->regs_R[MD_REG_A3],
(int)regs->regs_R[MD_REG_V0]);
}
--- 3518,3524 ----
}
if (verbose)
! fprintf(err_stream, "syscall(%d): returned %d:%d...\n",
(int)syscode, (int)regs->regs_R[MD_REG_A3],
(int)regs->regs_R[MD_REG_V0]);
}
Common subdirectories: ../simplesim-3.0/target-alpha and simplesim-3.0/target-alpha
Common subdirectories: ../simplesim-3.0/target-pisa and simplesim-3.0/target-pisa
Common subdirectories: ../simplesim-3.0/tests and simplesim-3.0/tests
Common subdirectories: ../simplesim-3.0/tests-alpha and simplesim-3.0/tests-alpha
Common subdirectories: ../simplesim-3.0/tests-pisa and simplesim-3.0/tests-pisa