Merge from vendor branch TNF:
[pkgsrc.git] / devel / mit-pthreads / patches / patch-bc
1 $NetBSD: patch-ay,v 1.1 1998/10/28 18:18:09 bad Exp $
2
3 --- /dev/null   Sun Oct 25 03:15:17 1998
4 +++ machdep/syscall-arm32-netbsd-1.3.S  Sun Oct 25 18:49:24 1998
5 @@ -0,0 +1,193 @@
6 +/* ==== syscall.S ============================================================
7 + * Copyright (c) 1990 The Regents of the University of California.
8 + * Copyright (c) 1993 Chris Provenzano, proven@mit.edu
9 + * All rights reserved.
10 + *
11 + * This code is derived from software contributed to Berkeley by
12 + * William Jolitz.
13 + *
14 + * Redistribution and use in source and binary forms, with or without
15 + * modification, are permitted provided that the following conditions
16 + * are met:
17 + * 1. Redistributions of source code must retain the above copyright
18 + *    notice, this list of conditions and the following disclaimer.
19 + * 2. Redistributions in binary form must reproduce the above copyright
20 + *    notice, this list of conditions and the following disclaimer in the
21 + *    documentation and/or other materials provided with the distribution.
22 + * 3. All advertising materials mentioning features or use of this software
23 + *    must display the following acknowledgement:
24 + *     This product includes software developed by the University of
25 + *     California, Berkeley and its contributors.
26 + * 4. Neither the name of the University nor the names of its contributors
27 + *    may be used to endorse or promote products derived from this software
28 + *    without specific prior written permission.
29 + *
30 + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
31 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
33 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
34 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
35 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
36 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
37 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
39 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 + * SUCH DAMAGE.
41 + *
42 + * Description : Machine dependent syscalls for i386/i486/i586
43 + *
44 + *  1.00 93/08/26 proven
45 + *      -Started coding this file.
46 + *
47 + *     1.01 93/11/13 proven
48 + *             -The functions readv() and writev() added.
49 + */
50 +
51 +#ifndef lint
52 +       .text
53 +       .asciz "$Id: patch-bc,v 1.1 1998/12/28 22:22:03 bad Exp $";
54 +#endif
55
56 +#if defined(SYSLIBC_SCCS) && !defined(lint)
57 +        .asciz "@(#)syscall.s   5.1 (Berkeley) 4/23/90"
58 +#endif /* SYSLIBC_SCCS and not lint */
59 +
60 +#include <machine/asm.h>
61 +#include <sys/syscall.h>
62 +
63 +/*
64 + * Initial asm stuff for all functions.
65 + */
66 +       .text
67 +       .align  0
68 +
69 +
70 +/* ==========================================================================
71 + * machdep_sys_fork()
72 + */
73 +       .globl _machdep_sys_fork;               
74 +                                                                       
75 +_machdep_sys_fork:;                            
76 +
77 +       swi     SYS_fork
78 +       bcs     1f
79 +        sub     r1, r1, #0x00000001
80 +       and     r0, r0, r1
81 +       mov     r15, r14
82 +
83 +                                                                       
84 +
85 +/* ==========================================================================
86 + * machdep_sys_fstat()
87 + */
88 +       .globl _machdep_sys_fstat;
89 +
90 +_machdep_sys_fstat:;                           
91 +
92 +       swi     SYS___fstat13
93 +       bcs     1f
94 +       mov     r15, r14
95 +
96 +/* ==========================================================================
97 + * machdep_sys___syscall()
98 + */
99 +
100 +_machdep_sys___syscall:;                               
101 +
102 +       swi     SYS___syscall
103 +       bcs     1f
104 +       mov     r15, r14
105 +
106 +
107 +#ifndef SYS___sigsuspend14
108 +/* ==========================================================================
109 + * machdep_sys_sigsuspend()
110 + */
111 +       .globl _machdep_sys_sigsuspend;         
112 +
113 +_machdep_sys_sigsuspend:;
114 +
115 +       ldr     r0, [r0]
116 +       swi     SYS_sigsuspend
117 +       bcs     1f
118 +       mov     r0, #0x00000000
119 +       mov     r15, r14
120 +
121 +#endif
122 +
123 +#ifndef SYS___sigprocmask14
124 +/* ==========================================================================
125 + * machdep_sys_sigprocmask()
126 + */
127 +       .globl _machdep_sys_sigprocmask;                
128 +
129 +_machdep_sys_sigprocmask:;                             
130 +                                                                       
131 +       teq     r1, #0x00000000
132 +       moveq   r0, #0x00000001
133 +       moveq   r1, #0x00000000
134 +       ldrne   r1, [r1]
135 +       swi     SYS_sigprocmask
136 +       bcs     1f
137 +       teq     r2, #0x00000000
138 +       strne   r0, [r2]
139 +       mov     r0, #0x00000000
140 +       mov     r15, r14
141 +#endif
142 +
143 +/* ==========================================================================
144 + * machdep_sys_ftruncate()
145 + */
146 +       .global _machdep_sys_ftruncate
147 +_machdep_sys_ftruncate:
148 +       mov     r12, r13
149 +       stmfd   r13!, {r11, r12, r14, r15}
150 +       sub     r13, r13, #8
151 +       stmia   r13, {r1-r2}
152 +       mov     r3, #0
153 +       sub     r11, r12, #4
154 +       mov     r2, r0
155 +       mov     r1, #0
156 +       mov     r0, #201
157 +       bl      _machdep_sys___syscall
158 +       ldmea   r11, {r11, r13, r15}
159 +
160 +/* ==========================================================================
161 + * machdep_sys_lseek()
162 + */
163 +       .global _machdep_sys_lseek
164 +
165 +_machdep_sys_lseek:
166 +       mov     r12, r13
167 +       stmfd   r13!, {r11, r12, r14, r15}
168 +       str     r3, [r13, #-4]!
169 +       sub     r13, r13, #8
170 +       stmia   r13, {r1-r2}
171 +       sub     r11, r12, #4
172 +       mov     r3, #0
173 +       mov     r2, r0
174 +       mov     r1, #0
175 +       mov     r0, #SYS_lseek
176 +       bl      _machdep_sys___syscall
177 +       ldmea   r11, {r11, r13, r15}
178 +
179 +/* ==========================================================================
180 + * machdep_sys_pipe()
181 + */
182 +       .globl _machdep_sys_pipe;               
183 +
184 +_machdep_sys_pipe:;    
185 +
186 +        mov     r2, r0
187 +       swi     SYS_pipe
188 +       bcs     1f
189 +       str     r0, [r2, #0x0000]
190 +       str     r1, [r2, #0x0004]
191 +       mov     r0, #0x00000000
192 +       mov     r15, r14
193 +
194 +
195 +1:
196 +       rsb     r0, r0, #0x00000000
197 +       mvn     r1, #0x00000000
198 +       mov     r15, r14