~vorlon/ubuntu/natty/eglibc/multiarch

« back to all changes in this revision

Viewing changes to debian/patches/m68k/cvs-tls-support.patch

  • Committer: Steve Langasek
  • Date: 2011-02-18 21:18:44 UTC
  • mfrom: (103.1.7 eglibc)
  • Revision ID: steve.langasek@linaro.org-20110218211844-lodmi8b1qhyq3f3x
Tags: 2.13~pre1-0ubuntu1+multiarch.1
merge from natty

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This series of m68k related commits brings eglibc-2.11.2 up to date with the glibc-ports git
2
 
as of 2010-06-30, including NPTL support.
3
 
 
4
 
From: Joseph Myers <joseph@codesourcery.com>
5
 
Date: Wed, 18 Nov 2009 17:30:48 +0000 (+0000)
6
 
Subject: Change misleading names of parameters of sync_file_range for M68K.
7
 
X-Git-Tag: glibc-2.12~86
8
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=6add932d9099ac27762c45e344416c1ee11f6d78
9
 
 
10
 
Change misleading names of parameters of sync_file_range for M68K.
11
 
---
12
 
 
13
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
14
 
index 7a3e8b7..87117d3 100644
15
 
--- a/ports/ChangeLog.m68k
16
 
+++ b/ports/ChangeLog.m68k
17
 
@@ -1,3 +1,8 @@
18
 
+2009-11-18  Joseph Myers  <joseph@codesourcery.com>
19
 
+
20
 
+       * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Change misleading
21
 
+       names of parameters of sync_file_range.
22
 
+
23
 
 2009-11-17  Joseph Myers  <joseph@codesourcery.com>
24
 
 
25
 
        [BZ #10972]
26
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
27
 
index 6fc7a0a..c6dd1a8 100644
28
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
29
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
30
 
@@ -236,7 +236,7 @@ extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
31
 
 
32
 
 
33
 
 /* Selective file content synch'ing.  */
34
 
-extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to,
35
 
+extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
36
 
                            unsigned int __flags);
37
 
 
38
 
 
39
 
From: Joseph Myers <joseph@codesourcery.com>
40
 
Date: Thu, 19 Nov 2009 22:34:08 +0000 (+0000)
41
 
Subject: Define F_OWNER_PGRP for M68K.
42
 
X-Git-Tag: glibc-2.12~82
43
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=76d306ec9888f824496ea7783266ea91e6825374
44
 
 
45
 
Define F_OWNER_PGRP for M68K.
46
 
---
47
 
 
48
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
49
 
index 87117d3..74407c4 100644
50
 
--- a/ports/ChangeLog.m68k
51
 
+++ b/ports/ChangeLog.m68k
52
 
@@ -1,3 +1,8 @@
53
 
+2009-11-19  Joseph Myers  <joseph@codesourcery.com>
54
 
+
55
 
+       * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Introduce new symbol
56
 
+       F_OWNER_PGRP and mark F_OWNER_GID obsolete.
57
 
+
58
 
 2009-11-18  Joseph Myers  <joseph@codesourcery.com>
59
 
 
60
 
        * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Change misleading
61
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
62
 
index c6dd1a8..8ed8eb6 100644
63
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
64
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
65
 
@@ -171,9 +171,10 @@ struct flock64
66
 
 /* Owner types.  */
67
 
 enum __pid_type
68
 
   {
69
 
-    F_OWNER_TID = 0,   /* Kernel thread.  */
70
 
-    F_OWNER_PID,       /* Process.  */
71
 
-    F_OWNER_GID                /* Process group.  */
72
 
+    F_OWNER_TID = 0,           /* Kernel thread.  */
73
 
+    F_OWNER_PID,               /* Process.  */
74
 
+    F_OWNER_PGRP,              /* Process group.  */
75
 
+    F_OWNER_GID = F_OWNER_PGRP /* Alternative, obsolete name.  */
76
 
   };
77
 
 
78
 
 /* Structure to use with F_GETOWN_EX and F_SETOWN_EX.  */
79
 
From: Andreas Schwab <schwab@redhat.com>
80
 
Date: Mon, 23 Nov 2009 15:34:39 +0000 (+0100)
81
 
Subject: Use struct timespec for timestamps in struct stat also if __USE_XOPEN2K8
82
 
X-Git-Tag: glibc-2.12~81
83
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=127f9dc1f0b7c21112007f476d710ea6b70d13c0
84
 
 
85
 
Use struct timespec for timestamps in struct stat also if __USE_XOPEN2K8
86
 
---
87
 
 
88
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
89
 
index 74407c4..42d6a91 100644
90
 
--- a/ports/ChangeLog.m68k
91
 
+++ b/ports/ChangeLog.m68k
92
 
@@ -1,3 +1,8 @@
93
 
+2009-11-23  Andreas Schwab  <schwab@linux-m68k.org>
94
 
+
95
 
+       * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Use struct timespec
96
 
+       for timestamps also if __USE_XOPEN2K8.
97
 
+
98
 
 2009-11-19  Joseph Myers  <joseph@codesourcery.com>
99
 
 
100
 
        * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Introduce new symbol
101
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
102
 
index 8d18d6d..7801043 100644
103
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
104
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
105
 
@@ -61,7 +61,7 @@ struct stat
106
 
 #else
107
 
     __blkcnt64_t st_blocks;            /* Number 512-byte blocks allocated. */
108
 
 #endif
109
 
-#ifdef __USE_MISC
110
 
+#if defined __USE_MISC || defined __USE_XOPEN2K8
111
 
     /* Nanosecond resolution timestamps are stored in a format
112
 
        equivalent to 'struct timespec'.  This is the type used
113
 
        whenever possible but the Unix namespace rules do not allow the
114
 
@@ -107,7 +107,7 @@ struct stat64
115
 
     __blksize_t st_blksize;            /* Optimal block size for I/O.  */
116
 
 
117
 
     __blkcnt64_t st_blocks;            /* Number 512-byte blocks allocated. */
118
 
-#ifdef __USE_MISC
119
 
+# if defined __USE_MISC || defined __USE_XOPEN2K8
120
 
     /* Nanosecond resolution timestamps are stored in a format
121
 
        equivalent to 'struct timespec'.  This is the type used
122
 
        whenever possible but the Unix namespace rules do not allow the
123
 
@@ -117,14 +117,14 @@ struct stat64
124
 
     struct timespec st_atim;           /* Time of last access.  */
125
 
     struct timespec st_mtim;           /* Time of last modification.  */
126
 
     struct timespec st_ctim;           /* Time of last status change.  */
127
 
-#else
128
 
+# else
129
 
     __time_t st_atime;                 /* Time of last access.  */
130
 
     unsigned long int st_atimensec;    /* Nscecs of last access.  */
131
 
     __time_t st_mtime;                 /* Time of last modification.  */
132
 
     unsigned long int st_mtimensec;    /* Nsecs of last modification.  */
133
 
     __time_t st_ctime;                 /* Time of last status change.  */
134
 
     unsigned long int st_ctimensec;    /* Nsecs of last status change.  */
135
 
-#endif
136
 
+# endif
137
 
     __ino64_t st_ino;                  /* File serial number.          */
138
 
   };
139
 
 #endif
140
 
From: Joseph Myers <joseph@codesourcery.com>
141
 
Date: Wed, 16 Dec 2009 12:37:07 +0000 (+0000)
142
 
Subject: Update M68K O_SYNC.
143
 
X-Git-Tag: glibc-2.12~69
144
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=4b8a7d2c3f00ac9a4e31e3c8c132b4b9aefbc5fe
145
 
 
146
 
Update M68K O_SYNC.
147
 
---
148
 
 
149
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
150
 
index 42d6a91..8411570 100644
151
 
--- a/ports/ChangeLog.m68k
152
 
+++ b/ports/ChangeLog.m68k
153
 
@@ -1,3 +1,8 @@
154
 
+2009-12-16  Joseph Myers  <joseph@codesourcery.com>
155
 
+
156
 
+       * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Redefine O_SYNC and
157
 
+       O_DSYNC to match 2.6.33+ kernels.
158
 
+
159
 
 2009-11-23  Andreas Schwab  <schwab@linux-m68k.org>
160
 
 
161
 
        * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Use struct timespec
162
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
163
 
index 8ed8eb6..1f98cf5 100644
164
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
165
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
166
 
@@ -40,7 +40,7 @@
167
 
 #define O_APPEND         02000
168
 
 #define O_NONBLOCK       04000
169
 
 #define O_NDELAY       O_NONBLOCK
170
 
-#define O_SYNC          010000
171
 
+#define O_SYNC        04010000
172
 
 #define O_FSYNC                 O_SYNC
173
 
 #define O_ASYNC                 020000
174
 
 
175
 
@@ -56,7 +56,7 @@
176
 
    We define the symbols here but let them do the same as O_SYNC since
177
 
    this is a superset. */
178
 
 #if defined __USE_POSIX199309 || defined __USE_UNIX98
179
 
-# define O_DSYNC       O_SYNC  /* Synchronize data.  */
180
 
+# define O_DSYNC       010000  /* Synchronize data.  */
181
 
 # define O_RSYNC       O_SYNC  /* Synchronize read operations.  */
182
 
 #endif
183
 
 
184
 
From: Joseph Myers <joseph@codesourcery.com>
185
 
Date: Wed, 16 Dec 2009 19:35:09 +0000 (+0000)
186
 
Subject: Update M68K bits/poll.h for POSIX 2008.
187
 
X-Git-Tag: glibc-2.12~65
188
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=5d79f83e907d938087a5a93c514e48a4ce438c9d
189
 
 
190
 
Update M68K bits/poll.h for POSIX 2008.
191
 
---
192
 
 
193
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
194
 
index 8411570..978cd1a 100644
195
 
--- a/ports/ChangeLog.m68k
196
 
+++ b/ports/ChangeLog.m68k
197
 
@@ -1,5 +1,11 @@
198
 
 2009-12-16  Joseph Myers  <joseph@codesourcery.com>
199
 
 
200
 
+       [BZ #11093]
201
 
+       * sysdeps/unix/sysv/linux/m68k/bits/poll.h: Define POLLRDNORM,
202
 
+       POLLRDBAND, POLLWRNORM, and POLLWRBAND also for POSIX 2008.
203
 
+
204
 
+2009-12-16  Joseph Myers  <joseph@codesourcery.com>
205
 
+
206
 
        * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Redefine O_SYNC and
207
 
        O_DSYNC to match 2.6.33+ kernels.
208
 
 
209
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h
210
 
index bc28579..84219ba 100644
211
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h
212
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/poll.h
213
 
@@ -1,4 +1,4 @@
214
 
-/* Copyright (C) 1997, 2001, 2008 Free Software Foundation, Inc.
215
 
+/* Copyright (C) 1997, 2001, 2008, 2009 Free Software Foundation, Inc.
216
 
    This file is part of the GNU C Library.
217
 
 
218
 
    The GNU C Library is free software; you can redistribute it and/or
219
 
@@ -27,7 +27,7 @@
220
 
 #define POLLPRI                0x002           /* There is urgent data to read.  */
221
 
 #define POLLOUT                0x004           /* Writing now will not block.  */
222
 
 
223
 
-#ifdef __USE_XOPEN
224
 
+#if defined __USE_XOPEN || defined __USE_XOPEN2K8
225
 
 /* These values are defined in XPG4.2.  */
226
 
 # define POLLRDNORM    0x040           /* Normal data may be read.  */
227
 
 # define POLLRDBAND    0x080           /* Priority data may be read.  */
228
 
From: Joseph Myers <joseph@codesourcery.com>
229
 
Date: Sun, 10 Jan 2010 19:02:51 +0000 (+0000)
230
 
Subject: Update M68K bits/fcntl.h for XPG7 and allow bits/stat.h inclusion from fcntl.h.
231
 
X-Git-Tag: glibc-2.12~62
232
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=2f12146a331fa728950cbe55da1efb406c26e5cb
233
 
 
234
 
Update M68K bits/fcntl.h for XPG7 and allow bits/stat.h inclusion from fcntl.h.
235
 
---
236
 
 
237
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
238
 
index 978cd1a..094e7a8 100644
239
 
--- a/ports/ChangeLog.m68k
240
 
+++ b/ports/ChangeLog.m68k
241
 
@@ -1,3 +1,11 @@
242
 
+2010-01-10  Joseph Myers  <joseph@codesourcery.com>
243
 
+
244
 
+       * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Define O_DIRECTORY,
245
 
+       O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN for
246
 
+       XPG7.
247
 
+       * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Enable using from
248
 
+       fcntl.h.
249
 
+
250
 
 2009-12-16  Joseph Myers  <joseph@codesourcery.com>
251
 
 
252
 
        [BZ #11093]
253
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
254
 
index 1f98cf5..d1eb706 100644
255
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
256
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
257
 
@@ -1,5 +1,5 @@
258
 
 /* O_*, F_*, FD_* bit values for Linux.
259
 
-   Copyright (C) 2000, 2004, 2008, 2009 Free Software Foundation, Inc.
260
 
+   Copyright (C) 2000, 2004, 2008, 2009, 2010 Free Software Foundation, Inc.
261
 
    This file is part of the GNU C Library.
262
 
 
263
 
    The GNU C Library is free software; you can redistribute it and/or
264
 
@@ -44,12 +44,14 @@
265
 
 #define O_FSYNC                 O_SYNC
266
 
 #define O_ASYNC                 020000
267
 
 
268
 
-#ifdef __USE_GNU
269
 
+#ifdef __USE_XOPEN2K8
270
 
 # define O_DIRECTORY    040000 /* Must be a directory.  */
271
 
 # define O_NOFOLLOW    0100000 /* Do not follow links.  */
272
 
+# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
273
 
+#endif
274
 
+#ifdef __USE_GNU
275
 
 # define O_DIRECT      0200000 /* Direct disk access.  */
276
 
 # define O_NOATIME     01000000 /* Do not set atime.  */
277
 
-# define O_CLOEXEC     02000000 /* Set close_on_exec.  */
278
 
 #endif
279
 
 
280
 
 /* For now Linux has synchronisity options for data and read operations.
281
 
@@ -83,7 +85,7 @@
282
 
 #define F_SETLK64      13      /* Set record locking info (non-blocking).  */
283
 
 #define F_SETLKW64     14      /* Set record locking info (blocking).  */
284
 
 
285
 
-#if defined __USE_BSD || defined __USE_UNIX98
286
 
+#if defined __USE_BSD || defined __USE_UNIX98 || defined __USE_XOPEN2K8
287
 
 # define F_SETOWN      8       /* Get owner of socket (receiver of SIGIO).  */
288
 
 # define F_GETOWN      9       /* Set owner of socket (receiver of SIGIO).  */
289
 
 #endif
290
 
@@ -99,6 +101,8 @@
291
 
 # define F_SETLEASE    1024    /* Set a lease.  */
292
 
 # define F_GETLEASE    1025    /* Enquire what lease is active.  */
293
 
 # define F_NOTIFY      1026    /* Request notfications on a directory.  */
294
 
+#endif
295
 
+#ifdef __USE_XOPEN2K8
296
 
 # define F_DUPFD_CLOEXEC 1030  /* Duplicate file descriptor with
297
 
                                   close-on-exit set.  */
298
 
 #endif
299
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
300
 
index 7801043..771a53a 100644
301
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
302
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
303
 
@@ -1,4 +1,4 @@
304
 
-/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002,2008,2009
305
 
+/* Copyright (C) 1992,95,96,97,98,99,2000,2001,2002,2008,2009,2010
306
 
      Free Software Foundation, Inc.
307
 
    This file is part of the GNU C Library.
308
 
 
309
 
@@ -17,7 +17,7 @@
310
 
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
311
 
    02111-1307 USA.  */
312
 
 
313
 
-#ifndef _SYS_STAT_H
314
 
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
315
 
 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
316
 
 #endif
317
 
 
318
 
From: Joseph Myers <joseph@codesourcery.com>
319
 
Date: Mon, 11 Jan 2010 21:51:34 +0000 (+0000)
320
 
Subject: Fix M68K bits/stat.h double inclusion problem.
321
 
X-Git-Tag: glibc-2.12~59
322
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=fdefc0e1f176327cabedf4011673b3272321093e
323
 
 
324
 
Fix M68K bits/stat.h double inclusion problem.
325
 
---
326
 
 
327
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
328
 
index 094e7a8..cdc9242 100644
329
 
--- a/ports/ChangeLog.m68k
330
 
+++ b/ports/ChangeLog.m68k
331
 
@@ -1,3 +1,8 @@
332
 
+2010-01-11  Joseph Myers  <joseph@codesourcery.com>
333
 
+
334
 
+       * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Fix double-inclusion
335
 
+       problem.
336
 
+
337
 
 2010-01-10  Joseph Myers  <joseph@codesourcery.com>
338
 
 
339
 
        * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h: Define O_DIRECTORY,
340
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
341
 
index 771a53a..0c1d149 100644
342
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
343
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/stat.h
344
 
@@ -21,6 +21,9 @@
345
 
 # error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
346
 
 #endif
347
 
 
348
 
+#ifndef _BITS_STAT_H
349
 
+#define _BITS_STAT_H   1
350
 
+
351
 
 /* Versions of the `struct stat' data structure.  */
352
 
 #define _STAT_VER_LINUX_OLD    1
353
 
 #define _STAT_VER_KERNEL       1
354
 
@@ -167,3 +170,5 @@ struct stat64
355
 
 # define UTIME_NOW     ((1l << 30) - 1l)
356
 
 # define UTIME_OMIT    ((1l << 30) - 2l)
357
 
 #endif
358
 
+
359
 
+#endif /* bits/stat.h */
360
 
From: Joseph Myers <joseph@codesourcery.com>
361
 
Date: Wed, 10 Feb 2010 15:32:33 +0000 (+0000)
362
 
Subject: Add hidden alias for M68K fegetenv.
363
 
X-Git-Tag: glibc-2.12~46
364
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=ee0c4dd1ccc424d57d97dc078a4aba0c70eeb8a4
365
 
 
366
 
Add hidden alias for M68K fegetenv.
367
 
---
368
 
 
369
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
370
 
index cdc9242..8487ba3 100644
371
 
--- a/ports/ChangeLog.m68k
372
 
+++ b/ports/ChangeLog.m68k
373
 
@@ -1,3 +1,7 @@
374
 
+2010-02-10  Joseph Myers  <joseph@codesourcery.com>
375
 
+
376
 
+       * sysdeps/m68k/fpu/fegetenv.c: Add hidden alias.
377
 
+
378
 
 2010-01-11  Joseph Myers  <joseph@codesourcery.com>
379
 
 
380
 
        * sysdeps/unix/sysv/linux/m68k/bits/stat.h: Fix double-inclusion
381
 
diff --git a/ports/sysdeps/m68k/fpu/fegetenv.c b/ports/sysdeps/m68k/fpu/fegetenv.c
382
 
index 6f23e8b..30f3fa5 100644
383
 
--- a/ports/sysdeps/m68k/fpu/fegetenv.c
384
 
+++ b/ports/sysdeps/m68k/fpu/fegetenv.c
385
 
@@ -1,5 +1,5 @@
386
 
 /* Store current floating-point environment.
387
 
-   Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc.
388
 
+   Copyright (C) 1997,99,2000,01,10 Free Software Foundation, Inc.
389
 
    This file is part of the GNU C Library.
390
 
    Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
391
 
 
392
 
@@ -41,4 +41,5 @@ strong_alias (__fegetenv, __old_fegetenv)
393
 
 compat_symbol (libm, __old_fegetenv, fegetenv, GLIBC_2_1);
394
 
 #endif
395
 
 
396
 
+libm_hidden_ver (__fegetenv, fegetenv)
397
 
 versioned_symbol (libm, __fegetenv, fegetenv, GLIBC_2_2);
398
 
From: Maxim Kuvyrkov <maxim@codesourcery.com>
399
 
Date: Tue, 9 Mar 2010 10:20:36 +0000 (-0800)
400
 
Subject: m68k: update jmpbuf-unwind.h
401
 
X-Git-Tag: glibc-2.12~41
402
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=42ae1878f326c413dd026373ebdb6bf6cd20e75d
403
 
 
404
 
m68k: update jmpbuf-unwind.h
405
 
---
406
 
 
407
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
408
 
index 8487ba3..d14368e 100644
409
 
--- a/ports/ChangeLog.m68k
410
 
+++ b/ports/ChangeLog.m68k
411
 
@@ -1,3 +1,8 @@
412
 
+2010-03-09  Maxim Kuvyrkov  <maxim@codesourcery.com>
413
 
+
414
 
+       * sysdeps/m68k/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ)
415
 
+       (_jmpbuf_sp, _JMPBUF_UNWINDS_ADJ, __libc_unwind_longjmp): Define.
416
 
+
417
 
 2010-02-10  Joseph Myers  <joseph@codesourcery.com>
418
 
 
419
 
        * sysdeps/m68k/fpu/fegetenv.c: Add hidden alias.
420
 
diff --git a/ports/sysdeps/m68k/jmpbuf-unwind.h b/ports/sysdeps/m68k/jmpbuf-unwind.h
421
 
index 3490c79..28b9537 100644
422
 
--- a/ports/sysdeps/m68k/jmpbuf-unwind.h
423
 
+++ b/ports/sysdeps/m68k/jmpbuf-unwind.h
424
 
@@ -1,5 +1,5 @@
425
 
 /* Examine __jmp_buf for unwinding frames.  m68k version.
426
 
-   Copyright (C) 2006 Free Software Foundation, Inc.
427
 
+   Copyright (C) 2006, 2010 Free Software Foundation, Inc.
428
 
    This file is part of the GNU C Library.
429
 
 
430
 
    The GNU C Library is free software; you can redistribute it and/or
431
 
@@ -18,8 +18,29 @@
432
 
    02111-1307 USA.  */
433
 
 
434
 
 #include <setjmp.h>
435
 
+#include <stdint.h>
436
 
+#include <unwind.h>
437
 
 
438
 
 /* Test if longjmp to JMPBUF would unwind the frame
439
 
    containing a local variable at ADDRESS.  */
440
 
 #define _JMPBUF_UNWINDS(jmpbuf, address, demangle)             \
441
 
   ((void *) (address) < (void *) demangle ((jmpbuf)->__sp))
442
 
+
443
 
+#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
444
 
+  _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
445
 
+
446
 
+static inline uintptr_t __attribute__ ((unused))
447
 
+_jmpbuf_sp (__jmp_buf regs)
448
 
+{
449
 
+  uintptr_t sp = regs[0].__sp;
450
 
+#ifdef PTR_DEMANGLE
451
 
+  PTR_DEMANGLE (sp);
452
 
+#endif
453
 
+  return sp;
454
 
+}
455
 
+
456
 
+#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
457
 
+  ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
458
 
+
459
 
+/* We use the normal longjmp for unwinding.  */
460
 
+#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)
461
 
From: Maxim Kuvyrkov <maxim@codesourcery.com>
462
 
Date: Tue, 9 Mar 2010 10:32:38 +0000 (-0800)
463
 
Subject: m68k: remove bits/siginfo.h in favor of generic one
464
 
X-Git-Tag: glibc-2.12~40
465
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=d8e90a15fedd2660d02f5d8e4e7da17e01916d30
466
 
 
467
 
m68k: remove bits/siginfo.h in favor of generic one
468
 
---
469
 
 
470
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
471
 
index d14368e..e2b54e5 100644
472
 
--- a/ports/ChangeLog.m68k
473
 
+++ b/ports/ChangeLog.m68k
474
 
@@ -1,5 +1,7 @@
475
 
 2010-03-09  Maxim Kuvyrkov  <maxim@codesourcery.com>
476
 
 
477
 
+       * sysdeps/unix/sysv/linux/m68k/bits/siginfo.h: Remove.
478
 
+
479
 
        * sysdeps/m68k/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ)
480
 
        (_jmpbuf_sp, _JMPBUF_UNWINDS_ADJ, __libc_unwind_longjmp): Define.
481
 
 
482
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/siginfo.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/siginfo.h
483
 
deleted file mode 100644
484
 
index 1ded1c2..0000000
485
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/siginfo.h
486
 
+++ /dev/null
487
 
@@ -1,316 +0,0 @@
488
 
-/* siginfo_t, sigevent and constants.  m68k linux version.
489
 
-   Copyright (C) 1997-2002, 2003 Free Software Foundation, Inc.
490
 
-   This file is part of the GNU C Library.
491
 
-
492
 
-   The GNU C Library is free software; you can redistribute it and/or
493
 
-   modify it under the terms of the GNU Lesser General Public
494
 
-   License as published by the Free Software Foundation; either
495
 
-   version 2.1 of the License, or (at your option) any later version.
496
 
-
497
 
-   The GNU C Library is distributed in the hope that it will be useful,
498
 
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
499
 
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
500
 
-   Lesser General Public License for more details.
501
 
-
502
 
-   You should have received a copy of the GNU Lesser General Public
503
 
-   License along with the GNU C Library; if not, write to the Free
504
 
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
505
 
-   02111-1307 USA.  */
506
 
-
507
 
-#if !defined _SIGNAL_H && !defined __need_siginfo_t \
508
 
-    && !defined __need_sigevent_t
509
 
-# error "Never include this file directly.  Use <signal.h> instead"
510
 
-#endif
511
 
-
512
 
-#include <bits/wordsize.h>
513
 
-
514
 
-#if (!defined __have_sigval_t \
515
 
-     && (defined _SIGNAL_H || defined __need_siginfo_t \
516
 
-        || defined __need_sigevent_t))
517
 
-# define __have_sigval_t       1
518
 
-
519
 
-/* Type for data associated with a signal.  */
520
 
-typedef union sigval
521
 
-  {
522
 
-    int sival_int;
523
 
-    void *sival_ptr;
524
 
-  } sigval_t;
525
 
-#endif
526
 
-
527
 
-#if (!defined __have_siginfo_t \
528
 
-     && (defined _SIGNAL_H || defined __need_siginfo_t))
529
 
-# define __have_siginfo_t      1
530
 
-
531
 
-# define __SI_MAX_SIZE     128
532
 
-# if __WORDSIZE == 64
533
 
-#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 4)
534
 
-# else
535
 
-#  define __SI_PAD_SIZE     ((__SI_MAX_SIZE / sizeof (int)) - 3)
536
 
-# endif
537
 
-
538
 
-typedef struct siginfo
539
 
-  {
540
 
-    int si_signo;              /* Signal number.  */
541
 
-    int si_errno;              /* If non-zero, an errno value associated with
542
 
-                                  this signal, as defined in <errno.h>.  */
543
 
-    int si_code;               /* Signal code.  */
544
 
-
545
 
-    union
546
 
-      {
547
 
-       int _pad[__SI_PAD_SIZE];
548
 
-
549
 
-        /* kill().  */
550
 
-       struct
551
 
-         {
552
 
-           __pid_t si_pid;     /* Sending process ID.  */
553
 
-           unsigned short __pad; /* 16-bit version of si_uid.  */
554
 
-           __uid_t si_uid;     /* Real user ID of sending process.  */
555
 
-         } _kill;
556
 
-
557
 
-       /* POSIX.1b timers.  */
558
 
-       struct
559
 
-         {
560
 
-           int si_tid;         /* Timer ID.  */
561
 
-           int si_overrun;     /* Overrun count.  */
562
 
-           sigval_t si_sigval; /* Signal value.  */
563
 
-         } _timer;
564
 
-
565
 
-       /* POSIX.1b signals.  */
566
 
-       struct
567
 
-         {
568
 
-           __pid_t si_pid;     /* Sending process ID.  */
569
 
-           unsigned short __pad; /* 16-bit version of si_uid.  */
570
 
-           sigval_t si_sigval; /* Signal value.  */
571
 
-           __uid_t si_uid;     /* Real user ID of sending process.  */
572
 
-         } _rt;
573
 
-
574
 
-       /* SIGCHLD.  */
575
 
-       struct
576
 
-         {
577
 
-           __pid_t si_pid;     /* Which child.  */
578
 
-           unsigned short __pad; /* 16-bit version of si_uid.  */
579
 
-           int si_status;      /* Exit value or signal.  */
580
 
-           __clock_t si_utime;
581
 
-           __clock_t si_stime;
582
 
-           __uid_t si_uid;     /* Real user ID of sending process.  */
583
 
-         } _sigchld;
584
 
-
585
 
-       /* SIGILL, SIGFPE, SIGSEGV, SIGBUS.  */
586
 
-       struct
587
 
-         {
588
 
-           void *si_addr;      /* Faulting insn/memory ref.  */
589
 
-         } _sigfault;
590
 
-
591
 
-       /* SIGPOLL.  */
592
 
-       struct
593
 
-         {
594
 
-           long int si_band;   /* Band event for SIGPOLL.  */
595
 
-           int si_fd;
596
 
-         } _sigpoll;
597
 
-      } _sifields;
598
 
-  } siginfo_t;
599
 
-
600
 
-
601
 
-/* X/Open requires some more fields with fixed names.  */
602
 
-# define si_pid                _sifields._kill.si_pid
603
 
-# define si_uid                _sifields._kill.si_uid
604
 
-# define si_timerid    _sifields._timer.si_tid
605
 
-# define si_overrun    _sifields._timer.si_overrun
606
 
-# define si_status     _sifields._sigchld.si_status
607
 
-# define si_utime      _sifields._sigchld.si_utime
608
 
-# define si_stime      _sifields._sigchld.si_stime
609
 
-# define si_value      _sifields._rt.si_sigval
610
 
-# define si_int                _sifields._rt.si_sigval.sival_int
611
 
-# define si_ptr                _sifields._rt.si_sigval.sival_ptr
612
 
-# define si_addr       _sifields._sigfault.si_addr
613
 
-# define si_band       _sifields._sigpoll.si_band
614
 
-# define si_fd         _sifields._sigpoll.si_fd
615
 
-
616
 
-
617
 
-/* Values for `si_code'.  Positive values are reserved for kernel-generated
618
 
-   signals.  */
619
 
-enum
620
 
-{
621
 
-  SI_ASYNCNL = -60,            /* Sent by asynch name lookup completion.  */
622
 
-# define SI_ASYNCNL    SI_ASYNCNL
623
 
-  SI_TKILL = -6,               /* Sent by tkill.  */
624
 
-# define SI_TKILL      SI_TKILL
625
 
-  SI_SIGIO,                    /* Sent by queued SIGIO. */
626
 
-# define SI_SIGIO      SI_SIGIO
627
 
-  SI_ASYNCIO,                  /* Sent by AIO completion.  */
628
 
-# define SI_ASYNCIO    SI_ASYNCIO
629
 
-  SI_MESGQ,                    /* Sent by real time mesq state change.  */
630
 
-# define SI_MESGQ      SI_MESGQ
631
 
-  SI_TIMER,                    /* Sent by timer expiration.  */
632
 
-# define SI_TIMER      SI_TIMER
633
 
-  SI_QUEUE,                    /* Sent by sigqueue.  */
634
 
-# define SI_QUEUE      SI_QUEUE
635
 
-  SI_USER,                     /* Sent by kill, sigsend, raise.  */
636
 
-# define SI_USER       SI_USER
637
 
-  SI_KERNEL = 0x80             /* Send by kernel.  */
638
 
-#define SI_KERNEL      SI_KERNEL
639
 
-};
640
 
-
641
 
-
642
 
-/* `si_code' values for SIGILL signal.  */
643
 
-enum
644
 
-{
645
 
-  ILL_ILLOPC = 1,              /* Illegal opcode.  */
646
 
-# define ILL_ILLOPC    ILL_ILLOPC
647
 
-  ILL_ILLOPN,                  /* Illegal operand.  */
648
 
-# define ILL_ILLOPN    ILL_ILLOPN
649
 
-  ILL_ILLADR,                  /* Illegal addressing mode.  */
650
 
-# define ILL_ILLADR    ILL_ILLADR
651
 
-  ILL_ILLTRP,                  /* Illegal trap. */
652
 
-# define ILL_ILLTRP    ILL_ILLTRP
653
 
-  ILL_PRVOPC,                  /* Privileged opcode.  */
654
 
-# define ILL_PRVOPC    ILL_PRVOPC
655
 
-  ILL_PRVREG,                  /* Privileged register.  */
656
 
-# define ILL_PRVREG    ILL_PRVREG
657
 
-  ILL_COPROC,                  /* Coprocessor error.  */
658
 
-# define ILL_COPROC    ILL_COPROC
659
 
-  ILL_BADSTK                   /* Internal stack error.  */
660
 
-# define ILL_BADSTK    ILL_BADSTK
661
 
-};
662
 
-
663
 
-/* `si_code' values for SIGFPE signal.  */
664
 
-enum
665
 
-{
666
 
-  FPE_INTDIV = 1,              /* Integer divide by zero.  */
667
 
-# define FPE_INTDIV    FPE_INTDIV
668
 
-  FPE_INTOVF,                  /* Integer overflow.  */
669
 
-# define FPE_INTOVF    FPE_INTOVF
670
 
-  FPE_FLTDIV,                  /* Floating point divide by zero.  */
671
 
-# define FPE_FLTDIV    FPE_FLTDIV
672
 
-  FPE_FLTOVF,                  /* Floating point overflow.  */
673
 
-# define FPE_FLTOVF    FPE_FLTOVF
674
 
-  FPE_FLTUND,                  /* Floating point underflow.  */
675
 
-# define FPE_FLTUND    FPE_FLTUND
676
 
-  FPE_FLTRES,                  /* Floating point inexact result.  */
677
 
-# define FPE_FLTRES    FPE_FLTRES
678
 
-  FPE_FLTINV,                  /* Floating point invalid operation.  */
679
 
-# define FPE_FLTINV    FPE_FLTINV
680
 
-  FPE_FLTSUB                   /* Subscript out of range.  */
681
 
-# define FPE_FLTSUB    FPE_FLTSUB
682
 
-};
683
 
-
684
 
-/* `si_code' values for SIGSEGV signal.  */
685
 
-enum
686
 
-{
687
 
-  SEGV_MAPERR = 1,             /* Address not mapped to object.  */
688
 
-# define SEGV_MAPERR   SEGV_MAPERR
689
 
-  SEGV_ACCERR                  /* Invalid permissions for mapped object.  */
690
 
-# define SEGV_ACCERR   SEGV_ACCERR
691
 
-};
692
 
-
693
 
-/* `si_code' values for SIGBUS signal.  */
694
 
-enum
695
 
-{
696
 
-  BUS_ADRALN = 1,              /* Invalid address alignment.  */
697
 
-# define BUS_ADRALN    BUS_ADRALN
698
 
-  BUS_ADRERR,                  /* Non-existant physical address.  */
699
 
-# define BUS_ADRERR    BUS_ADRERR
700
 
-  BUS_OBJERR                   /* Object specific hardware error.  */
701
 
-# define BUS_OBJERR    BUS_OBJERR
702
 
-};
703
 
-
704
 
-/* `si_code' values for SIGTRAP signal.  */
705
 
-enum
706
 
-{
707
 
-  TRAP_BRKPT = 1,              /* Process breakpoint.  */
708
 
-# define TRAP_BRKPT    TRAP_BRKPT
709
 
-  TRAP_TRACE                   /* Process trace trap.  */
710
 
-# define TRAP_TRACE    TRAP_TRACE
711
 
-};
712
 
-
713
 
-/* `si_code' values for SIGCHLD signal.  */
714
 
-enum
715
 
-{
716
 
-  CLD_EXITED = 1,              /* Child has exited.  */
717
 
-# define CLD_EXITED    CLD_EXITED
718
 
-  CLD_KILLED,                  /* Child was killed.  */
719
 
-# define CLD_KILLED    CLD_KILLED
720
 
-  CLD_DUMPED,                  /* Child terminated abnormally.  */
721
 
-# define CLD_DUMPED    CLD_DUMPED
722
 
-  CLD_TRAPPED,                 /* Traced child has trapped.  */
723
 
-# define CLD_TRAPPED   CLD_TRAPPED
724
 
-  CLD_STOPPED,                 /* Child has stopped.  */
725
 
-# define CLD_STOPPED   CLD_STOPPED
726
 
-  CLD_CONTINUED                        /* Stopped child has continued.  */
727
 
-# define CLD_CONTINUED CLD_CONTINUED
728
 
-};
729
 
-
730
 
-/* `si_code' values for SIGPOLL signal.  */
731
 
-enum
732
 
-{
733
 
-  POLL_IN = 1,                 /* Data input available.  */
734
 
-# define POLL_IN       POLL_IN
735
 
-  POLL_OUT,                    /* Output buffers available.  */
736
 
-# define POLL_OUT      POLL_OUT
737
 
-  POLL_MSG,                    /* Input message available.   */
738
 
-# define POLL_MSG      POLL_MSG
739
 
-  POLL_ERR,                    /* I/O error.  */
740
 
-# define POLL_ERR      POLL_ERR
741
 
-  POLL_PRI,                    /* High priority input available.  */
742
 
-# define POLL_PRI      POLL_PRI
743
 
-  POLL_HUP                     /* Device disconnected.  */
744
 
-# define POLL_HUP      POLL_HUP
745
 
-};
746
 
-
747
 
-# undef __need_siginfo_t
748
 
-#endif /* !have siginfo_t && (have _SIGNAL_H || need siginfo_t).  */
749
 
-
750
 
-
751
 
-#if (defined _SIGNAL_H || defined __need_sigevent_t) \
752
 
-    && !defined __have_sigevent_t
753
 
-# define __have_sigevent_t     1
754
 
-
755
 
-/* Structure to transport application-defined values with signals.  */
756
 
-# define __SIGEV_MAX_SIZE      64
757
 
-# if __WORDSIZE == 64
758
 
-#  define __SIGEV_PAD_SIZE     ((__SIGEV_MAX_SIZE / sizeof (int)) - 4)
759
 
-# else
760
 
-#  define __SIGEV_PAD_SIZE     ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
761
 
-# endif
762
 
-
763
 
-typedef struct sigevent
764
 
-  {
765
 
-    sigval_t sigev_value;
766
 
-    int sigev_signo;
767
 
-    int sigev_notify;
768
 
-
769
 
-    union
770
 
-      {
771
 
-       int _pad[__SIGEV_PAD_SIZE];
772
 
-
773
 
-       /* When SIGEV_SIGNAL and SIGEV_THREAD_ID set, LWP ID of the
774
 
-          thread to receive the signal.  */
775
 
-       __pid_t _tid;
776
 
-
777
 
-       struct
778
 
-         {
779
 
-           void (*_function) (sigval_t);       /* Function to start.  */
780
 
-           void *_attribute;                   /* Really pthread_attr_t.  */
781
 
-         } _sigev_thread;
782
 
-      } _sigev_un;
783
 
-  } sigevent_t;
784
 
-
785
 
-/* POSIX names to access some of the members.  */
786
 
-# define sigev_notify_function   _sigev_un._sigev_thread._function
787
 
-# define sigev_notify_attributes _sigev_un._sigev_thread._attribute
788
 
-
789
 
-/* `sigev_notify' values.  */
790
 
-enum
791
 
-{
792
 
-  SIGEV_SIGNAL = 0,            /* Notify via signal.  */
793
 
-# define SIGEV_SIGNAL  SIGEV_SIGNAL
794
 
-  SIGEV_NONE,                  /* Other notification: meaningless.  */
795
 
-# define SIGEV_NONE    SIGEV_NONE
796
 
-  SIGEV_THREAD,                        /* Deliver via thread creation.  */
797
 
-# define SIGEV_THREAD  SIGEV_THREAD
798
 
-
799
 
-  SIGEV_THREAD_ID = 4          /* Send signal to specific thread.  */
800
 
-#define SIGEV_THREAD_ID        SIGEV_THREAD_ID
801
 
-};
802
 
-
803
 
-#endif /* have _SIGNAL_H.  */
804
 
From: Maxim Kuvyrkov <maxim@codesourcery.com>
805
 
Date: Tue, 9 Mar 2010 10:34:24 +0000 (-0800)
806
 
Subject: m68k: update ColdFire sigcontext ABI
807
 
X-Git-Tag: glibc-2.12~39
808
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=75e73e66e49104a7aff24aa50043ae7ab02e38f3
809
 
 
810
 
m68k: update ColdFire sigcontext ABI
811
 
---
812
 
 
813
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
814
 
index e2b54e5..d63b88e 100644
815
 
--- a/ports/ChangeLog.m68k
816
 
+++ b/ports/ChangeLog.m68k
817
 
@@ -1,5 +1,8 @@
818
 
 2010-03-09  Maxim Kuvyrkov  <maxim@codesourcery.com>
819
 
 
820
 
+       * sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h: Remove.
821
 
+       * sysdeps/unix/sysv/linux/m68k/register-dump.h: Update.
822
 
+
823
 
        * sysdeps/unix/sysv/linux/m68k/bits/siginfo.h: Remove.
824
 
 
825
 
        * sysdeps/m68k/jmpbuf-unwind.h (_JMPBUF_CFA_UNWINDS_ADJ)
826
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h
827
 
deleted file mode 100644
828
 
index 8ad0c96..0000000
829
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h
830
 
+++ /dev/null
831
 
@@ -1,62 +0,0 @@
832
 
-/* Copyright (C) 2006 Free Software Foundation, Inc.
833
 
-   This file is part of the GNU C Library.
834
 
-
835
 
-   The GNU C Library is free software; you can redistribute it and/or
836
 
-   modify it under the terms of the GNU Lesser General Public
837
 
-   License as published by the Free Software Foundation; either
838
 
-   version 2.1 of the License, or (at your option) any later version.
839
 
-
840
 
-   The GNU C Library is distributed in the hope that it will be useful,
841
 
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
842
 
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
843
 
-   Lesser General Public License for more details.
844
 
-
845
 
-   You should have received a copy of the GNU Lesser General Public
846
 
-   License along with the GNU C Library; if not, write to the Free
847
 
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
848
 
-   02111-1307 USA.  */
849
 
-
850
 
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
851
 
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
852
 
-#endif
853
 
-
854
 
-#ifndef _BITS_SIGCONTEXT_H
855
 
-#define _BITS_SIGCONTEXT_H 1
856
 
-
857
 
-struct sigcontext {
858
 
-  unsigned long sc_mask;
859
 
-  unsigned long sc_usp;
860
 
-  unsigned long sc_d0;
861
 
-  unsigned long sc_d1;
862
 
-#ifdef __mcoldfire__
863
 
-  unsigned long sc_d2;
864
 
-  unsigned long sc_d3;
865
 
-  unsigned long sc_d4;
866
 
-  unsigned long sc_d5;
867
 
-  unsigned long sc_d6;
868
 
-  unsigned long sc_d7;
869
 
-#endif
870
 
-  unsigned long sc_a0;
871
 
-  unsigned long sc_a1;
872
 
-#ifdef __mcoldfire__
873
 
-  unsigned long sc_a2;
874
 
-  unsigned long sc_a3;
875
 
-  unsigned long sc_a4;
876
 
-  unsigned long sc_a5;
877
 
-  unsigned long sc_a6;
878
 
-#endif
879
 
-  unsigned short sc_sr;
880
 
-  unsigned long sc_pc;
881
 
-  unsigned short sc_formatvec;
882
 
-#ifdef __mcoldfire__
883
 
-  unsigned long sc_fpregs[8][2];
884
 
-  unsigned long sc_fpcntl[3];
885
 
-  unsigned char sc_fpstate[16];
886
 
-#else
887
 
-  unsigned long sc_fpregs[2*3];
888
 
-  unsigned long sc_fpcntl[3];
889
 
-  unsigned char sc_fpstate[216];
890
 
-#endif
891
 
-};
892
 
-
893
 
-#endif
894
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/register-dump.h b/ports/sysdeps/unix/sysv/linux/m68k/register-dump.h
895
 
index 391902f..78709d9 100644
896
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/register-dump.h
897
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/register-dump.h
898
 
@@ -40,7 +40,6 @@
899
 
 
900
 
 */
901
 
 
902
 
-#ifndef __mcoldfire__
903
 
 /* Linux saves only the call-clobbered registers in the sigcontext.  We
904
 
    need to use a trampoline that saves the rest so that the C code can
905
 
    access them.  We use the sc_fpstate field, since the handler is not
906
 
@@ -59,14 +58,17 @@ catch_segfault:\n\
907
 
        /* Clear the first 4 bytes to make it a null fp state, just\n\
908
 
           in case the handler does return.  */\n\
909
 
        clr.l (%%a0)+\n\
910
 
-       movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n\
911
 
-       fmovem.x %%fp2-%%fp7,11*4(%%a0)\n\
912
 
-       jra real_catch_segfault"
913
 
+       movem.l %%d2-%%d7/%%a2-%%a6,(%%a0)\n"
914
 
+#ifndef __mcoldfire__
915
 
+       "fmovem.x %%fp2-%%fp7,11*4(%%a0)\n"
916
 
+#elif defined __mcffpu__
917
 
+       "fmovem.d %%fp2-%%fp7,11*4(%%a0)\n"
918
 
+#endif
919
 
+       "jra real_catch_segfault"
920
 
        : : "n" (offsetof (struct sigcontext, sc_fpstate)));
921
 
 }
922
 
 #define catch_segfault(a,b) \
923
 
   __attribute_used__ real_catch_segfault(a,b)
924
 
-#endif
925
 
 
926
 
 static void
927
 
 hexvalue (unsigned long int value, char *buf, size_t len)
928
 
@@ -104,36 +106,19 @@ register_dump (int fd, struct sigcontext *ctx)
929
 
   /* Generate strings of register contents.  */
930
 
   hexvalue (ctx->sc_d0, regs[0], 8);
931
 
   hexvalue (ctx->sc_d1, regs[1], 8);
932
 
-#ifdef __mcoldfire__
933
 
-  hexvalue (ctx->sc_d2, regs[2], 8);
934
 
-  hexvalue (ctx->sc_d3, regs[3], 8);
935
 
-  hexvalue (ctx->sc_d4, regs[4], 8);
936
 
-  hexvalue (ctx->sc_d5, regs[5], 8);
937
 
-  hexvalue (ctx->sc_d6, regs[6], 8);
938
 
-  hexvalue (ctx->sc_d7, regs[7], 8);
939
 
-#else
940
 
   hexvalue (*p++, regs[2], 8);
941
 
   hexvalue (*p++, regs[3], 8);
942
 
   hexvalue (*p++, regs[4], 8);
943
 
   hexvalue (*p++, regs[5], 8);
944
 
   hexvalue (*p++, regs[6], 8);
945
 
   hexvalue (*p++, regs[7], 8);
946
 
-#endif
947
 
   hexvalue (ctx->sc_a0, regs[8], 8);
948
 
   hexvalue (ctx->sc_a1, regs[9], 8);
949
 
-#ifdef __mcoldfire__
950
 
-  hexvalue (ctx->sc_a2, regs[10], 8);
951
 
-  hexvalue (ctx->sc_a3, regs[11], 8);
952
 
-  hexvalue (ctx->sc_a4, regs[12], 8);
953
 
-  hexvalue (ctx->sc_a5, regs[13], 8);
954
 
-  hexvalue (ctx->sc_a6, regs[14], 8);
955
 
-#else
956
 
   hexvalue (*p++, regs[10], 8);
957
 
   hexvalue (*p++, regs[11], 8);
958
 
   hexvalue (*p++, regs[12], 8);
959
 
   hexvalue (*p++, regs[13], 8);
960
 
   hexvalue (*p++, regs[14], 8);
961
 
-#endif
962
 
   hexvalue (ctx->sc_usp, regs[15], 8);
963
 
   hexvalue (ctx->sc_pc, regs[16], 8);
964
 
   hexvalue (ctx->sc_sr, regs[17], 4);
965
 
@@ -142,9 +127,6 @@ register_dump (int fd, struct sigcontext *ctx)
966
 
   for (i = 0; i < 2; i++)
967
 
     for (j = 0; j < fpreg_size; j += 8)
968
 
       hexvalue (*pfp++, fpregs[i] + j, 8);
969
 
-#ifdef __mcoldfire__
970
 
-  p = pfp;
971
 
-#endif
972
 
   for (i = 2; i < 8; i++)
973
 
     for (j = 0; j < fpreg_size; j += 8)
974
 
       hexvalue (*p++, fpregs[i] + j, 8);
975
 
From: Maxim Kuvyrkov <maxim@codesourcery.com>
976
 
Date: Fri, 12 Mar 2010 18:50:55 +0000 (+0100)
977
 
Subject: NPTL support for m68k/ColdFire
978
 
X-Git-Tag: glibc-2.12~38
979
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=40111cb9e17a911c8913f00d9b913a71ceb6e609
980
 
 
981
 
NPTL support for m68k/ColdFire
982
 
---
983
 
 
984
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
985
 
index d63b88e..32681ff 100644
986
 
--- a/ports/ChangeLog.m68k
987
 
+++ b/ports/ChangeLog.m68k
988
 
@@ -1,5 +1,45 @@
989
 
 2010-03-09  Maxim Kuvyrkov  <maxim@codesourcery.com>
990
 
 
991
 
+       NPTL support for m68k/ColdFire
992
 
+       * sysdeps/unix/sysv/linux/m68k/sysdep.h (tls.h): Include.
993
 
+       (INTERNAL_SYSCALL): Convert to INTERNAL_SYSCALL_NCS.
994
 
+       (PTR_MANGLE, PTR_DEMANGLE): Define.
995
 
+       (NEED_STATIC_SYSINFO_DSO): Define.
996
 
+       * sysdeps/unix/sysv/linux/m68k/clone.S: Support RESET_PID.
997
 
+       * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: New.
998
 
+       * sysdeps/unix/sysv/linux/m68k/Makefile: Add new files to lists.
999
 
+       * sysdeps/unix/sysv/linux/m68k/vfork.S: Add SAVE_PID/RESTORE_PID.
1000
 
+       * sysdeps/unix/sysv/linux/m68k/m68k-vdso.c: New.
1001
 
+       * sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c: New.
1002
 
+       * sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: New.
1003
 
+       * sysdeps/unix/sysv/linux/m68k/coldfire/nptl/bits/atomic.h: New.
1004
 
+       * sysdeps/unix/sysv/linux/m68k/Versions: Add symbols for NPTL support.
1005
 
+       * sysdeps/unix/sysv/linux/m68k/init-first.c: New.
1006
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h: New.
1007
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h: New.
1008
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/bits/semaphore.h: New.
1009
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/clone.S: New.
1010
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/fork.c: New.
1011
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h: New.
1012
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/vfork.S: New.
1013
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S: New.
1014
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/createthread.c: New.
1015
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/pthread_once.c: New.
1016
 
+       * sysdeps/unix/sysv/linux/m68k/socket.S: Update cancelation code.
1017
 
+       * sysdeps/m68k/dl-tls.h: New.
1018
 
+       * sysdeps/m68k/libc-tls.c: New.
1019
 
+       * sysdeps/m68k/tls-macros.h: New.
1020
 
+       * sysdeps/m68k/dl-machine.h (RTLD_START): Terminate stack frame to
1021
 
+       generate better backtraces.
1022
 
+       (elf_machine_type_class, elf_machine_rela): Handle TLS relocations.
1023
 
+       * sysdeps/m68k/dl-machine.h: Handle TLS relocations.
1024
 
+       * sysdeps/m68k/nptl/tcb-offsets.sym: New.
1025
 
+       * sysdeps/m68k/nptl/pthread_spin_trylock.c: New.
1026
 
+       * sysdeps/m68k/nptl/tls.h: New.
1027
 
+       * sysdeps/m68k/nptl/pthread_spin_lock.c: New.
1028
 
+       * sysdeps/m68k/nptl/pthreaddef.h: New.
1029
 
+       * sysdeps/m68k/nptl/Makefile: New.
1030
 
+
1031
 
        * sysdeps/unix/sysv/linux/m68k/bits/sigcontext.h: Remove.
1032
 
        * sysdeps/unix/sysv/linux/m68k/register-dump.h: Update.
1033
 
 
1034
 
diff --git a/ports/sysdeps/m68k/dl-machine.h b/ports/sysdeps/m68k/dl-machine.h
1035
 
index 08a4396..9bc35e7 100644
1036
 
--- a/ports/sysdeps/m68k/dl-machine.h
1037
 
+++ b/ports/sysdeps/m68k/dl-machine.h
1038
 
@@ -1,5 +1,6 @@
1039
 
 /* Machine-dependent ELF dynamic relocation inline functions.  m68k version.
1040
 
-   Copyright (C) 1996-2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
1041
 
+   Copyright (C) 1996-2001, 2002, 2003, 2004, 2005, 2010
1042
 
+   Free Software Foundation, Inc.
1043
 
    This file is part of the GNU C Library.
1044
 
 
1045
 
    The GNU C Library is free software; you can redistribute it and/or
1046
 
@@ -24,6 +25,7 @@
1047
 
 
1048
 
 #include <sys/param.h>
1049
 
 #include <sysdep.h>
1050
 
+#include <dl-tls.h>
1051
 
 
1052
 
 /* Return nonzero iff ELF header is compatible with the running host.  */
1053
 
 static inline int
1054
 
@@ -121,6 +123,7 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
1055
 
        .globl _start\n\
1056
 
        .type _start,@function\n\
1057
 
 _start:\n\
1058
 
+       sub.l %fp, %fp\n\
1059
 
        move.l %sp, -(%sp)\n\
1060
 
        jbsr _dl_start\n\
1061
 
        addq.l #4, %sp\n\
1062
 
@@ -159,12 +162,16 @@ _dl_start_user:\n\
1063
 
        .size _dl_start_user, . - _dl_start_user\n\
1064
 
        .previous");
1065
 
 
1066
 
-/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
1067
 
-   PLT entries should not be allowed to define the value.
1068
 
+/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry or
1069
 
+   TLS variable, so undefined references should not be allowed to
1070
 
+   define the value.
1071
 
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
1072
 
    of the main executable's symbols, as for a COPY reloc.  */
1073
 
 #define elf_machine_type_class(type) \
1074
 
-  ((((type) == R_68K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)  \
1075
 
+  ((((type) == R_68K_JMP_SLOT       \
1076
 
+     || (type) == R_68K_TLS_DTPMOD32 \
1077
 
+     || (type) == R_68K_TLS_DTPREL32 \
1078
 
+     || (type) == R_68K_TLS_TPREL32) * ELF_RTYPE_CLASS_PLT)    \
1079
 
    | (((type) == R_68K_COPY) * ELF_RTYPE_CLASS_COPY))
1080
 
 
1081
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
1082
 
@@ -262,6 +269,25 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
1083
 
        case R_68K_PC32:
1084
 
          *reloc_addr = value + reloc->r_addend - (Elf32_Addr) reloc_addr;
1085
 
          break;
1086
 
+#if defined USE_TLS && !defined RTLD_BOOTSTRAP
1087
 
+       case R_68K_TLS_DTPMOD32:
1088
 
+         /* Get the information from the link map returned by the
1089
 
+            resolv function.  */
1090
 
+         if (sym_map != NULL)
1091
 
+           *reloc_addr = sym_map->l_tls_modid;
1092
 
+         break;
1093
 
+       case R_68K_TLS_DTPREL32:
1094
 
+         if (sym != NULL)
1095
 
+           *reloc_addr = TLS_DTPREL_VALUE (sym, reloc);
1096
 
+         break;
1097
 
+       case R_68K_TLS_TPREL32:
1098
 
+         if (sym != NULL)
1099
 
+           {
1100
 
+             CHECK_STATIC_TLS (map, sym_map);
1101
 
+             *reloc_addr = TLS_TPREL_VALUE (sym_map, sym, reloc);
1102
 
+           }
1103
 
+         break;
1104
 
+#endif /* defined USE_TLS && !defined RTLD_BOOTSTRAP */
1105
 
        case R_68K_NONE:                /* Alright, Wilbur.  */
1106
 
          break;
1107
 
        default:
1108
 
diff --git a/ports/sysdeps/m68k/dl-tls.h b/ports/sysdeps/m68k/dl-tls.h
1109
 
new file mode 100644
1110
 
index 0000000..f2ce998
1111
 
--- /dev/null
1112
 
+++ b/ports/sysdeps/m68k/dl-tls.h
1113
 
@@ -0,0 +1,48 @@
1114
 
+/* Thread-local storage handling in the ELF dynamic linker.  M68K version.
1115
 
+   Copyright (C) 2010 Free Software Foundation, Inc.
1116
 
+   This file is part of the GNU C Library.
1117
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1118
 
+
1119
 
+   The GNU C Library is free software; you can redistribute it and/or
1120
 
+   modify it under the terms of the GNU Lesser General Public
1121
 
+   License as published by the Free Software Foundation; either
1122
 
+   version 2.1 of the License, or (at your option) any later version.
1123
 
+
1124
 
+   The GNU C Library is distributed in the hope that it will be useful,
1125
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1126
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1127
 
+   Lesser General Public License for more details.
1128
 
+
1129
 
+   You should have received a copy of the GNU Lesser General Public
1130
 
+   License along with the GNU C Library; if not, write to the Free
1131
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1132
 
+   02111-1307 USA.  */
1133
 
+
1134
 
+
1135
 
+/* Type used for the representation of TLS information in the GOT.  */
1136
 
+typedef struct
1137
 
+{
1138
 
+  unsigned long int ti_module;
1139
 
+  unsigned long int ti_offset;
1140
 
+} tls_index;
1141
 
+
1142
 
+/* The thread pointer points 0x7000 past the first static TLS block.  */
1143
 
+#define TLS_TP_OFFSET          0x7000
1144
 
+
1145
 
+/* Dynamic thread vector pointers point 0x8000 past the start of each
1146
 
+   TLS block.  */
1147
 
+#define TLS_DTV_OFFSET         0x8000
1148
 
+
1149
 
+/* Compute the value for a TPREL reloc.  */
1150
 
+#define TLS_TPREL_VALUE(sym_map, sym, reloc)                           \
1151
 
+  ((sym_map)->l_tls_offset + (sym)->st_value + (reloc)->r_addend       \
1152
 
+   - TLS_TP_OFFSET)
1153
 
+
1154
 
+/* Compute the value for a DTPREL reloc.  */
1155
 
+#define TLS_DTPREL_VALUE(sym, reloc)                           \
1156
 
+  ((sym)->st_value + (reloc)->r_addend - TLS_DTV_OFFSET)
1157
 
+
1158
 
+extern void *__tls_get_addr (tls_index *ti);
1159
 
+
1160
 
+#define GET_ADDR_OFFSET                (ti->ti_offset + TLS_DTV_OFFSET)
1161
 
+#define __TLS_GET_ADDR(__ti)   (__tls_get_addr (__ti) - TLS_DTV_OFFSET)
1162
 
diff --git a/ports/sysdeps/m68k/libc-tls.c b/ports/sysdeps/m68k/libc-tls.c
1163
 
new file mode 100644
1164
 
index 0000000..e865fac
1165
 
--- /dev/null
1166
 
+++ b/ports/sysdeps/m68k/libc-tls.c
1167
 
@@ -0,0 +1,38 @@
1168
 
+/* Thread-local storage handling in the ELF dynamic linker.  m68k version.
1169
 
+   Copyright (C) 2010 Free Software Foundation, Inc.
1170
 
+   This file is part of the GNU C Library.
1171
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1172
 
+
1173
 
+   The GNU C Library is free software; you can redistribute it and/or
1174
 
+   modify it under the terms of the GNU Lesser General Public
1175
 
+   License as published by the Free Software Foundation; either
1176
 
+   version 2.1 of the License, or (at your option) any later version.
1177
 
+
1178
 
+   The GNU C Library is distributed in the hope that it will be useful,
1179
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1180
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1181
 
+   Lesser General Public License for more details.
1182
 
+
1183
 
+   You should have received a copy of the GNU Lesser General Public
1184
 
+   License along with the GNU C Library; if not, write to the Free
1185
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1186
 
+   02111-1307 USA.  */
1187
 
+
1188
 
+#include <csu/libc-tls.c>
1189
 
+#include <dl-tls.h>
1190
 
+
1191
 
+#if USE_TLS
1192
 
+
1193
 
+/* On M68K, linker optimizations are not required, so __tls_get_addr
1194
 
+   can be called even in statically linked binaries.  In this case module
1195
 
+   must be always 1 and PT_TLS segment exist in the binary, otherwise it
1196
 
+   would not link.  */
1197
 
+
1198
 
+void *
1199
 
+__tls_get_addr (tls_index *ti)
1200
 
+{
1201
 
+  dtv_t *dtv = THREAD_DTV ();
1202
 
+  return (char *) dtv[1].pointer.val + GET_ADDR_OFFSET;
1203
 
+}
1204
 
+
1205
 
+#endif
1206
 
diff --git a/ports/sysdeps/m68k/nptl/Makefile b/ports/sysdeps/m68k/nptl/Makefile
1207
 
new file mode 100644
1208
 
index 0000000..f36fc8f
1209
 
--- /dev/null
1210
 
+++ b/ports/sysdeps/m68k/nptl/Makefile
1211
 
@@ -0,0 +1,22 @@
1212
 
+# Copyright (C) 2010 Free Software Foundation, Inc.
1213
 
+# This file is part of the GNU C Library.
1214
 
+# Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1215
 
+#
1216
 
+# The GNU C Library is free software; you can redistribute it and/or
1217
 
+# modify it under the terms of the GNU Lesser General Public
1218
 
+# License as published by the Free Software Foundation; either
1219
 
+# version 2.1 of the License, or (at your option) any later version.
1220
 
+#
1221
 
+# The GNU C Library is distributed in the hope that it will be useful,
1222
 
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1223
 
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1224
 
+# Lesser General Public License for more details.
1225
 
+#
1226
 
+# You should have received a copy of the GNU Lesser General Public
1227
 
+# License along with the GNU C Library; if not, write to the Free
1228
 
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1229
 
+# 02111-1307 USA.
1230
 
+
1231
 
+ifeq ($(subdir),csu)
1232
 
+gen-as-const-headers += tcb-offsets.sym
1233
 
+endif
1234
 
diff --git a/ports/sysdeps/m68k/nptl/pthread_spin_lock.c b/ports/sysdeps/m68k/nptl/pthread_spin_lock.c
1235
 
new file mode 100644
1236
 
index 0000000..1cc16c8
1237
 
--- /dev/null
1238
 
+++ b/ports/sysdeps/m68k/nptl/pthread_spin_lock.c
1239
 
@@ -0,0 +1,31 @@
1240
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
1241
 
+   This file is part of the GNU C Library.
1242
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1243
 
+
1244
 
+   The GNU C Library is free software; you can redistribute it and/or
1245
 
+   modify it under the terms of the GNU Lesser General Public
1246
 
+   License as published by the Free Software Foundation; either
1247
 
+   version 2.1 of the License, or (at your option) any later version.
1248
 
+
1249
 
+   The GNU C Library is distributed in the hope that it will be useful,
1250
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1251
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1252
 
+   Lesser General Public License for more details.
1253
 
+
1254
 
+   You should have received a copy of the GNU Lesser General Public
1255
 
+   License along with the GNU C Library; if not, write to the Free
1256
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1257
 
+   02111-1307 USA.  */
1258
 
+
1259
 
+#include <atomic.h>
1260
 
+#include "pthreadP.h"
1261
 
+
1262
 
+int
1263
 
+pthread_spin_lock (pthread_spinlock_t *lock)
1264
 
+{
1265
 
+  while (atomic_compare_and_exchange_val_acq(lock, 1, 0) != 0)
1266
 
+   while (*lock != 0)
1267
 
+    ;
1268
 
+
1269
 
+  return 0;
1270
 
+}
1271
 
diff --git a/ports/sysdeps/m68k/nptl/pthread_spin_trylock.c b/ports/sysdeps/m68k/nptl/pthread_spin_trylock.c
1272
 
new file mode 100644
1273
 
index 0000000..831bffb
1274
 
--- /dev/null
1275
 
+++ b/ports/sysdeps/m68k/nptl/pthread_spin_trylock.c
1276
 
@@ -0,0 +1,28 @@
1277
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
1278
 
+   This file is part of the GNU C Library.
1279
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1280
 
+
1281
 
+   The GNU C Library is free software; you can redistribute it and/or
1282
 
+   modify it under the terms of the GNU Lesser General Public
1283
 
+   License as published by the Free Software Foundation; either
1284
 
+   version 2.1 of the License, or (at your option) any later version.
1285
 
+
1286
 
+   The GNU C Library is distributed in the hope that it will be useful,
1287
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1288
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1289
 
+   Lesser General Public License for more details.
1290
 
+
1291
 
+   You should have received a copy of the GNU Lesser General Public
1292
 
+   License along with the GNU C Library; if not, write to the Free
1293
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1294
 
+   02111-1307 USA.  */
1295
 
+
1296
 
+#include <errno.h>
1297
 
+#include <atomic.h>
1298
 
+#include "pthreadP.h"
1299
 
+
1300
 
+int
1301
 
+pthread_spin_trylock (pthread_spinlock_t *lock)
1302
 
+{
1303
 
+  return atomic_compare_and_exchange_val_acq(lock, 1, 0) ? EBUSY : 0;
1304
 
+}
1305
 
diff --git a/ports/sysdeps/m68k/nptl/pthreaddef.h b/ports/sysdeps/m68k/nptl/pthreaddef.h
1306
 
new file mode 100644
1307
 
index 0000000..0a54907
1308
 
--- /dev/null
1309
 
+++ b/ports/sysdeps/m68k/nptl/pthreaddef.h
1310
 
@@ -0,0 +1,39 @@
1311
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
1312
 
+   This file is part of the GNU C Library.
1313
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1314
 
+
1315
 
+   The GNU C Library is free software; you can redistribute it and/or
1316
 
+   modify it under the terms of the GNU Lesser General Public
1317
 
+   License as published by the Free Software Foundation; either
1318
 
+   version 2.1 of the License, or (at your option) any later version.
1319
 
+
1320
 
+   The GNU C Library is distributed in the hope that it will be useful,
1321
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1322
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1323
 
+   Lesser General Public License for more details.
1324
 
+
1325
 
+   You should have received a copy of the GNU Lesser General Public
1326
 
+   License along with the GNU C Library; if not, write to the Free
1327
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1328
 
+   02111-1307 USA.  */
1329
 
+
1330
 
+/* Default stack size.  */
1331
 
+#define ARCH_STACK_DEFAULT_SIZE        (2 * 1024 * 1024)
1332
 
+
1333
 
+/* Required stack pointer alignment at beginning.  */
1334
 
+#define STACK_ALIGN            16
1335
 
+
1336
 
+/* Minimal stack size after allocating thread descriptor and guard size.  */
1337
 
+#define MINIMAL_REST_STACK     2048
1338
 
+
1339
 
+/* Alignment requirement for TCB.  */
1340
 
+#define TCB_ALIGNMENT          16
1341
 
+
1342
 
+
1343
 
+/* Location of current stack frame.  */
1344
 
+#define CURRENT_STACK_FRAME    __builtin_frame_address (0)
1345
 
+
1346
 
+
1347
 
+/* XXX Until we have a better place keep the definitions here.  */
1348
 
+#define __exit_thread_inline(val) \
1349
 
+  INLINE_SYSCALL (exit, 1, (val))
1350
 
diff --git a/ports/sysdeps/m68k/nptl/tcb-offsets.sym b/ports/sysdeps/m68k/nptl/tcb-offsets.sym
1351
 
new file mode 100644
1352
 
index 0000000..b1bba65
1353
 
--- /dev/null
1354
 
+++ b/ports/sysdeps/m68k/nptl/tcb-offsets.sym
1355
 
@@ -0,0 +1,11 @@
1356
 
+#include <sysdep.h>
1357
 
+#include <tls.h>
1358
 
+
1359
 
+--
1360
 
+
1361
 
+-- Derive offsets relative to the thread register.
1362
 
+#define thread_offsetof(mem)   (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
1363
 
+
1364
 
+MULTIPLE_THREADS_OFFSET                thread_offsetof (header.multiple_threads)
1365
 
+PID_OFFSET                     thread_offsetof (pid)
1366
 
+TID_OFFSET                     thread_offsetof (tid)
1367
 
diff --git a/ports/sysdeps/m68k/nptl/tls.h b/ports/sysdeps/m68k/nptl/tls.h
1368
 
new file mode 100644
1369
 
index 0000000..c29824c
1370
 
--- /dev/null
1371
 
+++ b/ports/sysdeps/m68k/nptl/tls.h
1372
 
@@ -0,0 +1,171 @@
1373
 
+/* Definition for thread-local data handling.  NPTL/m68k version.
1374
 
+   Copyright (C) 2010 Free Software Foundation, Inc.
1375
 
+   This file is part of the GNU C Library.
1376
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1377
 
+
1378
 
+   The GNU C Library is free software; you can redistribute it and/or
1379
 
+   modify it under the terms of the GNU Lesser General Public
1380
 
+   License as published by the Free Software Foundation; either
1381
 
+   version 2.1 of the License, or (at your option) any later version.
1382
 
+
1383
 
+   The GNU C Library is distributed in the hope that it will be useful,
1384
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1385
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1386
 
+   Lesser General Public License for more details.
1387
 
+
1388
 
+   You should have received a copy of the GNU Lesser General Public
1389
 
+   License along with the GNU C Library; if not, write to the Free
1390
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1391
 
+   02111-1307 USA.  */
1392
 
+
1393
 
+#ifndef _TLS_H
1394
 
+#define _TLS_H 1
1395
 
+
1396
 
+#include <dl-sysdep.h>
1397
 
+
1398
 
+#ifndef __ASSEMBLER__
1399
 
+# include <stdbool.h>
1400
 
+# include <stddef.h>
1401
 
+# include <stdint.h>
1402
 
+
1403
 
+/* Type for the dtv.  */
1404
 
+typedef union dtv
1405
 
+{
1406
 
+  size_t counter;
1407
 
+  struct
1408
 
+  {
1409
 
+    void *val;
1410
 
+    bool is_static;
1411
 
+  } pointer;
1412
 
+} dtv_t;
1413
 
+
1414
 
+#else /* __ASSEMBLER__ */
1415
 
+# include <tcb-offsets.h>
1416
 
+#endif /* __ASSEMBLER__ */
1417
 
+
1418
 
+/* Signal that TLS support is available.  */
1419
 
+#define USE_TLS        1
1420
 
+
1421
 
+#ifndef __ASSEMBLER__
1422
 
+
1423
 
+/* Get system call information.  */
1424
 
+# include <sysdep.h>
1425
 
+
1426
 
+/* The TP points to the start of the thread blocks.  */
1427
 
+# define TLS_DTV_AT_TP 1
1428
 
+
1429
 
+/* Get the thread descriptor definition.  */
1430
 
+# include <nptl/descr.h>
1431
 
+
1432
 
+typedef struct
1433
 
+{
1434
 
+  dtv_t *dtv;
1435
 
+  void *private;
1436
 
+} tcbhead_t;
1437
 
+
1438
 
+/* This is the size of the initial TCB.  Because our TCB is before the thread
1439
 
+   pointer, we don't need this.  */
1440
 
+# define TLS_INIT_TCB_SIZE     0
1441
 
+
1442
 
+/* Alignment requirements for the initial TCB.  */
1443
 
+# define TLS_INIT_TCB_ALIGN    __alignof__ (struct pthread)
1444
 
+
1445
 
+/* This is the size of the TCB.  Because our TCB is before the thread
1446
 
+   pointer, we don't need this.  */
1447
 
+# define TLS_TCB_SIZE          0
1448
 
+
1449
 
+/* Alignment requirements for the TCB.  */
1450
 
+# define TLS_TCB_ALIGN         __alignof__ (struct pthread)
1451
 
+
1452
 
+/* This is the size we need before TCB - actually, it includes the TCB.  */
1453
 
+# define TLS_PRE_TCB_SIZE                                              \
1454
 
+  (sizeof (struct pthread)                                             \
1455
 
+   + ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
1456
 
+
1457
 
+/* The thread pointer (TP) points to the end of the
1458
 
+   TCB + 0x7000, as for PowerPC and MIPS.  This implies that TCB address is
1459
 
+   TP - 0x7000.  As we define TLS_DTV_AT_TP we can
1460
 
+   assume that the pthread struct is allocated immediately ahead of the
1461
 
+   TCB.  This implies that the pthread_descr address is
1462
 
+   TP - (TLS_PRE_TCB_SIZE + 0x7000).  */
1463
 
+# define TLS_TCB_OFFSET        0x7000
1464
 
+
1465
 
+/* Install the dtv pointer.  The pointer passed is to the element with
1466
 
+   index -1 which contain the length.  */
1467
 
+# define INSTALL_DTV(tcbp, dtvp) \
1468
 
+  ((tcbhead_t *) (tcbp))[-1].dtv = dtvp + 1
1469
 
+
1470
 
+/* Install new dtv for current thread.  */
1471
 
+# define INSTALL_NEW_DTV(dtv) \
1472
 
+  (THREAD_DTV () = (dtv))
1473
 
+
1474
 
+/* Return dtv of given thread descriptor.  */
1475
 
+# define GET_DTV(tcbp) \
1476
 
+  (((tcbhead_t *) (tcbp))[-1].dtv)
1477
 
+
1478
 
+/* Code to initially initialize the thread pointer.  This might need
1479
 
+   special attention since 'errno' is not yet available and if the
1480
 
+   operation can cause a failure 'errno' must not be touched.  */
1481
 
+# define TLS_INIT_TP(tcbp, secondcall)                                 \
1482
 
+  ({                                                                   \
1483
 
+    INTERNAL_SYSCALL_DECL (err);                                       \
1484
 
+    int _sys_result;                                                   \
1485
 
+                                                                       \
1486
 
+    _sys_result = INTERNAL_SYSCALL (set_thread_area, err, 1,           \
1487
 
+                                   ((void *) (tcbp)) + TLS_TCB_OFFSET); \
1488
 
+    INTERNAL_SYSCALL_ERROR_P (_sys_result, err) ? "unknown error" : NULL; })
1489
 
+
1490
 
+extern void * __m68k_read_tp (void);
1491
 
+
1492
 
+/* Return the address of the dtv for the current thread.  */
1493
 
+# define THREAD_DTV() \
1494
 
+  (((tcbhead_t *) (__m68k_read_tp () - TLS_TCB_OFFSET))[-1].dtv)
1495
 
+
1496
 
+/* Return the thread descriptor for the current thread.  */
1497
 
+# define THREAD_SELF \
1498
 
+  ((struct pthread *) (__m68k_read_tp () - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
1499
 
+
1500
 
+/* Magic for libthread_db to know how to do THREAD_SELF.  */
1501
 
+# define DB_THREAD_SELF \
1502
 
+  CONST_THREAD_AREA (32, TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
1503
 
+
1504
 
+/* Access to data in the thread descriptor is easy.  */
1505
 
+# define THREAD_GETMEM(descr, member) \
1506
 
+  descr->member
1507
 
+# define THREAD_GETMEM_NC(descr, member, idx) \
1508
 
+  descr->member[idx]
1509
 
+# define THREAD_SETMEM(descr, member, value) \
1510
 
+  descr->member = (value)
1511
 
+# define THREAD_SETMEM_NC(descr, member, idx, value) \
1512
 
+  descr->member[idx] = (value)
1513
 
+
1514
 
+/* l_tls_offset == 0 is perfectly valid on M68K, so we have to use some
1515
 
+   different value to mean unset l_tls_offset.  */
1516
 
+# define NO_TLS_OFFSET         -1
1517
 
+
1518
 
+/* Get and set the global scope generation counter in struct pthread.  */
1519
 
+#define THREAD_GSCOPE_FLAG_UNUSED 0
1520
 
+#define THREAD_GSCOPE_FLAG_USED   1
1521
 
+#define THREAD_GSCOPE_FLAG_WAIT   2
1522
 
+#define THREAD_GSCOPE_RESET_FLAG()                                     \
1523
 
+  do                                                                   \
1524
 
+    { int __res                                                                \
1525
 
+       = atomic_exchange_rel (&THREAD_SELF->header.gscope_flag,        \
1526
 
+                              THREAD_GSCOPE_FLAG_UNUSED);              \
1527
 
+      if (__res == THREAD_GSCOPE_FLAG_WAIT)                            \
1528
 
+       lll_futex_wake (&THREAD_SELF->header.gscope_flag, 1, LLL_PRIVATE); \
1529
 
+    }                                                                  \
1530
 
+  while (0)
1531
 
+#define THREAD_GSCOPE_SET_FLAG()                                       \
1532
 
+  do                                                                   \
1533
 
+    {                                                                  \
1534
 
+      THREAD_SELF->header.gscope_flag = THREAD_GSCOPE_FLAG_USED;       \
1535
 
+      atomic_write_barrier ();                                         \
1536
 
+    }                                                                  \
1537
 
+  while (0)
1538
 
+#define THREAD_GSCOPE_WAIT() \
1539
 
+  GL(dl_wait_lookup_done) ()
1540
 
+
1541
 
+#endif /* __ASSEMBLER__ */
1542
 
+
1543
 
+#endif /* tls.h */
1544
 
diff --git a/ports/sysdeps/m68k/tls-macros.h b/ports/sysdeps/m68k/tls-macros.h
1545
 
new file mode 100644
1546
 
index 0000000..d03d7b9
1547
 
--- /dev/null
1548
 
+++ b/ports/sysdeps/m68k/tls-macros.h
1549
 
@@ -0,0 +1,70 @@
1550
 
+/* Macros for accessing thread-local storage.  m68k version.
1551
 
+   Copyright (C) 2010 Free Software Foundation, Inc.
1552
 
+   This file is part of the GNU C Library.
1553
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1554
 
+
1555
 
+   The GNU C Library is free software; you can redistribute it and/or
1556
 
+   modify it under the terms of the GNU Lesser General Public
1557
 
+   License as published by the Free Software Foundation; either
1558
 
+   version 2.1 of the License, or (at your option) any later version.
1559
 
+
1560
 
+   The GNU C Library is distributed in the hope that it will be useful,
1561
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1562
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1563
 
+   Lesser General Public License for more details.
1564
 
+
1565
 
+   You should have received a copy of the GNU Lesser General Public
1566
 
+   License along with the GNU C Library; if not, write to the Free
1567
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1568
 
+   02111-1307 USA.  */
1569
 
+
1570
 
+#define TLS_GD(x)                                                      \
1571
 
+  ({                                                                   \
1572
 
+    void *__result;                                                    \
1573
 
+    extern void *__tls_get_addr (void *);                              \
1574
 
+                                                                       \
1575
 
+    asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"                  \
1576
 
+        "lea (-6, %%pc, %0), %0\n\t"                                   \
1577
 
+        "lea " #x "@TLSGD(%0), %0"                                     \
1578
 
+        : "=&a" (__result));                                           \
1579
 
+    (int *) __tls_get_addr (__result); })
1580
 
+
1581
 
+#define TLS_LD(x)                                                      \
1582
 
+  ({                                                                   \
1583
 
+    char *__tp;                                                                \
1584
 
+    int __offset;                                                      \
1585
 
+    extern void *__tls_get_addr (void *);                              \
1586
 
+                                                                       \
1587
 
+    asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"                  \
1588
 
+        "lea (-6, %%pc, %0), %0\n\t"                                   \
1589
 
+        "lea " #x "@TLSLDM(%0), %0"                                    \
1590
 
+        : "=&a" (__tp));                                               \
1591
 
+    __tp = (char *) __tls_get_addr (__tp);                             \
1592
 
+    asm ("movel #" #x "@TLSLDO, %0"                                    \
1593
 
+        : "=a" (__offset));                                            \
1594
 
+    (int *) (__tp + __offset); })
1595
 
+
1596
 
+#define TLS_IE(x)                                                      \
1597
 
+  ({                                                                   \
1598
 
+    char *__tp;                                                                \
1599
 
+    int __offset;                                                      \
1600
 
+    extern void * __m68k_read_tp (void);                               \
1601
 
+                                                                       \
1602
 
+    __tp = (char *) __m68k_read_tp ();                                 \
1603
 
+    asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"                  \
1604
 
+        "lea (-6, %%pc, %0), %0\n\t"                                   \
1605
 
+        "movel " #x "@TLSIE(%0), %0"                                   \
1606
 
+        : "=&a" (__offset));                                           \
1607
 
+    (int *) (__tp + __offset); })
1608
 
+
1609
 
+#define TLS_LE(x)                                                      \
1610
 
+  ({                                                                   \
1611
 
+    char *__tp;                                                                \
1612
 
+    int __offset;                                                      \
1613
 
+    extern void * __m68k_read_tp (void);                               \
1614
 
+                                                                       \
1615
 
+    __tp = (char *) __m68k_read_tp ();                                 \
1616
 
+    asm ("movel #" #x "@TLSLE, %0"                                     \
1617
 
+        : "=a" (__offset));                                            \
1618
 
+    (int *) (__tp + __offset); })
1619
 
+
1620
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/Makefile b/ports/sysdeps/unix/sysv/linux/m68k/Makefile
1621
 
index 6bb4f6b..97d9584 100644
1622
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/Makefile
1623
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/Makefile
1624
 
@@ -2,12 +2,18 @@
1625
 
 
1626
 
 m68k-syntax-flag = -DMOTOROLA_SYNTAX
1627
 
 
1628
 
+ifeq ($(subdir),csu)
1629
 
+sysdep_routines += m68k-helpers
1630
 
+endif
1631
 
+
1632
 
 ifeq ($(subdir),misc)
1633
 
 sysdep_routines += mremap
1634
 
 sysdep_headers += sys/reg.h
1635
 
 endif
1636
 
 
1637
 
 ifeq ($(subdir),elf)
1638
 
+sysdep_routines += dl-vdso libc-m68k-vdso
1639
 
+sysdep-rtld-routines += m68k-vdso
1640
 
 sysdep-others += lddlibc4
1641
 
 install-bin += lddlibc4
1642
 
 endif
1643
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/Versions b/ports/sysdeps/unix/sysv/linux/m68k/Versions
1644
 
index 5650f7f..8a941f8 100644
1645
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/Versions
1646
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/Versions
1647
 
@@ -32,4 +32,18 @@ libc {
1648
 
   GLIBC_2.11 {
1649
 
     fallocate64;
1650
 
   }
1651
 
+  GLIBC_2.12 {
1652
 
+    __m68k_read_tp;
1653
 
+  }
1654
 
+  GLIBC_PRIVATE {
1655
 
+    __vdso_atomic_cmpxchg_32; __vdso_atomic_barrier;
1656
 
+  }
1657
 
+}
1658
 
+
1659
 
+ld {
1660
 
+  GLIBC_PRIVATE {
1661
 
+    __rtld___vdso_read_tp;
1662
 
+    __rtld___vdso_atomic_cmpxchg_32;
1663
 
+    __rtld___vdso_atomic_barrier;
1664
 
+  }
1665
 
 }
1666
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h
1667
 
new file mode 100644
1668
 
index 0000000..c361060
1669
 
--- /dev/null
1670
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h
1671
 
@@ -0,0 +1,61 @@
1672
 
+/* Resolve function pointers to VDSO functions.
1673
 
+   Copyright (C) 2010 Free Software Foundation, Inc.
1674
 
+   This file is part of the GNU C Library.
1675
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1676
 
+
1677
 
+   The GNU C Library is free software; you can redistribute it and/or
1678
 
+   modify it under the terms of the GNU Lesser General Public
1679
 
+   License as published by the Free Software Foundation; either
1680
 
+   version 2.1 of the License, or (at your option) any later version.
1681
 
+
1682
 
+   The GNU C Library is distributed in the hope that it will be useful,
1683
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1684
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1685
 
+   Lesser General Public License for more details.
1686
 
+
1687
 
+   You should have received a copy of the GNU Lesser General Public
1688
 
+   License along with the GNU C Library; if not, write to the Free
1689
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1690
 
+   02111-1307 USA.  */
1691
 
+
1692
 
+
1693
 
+#ifndef _M68K_VDSO_H
1694
 
+#define _M68K_VDSO_H
1695
 
+
1696
 
+#ifdef SHARED
1697
 
+
1698
 
+# ifdef IS_IN_rtld
1699
 
+# define M68K_VDSO_SYMBOL(name) __rtld_##name
1700
 
+# define STR_M68K_VDSO_SYMBOL(name) "__rtld_" #name
1701
 
+# else
1702
 
+# define M68K_VDSO_SYMBOL(name) name
1703
 
+# define STR_M68K_VDSO_SYMBOL(name) #name
1704
 
+# endif
1705
 
+
1706
 
+# ifndef __ASSEMBLER__
1707
 
+
1708
 
+/* We define __rtld_* copies for rtld.
1709
 
+   We need them visible in libc to initialize.  */
1710
 
+#  if defined IS_IN_rtld || !defined NOT_IN_libc
1711
 
+extern void *__rtld___vdso_read_tp;
1712
 
+extern void *__rtld___vdso_atomic_cmpxchg_32;
1713
 
+extern void *__rtld___vdso_atomic_barrier;
1714
 
+
1715
 
+/* These stubs are meant to be invoked only from the assembly.  */
1716
 
+extern void __vdso_read_tp_stub (void);
1717
 
+extern void __vdso_atomic_cmpxchg_32_stub (void);
1718
 
+extern void __vdso_atomic_barrier_stub (void);
1719
 
+#  endif /* IS_IN_rtld || !NOT_IN_libc */
1720
 
+
1721
 
+/* RTLD should only use its own copies.  */
1722
 
+#  ifndef IS_IN_rtld
1723
 
+extern void *__vdso_read_tp;
1724
 
+extern void *__vdso_atomic_cmpxchg_32;
1725
 
+extern void *__vdso_atomic_barrier;
1726
 
+#  endif /* !IS_IN_rtld */
1727
 
+
1728
 
+# endif /* !__ASSEMBLER__ */
1729
 
+
1730
 
+#endif /* SHARED */
1731
 
+
1732
 
+#endif /* _M68K_VDSO_H */
1733
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/clone.S b/ports/sysdeps/unix/sysv/linux/m68k/clone.S
1734
 
index a179f8e..401e2ef 100644
1735
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/clone.S
1736
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/clone.S
1737
 
@@ -1,4 +1,4 @@
1738
 
-/* Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
1739
 
+/* Copyright (C) 1996,97,98,2002,2010 Free Software Foundation, Inc.
1740
 
    This file is part of the GNU C Library.
1741
 
    Contributed by Andreas Schwab (schwab@issan.informatik.uni-dortmund.de)
1742
 
 
1743
 
@@ -17,14 +17,21 @@
1744
 
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1745
 
    02111-1307 USA.  */
1746
 
 
1747
 
-/* clone is even more special than fork as it mucks with stacks
1748
 
+/* clone() is even more special than fork() as it mucks with stacks
1749
 
    and invokes a function in the right context after its all over.  */
1750
 
 
1751
 
 #include <sysdep.h>
1752
 
 #define _ERRNO_H       1
1753
 
 #include <bits/errno.h>
1754
 
+#ifdef RESET_PID
1755
 
+#include <tls.h>
1756
 
+#endif
1757
 
+
1758
 
+#define CLONE_VM      0x00000100
1759
 
+#define CLONE_THREAD  0x00010000
1760
 
 
1761
 
-/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
1762
 
+/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg,
1763
 
+            void *parent_tidptr, void *tls, void *child_tidptr) */
1764
 
 
1765
 
         .text
1766
 
 ENTRY (__clone)
1767
 
@@ -42,7 +49,17 @@ ENTRY (__clone)
1768
 
        movel   16(%sp), -(%a1)
1769
 
 
1770
 
        /* Do the system call */
1771
 
-       movel   12(%sp), %d1            /* get flags */
1772
 
+       movel   12+0(%sp), %d1          /* get flags */
1773
 
+       movel   %d3, -(%a1)             /* save %d3 and get parent_tidptr */
1774
 
+       movel   %d3, -(%sp)
1775
 
+       movel   20+4(%sp), %d3
1776
 
+       movel   %d4, -(%a1)             /* save %d4 and get child_tidptr */
1777
 
+       movel   %d4, -(%sp)
1778
 
+       movel   28+8(%sp), %d4
1779
 
+       movel   %d5, -(%a1)             /* save %d5 and get tls */
1780
 
+       movel   %d5, -(%sp)
1781
 
+       movel   24+12(%sp), %d5
1782
 
+       /* save %d2 and get stack pointer */
1783
 
 #ifdef __mcoldfire__
1784
 
        movel   %d2, -(%a1)
1785
 
        movel   %d2, -(%sp)
1786
 
@@ -57,6 +74,9 @@ ENTRY (__clone)
1787
 
 #else
1788
 
        exg     %d2, %a1                /* restore %d2 */
1789
 
 #endif
1790
 
+       movel   (%sp)+, %d5             /* restore %d5, %d4 and %d3 */
1791
 
+       movel   (%sp)+, %d4
1792
 
+       movel   (%sp)+, %d3
1793
 
 
1794
 
        tstl    %d0
1795
 
        jmi     SYSCALL_ERROR_LABEL
1796
 
@@ -65,11 +85,35 @@ ENTRY (__clone)
1797
 
        rts
1798
 
 
1799
 
 thread_start:
1800
 
+       cfi_startproc
1801
 
+       cfi_undefined (pc)      /* Mark end of stack */
1802
 
        subl    %fp, %fp        /* terminate the stack frame */
1803
 
+#ifdef RESET_PID
1804
 
+       /* Check and see if we need to reset the PID.  */
1805
 
+       movel   %d1, %a1
1806
 
+       andl    #CLONE_THREAD, %d1
1807
 
+       jne     donepid
1808
 
+       movel   %a1, %d1
1809
 
+       movel   #-1, %d0
1810
 
+       andl    #CLONE_VM, %d1
1811
 
+       jne     gotpid
1812
 
+       movel   #SYS_ify (getpid), %d0
1813
 
+       trap    #0
1814
 
+gotpid:
1815
 
+       movel   %a0, -(%sp)
1816
 
+       movel   %d0, -(%sp)
1817
 
+       bsrl    __m68k_read_tp@PLTPC
1818
 
+       movel   (%sp)+, %d0
1819
 
+       movel   %d0, PID_OFFSET(%a0)
1820
 
+       movel   %d0, TID_OFFSET(%a0)
1821
 
+       movel   (%sp)+, %a0
1822
 
+donepid:
1823
 
+#endif
1824
 
        jsr     (%a0)
1825
 
        movel   %d0, %d1
1826
 
        movel   #SYS_ify (exit), %d0
1827
 
        trap    #0
1828
 
+       cfi_endproc
1829
 
 
1830
 
 PSEUDO_END (__clone)
1831
 
 
1832
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/bits/atomic.h b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/bits/atomic.h
1833
 
new file mode 100644
1834
 
index 0000000..1198bb9
1835
 
--- /dev/null
1836
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/bits/atomic.h
1837
 
@@ -0,0 +1,105 @@
1838
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
1839
 
+   This file is part of the GNU C Library.
1840
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1841
 
+
1842
 
+   The GNU C Library is free software; you can redistribute it and/or
1843
 
+   modify it under the terms of the GNU Lesser General Public
1844
 
+   License as published by the Free Software Foundation; either
1845
 
+   version 2.1 of the License, or (at your option) any later version.
1846
 
+
1847
 
+   The GNU C Library is distributed in the hope that it will be useful,
1848
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1849
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1850
 
+   Lesser General Public License for more details.
1851
 
+
1852
 
+   You should have received a copy of the GNU Lesser General Public
1853
 
+   License along with the GNU C Library; if not, write to the Free
1854
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1855
 
+   02111-1307 USA.  */
1856
 
+
1857
 
+#ifndef _BITS_ATOMIC_H
1858
 
+#define _BITS_ATOMIC_H 1
1859
 
+
1860
 
+#include <stdint.h>
1861
 
+#include <sysdep.h>
1862
 
+#include <bits/m68k-vdso.h>
1863
 
+
1864
 
+/* Coldfire has no atomic compare-and-exchange operation, but the
1865
 
+   kernel provides userspace atomicity operations.  Use them.  */
1866
 
+
1867
 
+typedef int32_t atomic32_t;
1868
 
+typedef uint32_t uatomic32_t;
1869
 
+typedef int_fast32_t atomic_fast32_t;
1870
 
+typedef uint_fast32_t uatomic_fast32_t;
1871
 
+
1872
 
+typedef intptr_t atomicptr_t;
1873
 
+typedef uintptr_t uatomicptr_t;
1874
 
+typedef intmax_t atomic_max_t;
1875
 
+typedef uintmax_t uatomic_max_t;
1876
 
+
1877
 
+/* The only basic operation needed is compare and exchange.  */
1878
 
+/* For ColdFire we'll have to trap into the kernel mode anyway,
1879
 
+   so trap from the library rather then from the kernel wrapper.  */
1880
 
+#ifdef SHARED
1881
 
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval)      \
1882
 
+  ({                                                                   \
1883
 
+    /* Use temporary variables to workaround call-clobberness of */    \
1884
 
+    /* the registers.  */                                              \
1885
 
+    __typeof (mem) _mem = mem;                                         \
1886
 
+    __typeof (oldval) _oldval = oldval;                                        \
1887
 
+    __typeof (newval) _newval = newval;                                        \
1888
 
+    register __typeof (mem) _a0 asm ("a0") = _mem;                     \
1889
 
+    register __typeof (oldval) _d0 asm ("d0") = _oldval;               \
1890
 
+    register __typeof (newval) _d1 asm ("d1") = _newval;               \
1891
 
+    void *tmp;                                                         \
1892
 
+                                                                       \
1893
 
+    asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %2\n\t"                  \
1894
 
+        "lea (-6, %%pc, %2), %2\n\t"                                   \
1895
 
+        "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32)       \
1896
 
+        "@GOT(%2), %2\n\t"                                             \
1897
 
+        "movel (%2), %2\n\t"                                           \
1898
 
+        "jsr (%2)\n\t"                                                 \
1899
 
+        : "+d" (_d0), "+m" (*_a0), "=&a" (tmp)                         \
1900
 
+        : "a" (_a0), "d" (_d1));                                       \
1901
 
+    _d0;                                                               \
1902
 
+  })
1903
 
+#else
1904
 
+# define atomic_compare_and_exchange_val_acq(mem, newval, oldval)      \
1905
 
+  ({                                                                   \
1906
 
+    /* Use temporary variables to workaround call-clobberness of */    \
1907
 
+    /* the registers.  */                                              \
1908
 
+    __typeof (mem) _mem = mem;                                         \
1909
 
+    __typeof (oldval) _oldval = oldval;                                        \
1910
 
+    __typeof (newval) _newval = newval;                                        \
1911
 
+    register __typeof (oldval) _d0 asm ("d0")                          \
1912
 
+      = SYS_ify (atomic_cmpxchg_32);                                   \
1913
 
+    register __typeof (mem) _a0 asm ("a0") = _mem;                     \
1914
 
+    register __typeof (oldval) _d2 asm ("d2") = _oldval;               \
1915
 
+    register __typeof (newval) _d1 asm ("d1") = _newval;               \
1916
 
+                                                                       \
1917
 
+    asm ("trap #0"                                                     \
1918
 
+        : "+d" (_d0), "+m" (*_a0)                                      \
1919
 
+        : "a" (_a0), "d" (_d2), "d" (_d1));                            \
1920
 
+    _d0;                                                               \
1921
 
+  })
1922
 
+#endif
1923
 
+
1924
 
+#ifdef SHARED
1925
 
+# define atomic_full_barrier()                                  \
1926
 
+  ({                                                            \
1927
 
+    void *tmp;                                                  \
1928
 
+                                                                \
1929
 
+    asm ("movel #_GLOBAL_OFFSET_TABLE_@GOTPC, %0\n\t"           \
1930
 
+        "lea (-6, %pc, %0), %0\n\t"                             \
1931
 
+        "movel " STR_M68K_VDSO_SYMBOL (__vdso_atomic_barrier)   \
1932
 
+        "@GOT(%0), %0\n\t"                                      \
1933
 
+        "movel (%0), %0\n\t"                                    \
1934
 
+        "jsr (%0)\n\t"                                          \
1935
 
+        : "=&a" (tmp));                                         \
1936
 
+  })
1937
 
+#else
1938
 
+# define atomic_full_barrier()                         \
1939
 
+  (INTERNAL_SYSCALL (atomic_barrier, , 0), (void) 0)
1940
 
+#endif
1941
 
+
1942
 
+#endif
1943
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/init-first.c b/ports/sysdeps/unix/sysv/linux/m68k/init-first.c
1944
 
new file mode 100644
1945
 
index 0000000..f8168d1
1946
 
--- /dev/null
1947
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/init-first.c
1948
 
@@ -0,0 +1,74 @@
1949
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
1950
 
+   This file is part of the GNU C Library.
1951
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
1952
 
+
1953
 
+   The GNU C Library is free software; you can redistribute it and/or
1954
 
+   modify it under the terms of the GNU Lesser General Public
1955
 
+   License as published by the Free Software Foundation; either
1956
 
+   version 2.1 of the License, or (at your option) any later version.
1957
 
+
1958
 
+   The GNU C Library is distributed in the hope that it will be useful,
1959
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
1960
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1961
 
+   Lesser General Public License for more details.
1962
 
+
1963
 
+   You should have received a copy of the GNU Lesser General Public
1964
 
+   License along with the GNU C Library; if not, write to the Free
1965
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1966
 
+   02111-1307 USA.  */
1967
 
+
1968
 
+/* Note: linking in vDSO to a static binary requires changes to
1969
 
+   the main GLIBC proper.  Not yet implemented.  */
1970
 
+#ifdef SHARED
1971
 
+
1972
 
+#include <dl-vdso.h>
1973
 
+#include <bits/m68k-vdso.h>
1974
 
+
1975
 
+static inline void
1976
 
+_libc_vdso_platform_setup (void)
1977
 
+{
1978
 
+  void *p;
1979
 
+
1980
 
+  PREPARE_VERSION (linux26, "LINUX_2.6", 61765110);
1981
 
+
1982
 
+  /* It may happen that rtld didn't initialize the vDSO, so fallback
1983
 
+     to the syscall implementations if _dl_vdso_vsym returns NULL.
1984
 
+     This may happen when a static executable dlopen's a dynamic library.
1985
 
+     This really is nothing more than a workaround for rtld/csu
1986
 
+     deficiency.  Ideally, init code would setup the vDSO for static
1987
 
+     binaries too.  */
1988
 
+
1989
 
+  p = _dl_vdso_vsym ("__kernel_read_tp", &linux26);
1990
 
+  if (p != NULL)
1991
 
+    {
1992
 
+      __vdso_read_tp = p;
1993
 
+      __rtld___vdso_read_tp = p;
1994
 
+    }
1995
 
+  else
1996
 
+    assert (__vdso_read_tp == (void *) __vdso_read_tp_stub);
1997
 
+
1998
 
+  p = _dl_vdso_vsym ("__kernel_atomic_cmpxchg_32", &linux26);
1999
 
+  if (p != NULL)
2000
 
+    {
2001
 
+      __vdso_atomic_cmpxchg_32 = p;
2002
 
+      __rtld___vdso_atomic_cmpxchg_32 = p;
2003
 
+    }
2004
 
+  else
2005
 
+    assert (__vdso_atomic_cmpxchg_32
2006
 
+           == (void *) __vdso_atomic_cmpxchg_32_stub);
2007
 
+
2008
 
+  p = _dl_vdso_vsym ("__kernel_atomic_barrier", &linux26);
2009
 
+  if (p != NULL)
2010
 
+    {
2011
 
+      __vdso_atomic_barrier = p;
2012
 
+      __rtld___vdso_atomic_barrier = p;
2013
 
+    }
2014
 
+  else
2015
 
+    assert (__vdso_atomic_barrier == (void *) __vdso_atomic_barrier_stub);
2016
 
+}
2017
 
+
2018
 
+#define VDSO_SETUP _libc_vdso_platform_setup
2019
 
+
2020
 
+#endif /* SHARED */
2021
 
+
2022
 
+#include <sysdeps/unix/sysv/linux/init-first.c>
2023
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c b/ports/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c
2024
 
new file mode 100644
2025
 
index 0000000..45982e9
2026
 
--- /dev/null
2027
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/libc-m68k-vdso.c
2028
 
@@ -0,0 +1 @@
2029
 
+#include "m68k-vdso.c"
2030
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
2031
 
new file mode 100644
2032
 
index 0000000..00db4bb
2033
 
--- /dev/null
2034
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
2035
 
@@ -0,0 +1,105 @@
2036
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2037
 
+   This file is part of the GNU C Library.
2038
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2039
 
+
2040
 
+   The GNU C Library is free software; you can redistribute it and/or
2041
 
+   modify it under the terms of the GNU Lesser General Public
2042
 
+   License as published by the Free Software Foundation; either
2043
 
+   version 2.1 of the License, or (at your option) any later version.
2044
 
+
2045
 
+   In addition to the permissions in the GNU Lesser General Public
2046
 
+   License, the Free Software Foundation gives you unlimited
2047
 
+   permission to link the compiled version of this file with other
2048
 
+   programs, and to distribute those programs without any restriction
2049
 
+   coming from the use of this file. (The GNU Lesser General Public
2050
 
+   License restrictions do apply in other respects; for example, they
2051
 
+   cover modification of the file, and distribution when not linked
2052
 
+   into another program.)
2053
 
+
2054
 
+   Note that people who make modified versions of this file are not
2055
 
+   obligated to grant this special exception for their modified
2056
 
+   versions; it is their choice whether to do so. The GNU Lesser
2057
 
+   General Public License gives permission to release a modified
2058
 
+   version without this exception; this exception also makes it
2059
 
+   possible to release a modified version which carries forward this
2060
 
+   exception.
2061
 
+
2062
 
+   The GNU C Library is distributed in the hope that it will be useful,
2063
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2064
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2065
 
+   Lesser General Public License for more details.
2066
 
+
2067
 
+   You should have received a copy of the GNU Lesser General Public
2068
 
+   License along with the GNU C Library; if not, write to the Free
2069
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2070
 
+   02111-1307 USA.  */
2071
 
+
2072
 
+#include <sysdep.h>
2073
 
+#include <bits/m68k-vdso.h>
2074
 
+
2075
 
+       .text
2076
 
+
2077
 
+       .hidden __vdso_read_tp_stub
2078
 
+ENTRY (__vdso_read_tp_stub)
2079
 
+       cfi_startproc
2080
 
+       move.l  #__NR_get_thread_area, %d0
2081
 
+       trap    #0
2082
 
+       move.l  %d0, %a0
2083
 
+       rts
2084
 
+       cfi_endproc
2085
 
+END (__vdso_read_tp_stub)
2086
 
+
2087
 
+# ifdef SHARED
2088
 
+/* GCC will emit calls to this routine.  Linux has an
2089
 
+   equivalent helper function (which clobbers fewer registers than
2090
 
+   a normal function call) in a vdso; tail call to the
2091
 
+   helper.  */
2092
 
+# ifdef IS_IN_rtld
2093
 
+/* rtld gets a hidden copy of __m68k_read_tp.  */
2094
 
+       .hidden __m68k_read_tp
2095
 
+# endif
2096
 
+ENTRY (__m68k_read_tp)
2097
 
+       cfi_startproc
2098
 
+       move.l  #_GLOBAL_OFFSET_TABLE_@GOTPC, %a0
2099
 
+       lea     (-6, %pc, %a0), %a0
2100
 
+       move.l  M68K_VDSO_SYMBOL (__vdso_read_tp)@GOT(%a0), %a0
2101
 
+       move.l  (%a0), %a0
2102
 
+       jmp     (%a0)
2103
 
+       cfi_endproc
2104
 
+END (__m68k_read_tp)
2105
 
+
2106
 
+/* The following two stubs are for macros in atomic.h, they can't
2107
 
+   clobber anything.  */
2108
 
+
2109
 
+       .hidden __vdso_atomic_cmpxchg_32_stub
2110
 
+ENTRY (__vdso_atomic_cmpxchg_32_stub)
2111
 
+       cfi_startproc
2112
 
+       move.l  %d2, -(%sp)
2113
 
+       cfi_adjust_cfa_offset (4)
2114
 
+       cfi_rel_offset (%d2, 0)
2115
 
+       move.l  %d0, %d2
2116
 
+       move.l  #SYS_ify (atomic_cmpxchg_32), %d0
2117
 
+       trap    #0
2118
 
+       move.l  (%sp)+, %d2
2119
 
+       cfi_adjust_cfa_offset (-4)
2120
 
+       cfi_restore (%d2)
2121
 
+       rts
2122
 
+       cfi_endproc
2123
 
+END (__vdso_atomic_cmpxchg_32_stub)
2124
 
+       
2125
 
+       .hidden __vdso_atomic_barrier_stub
2126
 
+ENTRY (__vdso_atomic_barrier_stub)
2127
 
+       cfi_startproc
2128
 
+       move.l  %d0, -(%sp)
2129
 
+       cfi_adjust_cfa_offset (4)
2130
 
+       move.l  #SYS_ify (atomic_barrier), %d0
2131
 
+       trap    #0
2132
 
+       move.l  (%sp)+, %d0
2133
 
+       cfi_adjust_cfa_offset (-4)
2134
 
+       rts
2135
 
+       cfi_endproc
2136
 
+END (__vdso_atomic_barrier_stub)
2137
 
+# else /* !SHARED */
2138
 
+/* If the vDSO is not available, use a syscall to get TP.  */
2139
 
+       strong_alias (__vdso_read_tp_stub, __m68k_read_tp)
2140
 
+# endif /* SHARED */
2141
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c b/ports/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c
2142
 
new file mode 100644
2143
 
index 0000000..73b2570
2144
 
--- /dev/null
2145
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m68k-vdso.c
2146
 
@@ -0,0 +1,35 @@
2147
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2148
 
+   This file is part of the GNU C Library.
2149
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2150
 
+
2151
 
+   The GNU C Library is free software; you can redistribute it and/or
2152
 
+   modify it under the terms of the GNU Lesser General Public
2153
 
+   License as published by the Free Software Foundation; either
2154
 
+   version 2.1 of the License, or (at your option) any later version.
2155
 
+
2156
 
+   The GNU C Library is distributed in the hope that it will be useful,
2157
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2158
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2159
 
+   Lesser General Public License for more details.
2160
 
+
2161
 
+   You should have received a copy of the GNU Lesser General Public
2162
 
+   License along with the GNU C Library; if not, write to the Free
2163
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2164
 
+   02111-1307 USA.  */
2165
 
+
2166
 
+#ifdef SHARED
2167
 
+
2168
 
+#include <bits/m68k-vdso.h>
2169
 
+
2170
 
+/* Because these pointers are used from other libraries than libc,
2171
 
+   they are exported at GLIBC_PRIVATE version.
2172
 
+   We initialize them to syscall implementation so that they will be ready
2173
 
+   to use from the very beginning.  */
2174
 
+void * M68K_VDSO_SYMBOL (__vdso_read_tp)
2175
 
+= (void *) __vdso_read_tp_stub;
2176
 
+void * M68K_VDSO_SYMBOL (__vdso_atomic_cmpxchg_32)
2177
 
+= (void *) __vdso_atomic_cmpxchg_32_stub;
2178
 
+void * M68K_VDSO_SYMBOL (__vdso_atomic_barrier)
2179
 
+= (void *) __vdso_atomic_barrier_stub;
2180
 
+
2181
 
+#endif /* SHARED */
2182
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h
2183
 
new file mode 100644
2184
 
index 0000000..0140810
2185
 
--- /dev/null
2186
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h
2187
 
@@ -0,0 +1,172 @@
2188
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2189
 
+   This file is part of the GNU C Library.
2190
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2191
 
+
2192
 
+   The GNU C Library is free software; you can redistribute it and/or
2193
 
+   modify it under the terms of the GNU Lesser General Public
2194
 
+   License as published by the Free Software Foundation; either
2195
 
+   version 2.1 of the License, or (at your option) any later version.
2196
 
+
2197
 
+   The GNU C Library is distributed in the hope that it will be useful,
2198
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2199
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2200
 
+   Lesser General Public License for more details.
2201
 
+
2202
 
+   You should have received a copy of the GNU Lesser General Public
2203
 
+   License along with the GNU C Library; if not, write to the Free
2204
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2205
 
+   02111-1307 USA.  */
2206
 
+
2207
 
+#ifndef _BITS_PTHREADTYPES_H
2208
 
+#define _BITS_PTHREADTYPES_H   1
2209
 
+
2210
 
+#include <endian.h>
2211
 
+
2212
 
+#define __SIZEOF_PTHREAD_ATTR_T 36
2213
 
+#define __SIZEOF_PTHREAD_MUTEX_T 24
2214
 
+#define __SIZEOF_PTHREAD_MUTEXATTR_T 4
2215
 
+#define __SIZEOF_PTHREAD_COND_T 48
2216
 
+#define __SIZEOF_PTHREAD_CONDATTR_T 4
2217
 
+#define __SIZEOF_PTHREAD_RWLOCK_T 32
2218
 
+#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
2219
 
+#define __SIZEOF_PTHREAD_BARRIER_T 20
2220
 
+#define __SIZEOF_PTHREAD_BARRIERATTR_T 4
2221
 
+
2222
 
+
2223
 
+/* Thread identifiers.  The structure of the attribute type is
2224
 
+   deliberately not exposed.  */
2225
 
+typedef unsigned long int pthread_t;
2226
 
+
2227
 
+
2228
 
+typedef union
2229
 
+{
2230
 
+  char __size[__SIZEOF_PTHREAD_ATTR_T];
2231
 
+  long int __align;
2232
 
+} pthread_attr_t;
2233
 
+
2234
 
+
2235
 
+typedef struct __pthread_internal_slist
2236
 
+{
2237
 
+  struct __pthread_internal_slist *__next;
2238
 
+} __pthread_slist_t;
2239
 
+
2240
 
+
2241
 
+/* Data structures for mutex handling.  The structure of the attribute
2242
 
+   type is deliberately not exposed.  */
2243
 
+typedef union
2244
 
+{
2245
 
+  struct __pthread_mutex_s
2246
 
+  {
2247
 
+    int __lock;
2248
 
+    unsigned int __count;
2249
 
+    int __owner;
2250
 
+    /* KIND must stay at this position in the structure to maintain
2251
 
+       binary compatibility.  */
2252
 
+    int __kind;
2253
 
+    unsigned int __nusers;
2254
 
+    __extension__ union
2255
 
+    {
2256
 
+      int __spins;
2257
 
+      __pthread_slist_t __list;
2258
 
+    };
2259
 
+  } __data;
2260
 
+  char __size[__SIZEOF_PTHREAD_MUTEX_T];
2261
 
+  long int __align;
2262
 
+} pthread_mutex_t;
2263
 
+
2264
 
+typedef union
2265
 
+{
2266
 
+  char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
2267
 
+  int __align;
2268
 
+} pthread_mutexattr_t;
2269
 
+
2270
 
+
2271
 
+/* Data structure for conditional variable handling.  The structure of
2272
 
+   the attribute type is deliberately not exposed.  */
2273
 
+typedef union
2274
 
+{
2275
 
+  struct
2276
 
+  {
2277
 
+    int __lock;
2278
 
+    unsigned int __futex;
2279
 
+    __extension__ unsigned long long int __total_seq;
2280
 
+    __extension__ unsigned long long int __wakeup_seq;
2281
 
+    __extension__ unsigned long long int __woken_seq;
2282
 
+    void *__mutex;
2283
 
+    unsigned int __nwaiters;
2284
 
+    unsigned int __broadcast_seq;
2285
 
+  } __data;
2286
 
+  char __size[__SIZEOF_PTHREAD_COND_T];
2287
 
+  __extension__ long long int __align;
2288
 
+} pthread_cond_t;
2289
 
+
2290
 
+typedef union
2291
 
+{
2292
 
+  char __size[__SIZEOF_PTHREAD_CONDATTR_T];
2293
 
+  int __align;
2294
 
+} pthread_condattr_t;
2295
 
+
2296
 
+
2297
 
+/* Keys for thread-specific data */
2298
 
+typedef unsigned int pthread_key_t;
2299
 
+
2300
 
+
2301
 
+/* Once-only execution */
2302
 
+typedef int pthread_once_t;
2303
 
+
2304
 
+
2305
 
+#if defined __USE_UNIX98 || defined __USE_XOPEN2K
2306
 
+/* Data structure for read-write lock variable handling.  The
2307
 
+   structure of the attribute type is deliberately not exposed.  */
2308
 
+typedef union
2309
 
+{
2310
 
+  struct
2311
 
+  {
2312
 
+    int __lock;
2313
 
+    unsigned int __nr_readers;
2314
 
+    unsigned int __readers_wakeup;
2315
 
+    unsigned int __writer_wakeup;
2316
 
+    unsigned int __nr_readers_queued;
2317
 
+    unsigned int __nr_writers_queued;
2318
 
+    unsigned char __pad1;
2319
 
+    unsigned char __pad2;
2320
 
+    unsigned char __shared;
2321
 
+    /* FLAGS must stay at this position in the structure to maintain
2322
 
+       binary compatibility.  */
2323
 
+    unsigned char __flags;
2324
 
+    int __writer;
2325
 
+  } __data;
2326
 
+  char __size[__SIZEOF_PTHREAD_RWLOCK_T];
2327
 
+  long int __align;
2328
 
+} pthread_rwlock_t;
2329
 
+
2330
 
+typedef union
2331
 
+{
2332
 
+  char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
2333
 
+  long int __align;
2334
 
+} pthread_rwlockattr_t;
2335
 
+#endif
2336
 
+
2337
 
+
2338
 
+#ifdef __USE_XOPEN2K
2339
 
+/* POSIX spinlock data type.  */
2340
 
+typedef volatile int pthread_spinlock_t;
2341
 
+
2342
 
+
2343
 
+/* POSIX barriers data type.  The structure of the type is
2344
 
+   deliberately not exposed.  */
2345
 
+typedef union
2346
 
+{
2347
 
+  char __size[__SIZEOF_PTHREAD_BARRIER_T];
2348
 
+  long int __align;
2349
 
+} pthread_barrier_t;
2350
 
+
2351
 
+typedef union
2352
 
+{
2353
 
+  char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
2354
 
+  int __align;
2355
 
+} pthread_barrierattr_t;
2356
 
+#endif
2357
 
+
2358
 
+
2359
 
+#endif /* bits/pthreadtypes.h */
2360
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/semaphore.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/semaphore.h
2361
 
new file mode 100644
2362
 
index 0000000..2950cc9
2363
 
--- /dev/null
2364
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/semaphore.h
2365
 
@@ -0,0 +1,36 @@
2366
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2367
 
+   This file is part of the GNU C Library.
2368
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2369
 
+
2370
 
+   The GNU C Library is free software; you can redistribute it and/or
2371
 
+   modify it under the terms of the GNU Lesser General Public
2372
 
+   License as published by the Free Software Foundation; either
2373
 
+   version 2.1 of the License, or (at your option) any later version.
2374
 
+
2375
 
+   The GNU C Library is distributed in the hope that it will be useful,
2376
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2377
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2378
 
+   Lesser General Public License for more details.
2379
 
+
2380
 
+   You should have received a copy of the GNU Lesser General Public
2381
 
+   License along with the GNU C Library; if not, write to the Free
2382
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2383
 
+   02111-1307 USA.  */
2384
 
+
2385
 
+#ifndef _SEMAPHORE_H
2386
 
+# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
2387
 
+#endif
2388
 
+
2389
 
+
2390
 
+#define __SIZEOF_SEM_T 16
2391
 
+
2392
 
+
2393
 
+/* Value returned if `sem_open' failed.  */
2394
 
+#define SEM_FAILED      ((sem_t *) 0)
2395
 
+
2396
 
+
2397
 
+typedef union
2398
 
+{
2399
 
+  char __size[__SIZEOF_SEM_T];
2400
 
+  long int __align;
2401
 
+} sem_t;
2402
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/clone.S b/ports/sysdeps/unix/sysv/linux/m68k/nptl/clone.S
2403
 
new file mode 100644
2404
 
index 0000000..e7388fe
2405
 
--- /dev/null
2406
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/clone.S
2407
 
@@ -0,0 +1,2 @@
2408
 
+#define RESET_PID
2409
 
+#include "../clone.S"
2410
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/createthread.c b/ports/sysdeps/unix/sysv/linux/m68k/nptl/createthread.c
2411
 
new file mode 100644
2412
 
index 0000000..be11444
2413
 
--- /dev/null
2414
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/createthread.c
2415
 
@@ -0,0 +1,25 @@
2416
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2417
 
+   This file is part of the GNU C Library.
2418
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2419
 
+
2420
 
+   The GNU C Library is free software; you can redistribute it and/or
2421
 
+   modify it under the terms of the GNU Lesser General Public
2422
 
+   License as published by the Free Software Foundation; either
2423
 
+   version 2.1 of the License, or (at your option) any later version.
2424
 
+
2425
 
+   The GNU C Library is distributed in the hope that it will be useful,
2426
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2427
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
2428
 
+   Lesser General Public License for more details.
2429
 
+
2430
 
+   You should have received a copy of the GNU Lesser General Public
2431
 
+   License along with the GNU C Library; if not, write to the Free
2432
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2433
 
+   02111-1307 USA.  */
2434
 
+
2435
 
+/* Value passed to 'clone' for initialization of the thread register.  */
2436
 
+#define TLS_VALUE ((void *) (pd) \
2437
 
+                  + TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
2438
 
+
2439
 
+/* Get the real implementation.         */
2440
 
+#include <nptl/sysdeps/pthread/createthread.c>
2441
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/fork.c b/ports/sysdeps/unix/sysv/linux/m68k/nptl/fork.c
2442
 
new file mode 100644
2443
 
index 0000000..dc1584e
2444
 
--- /dev/null
2445
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/fork.c
2446
 
@@ -0,0 +1,30 @@
2447
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2448
 
+   This file is part of the GNU C Library.
2449
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2450
 
+
2451
 
+   The GNU C Library is free software; you can redistribute it and/or
2452
 
+   modify it under the terms of the GNU Lesser General Public
2453
 
+   License as published by the Free Software Foundation; either
2454
 
+   version 2.1 of the License, or (at your option) any later version.
2455
 
+
2456
 
+   The GNU C Library is distributed in the hope that it will be useful,
2457
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2458
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2459
 
+   Lesser General Public License for more details.
2460
 
+
2461
 
+   You should have received a copy of the GNU Lesser General Public
2462
 
+   License along with the GNU C Library; if not, write to the Free
2463
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2464
 
+   02111-1307 USA.  */
2465
 
+
2466
 
+#include <sched.h>
2467
 
+#include <signal.h>
2468
 
+#include <sysdep.h>
2469
 
+#include <tls.h>
2470
 
+
2471
 
+#define ARCH_FORK() \
2472
 
+  INLINE_SYSCALL (clone, 5,                                                  \
2473
 
+                 CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0,     \
2474
 
+                 NULL, &THREAD_SELF->tid, NULL)
2475
 
+
2476
 
+#include <sysdeps/unix/sysv/linux/fork.c>
2477
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
2478
 
new file mode 100644
2479
 
index 0000000..926077d
2480
 
--- /dev/null
2481
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
2482
 
@@ -0,0 +1,281 @@
2483
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2484
 
+   This file is part of the GNU C Library.
2485
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2486
 
+
2487
 
+   The GNU C Library is free software; you can redistribute it and/or
2488
 
+   modify it under the terms of the GNU Lesser General Public
2489
 
+   License as published by the Free Software Foundation; either
2490
 
+   version 2.1 of the License, or (at your option) any later version.
2491
 
+
2492
 
+   The GNU C Library is distributed in the hope that it will be useful,
2493
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2494
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
2495
 
+   Lesser General Public License for more details.
2496
 
+
2497
 
+   You should have received a copy of the GNU Lesser General Public
2498
 
+   License along with the GNU C Library; if not, write to the Free
2499
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2500
 
+   02111-1307 USA.  */
2501
 
+
2502
 
+/* Borrowed from ARM's version.  */
2503
 
+
2504
 
+#ifndef _LOWLEVELLOCK_H
2505
 
+#define _LOWLEVELLOCK_H        1
2506
 
+
2507
 
+#include <time.h>
2508
 
+#include <sys/param.h>
2509
 
+#include <bits/pthreadtypes.h>
2510
 
+#include <atomic.h>
2511
 
+#include <sysdep.h>
2512
 
+#include <kernel-features.h>
2513
 
+
2514
 
+#define FUTEX_WAIT             0
2515
 
+#define FUTEX_WAKE             1
2516
 
+#define FUTEX_REQUEUE          3
2517
 
+#define FUTEX_CMP_REQUEUE      4
2518
 
+#define FUTEX_WAKE_OP          5
2519
 
+#define FUTEX_OP_CLEAR_WAKE_IF_GT_ONE  ((4 << 24) | 1)
2520
 
+#define FUTEX_LOCK_PI          6
2521
 
+#define FUTEX_UNLOCK_PI                7
2522
 
+#define FUTEX_TRYLOCK_PI       8
2523
 
+#define FUTEX_WAIT_BITSET      9
2524
 
+#define FUTEX_WAKE_BITSET      10
2525
 
+#define FUTEX_PRIVATE_FLAG     128
2526
 
+#define FUTEX_CLOCK_REALTIME   256
2527
 
+
2528
 
+#define FUTEX_BITSET_MATCH_ANY 0xffffffff
2529
 
+
2530
 
+/* Values for 'private' parameter of locking macros.  Yes, the
2531
 
+   definition seems to be backwards.  But it is not.  The bit will be
2532
 
+   reversed before passing to the system call.  */
2533
 
+#define LLL_PRIVATE    0
2534
 
+#define LLL_SHARED     FUTEX_PRIVATE_FLAG
2535
 
+
2536
 
+
2537
 
+#if !defined NOT_IN_libc || defined IS_IN_rtld
2538
 
+/* In libc.so or ld.so all futexes are private.  */
2539
 
+# ifdef __ASSUME_PRIVATE_FUTEX
2540
 
+#  define __lll_private_flag(fl, private) \
2541
 
+  ((fl) | FUTEX_PRIVATE_FLAG)
2542
 
+# else
2543
 
+#  define __lll_private_flag(fl, private) \
2544
 
+  ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))
2545
 
+# endif
2546
 
+#else
2547
 
+# ifdef __ASSUME_PRIVATE_FUTEX
2548
 
+#  define __lll_private_flag(fl, private) \
2549
 
+  (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
2550
 
+# else
2551
 
+#  define __lll_private_flag(fl, private) \
2552
 
+  (__builtin_constant_p (private)                                            \
2553
 
+   ? ((private) == 0                                                         \
2554
 
+      ? ((fl) | THREAD_GETMEM (THREAD_SELF, header.private_futex))           \
2555
 
+      : (fl))                                                                \
2556
 
+   : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG)                               \
2557
 
+             & THREAD_GETMEM (THREAD_SELF, header.private_futex))))
2558
 
+# endif              
2559
 
+#endif
2560
 
+
2561
 
+
2562
 
+#define lll_futex_wait(futexp, val, private) \
2563
 
+  lll_futex_timed_wait(futexp, val, NULL, private)
2564
 
+
2565
 
+#define lll_futex_timed_wait(futexp, val, timespec, private) \
2566
 
+  ({                                                                         \
2567
 
+    INTERNAL_SYSCALL_DECL (__err);                                           \
2568
 
+    long int __ret;                                                          \
2569
 
+    __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp),                     \
2570
 
+                             __lll_private_flag (FUTEX_WAIT, private),       \
2571
 
+                             (val), (timespec));                             \
2572
 
+    __ret;                                                                   \
2573
 
+  })
2574
 
+
2575
 
+#define lll_futex_wake(futexp, nr, private) \
2576
 
+  ({                                                                         \
2577
 
+    INTERNAL_SYSCALL_DECL (__err);                                           \
2578
 
+    long int __ret;                                                          \
2579
 
+    __ret = INTERNAL_SYSCALL (futex, __err, 4, (futexp),                     \
2580
 
+                             __lll_private_flag (FUTEX_WAKE, private),       \
2581
 
+                             (nr), 0);                                       \
2582
 
+    __ret;                                                                   \
2583
 
+  })
2584
 
+
2585
 
+#define lll_robust_dead(futexv, private) \
2586
 
+  do                                                                         \
2587
 
+    {                                                                        \
2588
 
+      int *__futexp = &(futexv);                                             \
2589
 
+      atomic_or (__futexp, FUTEX_OWNER_DIED);                                \
2590
 
+      lll_futex_wake (__futexp, 1, private);                                 \
2591
 
+    }                                                                        \
2592
 
+  while (0)
2593
 
+
2594
 
+/* Returns non-zero if error happened, zero if success.  */
2595
 
+#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
2596
 
+  ({                                                                         \
2597
 
+    INTERNAL_SYSCALL_DECL (__err);                                           \
2598
 
+    long int __ret;                                                          \
2599
 
+    __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),                     \
2600
 
+                             __lll_private_flag (FUTEX_CMP_REQUEUE, private),\
2601
 
+                             (nr_wake), (nr_move), (mutex), (val));          \
2602
 
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err);                                 \
2603
 
+  })
2604
 
+
2605
 
+/* Returns non-zero if error happened, zero if success.  */
2606
 
+#define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
2607
 
+  ({                                                                         \
2608
 
+    INTERNAL_SYSCALL_DECL (__err);                                           \
2609
 
+    long int __ret;                                                          \
2610
 
+    __ret = INTERNAL_SYSCALL (futex, __err, 6, (futexp),                     \
2611
 
+                             __lll_private_flag (FUTEX_WAKE_OP, private),    \
2612
 
+                             (nr_wake), (nr_wake2), (futexp2),               \
2613
 
+                             FUTEX_OP_CLEAR_WAKE_IF_GT_ONE);                 \
2614
 
+    INTERNAL_SYSCALL_ERROR_P (__ret, __err);                                 \
2615
 
+  })
2616
 
+
2617
 
+#define lll_trylock(lock)                              \
2618
 
+  atomic_compare_and_exchange_val_acq (&(lock), 1, 0)
2619
 
+
2620
 
+#define lll_cond_trylock(lock)                         \
2621
 
+  atomic_compare_and_exchange_val_acq (&(lock), 2, 0)
2622
 
+
2623
 
+#define lll_robust_trylock(lock, id)                   \
2624
 
+  atomic_compare_and_exchange_val_acq (&(lock), id, 0)
2625
 
+
2626
 
+extern void __lll_lock_wait_private (int *futex) attribute_hidden;
2627
 
+extern void __lll_lock_wait (int *futex, int private) attribute_hidden;
2628
 
+extern int __lll_robust_lock_wait (int *futex, int private) attribute_hidden;
2629
 
+
2630
 
+#define __lll_lock(futex, private)                                           \
2631
 
+  ((void) ({                                                                 \
2632
 
+    int *__futex = (futex);                                                  \
2633
 
+    if (__builtin_expect (atomic_compare_and_exchange_val_acq (__futex,       \
2634
 
+                                                               1, 0), 0))    \
2635
 
+      {                                                                              \
2636
 
+       if (__builtin_constant_p (private) && (private) == LLL_PRIVATE)       \
2637
 
+         __lll_lock_wait_private (__futex);                                  \
2638
 
+       else                                                                  \
2639
 
+         __lll_lock_wait (__futex, private);                                 \
2640
 
+      }                                                                              \
2641
 
+  }))
2642
 
+#define lll_lock(futex, private) __lll_lock (&(futex), private)
2643
 
+
2644
 
+
2645
 
+#define __lll_robust_lock(futex, id, private)                                \
2646
 
+  ({                                                                         \
2647
 
+    int *__futex = (futex);                                                  \
2648
 
+    int __val = 0;                                                           \
2649
 
+                                                                             \
2650
 
+    if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id,  \
2651
 
+                                                               0), 0))       \
2652
 
+      __val = __lll_robust_lock_wait (__futex, private);                     \
2653
 
+    __val;                                                                   \
2654
 
+  })
2655
 
+#define lll_robust_lock(futex, id, private) \
2656
 
+  __lll_robust_lock (&(futex), id, private)
2657
 
+
2658
 
+
2659
 
+#define __lll_cond_lock(futex, private)                                              \
2660
 
+  ((void) ({                                                                 \
2661
 
+    int *__futex = (futex);                                                  \
2662
 
+    if (__builtin_expect (atomic_exchange_acq (__futex, 2), 0))                      \
2663
 
+      __lll_lock_wait (__futex, private);                                    \
2664
 
+  }))
2665
 
+#define lll_cond_lock(futex, private) __lll_cond_lock (&(futex), private)
2666
 
+
2667
 
+
2668
 
+#define lll_robust_cond_lock(futex, id, private) \
2669
 
+  __lll_robust_lock (&(futex), (id) | FUTEX_WAITERS, private)
2670
 
+
2671
 
+
2672
 
+extern int __lll_timedlock_wait (int *futex, const struct timespec *,
2673
 
+                                int private) attribute_hidden;
2674
 
+extern int __lll_robust_timedlock_wait (int *futex, const struct timespec *,
2675
 
+                                       int private) attribute_hidden;
2676
 
+
2677
 
+#define __lll_timedlock(futex, abstime, private)                             \
2678
 
+  ({                                                                         \
2679
 
+     int *__futex = (futex);                                                 \
2680
 
+     int __val = 0;                                                          \
2681
 
+                                                                             \
2682
 
+     if (__builtin_expect (atomic_exchange_acq (__futex, 1), 0))             \
2683
 
+       __val = __lll_timedlock_wait (__futex, abstime, private);             \
2684
 
+     __val;                                                                  \
2685
 
+  })
2686
 
+#define lll_timedlock(futex, abstime, private) \
2687
 
+  __lll_timedlock (&(futex), abstime, private)
2688
 
+
2689
 
+
2690
 
+#define __lll_robust_timedlock(futex, abstime, id, private)                  \
2691
 
+  ({                                                                         \
2692
 
+    int *__futex = (futex);                                                  \
2693
 
+    int __val = 0;                                                           \
2694
 
+                                                                             \
2695
 
+    if (__builtin_expect (atomic_compare_and_exchange_bool_acq (__futex, id,  \
2696
 
+                                                               0), 0))       \
2697
 
+      __val = __lll_robust_timedlock_wait (__futex, abstime, private);       \
2698
 
+    __val;                                                                   \
2699
 
+  })
2700
 
+#define lll_robust_timedlock(futex, abstime, id, private) \
2701
 
+  __lll_robust_timedlock (&(futex), abstime, id, private)
2702
 
+
2703
 
+
2704
 
+#define __lll_unlock(futex, private) \
2705
 
+  (void)                                                       \
2706
 
+    ({ int *__futex = (futex);                                 \
2707
 
+       int __oldval = atomic_exchange_rel (__futex, 0);                \
2708
 
+       if (__builtin_expect (__oldval > 1, 0))                 \
2709
 
+        lll_futex_wake (__futex, 1, private);                  \
2710
 
+    })
2711
 
+#define lll_unlock(futex, private) __lll_unlock(&(futex), private)
2712
 
+
2713
 
+
2714
 
+#define __lll_robust_unlock(futex, private) \
2715
 
+  (void)                                                       \
2716
 
+    ({ int *__futex = (futex);                                 \
2717
 
+       int __oldval = atomic_exchange_rel (__futex, 0);                \
2718
 
+       if (__builtin_expect (__oldval & FUTEX_WAITERS, 0))     \
2719
 
+        lll_futex_wake (__futex, 1, private);                  \
2720
 
+    })
2721
 
+#define lll_robust_unlock(futex, private) \
2722
 
+  __lll_robust_unlock(&(futex), private)
2723
 
+
2724
 
+
2725
 
+#define lll_islocked(futex) \
2726
 
+  (futex != 0)
2727
 
+
2728
 
+
2729
 
+/* Our internal lock implementation is identical to the binary-compatible
2730
 
+   mutex implementation. */
2731
 
+
2732
 
+/* Initializers for lock.  */
2733
 
+#define LLL_LOCK_INITIALIZER           (0)
2734
 
+#define LLL_LOCK_INITIALIZER_LOCKED    (1)
2735
 
+
2736
 
+/* The states of a lock are:
2737
 
+    0  -  untaken
2738
 
+    1  -  taken by one user
2739
 
+   >1  -  taken by more users */
2740
 
+
2741
 
+/* The kernel notifies a process which uses CLONE_CLEARTID via futex
2742
 
+   wakeup when the clone terminates.  The memory location contains the
2743
 
+   thread ID while the clone is running and is reset to zero
2744
 
+   afterwards. */
2745
 
+#define lll_wait_tid(tid) \
2746
 
+  do {                                                 \
2747
 
+    __typeof (tid) __tid;                              \
2748
 
+    while ((__tid = (tid)) != 0)                       \
2749
 
+      lll_futex_wait (&(tid), __tid, LLL_SHARED);      \
2750
 
+  } while (0)
2751
 
+
2752
 
+extern int __lll_timedwait_tid (int *, const struct timespec *)
2753
 
+     attribute_hidden;
2754
 
+
2755
 
+#define lll_timedwait_tid(tid, abstime) \
2756
 
+  ({                                                   \
2757
 
+    int __res = 0;                                     \
2758
 
+    if ((tid) != 0)                                    \
2759
 
+      __res = __lll_timedwait_tid (&(tid), (abstime)); \
2760
 
+    __res;                                             \
2761
 
+  })
2762
 
+
2763
 
+#endif /* lowlevellock.h */
2764
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S
2765
 
new file mode 100644
2766
 
index 0000000..36c9270
2767
 
--- /dev/null
2768
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S
2769
 
@@ -0,0 +1,36 @@
2770
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2771
 
+   This file is part of the GNU C Library.
2772
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2773
 
+
2774
 
+   The GNU C Library is free software; you can redistribute it and/or
2775
 
+   modify it under the terms of the GNU Lesser General Public
2776
 
+   License as published by the Free Software Foundation; either
2777
 
+   version 2.1 of the License, or (at your option) any later version.
2778
 
+
2779
 
+   The GNU C Library is distributed in the hope that it will be useful,
2780
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2781
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2782
 
+   Lesser General Public License for more details.
2783
 
+
2784
 
+   You should have received a copy of the GNU Lesser General Public
2785
 
+   License along with the GNU C Library; if not, write to the Free
2786
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2787
 
+   02111-1307 USA.  */
2788
 
+
2789
 
+#include <tcb-offsets.h>
2790
 
+
2791
 
+#define SAVE_PID \
2792
 
+       bsrl    __m68k_read_tp@PLTPC    ; /* Get the thread pointer.  */ \
2793
 
+       movel   %a0, %a1                ; /* Save TP for RESTORE_PID.  */ \
2794
 
+       movel   PID_OFFSET(%a1), %d0    ; /* Get the PID.  */ \
2795
 
+       movel   %d0, %d1                ; /* Save PID for RESTORE_PID.  */ \
2796
 
+       negl    %d0                     ; /* Negate the PID.  */ \
2797
 
+       movel   %d0, PID_OFFSET(%a1)    ; /* Store the temporary PID.  */
2798
 
+
2799
 
+#define RESTORE_PID \
2800
 
+       tstl    %d0                     ; \
2801
 
+       beq     1f                      ; /* If we are the parent... */ \
2802
 
+       movel   %d1, PID_OFFSET(%a1)    ; /* Restore the PID.  */ \
2803
 
+1:     
2804
 
+
2805
 
+#include <sysdeps/unix/sysv/linux/m68k/vfork.S>
2806
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/pthread_once.c b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pthread_once.c
2807
 
new file mode 100644
2808
 
index 0000000..415045f
2809
 
--- /dev/null
2810
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pthread_once.c
2811
 
@@ -0,0 +1,91 @@
2812
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2813
 
+   This file is part of the GNU C Library.
2814
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2815
 
+
2816
 
+   The GNU C Library is free software; you can redistribute it and/or
2817
 
+   modify it under the terms of the GNU Lesser General Public
2818
 
+   License as published by the Free Software Foundation; either
2819
 
+   version 2.1 of the License, or (at your option) any later version.
2820
 
+
2821
 
+   The GNU C Library is distributed in the hope that it will be useful,
2822
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2823
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the GNU
2824
 
+   Lesser General Public License for more details.
2825
 
+
2826
 
+   You should have received a copy of the GNU Lesser General Public
2827
 
+   License along with the GNU C Library; if not, write to the Free
2828
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2829
 
+   02111-1307 USA.  */
2830
 
+
2831
 
+#include "pthreadP.h"
2832
 
+#include <lowlevellock.h>
2833
 
+
2834
 
+unsigned long int __fork_generation attribute_hidden;
2835
 
+
2836
 
+static void
2837
 
+clear_once_control (void *arg)
2838
 
+{
2839
 
+  pthread_once_t *once_control = (pthread_once_t *) arg;
2840
 
+
2841
 
+  *once_control = 0;
2842
 
+  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
2843
 
+}
2844
 
+
2845
 
+int
2846
 
+__pthread_once (pthread_once_t *once_control, void (*init_routine) (void))
2847
 
+{
2848
 
+  for (;;)
2849
 
+    {
2850
 
+      int oldval;
2851
 
+      int newval;
2852
 
+
2853
 
+      /* Pseudo code:
2854
 
+        newval = __fork_generation | 1;
2855
 
+        oldval = *once_control;
2856
 
+        if ((oldval & 2) == 0)
2857
 
+          *once_control = newval;
2858
 
+        Do this atomically.
2859
 
+      */
2860
 
+      do
2861
 
+       {
2862
 
+         newval = __fork_generation | 1;
2863
 
+         oldval = *once_control;
2864
 
+         if (oldval & 2)
2865
 
+           break;
2866
 
+       } while (atomic_compare_and_exchange_val_acq (once_control, newval, oldval) != oldval);
2867
 
+
2868
 
+      /* Check if the initializer has already been done.  */
2869
 
+      if ((oldval & 2) != 0)
2870
 
+       return 0;
2871
 
+
2872
 
+      /* Check if another thread already runs the initializer. */
2873
 
+      if ((oldval & 1) == 0)
2874
 
+       break;
2875
 
+
2876
 
+      /* Check whether the initializer execution was interrupted by a fork.  */
2877
 
+      if (oldval != newval)
2878
 
+       break;
2879
 
+
2880
 
+      /* Same generation, some other thread was faster. Wait.  */
2881
 
+      lll_futex_wait (once_control, oldval, LLL_PRIVATE);
2882
 
+    }
2883
 
+
2884
 
+  /* This thread is the first here.  Do the initialization.
2885
 
+     Register a cleanup handler so that in case the thread gets
2886
 
+     interrupted the initialization can be restarted.  */
2887
 
+  pthread_cleanup_push (clear_once_control, once_control);
2888
 
+
2889
 
+  init_routine ();
2890
 
+
2891
 
+  pthread_cleanup_pop (0);
2892
 
+
2893
 
+  /* Say that the initialisation is done.  */
2894
 
+  *once_control = __fork_generation | 2;
2895
 
+
2896
 
+  /* Wake up all other threads.  */
2897
 
+  lll_futex_wake (once_control, INT_MAX, LLL_PRIVATE);
2898
 
+
2899
 
+  return 0;
2900
 
+}
2901
 
+weak_alias (__pthread_once, pthread_once)
2902
 
+strong_alias (__pthread_once, __pthread_once_internal)
2903
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h
2904
 
new file mode 100644
2905
 
index 0000000..87e2d55
2906
 
--- /dev/null
2907
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/sysdep-cancel.h
2908
 
@@ -0,0 +1,141 @@
2909
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
2910
 
+   This file is part of the GNU C Library.
2911
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
2912
 
+
2913
 
+   The GNU C Library is free software; you can redistribute it and/or
2914
 
+   modify it under the terms of the GNU Lesser General Public
2915
 
+   License as published by the Free Software Foundation; either
2916
 
+   version 2.1 of the License, or (at your option) any later version.
2917
 
+
2918
 
+   The GNU C Library is distributed in the hope that it will be useful,
2919
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
2920
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2921
 
+   Lesser General Public License for more details.
2922
 
+
2923
 
+   You should have received a copy of the GNU Lesser General Public
2924
 
+   License along with the GNU C Library; if not, write to the Free
2925
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
2926
 
+   02111-1307 USA.  */
2927
 
+
2928
 
+#include <sysdep.h>
2929
 
+#include <tls.h>
2930
 
+#ifndef __ASSEMBLER__
2931
 
+# include <nptl/pthreadP.h>
2932
 
+#endif
2933
 
+
2934
 
+#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
2935
 
+
2936
 
+# undef PSEUDO
2937
 
+# define PSEUDO(name, syscall_name, args)                                    \
2938
 
+  .text;                                                                     \
2939
 
+  ENTRY (name)                                                               \
2940
 
+    SINGLE_THREAD_P;                                                         \
2941
 
+    jne .Lpseudo_cancel;                                                     \
2942
 
+  .type __##syscall_name##_nocancel,@function;                               \
2943
 
+  .globl __##syscall_name##_nocancel;                                        \
2944
 
+  __##syscall_name##_nocancel:                                               \
2945
 
+    DO_CALL (syscall_name, args);                                            \
2946
 
+    cmp.l &-4095, %d0;                                                       \
2947
 
+    jcc SYSCALL_ERROR_LABEL;                                                 \
2948
 
+    rts;                                                                     \
2949
 
+  .size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel;           \
2950
 
+  .Lpseudo_cancel:                                                           \
2951
 
+    cfi_startproc;                                                           \
2952
 
+    CENABLE;                                                                 \
2953
 
+    DOCARGS_##args                                                           \
2954
 
+    move.l %d0, -(%sp); /* Save result of CENABLE.  */                       \
2955
 
+    cfi_adjust_cfa_offset (4); \
2956
 
+    move.l &SYS_ify (syscall_name), %d0;                                     \
2957
 
+    trap &0;                                                                 \
2958
 
+    move.l %d0, %d2;                                                         \
2959
 
+    CDISABLE;                                                                \
2960
 
+    addq.l &4, %sp; /* Remove result of CENABLE from the stack.  */           \
2961
 
+    cfi_adjust_cfa_offset (-4); \
2962
 
+    move.l %d2, %d0;                                                         \
2963
 
+    UNDOCARGS_##args                                                         \
2964
 
+    cmp.l &-4095, %d0;                                                       \
2965
 
+    jcc SYSCALL_ERROR_LABEL;                                                 \
2966
 
+    cfi_endproc
2967
 
+
2968
 
+/* Note: we use D2 to save syscall's return value as D0 will be clobbered in
2969
 
+   CDISABLE.  */
2970
 
+# define DOCARGS_0     move.l %d2, -(%sp);             \
2971
 
+  cfi_adjust_cfa_offset (4); cfi_rel_offset (%d2, 0);
2972
 
+# define UNDOCARGS_0   move.l (%sp)+, %d2;     \
2973
 
+  cfi_adjust_cfa_offset (-4); cfi_restore (%d2);
2974
 
+
2975
 
+# define DOCARGS_1     _DOCARGS_1 (4); DOCARGS_0
2976
 
+# define _DOCARGS_1(n) move.l n(%sp), %d1;
2977
 
+# define UNDOCARGS_1   UNDOCARGS_0
2978
 
+
2979
 
+# define DOCARGS_2     _DOCARGS_2 (8)
2980
 
+# define _DOCARGS_2(n) DOCARGS_0 move.l n+4(%sp), %d2; _DOCARGS_1 (n)
2981
 
+# define UNDOCARGS_2   UNDOCARGS_0
2982
 
+
2983
 
+/* TODO: We can optimize DOCARGS_{3, 4} by saving registers to a0 and a1
2984
 
+   instead of pushing them on stack.  */
2985
 
+# define DOCARGS_3     _DOCARGS_3 (12)
2986
 
+# define _DOCARGS_3(n) move.l %d3, -(%sp);                             \
2987
 
+  cfi_adjust_cfa_offset (4); cfi_rel_offset (%d3, 0);                  \
2988
 
+  move.l n+4(%sp), %d3; _DOCARGS_2 (n)
2989
 
+# define UNDOCARGS_3   UNDOCARGS_2 move.l (%sp)+, %d3;         \
2990
 
+  cfi_adjust_cfa_offset (-4); cfi_restore (%d3);
2991
 
+
2992
 
+# define DOCARGS_4     _DOCARGS_4 (16)
2993
 
+# define _DOCARGS_4(n) move.l %d4, -(%sp);                     \
2994
 
+  cfi_adjust_cfa_offset (4); cfi_rel_offset (%d4, 0);          \
2995
 
+  move.l n+4(%sp), %d4; _DOCARGS_3 (n)
2996
 
+# define UNDOCARGS_4   UNDOCARGS_3 move.l (%sp)+, %d4; \
2997
 
+  cfi_adjust_cfa_offset (-4); cfi_restore (%d4);
2998
 
+
2999
 
+# define DOCARGS_5     _DOCARGS_5 (20)
3000
 
+# define _DOCARGS_5(n) move.l %d5, %a1; cfi_register (%d5, a1); \
3001
 
+  move.l n(%sp), %d5; _DOCARGS_4 (n-4)
3002
 
+# define UNDOCARGS_5   UNDOCARGS_4 move.l %a1, %d5; cfi_restore (%d5);
3003
 
+
3004
 
+# define DOCARGS_6     _DOCARGS_6 (24)
3005
 
+# define _DOCARGS_6(n) move.l n(%sp), %a0; _DOCARGS_5 (n-4)
3006
 
+# define UNDOCARGS_6   UNDOCARGS_5
3007
 
+
3008
 
+# ifdef PIC
3009
 
+#  define PSEUDO_JMP(sym) jbsr sym ## @PLTPC
3010
 
+# else
3011
 
+#  define PSEUDO_JMP(sym) jbsr sym
3012
 
+# endif
3013
 
+
3014
 
+# ifdef IS_IN_libpthread
3015
 
+#  define CENABLE      PSEUDO_JMP (__pthread_enable_asynccancel)
3016
 
+#  define CDISABLE     PSEUDO_JMP (__pthread_disable_asynccancel)
3017
 
+# elif !defined NOT_IN_libc
3018
 
+#  define CENABLE      PSEUDO_JMP (__libc_enable_asynccancel)
3019
 
+#  define CDISABLE     PSEUDO_JMP (__libc_disable_asynccancel)
3020
 
+# elif defined IS_IN_librt
3021
 
+#  define CENABLE      PSEUDO_JMP (__librt_enable_asynccancel)
3022
 
+#  define CDISABLE     PSEUDO_JMP (__librt_disable_asynccancel)
3023
 
+# else
3024
 
+#  error Unsupported library
3025
 
+# endif
3026
 
+
3027
 
+# ifndef __ASSEMBLER__
3028
 
+#  define SINGLE_THREAD_P                                              \
3029
 
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF,                                \
3030
 
+                                  header.multiple_threads) == 0, 1)
3031
 
+# else
3032
 
+#  define SINGLE_THREAD_P                      \
3033
 
+  PSEUDO_JMP (__m68k_read_tp);                 \
3034
 
+  tst.l MULTIPLE_THREADS_OFFSET(%a0)
3035
 
+# endif
3036
 
+
3037
 
+#elif !defined __ASSEMBLER__
3038
 
+
3039
 
+# define SINGLE_THREAD_P (1)
3040
 
+# define NO_CANCELLATION (1)
3041
 
+
3042
 
+#endif
3043
 
+
3044
 
+#ifndef __ASSEMBLER__
3045
 
+# define RTLD_SINGLE_THREAD_P                                    \
3046
 
+  __builtin_expect (THREAD_GETMEM (THREAD_SELF,                          \
3047
 
+                                  header.multiple_threads) == 0, \
3048
 
+                   1)
3049
 
+#endif
3050
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S
3051
 
new file mode 100644
3052
 
index 0000000..8599c3d
3053
 
--- /dev/null
3054
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S
3055
 
@@ -0,0 +1,38 @@
3056
 
+/* Copyright (C) 2010 Free Software Foundation, Inc.
3057
 
+   This file is part of the GNU C Library.
3058
 
+   Contributed by Maxim Kuvyrkov <maxim@codesourcery.com>, 2010.
3059
 
+
3060
 
+   The GNU C Library is free software; you can redistribute it and/or
3061
 
+   modify it under the terms of the GNU Lesser General Public
3062
 
+   License as published by the Free Software Foundation; either
3063
 
+   version 2.1 of the License, or (at your option) any later version.
3064
 
+
3065
 
+   The GNU C Library is distributed in the hope that it will be useful,
3066
 
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
3067
 
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3068
 
+   Lesser General Public License for more details.
3069
 
+
3070
 
+   You should have received a copy of the GNU Lesser General Public
3071
 
+   License along with the GNU C Library; if not, write to the Free
3072
 
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
3073
 
+   02111-1307 USA.  */
3074
 
+
3075
 
+#include <tcb-offsets.h>
3076
 
+
3077
 
+#define SAVE_PID \
3078
 
+       bsrl    __m68k_read_tp@PLTPC    ; /* Get the thread pointer.  */ \
3079
 
+       movel   %a0, %a1                ; /* Save TP for RESTORE_PID.  */ \
3080
 
+       movel   PID_OFFSET(%a1), %d0    ; /* Get the PID.  */ \
3081
 
+       movel   %d0, %d1                ; /* Save PID for RESTORE_PID.  */ \
3082
 
+       negl    %d0                     ; /* Negate the PID.  */ \
3083
 
+       bne     1f                      ; /* If it was zero... */ \
3084
 
+       movel   #0x80000000, %d0        ; /* use 0x80000000 instead.  */ \
3085
 
+1:     movel   %d0, PID_OFFSET(%a1)    ; /* Store the temporary PID.  */
3086
 
+
3087
 
+#define RESTORE_PID \
3088
 
+       tstl    %d0                     ; \
3089
 
+       beq     1f                      ; /* If we are the parent... */ \
3090
 
+       movel   %d1, PID_OFFSET(%a1)    ; /* Restore the PID.  */ \
3091
 
+1:     
3092
 
+
3093
 
+#include <sysdeps/unix/sysv/linux/m68k/vfork.S>
3094
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/socket.S b/ports/sysdeps/unix/sysv/linux/m68k/socket.S
3095
 
index 2690f18..147a3b2 100644
3096
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/socket.S
3097
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/socket.S
3098
 
@@ -1,4 +1,4 @@
3099
 
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
3100
 
+/* Copyright (C) 1996, 1997, 1998, 2010 Free Software Foundation, Inc.
3101
 
    This file is part of the GNU C Library.
3102
 
 
3103
 
    The GNU C Library is free software; you can redistribute it and/or
3104
 
@@ -41,8 +41,11 @@
3105
 
 
3106
 
 .globl __socket
3107
 
 ENTRY (__socket)
3108
 
-#if defined NEED_CANCELLATION && defined CENABLE
3109
 
-       SINGLE_THREAD_P (%a0)
3110
 
+#ifdef NEED_CANCELLATION
3111
 
+# if !defined CENABLE || !defined CDISABLE
3112
 
+#  error CENABLE and/or CDISABLE is not defined
3113
 
+# endif
3114
 
+       SINGLE_THREAD_P
3115
 
        jne 1f
3116
 
 #endif
3117
 
 
3118
 
@@ -69,21 +72,26 @@ ENTRY (__socket)
3119
 
        /* Successful; return the syscall's value.  */
3120
 
        rts
3121
 
 
3122
 
-#if defined NEED_CANCELLATION && defined CENABLE
3123
 
-1:     /* Enable asynchronous cancellation.  */
3124
 
+#ifdef NEED_CANCELLATION
3125
 
+1:     cfi_startproc
3126
 
+       /* Enable asynchronous cancellation.  */
3127
 
        CENABLE
3128
 
 
3129
 
-       /* Save registers.  */
3130
 
+       /* Save D2.  */
3131
 
        move.l %d2, -(%sp)
3132
 
-       move.l %d0, -(%sp)
3133
 
+       cfi_adjust_cfa_offset (4)
3134
 
+       cfi_rel_offset (%d2, 0)
3135
 
 
3136
 
-       move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
3137
 
+       /* Save the result of CENABLE.  */
3138
 
+       move.l %d0, -(%sp)
3139
 
+       cfi_adjust_cfa_offset (4)
3140
 
 
3141
 
        /* Use ## so `socket' is a separate token that might be #define'd.  */
3142
 
        move.l #P (SOCKOP_,socket), %d1 /* Subcode is first arg to syscall.  */
3143
 
        lea 4+8(%sp), %a1               /* Address of args is 2nd arg.  */
3144
 
        move.l %a1, %d2
3145
 
 
3146
 
+       move.l #SYS_ify (socketcall), %d0 /* System call number in %d0.  */
3147
 
        /* Do the system call trap.  */
3148
 
        trap #0
3149
 
 
3150
 
@@ -91,14 +99,18 @@ ENTRY (__socket)
3151
 
        move.l %d0, %d2
3152
 
        CDISABLE
3153
 
        addq.l #4, %sp
3154
 
+       cfi_adjust_cfa_offset (-4)
3155
 
        move.l %d2, %d0
3156
 
 
3157
 
        /* Restore registers.  */
3158
 
        move.l (%sp)+, %d2
3159
 
+       cfi_adjust_cfa_offset (-4)
3160
 
+       cfi_restore (%d2)
3161
 
 
3162
 
        /* %d0 is < 0 if there was an error.  */
3163
 
        tst.l %d0
3164
 
        jmi SYSCALL_ERROR_LABEL
3165
 
+       cfi_endproc
3166
 
 
3167
 
        /* Successful; return the syscall's value.  */
3168
 
        rts
3169
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h b/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3170
 
index 12687d8..e3aed15 100644
3171
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3172
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3173
 
@@ -1,4 +1,5 @@
3174
 
-/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004, 2006 Free Software Foundation, Inc.
3175
 
+/* Copyright (C) 1996, 1997, 1998, 2000, 2003, 2004, 2006, 2010
3176
 
+   Free Software Foundation, Inc.
3177
 
    This file is part of the GNU C Library.
3178
 
    Written by Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de>,
3179
 
    December 1995.
3180
 
@@ -23,6 +24,7 @@
3181
 
 
3182
 
 #include <sysdeps/unix/sysdep.h>
3183
 
 #include <sysdeps/m68k/sysdep.h>
3184
 
+#include <tls.h>
3185
 
 
3186
 
 /* Defines RTLD_PRIVATE_ERRNO.  */
3187
 
 #include <dl-sysdep.h>
3188
 
@@ -148,9 +150,11 @@ SYSCALL_ERROR_LABEL:                                                             \
3189
 
        arg 3           %d3          call-saved
3190
 
        arg 4           %d4          call-saved
3191
 
        arg 5           %d5          call-saved
3192
 
+       arg 6           %a0          call-clobbered
3193
 
 
3194
 
    The stack layout upon entering the function is:
3195
 
 
3196
 
+       24(%sp)         Arg# 6
3197
 
        20(%sp)         Arg# 5
3198
 
        16(%sp)         Arg# 4
3199
 
        12(%sp)         Arg# 3
3200
 
@@ -229,7 +233,7 @@ SYSCALL_ERROR_LABEL:                                                              \
3201
 
    normally.  It will never touch errno.  This returns just what the kernel
3202
 
    gave back.  */
3203
 
 #undef INTERNAL_SYSCALL
3204
 
-#define INTERNAL_SYSCALL(name, err, nr, args...)       \
3205
 
+#define INTERNAL_SYSCALL_NCS(name, err, nr, args...)   \
3206
 
   ({ unsigned int _sys_result;                         \
3207
 
      {                                                 \
3208
 
        /* Load argument values in temporary variables
3209
 
@@ -237,7 +241,7 @@ SYSCALL_ERROR_LABEL:                                                              \
3210
 
          before the call used registers are set.  */   \
3211
 
        LOAD_ARGS_##nr (args)                           \
3212
 
        LOAD_REGS_##nr                                  \
3213
 
-       register int _d0 asm ("%d0") = __NR_##name;     \
3214
 
+       register int _d0 asm ("%d0") = name;            \
3215
 
        asm volatile ("trap #0"                         \
3216
 
                     : "=d" (_d0)                       \
3217
 
                     : "0" (_d0) ASM_ARGS_##nr          \
3218
 
@@ -245,6 +249,8 @@ SYSCALL_ERROR_LABEL:                                                              \
3219
 
        _sys_result = _d0;                              \
3220
 
      }                                                 \
3221
 
      (int) _sys_result; })
3222
 
+#define INTERNAL_SYSCALL(name, err, nr, args...)       \
3223
 
+  INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
3224
 
 
3225
 
 #undef INTERNAL_SYSCALL_ERROR_P
3226
 
 #define INTERNAL_SYSCALL_ERROR_P(val, err)             \
3227
 
@@ -300,4 +306,15 @@ SYSCALL_ERROR_LABEL:                                                             \
3228
 
 #define ASM_ARGS_6     ASM_ARGS_5, "a" (_a0)
3229
 
 
3230
 
 #endif /* not __ASSEMBLER__ */
3231
 
+
3232
 
+/* Pointer mangling is not yet supported for M68K.  */
3233
 
+#define PTR_MANGLE(var) (void) (var)
3234
 
+#define PTR_DEMANGLE(var) (void) (var)
3235
 
+
3236
 
+#if defined NEED_DL_SYSINFO || defined NEED_DL_SYSINFO_DSO
3237
 
+/* M68K needs system-supplied DSO to access TLS helpers
3238
 
+   even when statically linked.  */
3239
 
+# define NEED_STATIC_SYSINFO_DSO 1
3240
 
+#endif
3241
 
+
3242
 
 #endif
3243
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3244
 
index 8027b2f..61bbf2f 100644
3245
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3246
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3247
 
@@ -1,4 +1,4 @@
3248
 
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
3249
 
+/* Copyright (C) 1999, 2002, 2003, 2010 Free Software Foundation, Inc.
3250
 
    This file is part of the GNU C Library.
3251
 
    Contributed by Andreas Schwab <schwab@gnu.org>.
3252
 
 
3253
 
@@ -22,6 +22,14 @@
3254
 
 #include <bits/errno.h>
3255
 
 #include <kernel-features.h>
3256
 
 
3257
 
+#ifndef SAVE_PID
3258
 
+#define SAVE_PID
3259
 
+#endif
3260
 
+
3261
 
+#ifndef RESTORE_PID
3262
 
+#define RESTORE_PID
3263
 
+#endif
3264
 
+
3265
 
 /* Clone the calling process, but without copying the whole address space.
3266
 
    The calling process is suspended until the new process exits or is
3267
 
    replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
3268
 
@@ -31,12 +39,20 @@ ENTRY (__vfork)
3269
 
 
3270
 
 #ifdef __NR_vfork
3271
 
 
3272
 
+       /* SAVE_PID clobbers call-clobbered registers and
3273
 
+          saves data in D1 and A1.  */
3274
 
+
3275
 
+       SAVE_PID
3276
 
+       
3277
 
        /* Pop the return PC value into A0.  */
3278
 
        movel   %sp@+, %a0
3279
 
 
3280
 
        /* Stuff the syscall number in D0 and trap into the kernel.  */
3281
 
        movel   #SYS_ify (vfork), %d0
3282
 
        trap    #0
3283
 
+
3284
 
+       RESTORE_PID
3285
 
+
3286
 
        tstl    %d0
3287
 
        jmi     .Lerror         /* Branch forward if it failed.  */
3288
 
 
3289
 
From: Andreas Schwab <schwab@linux-m68k.org>
3290
 
Date: Fri, 12 Mar 2010 18:55:40 +0000 (+0100)
3291
 
Subject: Whitespace cleanup
3292
 
X-Git-Tag: glibc-2.12~37
3293
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=2b3dafb0874b7843355e7e02b0009be6df52271d
3294
 
 
3295
 
Whitespace cleanup
3296
 
---
3297
 
 
3298
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3299
 
index 00db4bb..242d23d 100644
3300
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3301
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3302
 
@@ -86,7 +86,7 @@ ENTRY (__vdso_atomic_cmpxchg_32_stub)
3303
 
        rts
3304
 
        cfi_endproc
3305
 
 END (__vdso_atomic_cmpxchg_32_stub)
3306
 
-       
3307
 
+
3308
 
        .hidden __vdso_atomic_barrier_stub
3309
 
 ENTRY (__vdso_atomic_barrier_stub)
3310
 
        cfi_startproc
3311
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3312
 
index 926077d..bc2970e 100644
3313
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3314
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3315
 
@@ -73,7 +73,7 @@
3316
 
       : (fl))                                                                \
3317
 
    : ((fl) | (((private) ^ FUTEX_PRIVATE_FLAG)                               \
3318
 
              & THREAD_GETMEM (THREAD_SELF, header.private_futex))))
3319
 
-# endif              
3320
 
+# endif
3321
 
 #endif
3322
 
 
3323
 
 
3324
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S
3325
 
index 36c9270..639d5ed 100644
3326
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S
3327
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/pt-vfork.S
3328
 
@@ -31,6 +31,6 @@
3329
 
        tstl    %d0                     ; \
3330
 
        beq     1f                      ; /* If we are the parent... */ \
3331
 
        movel   %d1, PID_OFFSET(%a1)    ; /* Restore the PID.  */ \
3332
 
-1:     
3333
 
+1:
3334
 
 
3335
 
 #include <sysdeps/unix/sysv/linux/m68k/vfork.S>
3336
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S
3337
 
index 8599c3d..95e3764 100644
3338
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S
3339
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/vfork.S
3340
 
@@ -33,6 +33,6 @@
3341
 
        tstl    %d0                     ; \
3342
 
        beq     1f                      ; /* If we are the parent... */ \
3343
 
        movel   %d1, PID_OFFSET(%a1)    ; /* Restore the PID.  */ \
3344
 
-1:     
3345
 
+1:
3346
 
 
3347
 
 #include <sysdeps/unix/sysv/linux/m68k/vfork.S>
3348
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3349
 
index 61bbf2f..4def7e3 100644
3350
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3351
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
3352
 
@@ -43,7 +43,7 @@ ENTRY (__vfork)
3353
 
           saves data in D1 and A1.  */
3354
 
 
3355
 
        SAVE_PID
3356
 
-       
3357
 
+
3358
 
        /* Pop the return PC value into A0.  */
3359
 
        movel   %sp@+, %a0
3360
 
 
3361
 
From: Andreas Schwab <schwab@linux-m68k.org>
3362
 
Date: Fri, 12 Mar 2010 20:37:02 +0000 (+0100)
3363
 
Subject: Add m68k-helpers optimized for m680x0
3364
 
X-Git-Tag: glibc-2.12~36
3365
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=7e261ba3d85d10eefbb55f2e9d67c55910dfae2f
3366
 
 
3367
 
Add m68k-helpers optimized for m680x0
3368
 
---
3369
 
 
3370
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3371
 
index 32681ff..446a307 100644
3372
 
--- a/ports/ChangeLog.m68k
3373
 
+++ b/ports/ChangeLog.m68k
3374
 
@@ -1,3 +1,10 @@
3375
 
+2010-03-12  Andreas Schwab  <schwab@linux-m68k.org>
3376
 
+
3377
 
+       * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Renamed ...
3378
 
+       * sysdeps/unix/sysv/linux/m68k/coldfire/m68k-helpers.S: ... to
3379
 
+       this.
3380
 
+       * sysdeps/unix/sysv/linux/m68k/m680x0/m68k-helpers.S: New file.
3381
 
+
3382
 
 2010-03-09  Maxim Kuvyrkov  <maxim@codesourcery.com>
3383
 
 
3384
 
        NPTL support for m68k/ColdFire
3385
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/ports/sysdeps/unix/sysv/linux/m68k/coldfire/m68k-helpers.S
3386
 
similarity index 100%
3387
 
copy from sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3388
 
copy to sysdeps/unix/sysv/linux/m68k/coldfire/m68k-helpers.S
3389
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/m68k-helpers.S
3390
 
similarity index 97%
3391
 
rename from sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3392
 
rename to sysdeps/unix/sysv/linux/m68k/m680x0/m68k-helpers.S
3393
 
index 242d23d..83ce564 100644
3394
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/m68k-helpers.S
3395
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/m680x0/m68k-helpers.S
3396
 
@@ -60,11 +60,9 @@ END (__vdso_read_tp_stub)
3397
 
 # endif
3398
 
 ENTRY (__m68k_read_tp)
3399
 
        cfi_startproc
3400
 
-       move.l  #_GLOBAL_OFFSET_TABLE_@GOTPC, %a0
3401
 
-       lea     (-6, %pc, %a0), %a0
3402
 
+       lea     _GLOBAL_OFFSET_TABLE_@GOTPC(%pc), %a0
3403
 
        move.l  M68K_VDSO_SYMBOL (__vdso_read_tp)@GOT(%a0), %a0
3404
 
-       move.l  (%a0), %a0
3405
 
-       jmp     (%a0)
3406
 
+       jmp     ([%a0])
3407
 
        cfi_endproc
3408
 
 END (__m68k_read_tp)
3409
 
 
3410
 
From: Andreas Schwab <schwab@linux-m68k.org>
3411
 
Date: Fri, 12 Mar 2010 21:15:23 +0000 (+0100)
3412
 
Subject: m68k: don't include <sysdep.h> in lowlevellock.h
3413
 
X-Git-Tag: glibc-2.12~35
3414
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=7d6cb729ed0451f51b63cb563271f1ce889d5a78
3415
 
 
3416
 
m68k: don't include <sysdep.h> in lowlevellock.h
3417
 
---
3418
 
 
3419
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3420
 
index 446a307..712651d 100644
3421
 
--- a/ports/ChangeLog.m68k
3422
 
+++ b/ports/ChangeLog.m68k
3423
 
@@ -1,5 +1,8 @@
3424
 
 2010-03-12  Andreas Schwab  <schwab@linux-m68k.org>
3425
 
 
3426
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h: Don't include
3427
 
+       <sysdep.h>.
3428
 
+
3429
 
        * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Renamed ...
3430
 
        * sysdeps/unix/sysv/linux/m68k/coldfire/m68k-helpers.S: ... to
3431
 
        this.
3432
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3433
 
index bc2970e..5ca78ec 100644
3434
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3435
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h
3436
 
@@ -26,7 +26,6 @@
3437
 
 #include <sys/param.h>
3438
 
 #include <bits/pthreadtypes.h>
3439
 
 #include <atomic.h>
3440
 
-#include <sysdep.h>
3441
 
 #include <kernel-features.h>
3442
 
 
3443
 
 #define FUTEX_WAIT             0
3444
 
From: Andreas Schwab <schwab@linux-m68k.org>
3445
 
Date: Sat, 13 Mar 2010 00:00:03 +0000 (+0100)
3446
 
Subject: m68k: TLS reference to errno in syscall stubs
3447
 
X-Git-Tag: glibc-2.12~34
3448
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=dbd0094b3f71213bc178cd1946496defbedb1d62
3449
 
 
3450
 
m68k: TLS reference to errno in syscall stubs
3451
 
---
3452
 
 
3453
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3454
 
index 712651d..b16fde2 100644
3455
 
--- a/ports/ChangeLog.m68k
3456
 
+++ b/ports/ChangeLog.m68k
3457
 
@@ -1,3 +1,8 @@
3458
 
+2010-03-13  Andreas Schwab  <schwab@linux-m68k.org>
3459
 
+
3460
 
+       * sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER):
3461
 
+       Add variant for USE__THREAD.
3462
 
+
3463
 
 2010-03-12  Andreas Schwab  <schwab@linux-m68k.org>
3464
 
 
3465
 
        * sysdeps/unix/sysv/linux/m68k/nptl/lowlevellock.h: Don't include
3466
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h b/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3467
 
index e3aed15..8bd188b 100644
3468
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3469
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/sysdep.h
3470
 
@@ -111,10 +111,27 @@ SYSCALL_ERROR_LABEL:                                                            \
3471
 
        a pointer (e.g., mmap).  */                                           \
3472
 
     move.l %d0, %a0;                                                         \
3473
 
     rts;
3474
 
-# else /* !RTLD_PRIVATE_ERRNO */
3475
 
-/* Store (- %d0) into errno through the GOT.  */
3476
 
-#  if defined _LIBC_REENTRANT
3477
 
-#   define SYSCALL_ERROR_HANDLER                                             \
3478
 
+# elif USE___THREAD
3479
 
+#  ifndef NOT_IN_libc
3480
 
+#   define SYSCALL_ERROR_ERRNO __libc_errno
3481
 
+#  else
3482
 
+#   define SYSCALL_ERROR_ERRNO errno
3483
 
+#  endif
3484
 
+#  define SYSCALL_ERROR_HANDLER                                                      \
3485
 
+SYSCALL_ERROR_LABEL:                                                         \
3486
 
+    neg.l %d0;                                                               \
3487
 
+    move.l %d0, -(%sp);                                                              \
3488
 
+    jbsr __m68k_read_tp@PLTPC;                                               \
3489
 
+    lea (_GLOBAL_OFFSET_TABLE_@GOTPC, %pc), %a1;                             \
3490
 
+    add.l (SYSCALL_ERROR_ERRNO@TLSIE, %a1), %a0;                             \
3491
 
+    move.l (%sp)+, (%a0);                                                    \
3492
 
+    move.l &-1, %d0;                                                         \
3493
 
+    /* Copy return value to %a0 for syscalls that are declared to return      \
3494
 
+       a pointer (e.g., mmap).  */                                           \
3495
 
+    move.l %d0, %a0;                                                         \
3496
 
+    rts;
3497
 
+# elif defined _LIBC_REENTRANT
3498
 
+#  define SYSCALL_ERROR_HANDLER                                                      \
3499
 
 SYSCALL_ERROR_LABEL:                                                         \
3500
 
     neg.l %d0;                                                               \
3501
 
     move.l %d0, -(%sp);                                                              \
3502
 
@@ -125,8 +142,9 @@ SYSCALL_ERROR_LABEL:                                                              \
3503
 
        a pointer (e.g., mmap).  */                                           \
3504
 
     move.l %d0, %a0;                                                         \
3505
 
     rts;
3506
 
-#  else /* !_LIBC_REENTRANT */
3507
 
-#   define SYSCALL_ERROR_HANDLER                                             \
3508
 
+# else /* !_LIBC_REENTRANT */
3509
 
+/* Store (- %d0) into errno through the GOT.  */
3510
 
+#  define SYSCALL_ERROR_HANDLER                                                      \
3511
 
 SYSCALL_ERROR_LABEL:                                                         \
3512
 
     move.l (errno@GOTPC, %pc), %a0;                                          \
3513
 
     neg.l %d0;                                                               \
3514
 
@@ -136,8 +154,7 @@ SYSCALL_ERROR_LABEL:                                                              \
3515
 
        a pointer (e.g., mmap).  */                                           \
3516
 
     move.l %d0, %a0;                                                         \
3517
 
     rts;
3518
 
-#  endif /* _LIBC_REENTRANT */
3519
 
-# endif /* RTLD_PRIVATE_ERRNO */
3520
 
+# endif /* _LIBC_REENTRANT */
3521
 
 #else
3522
 
 # define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used.  */
3523
 
 #endif /* PIC */
3524
 
From: Andreas Schwab <schwab@linux-m68k.org>
3525
 
Date: Sat, 13 Mar 2010 15:59:42 +0000 (+0100)
3526
 
Subject: m68k: define __signbit inlines
3527
 
X-Git-Tag: glibc-2.12~33
3528
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=326a03edf9a702f60ea2116364d8177dc682b9a5
3529
 
 
3530
 
m68k: define __signbit inlines
3531
 
---
3532
 
 
3533
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3534
 
index b16fde2..1c8d232 100644
3535
 
--- a/ports/ChangeLog.m68k
3536
 
+++ b/ports/ChangeLog.m68k
3537
 
@@ -1,5 +1,8 @@
3538
 
 2010-03-13  Andreas Schwab  <schwab@linux-m68k.org>
3539
 
 
3540
 
+       * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__signbit)
3541
 
+       (__signbitf, __signbitl): Define.
3542
 
+
3543
 
        * sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER):
3544
 
        Add variant for USE__THREAD.
3545
 
 
3546
 
diff --git a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3547
 
index 6b69f7a..0da98e4 100644
3548
 
--- a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3549
 
+++ b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3550
 
@@ -1,5 +1,5 @@
3551
 
 /* Definitions of inline math functions implemented by the m68881/2.
3552
 
-   Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004, 2008
3553
 
+   Copyright (C) 1991,92,93,94,96,97,98,99,2000,2002, 2003, 2004, 2008, 2010
3554
 
      Free Software Foundation, Inc.
3555
 
    This file is part of the GNU C Library.
3556
 
 
3557
 
@@ -85,6 +85,26 @@
3558
 
               : "=dm" (__result) : "f" (x), "f" (y));  \
3559
 
       __result != 0; })
3560
 
 # endif /* GCC 3.1 */
3561
 
+
3562
 
+/* Test for negative number.  Used in the signbit() macro.  */
3563
 
+__MATH_INLINE int
3564
 
+__NTH (__signbitf (float __x))
3565
 
+{
3566
 
+  __extension__ union { float __f; int __i; } __u = { __f: __x };
3567
 
+  return __u.__i < 0;
3568
 
+}
3569
 
+__MATH_INLINE int
3570
 
+__NTH (__signbit (double __x))
3571
 
+{
3572
 
+  __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
3573
 
+  return __u.__i[0] < 0;
3574
 
+}
3575
 
+__MATH_INLINE int
3576
 
+__NTH (__signbitl (long double __x))
3577
 
+{
3578
 
+  __extension__ union { long double __d; int __i[3]; } __u = { __d: __x };
3579
 
+  return __u.__i[0] < 0;
3580
 
+}
3581
 
 #endif
3582
 
 
3583
 
 
3584
 
From: Andreas Schwab <schwab@linux-m68k.org>
3585
 
Date: Sat, 13 Mar 2010 16:28:12 +0000 (+0100)
3586
 
Subject: m68k: remove duplicate __signbit definitions
3587
 
X-Git-Tag: glibc-2.12~32
3588
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=b5e933757cbe34989698fc1b1390c9b2a9a6b0be
3589
 
 
3590
 
m68k: remove duplicate __signbit definitions
3591
 
---
3592
 
 
3593
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3594
 
index 1c8d232..9fafc08 100644
3595
 
--- a/ports/ChangeLog.m68k
3596
 
+++ b/ports/ChangeLog.m68k
3597
 
@@ -1,7 +1,7 @@
3598
 
 2010-03-13  Andreas Schwab  <schwab@linux-m68k.org>
3599
 
 
3600
 
        * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__signbit)
3601
 
-       (__signbitf, __signbitl): Define.
3602
 
+       (__signbitf, __signbitl): Always define as inline.
3603
 
 
3604
 
        * sysdeps/unix/sysv/linux/m68k/sysdep.h (SYSCALL_ERROR_HANDLER):
3605
 
        Add variant for USE__THREAD.
3606
 
diff --git a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3607
 
index 0da98e4..975ffd8 100644
3608
 
--- a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3609
 
+++ b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3610
 
@@ -301,17 +301,7 @@ __inline_functions(long double,l)
3611
 
 #ifdef __USE_ISOC99
3612
 
 
3613
 
 # define __inline_functions(float_type, s)                               \
3614
 
-__m81_defun (int, __CONCAT(__signbit,s), (float_type __value))           \
3615
 
-{                                                                        \
3616
 
-  /* There is no branch-condition for the sign bit, so we must extract   \
3617
 
-     and examine the condition codes manually.  */                       \
3618
 
-  unsigned long int __fpsr;                                              \
3619
 
-  __asm ("ftst%.x %1\n"                                                          \
3620
 
-        "fmove%.l %/fpsr, %0" : "=dm" (__fpsr) : "f" (__value));         \
3621
 
-  return (__fpsr >> 27) & 1;                                             \
3622
 
-}                                                                        \
3623
 
-                                                                         \
3624
 
-  __m81_defun (float_type, __CONCAT(__scalbln,s),                        \
3625
 
+__m81_defun (float_type, __CONCAT(__scalbln,s),                          \
3626
 
             (float_type __x, long int __n))                              \
3627
 
 {                                                                        \
3628
 
   return __CONCAT(__scalbn,s) (__x, __n);                                \
3629
 
From: Andreas Schwab <schwab@linux-m68k.org>
3630
 
Date: Sat, 13 Mar 2010 17:14:35 +0000 (+0100)
3631
 
Subject: m68k: use signbit macro
3632
 
X-Git-Tag: glibc-2.12~31
3633
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=92dd2ecf169ac81a2fa16cbe246a1036c6b94656
3634
 
 
3635
 
m68k: use signbit macro
3636
 
---
3637
 
 
3638
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3639
 
index 9fafc08..c7d068e 100644
3640
 
--- a/ports/ChangeLog.m68k
3641
 
+++ b/ports/ChangeLog.m68k
3642
 
@@ -1,5 +1,8 @@
3643
 
 2010-03-13  Andreas Schwab  <schwab@linux-m68k.org>
3644
 
 
3645
 
+       * sysdeps/m68k/m680x0/fpu/s_ccosh.c: Use signbit macro.
3646
 
+       * sysdeps/m68k/m680x0/fpu/s_ccos.c: Likewise.
3647
 
+
3648
 
        * sysdeps/m68k/m680x0/fpu/bits/mathinline.h (__signbit)
3649
 
        (__signbitf, __signbitl): Always define as inline.
3650
 
 
3651
 
diff --git a/ports/sysdeps/m68k/m680x0/fpu/s_ccos.c b/ports/sysdeps/m68k/m680x0/fpu/s_ccos.c
3652
 
index d302d3d..8239159 100644
3653
 
--- a/ports/sysdeps/m68k/m680x0/fpu/s_ccos.c
3654
 
+++ b/ports/sysdeps/m68k/m680x0/fpu/s_ccos.c
3655
 
@@ -1,5 +1,5 @@
3656
 
 /* Complex cosine function.  m68k fpu version
3657
 
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
3658
 
+   Copyright (C) 1997, 1999, 2010 Free Software Foundation, Inc.
3659
 
    This file is part of the GNU C Library.
3660
 
    Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
3661
 
 
3662
 
@@ -48,7 +48,7 @@ s(__ccos) (__complex__ float_type x)
3663
 
             : "f" (__real__ x));
3664
 
       __real__ retval = cos_rx * m81(__ieee754_cosh) (__imag__ x);
3665
 
       if (rx_cond & __M81_COND_ZERO)
3666
 
-       __imag__ retval = (m81(__signbit) (__imag__ x)
3667
 
+       __imag__ retval = (signbit (__imag__ x)
3668
 
                           ? __real__ x : -__real__ x);
3669
 
       else
3670
 
        __imag__ retval = -sin_rx * m81(__ieee754_sinh) (__imag__ x);
3671
 
diff --git a/ports/sysdeps/m68k/m680x0/fpu/s_ccosh.c b/ports/sysdeps/m68k/m680x0/fpu/s_ccosh.c
3672
 
index 1698881..d272e98 100644
3673
 
--- a/ports/sysdeps/m68k/m680x0/fpu/s_ccosh.c
3674
 
+++ b/ports/sysdeps/m68k/m680x0/fpu/s_ccosh.c
3675
 
@@ -1,5 +1,5 @@
3676
 
 /* Complex cosine hyperbole function.  m68k fpu version
3677
 
-   Copyright (C) 1997, 1999 Free Software Foundation, Inc.
3678
 
+   Copyright (C) 1997, 1999, 2010 Free Software Foundation, Inc.
3679
 
    This file is part of the GNU C Library.
3680
 
    Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>.
3681
 
 
3682
 
@@ -48,7 +48,7 @@ s(__ccosh) (__complex__ float_type x)
3683
 
             : "f" (__imag__ x));
3684
 
       __real__ retval = cos_ix * m81(__ieee754_cosh) (__real__ x);
3685
 
       if (ix_cond & __M81_COND_ZERO)
3686
 
-       __imag__ retval = (m81(__signbit) (__real__ x)
3687
 
+       __imag__ retval = (signbit (__real__ x)
3688
 
                           ? -__imag__ x : __imag__ x);
3689
 
       else
3690
 
        __imag__ retval = sin_ix * m81(__ieee754_sinh) (__real__ x);
3691
 
From: Andreas Schwab <schwab@linux-m68k.org>
3692
 
Date: Sat, 22 May 2010 19:04:42 +0000 (+0200)
3693
 
Subject: m68k: add c++-types and localplt data for m68k-linux-gnu
3694
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=0a124d8bc7a3d99f461af942aebdd3a8848672e9
3695
 
 
3696
 
m68k: add c++-types and localplt data for m68k-linux-gnu
3697
 
---
3698
 
 
3699
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3700
 
index c7d068e..cdc0ab5 100644
3701
 
--- a/ports/ChangeLog.m68k
3702
 
+++ b/ports/ChangeLog.m68k
3703
 
@@ -1,3 +1,8 @@
3704
 
+2010-05-22  Andreas Schwab  <schwab@linux-m68k.org>
3705
 
+
3706
 
+       * data/c++-types-m68k-linux-gnu.data: New file.
3707
 
+       * data/localplt-m68k-linux-gnu.data: New file.
3708
 
+
3709
 
 2010-03-13  Andreas Schwab  <schwab@linux-m68k.org>
3710
 
 
3711
 
        * sysdeps/m68k/m680x0/fpu/s_ccosh.c: Use signbit macro.
3712
 
diff --git a/ports/data/c++-types-m68k-linux-gnu.data b/ports/data/c++-types-m68k-linux-gnu.data
3713
 
new file mode 100644
3714
 
index 0000000..fde53bf
3715
 
--- /dev/null
3716
 
+++ b/ports/data/c++-types-m68k-linux-gnu.data
3717
 
@@ -0,0 +1,67 @@
3718
 
+blkcnt64_t:x
3719
 
+blkcnt_t:l
3720
 
+blksize_t:l
3721
 
+caddr_t:Pc
3722
 
+clockid_t:i
3723
 
+clock_t:l
3724
 
+daddr_t:i
3725
 
+dev_t:y
3726
 
+fd_mask:l
3727
 
+fsblkcnt64_t:y
3728
 
+fsblkcnt_t:m
3729
 
+fsfilcnt64_t:y
3730
 
+fsfilcnt_t:m
3731
 
+fsid_t:8__fsid_t
3732
 
+gid_t:j
3733
 
+id_t:j
3734
 
+ino64_t:y
3735
 
+ino_t:m
3736
 
+int16_t:s
3737
 
+int32_t:i
3738
 
+int64_t:x
3739
 
+int8_t:a
3740
 
+intptr_t:i
3741
 
+key_t:i
3742
 
+loff_t:x
3743
 
+mode_t:j
3744
 
+nlink_t:j
3745
 
+off64_t:x
3746
 
+off_t:l
3747
 
+pid_t:i
3748
 
+pthread_attr_t:14pthread_attr_t
3749
 
+pthread_barrier_t:17pthread_barrier_t
3750
 
+pthread_barrierattr_t:21pthread_barrierattr_t
3751
 
+pthread_cond_t:14pthread_cond_t
3752
 
+pthread_condattr_t:18pthread_condattr_t
3753
 
+pthread_key_t:j
3754
 
+pthread_mutex_t:15pthread_mutex_t
3755
 
+pthread_mutexattr_t:19pthread_mutexattr_t
3756
 
+pthread_once_t:i
3757
 
+pthread_rwlock_t:16pthread_rwlock_t
3758
 
+pthread_rwlockattr_t:20pthread_rwlockattr_t
3759
 
+pthread_spinlock_t:i
3760
 
+pthread_t:m
3761
 
+quad_t:x
3762
 
+register_t:i
3763
 
+rlim64_t:y
3764
 
+rlim_t:m
3765
 
+sigset_t:10__sigset_t
3766
 
+size_t:j
3767
 
+socklen_t:j
3768
 
+ssize_t:i
3769
 
+suseconds_t:l
3770
 
+time_t:l
3771
 
+u_char:h
3772
 
+uid_t:j
3773
 
+uint:j
3774
 
+u_int:j
3775
 
+u_int16_t:t
3776
 
+u_int32_t:j
3777
 
+u_int64_t:y
3778
 
+u_int8_t:h
3779
 
+ulong:m
3780
 
+u_long:m
3781
 
+u_quad_t:y
3782
 
+useconds_t:j
3783
 
+ushort:t
3784
 
+u_short:t
3785
 
diff --git a/ports/data/localplt-m68k-linux-gnu.data b/ports/data/localplt-m68k-linux-gnu.data
3786
 
new file mode 100644
3787
 
index 0000000..d266b8f
3788
 
--- /dev/null
3789
 
+++ b/ports/data/localplt-m68k-linux-gnu.data
3790
 
@@ -0,0 +1,8 @@
3791
 
+libc.so: _Unwind_Find_FDE
3792
 
+libc.so: __m68k_read_tp
3793
 
+libc.so: calloc
3794
 
+libc.so: free
3795
 
+libc.so: malloc
3796
 
+libc.so: memalign
3797
 
+libc.so: realloc
3798
 
+libm.so: matherr
3799
 
From: Andreas Schwab <schwab@linux-m68k.org>
3800
 
Date: Fri, 11 Jun 2010 19:58:32 +0000 (+0200)
3801
 
Subject: m68k: force alignment of futex variables
3802
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=0df56592854fa25ce091883cb60fc417283383b8
3803
 
 
3804
 
m68k: force alignment of futex variables
3805
 
---
3806
 
 
3807
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3808
 
index cdc0ab5..6cf5d39 100644
3809
 
--- a/ports/ChangeLog.m68k
3810
 
+++ b/ports/ChangeLog.m68k
3811
 
@@ -1,3 +1,8 @@
3812
 
+2010-06-11  Andreas Schwab  <schwab@linux-m68k.org>
3813
 
+
3814
 
+       * sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h: Force
3815
 
+       alignment of futex variables.
3816
 
+
3817
 
 2010-05-22  Andreas Schwab  <schwab@linux-m68k.org>
3818
 
 
3819
 
        * data/ports/c++-types-m68k-linux-gnu.data: New file.
3820
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h
3821
 
index 0140810..832609d 100644
3822
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h
3823
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h
3824
 
@@ -57,7 +57,7 @@ typedef union
3825
 
 {
3826
 
   struct __pthread_mutex_s
3827
 
   {
3828
 
-    int __lock;
3829
 
+    int __lock __attribute__ ((__aligned__ (4)));
3830
 
     unsigned int __count;
3831
 
     int __owner;
3832
 
     /* KIND must stay at this position in the structure to maintain
3833
 
@@ -87,7 +87,7 @@ typedef union
3834
 
 {
3835
 
   struct
3836
 
   {
3837
 
-    int __lock;
3838
 
+    int __lock __attribute__ ((__aligned__ (4)));
3839
 
     unsigned int __futex;
3840
 
     __extension__ unsigned long long int __total_seq;
3841
 
     __extension__ unsigned long long int __wakeup_seq;
3842
 
@@ -112,7 +112,7 @@ typedef unsigned int pthread_key_t;
3843
 
 
3844
 
 
3845
 
 /* Once-only execution */
3846
 
-typedef int pthread_once_t;
3847
 
+typedef int __attribute__ ((__aligned__ (4))) pthread_once_t;
3848
 
 
3849
 
 
3850
 
 #if defined __USE_UNIX98 || defined __USE_XOPEN2K
3851
 
@@ -122,7 +122,7 @@ typedef union
3852
 
 {
3853
 
   struct
3854
 
   {
3855
 
-    int __lock;
3856
 
+    int __lock __attribute__ ((__aligned__ (4)));
3857
 
     unsigned int __nr_readers;
3858
 
     unsigned int __readers_wakeup;
3859
 
     unsigned int __writer_wakeup;
3860
 
@@ -158,7 +158,7 @@ typedef volatile int pthread_spinlock_t;
3861
 
 typedef union
3862
 
 {
3863
 
   char __size[__SIZEOF_PTHREAD_BARRIER_T];
3864
 
-  long int __align;
3865
 
+  long int __align __attribute__ ((__aligned__ (4)));
3866
 
 } pthread_barrier_t;
3867
 
 
3868
 
 typedef union
3869
 
From: Andreas Schwab <schwab@linux-m68k.org>
3870
 
Date: Sun, 13 Jun 2010 19:09:38 +0000 (+0200)
3871
 
Subject: m68k: Add required definitions to sys/user.h
3872
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=08b1b36387286ed1ba48c56a32e52429b5ef6963
3873
 
 
3874
 
m68k: Add required definitions to sys/user.h
3875
 
---
3876
 
 
3877
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3878
 
index 6cf5d39..bbc8a8c 100644
3879
 
--- a/ports/ChangeLog.m68k
3880
 
+++ b/ports/ChangeLog.m68k
3881
 
@@ -1,3 +1,8 @@
3882
 
+2010-06-13  Andreas Schwab  <schwab@linux-m68k.org>
3883
 
+
3884
 
+       * sysdeps/unix/sysv/linux/m68k/sys/user.h (NBPG, UPAGES)
3885
 
+       (HOST_TEXT_START_ADDR, HOST_STACK_END_ADDR): Define.
3886
 
+
3887
 
 2010-06-11  Andreas Schwab  <schwab@linux-m68k.org>
3888
 
 
3889
 
        * sysdeps/unix/sysv/linux/m68k/nptl/bits/pthreadtypes.h: Force
3890
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h b/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
3891
 
index f8b19fc..2663ac6 100644
3892
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
3893
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/sys/user.h
3894
 
@@ -1,4 +1,4 @@
3895
 
-/* Copyright (C) 2008 Free Software Foundation, Inc.
3896
 
+/* Copyright (C) 2008, 2010 Free Software Foundation, Inc.
3897
 
    This file is part of the GNU C Library.
3898
 
 
3899
 
    The GNU C Library is free software; you can redistribute it and/or
3900
 
@@ -58,4 +58,9 @@ struct user {
3901
 
        char u_comm[32];
3902
 
 };
3903
 
 
3904
 
+#define NBPG 4096
3905
 
+#define UPAGES 1
3906
 
+#define HOST_TEXT_START_ADDR u.start_code
3907
 
+#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
3908
 
+
3909
 
 #endif
3910
 
From: Andreas Schwab <schwab@linux-m68k.org>
3911
 
Date: Sun, 13 Jun 2010 20:30:17 +0000 (+0200)
3912
 
Subject: m68k: mark all inline math functions as non-throwing
3913
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=9166f36fcc5390efb701e50564c63cb4534bd998
3914
 
 
3915
 
m68k: mark all inline math functions as non-throwing
3916
 
---
3917
 
 
3918
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3919
 
index bbc8a8c..c5b5706 100644
3920
 
--- a/ports/ChangeLog.m68k
3921
 
+++ b/ports/ChangeLog.m68k
3922
 
@@ -1,5 +1,8 @@
3923
 
 2010-06-13  Andreas Schwab  <schwab@linux-m68k.org>
3924
 
 
3925
 
+       * sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Mark all functions as
3926
 
+       non-throwing.
3927
 
+
3928
 
        * sysdeps/unix/sysv/linux/m68k/sys/user.h (NBPG, UPAGES)
3929
 
        (HOST_TEXT_START_ADDR, HOST_STACK_END_ADDR): Define.
3930
 
 
3931
 
diff --git a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3932
 
index 975ffd8..8a17127 100644
3933
 
--- a/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3934
 
+++ b/ports/sysdeps/m68k/m680x0/fpu/bits/mathinline.h
3935
 
@@ -126,7 +126,7 @@ __NTH (__signbitl (long double __x))
3936
 
 /* Define a const math function.  */
3937
 
 #define __m81_defun(rettype, func, args)                                     \
3938
 
   __m81_inline rettype __attribute__((__const__))                            \
3939
 
-  __m81_u(func) args
3940
 
+  __NTH (__m81_u(func) args)
3941
 
 
3942
 
 /* Define the three variants of a math function that has a direct
3943
 
    implementation in the m68k fpu.  FUNC is the name for C (which will be
3944
 
@@ -329,8 +329,8 @@ __m81_defun (long int, __CONCAT(__lrint,s), (float_type __x))                 \
3945
 
 }                                                                        \
3946
 
                                                                          \
3947
 
 __m81_inline float_type                                                          \
3948
 
-__m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y,               \
3949
 
-                          float_type __z)                                \
3950
 
+__NTH (__m81_u(__CONCAT(__fma,s))(float_type __x, float_type __y,        \
3951
 
+                                 float_type __z))                        \
3952
 
 {                                                                        \
3953
 
   return (__x * __y) + __z;                                              \
3954
 
 }
3955
 
@@ -346,8 +346,8 @@ __inline_functions (long double,l)
3956
 
 
3957
 
 # define __inline_functions(float_type, s)                             \
3958
 
 __m81_inline void                                                      \
3959
 
-__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx,      \
3960
 
-                             float_type *__cosx)                       \
3961
 
+__NTH (__m81_u(__CONCAT(__sincos,s))(float_type __x, float_type *__sinx, \
3962
 
+                                    float_type *__cosx))               \
3963
 
 {                                                                      \
3964
 
   __asm ("fsincos%.x %2,%1:%0"                                         \
3965
 
         : "=f" (*__sinx), "=f" (*__cosx) : "f" (__x));                 \
3966
 
@@ -368,13 +368,13 @@ __inline_functions (long double,l)
3967
 
    NAME, to make token pasting work correctly with -traditional.  */
3968
 
 # define __inline_forward_c(rettype, name, args1, args2)       \
3969
 
 __MATH_INLINE rettype __attribute__((__const__))               \
3970
 
-  name args1                                                   \
3971
 
+__NTH (name args1)                                             \
3972
 
 {                                                              \
3973
 
   return __CONCAT(__,name) args2;                              \
3974
 
 }
3975
 
 
3976
 
 # define __inline_forward(rettype, name, args1, args2) \
3977
 
-__MATH_INLINE rettype name args1                       \
3978
 
+__MATH_INLINE rettype __NTH (name args1)               \
3979
 
 {                                                      \
3980
 
   return __CONCAT(__,name) args2;                      \
3981
 
 }
3982
 
From: Joseph Myers <joseph@codesourcery.com>
3983
 
Date: Thu, 24 Jun 2010 16:18:51 +0000 (+0000)
3984
 
Subject: Define F_SETPIPE_SZ and F_GETPIPE_SZ for M68K.
3985
 
X-Git-Url: http://sourceware.org/git/?p=glibc-ports.git;a=commitdiff_plain;h=71feaf72066abfe0e434e49d56e26b54152fb221
3986
 
 
3987
 
Define F_SETPIPE_SZ and F_GETPIPE_SZ for M68K.
3988
 
---
3989
 
 
3990
 
diff --git a/ports/ChangeLog.m68k b/ports/ChangeLog.m68k
3991
 
index c5b5706..be4956b 100644
3992
 
--- a/ports/ChangeLog.m68k
3993
 
+++ b/ports/ChangeLog.m68k
3994
 
@@ -1,3 +1,8 @@
3995
 
+2010-06-24  Joseph Myers  <joseph@codesourcery.com>
3996
 
+
3997
 
+       * sysdeps/unix/sysv/linux/m68k/bits/fcntl.h (F_SETPIPE_SZ,
3998
 
+       F_GETPIPE_SZ): Define.
3999
 
+
4000
 
 2010-06-13  Andreas Schwab  <schwab@linux-m68k.org>
4001
 
 
4002
 
        * sysdeps/m68k/m680x0/fpu/bits/mathinline.h: Mark all functions as
4003
 
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
4004
 
index d1eb706..f36507b 100644
4005
 
--- a/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
4006
 
+++ b/ports/sysdeps/unix/sysv/linux/m68k/bits/fcntl.h
4007
 
@@ -101,6 +101,8 @@
4008
 
 # define F_SETLEASE    1024    /* Set a lease.  */
4009
 
 # define F_GETLEASE    1025    /* Enquire what lease is active.  */
4010
 
 # define F_NOTIFY      1026    /* Request notfications on a directory.  */
4011
 
+# define F_SETPIPE_SZ  1031    /* Set pipe page size array.  */
4012
 
+# define F_GETPIPE_SZ  1032    /* Set pipe page size array.  */
4013
 
 #endif
4014
 
 #ifdef __USE_XOPEN2K8
4015
 
 # define F_DUPFD_CLOEXEC 1030  /* Duplicate file descriptor with