480 lines
		
	
	
	
		
			7.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			480 lines
		
	
	
	
		
			7.1 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| .sect .text
 | |
| .sect .rom
 | |
| .sect .data
 | |
| .retaddr:
 | |
| 	.data4	0
 | |
| .sect .bss
 | |
| .sect .text
 | |
| !THIS FILE CONTAINS THE SYSTEM CALLS FOR PMDS-II AS SUBROUTINES FOR THE
 | |
| !EM-INTERPRETER. a5 CONTAINS A POINTER TO THE RETURN AREA . EACH SUBROUTINE
 | |
| !EXPECTS ITS DATA IN THE FORM EM PRODUCES AND GIVES ITS RESULTS AS EM 
 | |
| !REQUIRES.
 | |
| !THE PMDS-II REQUIRES THE ARGUMENTS ON THE STACK AS 4 BYTE INTEGERS  OR
 | |
| !POINTERS , AND USES THE C-CALLING CONVENTION. THE 2 BYTE WORDS 4 BYTE
 | |
| !POINTERS VERSION HAS TO DO SOME CONVERSION FIRST .
 | |
| 
 | |
| _Xexit:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	__exit
 | |
| 
 | |
| _Xfork:		move.l	(sp)+,.retaddr
 | |
| 		jsr	_fork
 | |
| 		tst.l	d0
 | |
| 		blt	2f
 | |
| 		bne	1f
 | |
| 		jsr	_getpid
 | |
| 		mov	d1,-(sp)	!PID OF PARENT IN d1
 | |
| 		mov	#1,-(sp)	!(PID OF CHILD IN D0),FLAG 1 IN CHILD
 | |
| 		bra	0f
 | |
| 1:		mov	d0,-(sp)	!PID OF CHILD IN d0
 | |
| 		cl	-(sp)		!FLAG 0 IN PARENT
 | |
| 0:		cl	-(sp)
 | |
| 		bra	3f
 | |
| 2:		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 3:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| !_Xfork is special
 | |
| 
 | |
| _Xread:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_read
 | |
| sys0:		lea	12(sp),sp
 | |
| 		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		move.l	d0,-(sp)
 | |
| 		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xwrite:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_write
 | |
| 		bra	sys0
 | |
| 
 | |
| _Xopen:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st243
 | |
| #endif
 | |
| 		jsr	_open
 | |
| sys1:		lea	8(sp),sp
 | |
| sys5:		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		mov	d0,-(sp)
 | |
| 		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xclose:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_close
 | |
| sys3:		lea	4(sp),sp
 | |
| sys4:		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xwait:		move.l	(sp)+,.retaddr
 | |
| .sect .data
 | |
| xxxx:
 | |
| 	.data4 0, 0
 | |
| .sect .text
 | |
| 		move.l	#xxxx,-(sp)
 | |
| 		jsr	_wait
 | |
| 		add.l	#4,sp
 | |
| sys6:		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		mov	xxxx+4,-(sp)		! ??
 | |
| 		mov	xxxx,-(sp)
 | |
| 		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xcreat:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st243
 | |
| #endif
 | |
| 		jsr	_creat
 | |
| 		bra	sys1
 | |
| 
 | |
| _Xlink:		move.l	(sp)+,.retaddr
 | |
| 		jsr	_link
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xunlink:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_unlink
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xchdir:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_chdir
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xmknod:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st244
 | |
| #endif
 | |
| 		jsr	_mknod
 | |
| 		lea	12(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xchmod:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st243
 | |
| #endif
 | |
| 		jsr	_chmod
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xchown:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st244
 | |
| #endif
 | |
| 		jsr	_chown
 | |
| 		lea	12(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xbreak:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_brk
 | |
| 		lea	4(sp),sp
 | |
| 		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		move.l	-4(sp),nd
 | |
| 		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| 	.sect .data
 | |
| nd:	.data4	endbss
 | |
| 	.sect .text
 | |
| 
 | |
| _Xstat:		move.l	(sp)+,.retaddr
 | |
| 		jsr	_stat
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xlseek:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st245
 | |
| #endif
 | |
| 		jsr	_lseek
 | |
| 		lea	12(sp),sp
 | |
| 		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:		move.l	d0,-(sp)
 | |
| 		cl	-(sp)
 | |
| 2:		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xgetpid:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_getpid
 | |
| 		mov	d0,-(sp)
 | |
| 		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xmount:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st246
 | |
| #endif
 | |
| 		jsr	_mount
 | |
| 		lea	12(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xumount:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_umount
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xsetuid:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_setuid
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xgetuid:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_getuid
 | |
| sys7:		mov	d1,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xstime:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_stime
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xptrace:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st247
 | |
| #endif
 | |
| 		jsr	_ptrace
 | |
| 		lea	16(sp),sp
 | |
| 		bra	sys5
 | |
| 
 | |
| _Xalarm:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		sub.l	#2,sp
 | |
| 		clr.w	(sp)
 | |
| #endif
 | |
| 		jsr	_alarm
 | |
| 		lea	4(sp),sp
 | |
| 		mov	d0,-(sp)
 | |
| 		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xfstat:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_fstat
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xpause:	jsr	_pause
 | |
| 		rts
 | |
| 
 | |
| _Xutime:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_utime
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xaccess:	move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st243
 | |
| #endif
 | |
| 		jsr	_access
 | |
| 		lea	8(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xnice:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	241
 | |
| #endif
 | |
| 		jsr	_nice
 | |
| 		move.l	.retaddr,(sp)
 | |
| 		rts
 | |
| 
 | |
| _Xftime:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_ftime
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xsync:		jsr	_sync
 | |
| 		rts
 | |
| 
 | |
| _Xkill:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st248
 | |
| #endif
 | |
| 		jsr	_kill
 | |
| 		lea	4(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xdup:		move.l	(sp)+,.retaddr
 | |
| #ifndef lword
 | |
| 		bsr	st248
 | |
| #endif
 | |
| 		jsr	_dup
 | |
| 		bra	sys1
 | |
| 
 | |
| _Xpipe:		move.l	(sp)+,.retaddr
 | |
| 		move.l	#xxxx,-(sp)
 | |
| 		jsr	_pipe
 | |
| 		add.l	#4,sp
 | |
| 		bra	sys6
 | |
| 
 | |
| _Xtimes:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_times
 | |
| 		move.l	.retaddr,a0
 | |
| 		add.l	#4,sp
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xprofil:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_profil
 | |
| 		move.l	.retaddr,a0
 | |
| 		lea	16(sp),sp
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xsetgid:	move.l	(sp)+,.retaddr
 | |
| #ifndef	lword
 | |
| 		bsr	st241 
 | |
| #endif
 | |
| 		jsr	_setgid
 | |
| 		bra	sys3
 | |
| 
 | |
| _Xgetgid:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_getpid
 | |
| 		bra	sys7
 | |
| 
 | |
| _Xsignal:	move.l	(sp)+,.retaddr
 | |
| 		mov	(sp)+,d4
 | |
| 		extend	d4
 | |
| 		move.l	d4,-(sp)
 | |
| 		move.l	.retaddr,-(sp)
 | |
| 		jsr	_signal
 | |
| 		lea	12(sp),sp		!remove arguments
 | |
| 		cmp.l	#-1,d0
 | |
| 		bne	1f
 | |
| 		move.l	_errno,d0
 | |
| 		mov	d0,-(sp)
 | |
| 		mov	d0,-(sp)
 | |
| 		bra	2f
 | |
| 1:
 | |
|  		mov	d0,-(sp)
 | |
| 		cl	-(sp)
 | |
| 2:
 | |
| 		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xacct:		move.l	(sp)+,.retaddr
 | |
| 		jsr	_acct
 | |
| 		bra	sys3
 | |
| !_Xlock:		move.l	(sp)+,.retaddr
 | |
| !#ifndef	lword
 | |
| !		bsr	st241
 | |
| !#endif
 | |
| !		jsr	_lock
 | |
| !		bra	sys3
 | |
| 
 | |
| _Xioctl:	move.l	(sp)+,.retaddr
 | |
| #ifndef	lword
 | |
| 		bsr	st248
 | |
| #endif
 | |
| 		jsr	_ioctl
 | |
| 		lea	12(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| !_Xmpxcall:	move.l	(sp)+,.retaddr
 | |
| !#ifndef	lword
 | |
| !		bsr	st241
 | |
| !#endif
 | |
| !		trap	#0
 | |
| !	.data2	56
 | |
| !		lea	12(sp),sp
 | |
| !		bra	sys4
 | |
| 
 | |
| _Xexece:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_execve
 | |
| 		lea	12(sp),sp
 | |
| 		bra	sys4
 | |
| 
 | |
| _Xumask:	move.l	(sp)+,.retaddr
 | |
| #ifndef	lword
 | |
| 		bsr	st241
 | |
| #endif
 | |
| 		jsr	_umask
 | |
| 		add.l	#4,sp
 | |
| 		mov	d0,-(sp)
 | |
| 		move.l	.retaddr,a0
 | |
| 		jmp	(a0)
 | |
| 
 | |
| _Xchroot:	move.l	(sp)+,.retaddr
 | |
| 		jsr	_chroot
 | |
| 		bra	sys3
 | |
| 
 | |
| 
 | |
| !----------------------------------------------------------------------------
 | |
| !		STACK ADJUSTMENT FOR THE TWO BYTE INTERPRETER
 | |
| !-----------------------------------------------------------------------------
 | |
| #ifndef lword
 | |
| 
 | |
| st241:		sub.l	#2,sp
 | |
| 		move.l	2(sp),(sp)
 | |
| 		move.w	6(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,4(sp)
 | |
| 		rts
 | |
| 
 | |
| st243:		sub.l	#2,sp
 | |
| 		move.l	2(sp),(sp)
 | |
| 		move.l	6(sp),4(sp)
 | |
| 		move.w	10(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,8(sp)
 | |
| 		rts
 | |
| 
 | |
| st244:		move.l	(sp),-(sp)
 | |
| 		move.l	8(sp),4(sp)
 | |
| 		move.w	12(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,8(sp)
 | |
| 		move.w	16(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,12(sp)
 | |
| 		rts
 | |
| 
 | |
| st245:		move.l	(sp),-(sp)
 | |
| 		move.w	8(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,4(sp)
 | |
| 		move.l	10(sp),8(sp)
 | |
| 		move.w	14(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,12(sp)
 | |
| 		rts
 | |
| 
 | |
| st246:		sub.l	#2,sp
 | |
| 		move.l	2(sp),(sp)
 | |
| 		move.l	6(sp),4(sp)
 | |
| 		move.l	10(sp),8(sp)
 | |
| 		move.w	14(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,12(sp)
 | |
| 		rts
 | |
| 
 | |
| st247:		sub.l	#6,sp
 | |
| 		move.l	6(sp),(sp)
 | |
| 		move.w	10(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,4(sp)
 | |
| 		move.w	12(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,8(sp)
 | |
| 		move.l	14(sp),12(sp)
 | |
| 		move.w	18(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,16(sp)
 | |
| 		rts
 | |
| 
 | |
| st248:		move.l	(sp),-(sp)
 | |
| 		move.w	8(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,4(sp)
 | |
| 		move.w	10(sp),d0
 | |
| 		ext.l	d0
 | |
| 		move.l	d0,8(sp)
 | |
| 		rts
 | |
| 
 | |
| #endif
 |