ack/mach/mantra/int/mloopc
1987-03-30 09:39:38 +00:00

515 lines
7.1 KiB
Plaintext

.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
!THIS FILE CONTAINS THE SYSTEM CALLS FOR PMDS-II AS SUBROUTINES FOR THE
!EM-INTERPRETER. a1 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),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 1
_Xfork: move.l (sp),(a1)
trap #0
.data2 2
lea 4(sp),sp
bcs 2f
tst.l d0 !PID OF CHILD IN PARENT, 0 IN CHILD
bne 1f
trap #0
.data2 20
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: mov d0,-(sp)
mov d0,-(sp)
3: move.l (a1),a0
jmp (a0)
!_Xfork is special
_Xread: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 3
sys0: lea 16(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_Xwrite: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 4
bra sys0
_Xopen: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.data2 5
sys1: lea 12(sp),sp
sys5: bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: mov d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_Xclose: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 6
sys3: lea 8(sp),sp
sys4: bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: cl -(sp)
2: move.l (a1),a0
jmp (a0)
_Xwait: move.l (sp),(a1)
trap #0
.data2 7
sys6: lea 4(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: mov d1,-(sp) ! ??
mov d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_Xcreat: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.data2 8
bra sys1
_Xlink: move.l (sp),(a1)
trap #0
.data2 9
lea 12(sp),sp
bra sys4
_Xunlink: move.l (sp),(a1)
trap #0
.data2 10
bra sys3
_Xchdir: move.l (sp),(a1)
trap #0
.data2 12
bra sys3
_Xmknod: move.l (sp),(a1)
#ifndef lword
bsr st244
#endif
trap #0
.data2 14
lea 16(sp),sp
bra sys4
_Xchmod: move.l (sp),(a1)
#ifndef lword
bsr st243
#endif
trap #0
.data2 15
lea 12(sp),sp
bra sys4
_Xchown: move.l (sp),(a1)
#ifndef lword
bsr st244
#endif
trap #0
.data2 16
lea 16(sp),sp
bra sys4
_Xbreak: move.l (sp),(a1)
trap #0
.data2 17
lea 8(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l -4(sp),nd
cl -(sp)
2: move.l (a1),a0
jmp (a0)
.sect .data
nd: .data4 endbss
.sect .text
_Xstat: move.l (sp),(a1)
trap #0
.data2 18
lea 12(sp),sp
bra sys4
_Xlseek: move.l (sp),(a1)
#ifndef lword
bsr st245
#endif
trap #0
.data2 19
lea 16(sp),sp
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: move.l d0,-(sp)
cl -(sp)
2: move.l (a1),a0
jmp (a0)
_Xgetpid: move.l (sp),(a1)
trap #0
.data2 20
add.l #4,sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_Xmount: move.l (sp),(a1)
#ifndef lword
bsr st246
#endif
trap #0
.data2 21
lea 16(sp),sp
bra sys4
_Xumount: move.l (sp),(a1)
trap #0
.data2 22
bra sys3
_Xsetuid: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 23
bra sys3
_Xgetuid: move.l (sp),(a1)
trap #0
.data2 24
sys7: add.l #4,sp
mov d1,-(sp)
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_Xstime: move.l (sp),(a1)
trap #0
.data2 25
bra sys3
_Xptrace: move.l (sp),(a1)
#ifndef lword
bsr st247
#endif
trap #0
.data2 26
lea 20(sp),sp
bra sys5
_Xalarm: move.l (sp),(a1)
#ifndef lword
sub.l #2,sp
clr.w 4(sp)
#endif
trap #0
.data2 27
lea 8(sp),sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_Xfstat: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 28
lea 12(sp),sp
bra sys4
_Xpause: trap #0
.data2 29
rts
_Xutime: move.l (sp),(a1)
trap #0
.data2 30
lea 12(sp),sp
bra sys4
_Xaccess: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.data2 33
lea 12(sp),sp
bra sys4
_Xnice:
#ifndef lword
bsr 241
#endif
trap #0
.data2 34
move.l (sp)+,(sp)
rts
_Xftime: move.l (sp),(a1)
trap #0
.data2 35
bra sys3
_Xsync: trap #0
.data2 36
rts
_Xkill: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.data2 37
lea 12(sp),sp
bra sys4
_Xdup: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.data2 38
bra sys1
_Xpipe: move.l (sp),(a1)
trap #0
.data2 42
bra sys6
_Xtimes: trap #0
.data2 43
move.l (sp),a0
add.l #8,sp
jmp (a0)
_Xprofil: trap #0
.data2 44
move.l (sp),a0
lea 20(sp),sp
jmp (a0)
_Xsetgid: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 46
bra sys3
_Xgetgid: move.l (sp),(a1)
trap #0
.data2 47
bra sys7
_Xsignal: move.l (sp)+,retaddr
mov (sp)+,d4
extend d4
move.l d4,-(sp)
move.l retaddr,-(sp)
trap #0
.data2 48
lea 12(sp),sp !remove arguments
bcc 1f
mov d0,-(sp)
mov d0,-(sp)
bra 2f
1: mov d0,-(sp)
cl -(sp)
2: move.l retaddr,a0
jmp (a0)
.sect .data
retaddr: .data4 0
.sect .text
_Xacct: move.l (sp),(a1)
trap #0
.data2 51
bra sys3
_Xlock: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 53
bra sys3
_Xioctl: move.l (sp),(a1)
#ifndef lword
bsr st248
#endif
trap #0
.data2 54
lea 16(sp),sp
bra sys4
!_Xmpxcall: move.l (sp),(a1)
!#ifndef lword
! bsr st241
!#endif
! trap #0
! .data2 56
! lea 12(sp),sp
! bra sys4
_Xexece: move.l (sp),(a1)
trap #0
.data2 59
lea 16(sp),sp
bra sys4
_Xumask: move.l (sp),(a1)
#ifndef lword
bsr st241
#endif
trap #0
.data2 60
add.l #8,sp
mov d0,-(sp)
move.l (a1),a0
jmp (a0)
_Xchroot: move.l (sp),(a1)
trap #0
.data2 61
bra sys3
!----------------------------------------------------------------------------
! STACK ADJUSTMENT FOR THE TWO BYTE INTERPRETER
!-----------------------------------------------------------------------------
#ifndef lword
st241: 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
st243: 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
st244: move.l (sp),-(sp)
move.l 8(sp),4(sp)
move.l 12(sp),8(sp)
move.w 16(sp),d0
ext.l d0
move.l d0,12(sp)
move.w 18(sp),d0
ext.l d0
move.l d0,16(sp)
rts
st245: move.l (sp),-(sp)
move.l 8(sp),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
st246: sub.l #2,sp
move.l 2(sp),(sp)
move.l 6(sp),4(sp)
move.l 10(sp),8(sp)
move.l 14(sp),12(sp)
move.w 18(sp),d0
ext.l d0
move.l d0,16(sp)
rts
st247: sub.l #6,sp
move.l 6(sp),(sp)
move.l 10(sp),4(sp)
move.w 14(sp),d0
ext.l d0
move.l d0,8(sp)
move.w 16(sp),d0
ext.l d0
move.l d0,12(sp)
move.l 18(sp),16(sp)
move.w 22(sp),d0
ext.l d0
move.l d0,20(sp)
rts
st248: 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 14(sp),d0
ext.l d0
move.l d0,12(sp)
rts
#endif