xref: /original-bsd/local/toolchest/ksh/sh/syscall.s (revision 7e95104e)
1	.file	"syscall.s"
2#	@(#)syscall.s	1.4
3#	syscall(number, arg0, arg1, ... )
4
5	.globl	syscall
6syscall:
7	save	&0
8	addw2	&12,%sp			# get a place to store a call
9	movh	code,0(%fp)		# copy the "ost" to the stack
10	movh	code+2,2(%fp)
11	movh	code+4,4(%fp)
12	movw	&return,8(%fp)		# store the "return" address
13	movb	3(%ap),1(%fp)		# set the call code
14	addw2	&4,%ap			# point to the first arg
15	jmp	0(%fp)			# execute the call
16code:
17	ost	&0			# this code is copied to the stack
18	jmp	*8(%fp)
19return:
20	jcs	error
21	subw2	&4,%ap			# "ap" must be restored!
22	cmpw	&0,&1			# clear the carry flag
23	jmp	_csysret
24error:
25	subw2	&4,%ap
26	cmpw	&1,&1			# set the carry flag
27	jmp	_csysret
28