3.51 system calls

Alex S. Crain alex at umbc3.UMBC.EDU
Wed Feb 15 04:30:19 AEST 1989


	This is perhaps of truly dubious value, but somebody might need it 
someday, and maybe it will be useful. I needed to verify some BSD code that
used syscall(), so I created this header file for future reference.

	There is no similar file to this, so there is no compatability issue
here, I did check to see that there are no conflicting #defines anywhere, there
is only SYS_CONFIG, and I didn't use that one.

	while there is no reason to do so, one would implement syscall with

		global syscall
	syscall:
		mov.l	4(%sp),%d0	# snag the first argument into %d0
		mov.l	(%sp),4(%sp)	# push the return pointer up the stack.
		add.w	&4,%sp		# and remove the old stack bottom.
		trap	&0		# do the syscall
		beq	noerror		# 0 means no errors
		bra	_cerror		# oops...
	noerror:
		rts			# return


	_cerror doesn't exist in the shared library, but you can steal it
from libc.a. Note that the above is untested and written from memory. The
mov and add can probably be consolidated, but I can't remember the order
rules for post increment; should it be

		mov.l	(%sp)+,(%sp)
	or	
		mov.l	(%sp)+,4(%sp)

whatever. Enjoy...

					:alex
Alex Crain
Systems Programmer			alex at umbc3.umbc.edu       (NEW DOMAIN!)
Univ Md Baltimore County		nerwin!alex at umbc3.umbc.edu

----------------------------snip,snip,snip-------------------------------------


/*	@(#)syscalls.h	*/

#define SYS_NOSYS	0	/* generates a SIGSYS	*/
#define SYS_REXIT	1	/* exit()		*/
#define SYS_FORK	2	/* fork()		*/
#define SYS_READ	3	/* read()		*/
#define SYS_WRITE	4	/* write()		*/
#define SYS_OPEN	5	/* open()		*/
#define SYS_CLOSE	6	/* close()		*/
#define SYS_WAIT	7	/* wait()		*/
#define SYS_CREAT	8	/* creat()		*/
#define SYS_LINK	9	/* link()		*/
#define SYS_UNLINK	10	/* unlink()		*/
#define SYS_EXEC	11	/* execv		*/
#define SYS_CHDIR	12	/* chdir()		*/
#define SYS_GTIME	13	/* time()		*/
#define SYS_MKNOD	14	/* mknode()		*/
#define SYS_CHMOD	15	/* chmod()		*/
#defien SYS_CHOWN	16	/* chown()		*/
#define SYS_SBRK	17	/* sbrk()		*/
#define SYS_STAT	18	/* stat()		*/
#define SYS_SEEK	19	/* seek()		*/
#define SYS_GETPID	20	/* getpid()		*/
#define SYS_MOUNT	21	/* mount()		*/
#define SYS_UMOUNT	22	/* umount()		*/
#define SYS_SETUID	23	/* setuid()		*/
#define SYS_GETUID	24	/* getuid()		*/
#define SYS_STIME	25	/* stime()		*/
#define SYS_PTRACE	26	/* ptrace()		*/
#define SYS_ALARM	27	/* alarm()		*/
#define SYS_FSTAT	28	/* stat()		*/
#define SYS_PAUSE	29	/* pause()		*/
#define SYS_UTIME	30	/* utime()		*/
#define SYS_STTY	31	/* stty()		*/
#define SYS_GTTY	32	/* gtty()		*/
#define SYS_ACCESS	33	/* access()		*/
#define SYS_NICE	34	/* nice()		*/
#define SYS_NOSYS	35	/* generates a SIGSYS	*/
#define SYS_SYNC	36	/* sync()		*/
#define SYS_KILL	37	/* kill()		*/
#define SYS_NOSYS	38	/* generates a SIGSYS	*/
#define SYS_SETPGRP	39	/* setpgrp()		*/
#define SYS_NOSYS	40	/* generates a SIGSYS	*/
#define SYS_DUP		41	/* dup()		*/
#define SYS_PIPE	42	/* pipe()		*/
#define SYS_TIMES	43	/* times()		*/
#define SYS_PROFILE	44	/* profile()		*/
#define SYS_LOCK	45	/* lock()		*/
#define SYS_SETGID	46	/* setgid()		*/
#define SYS_GETGID	47	/* getgid()		*/
#define SYS_SIG		48	/* sig()		*/
#define SYS_MSGSYS	49	/* msgop()		*/
#define SYS_NOSYS	50	/* generates a SIGSYS	*/
#define SYS_SYSACCT	51	/* acct()		*/
#define SYS_SHMSYS	52	/* shmop()		*/
#define SYS_SEMSYS	53	/* semop()		*/
#define SYS_IOCTL	54	/* ioctl()		*/
#define SYS_NOSYS	55	/* generates a SIGSYS	*/
#define SYS_NOSYS	56	/* generates a SIGSYS	*/
#define SYS_UTSSYS	57	/* utime()		*/
#define SYS_NOSYS	58	/* generates a SIGSYS	*/
#define SYS_EXECE	59	/* execve		*/
#define SYS_UMASK	60	/* umask()		*/
#define SYS_CHROOT	61	/* chroot()		*/
#define SYS_FNCTL	62	/* fnctl()		*/
#define SYS_ULIMIT	63	/* ulimit()		*/
#define SYS_NOSYS	64	/* generates a SIGSYS	*/
#define SYS_NOSYS	65	/* generates a SIGSYS	*/
#define SYS_NOSYS	66	/* generates a SIGSYS	*/
#define SYS_LOCKING	67	/* locking()		*/
#define SYS_SYSLOCAL	68	/* syslocal()		*/
#define SYS_INO_OPEN	69	/* bogus, calls nosys()	*/
#define SYS_NOSYS	70	/* generates a SIGSYS	*/
#define SYS_NOSYS	71	/* generates a SIGSYS	*/
#define SYS_NODEV	72	/* errno = ENODEV	*/
#define SYS_NODEV	73	/* errno = ENODEV	*/
#define SYS_NODEV	74	/* errno = ENODEV	*/
#define SYS_NODEV	76	/* errno = ENODEV	*/
#define SYS_NODEV	77	/* errno = ENODEV	*/
#define SYS_NODEV	78	/* errno = ENODEV	*/
#define SYS_NODEV	79	/* errno = ENODEV	*/
#define SYS_NODEV	80	/* errno = ENODEV	*/
#define SYS_NODEV	81	/* errno = ENODEV	*/
#define SYS_NODEV	82	/* errno = ENODEV	*/
#define SYS_NODEV	83	/* errno = ENODEV	*/
#define SYS_NODEV	84	/* errno = ENODEV	*/
#define SYS_NODEV	85	/* errno = ENODEV	*/
#define SYS_NODEV	86	/* errno = ENODEV	*/


-- 
					:alex
Alex Crain
Systems Programmer			alex at umbc3.umbc.edu
Univ Md Baltimore County		nerwin!alex at umbc3.umbc.edu (NEW DOMAIN)



More information about the Comp.sys.att mailing list