Home | History | Annotate | Line # | Download | only in zboot
unixsys.S revision 1.1.4.2
      1  1.1.4.2  yamt /*	$NetBSD: unixsys.S,v 1.1.4.2 2009/05/04 08:12:16 yamt Exp $	*/
      2  1.1.4.2  yamt /*	$OpenBSD: unixsys.S,v 1.6 2005/05/24 20:38:20 uwe Exp $	*/
      3  1.1.4.2  yamt 
      4  1.1.4.2  yamt /*
      5  1.1.4.2  yamt  * Copyright (c) 2005 Uwe Stuehler <uwe (at) bsdx.de>
      6  1.1.4.2  yamt  *
      7  1.1.4.2  yamt  * Permission to use, copy, modify, and distribute this software for any
      8  1.1.4.2  yamt  * purpose with or without fee is hereby granted, provided that the above
      9  1.1.4.2  yamt  * copyright notice and this permission notice appear in all copies.
     10  1.1.4.2  yamt  *
     11  1.1.4.2  yamt  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  1.1.4.2  yamt  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  1.1.4.2  yamt  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  1.1.4.2  yamt  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  1.1.4.2  yamt  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  1.1.4.2  yamt  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  1.1.4.2  yamt  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  1.1.4.2  yamt  */
     19  1.1.4.2  yamt 
     20  1.1.4.2  yamt #include <machine/asm.h>
     21  1.1.4.2  yamt 
     22  1.1.4.2  yamt #include "compat_linux.h"
     23  1.1.4.2  yamt 
     24  1.1.4.2  yamt 	.text
     25  1.1.4.2  yamt 
     26  1.1.4.2  yamt #define RSYSCALL(x) \
     27  1.1.4.2  yamt 	ENTRY(__CONCAT(u,x)) \
     28  1.1.4.2  yamt 		swi	__CONCAT(__NR_,x); \
     29  1.1.4.2  yamt 		b	1f
     30  1.1.4.2  yamt 
     31  1.1.4.2  yamt RSYSCALL(exit)
     32  1.1.4.2  yamt RSYSCALL(read)
     33  1.1.4.2  yamt RSYSCALL(write)
     34  1.1.4.2  yamt RSYSCALL(open)
     35  1.1.4.2  yamt RSYSCALL(close)
     36  1.1.4.2  yamt RSYSCALL(lseek32)
     37  1.1.4.2  yamt RSYSCALL(ioctl)
     38  1.1.4.2  yamt RSYSCALL(stat)
     39  1.1.4.2  yamt 
     40  1.1.4.2  yamt 1:
     41  1.1.4.2  yamt 	cmn	r0, #4096
     42  1.1.4.2  yamt 	movcc	pc, lr
     43  1.1.4.2  yamt 	rsb	r0, r0, #0
     44  1.1.4.2  yamt 	ldr	r1, .Lerrno	/* XXX clobbers arg1 */
     45  1.1.4.2  yamt 	str	r0, [r1]
     46  1.1.4.2  yamt 	mvn	r0, #0
     47  1.1.4.2  yamt 	mov	pc, lr
     48  1.1.4.2  yamt 
     49  1.1.4.2  yamt .Lerrno:
     50  1.1.4.2  yamt 	.word	errno
     51  1.1.4.2  yamt 
     52  1.1.4.2  yamt /* XXX only works for up to four arguments. */
     53  1.1.4.2  yamt ENTRY(syscall)
     54  1.1.4.2  yamt 	swi	__NR_syscall
     55  1.1.4.2  yamt 	b	1b
     56  1.1.4.2  yamt 
     57  1.1.4.2  yamt ENTRY(uselect)
     58  1.1.4.2  yamt 	str	r4, [sp, #-4]!
     59  1.1.4.2  yamt 	ldr	r4, [sp, #4]
     60  1.1.4.2  yamt 	swi	__NR_select
     61  1.1.4.2  yamt 	ldr	r4, [sp], #4
     62  1.1.4.2  yamt 	cmn	r0, #4096
     63  1.1.4.2  yamt 	movcc	pc, lr
     64  1.1.4.2  yamt 	rsb	r0, r0, #0
     65  1.1.4.2  yamt 	str	r1, [sp, #-4]!
     66  1.1.4.2  yamt 	ldr	r1, .Lerrno
     67  1.1.4.2  yamt 	str	r0, [r1]
     68  1.1.4.2  yamt 	ldr	r1, [sp], #4
     69  1.1.4.2  yamt 	mvn	r0, #0
     70  1.1.4.2  yamt 	mov	pc, lr
     71  1.1.4.2  yamt 
     72  1.1.4.2  yamt .data
     73  1.1.4.2  yamt 
     74  1.1.4.2  yamt 	.global errno
     75  1.1.4.2  yamt errno:
     76  1.1.4.2  yamt 	.word	0
     77