37d01caabd
2 - lseek did not return correct.
510 lines
6.9 KiB
Plaintext
510 lines
6.9 KiB
Plaintext
!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 .
|
|
|
|
_exit: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 1
|
|
|
|
_fork: move.l (sp),(a1)
|
|
trap #0
|
|
.short 2
|
|
lea 4(sp),sp
|
|
bcs 2f
|
|
tst.l d0 !PID OF CHILD IN PARENT, 0 IN CHILD
|
|
bne 1f
|
|
trap #0
|
|
.short 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)
|
|
!_fork is special
|
|
|
|
_read: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 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)
|
|
|
|
_write: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 4
|
|
bra sys0
|
|
|
|
_open: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st243
|
|
#endif
|
|
trap #0
|
|
.short 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)
|
|
|
|
_close: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 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)
|
|
|
|
_wait: move.l (sp),(a1)
|
|
trap #0
|
|
.short 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)
|
|
|
|
_creat: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st243
|
|
#endif
|
|
trap #0
|
|
.short 8
|
|
bra sys1
|
|
|
|
_link: move.l (sp),(a1)
|
|
trap #0
|
|
.short 9
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_unlink: move.l (sp),(a1)
|
|
trap #0
|
|
.short 10
|
|
bra sys3
|
|
|
|
_chdir: move.l (sp),(a1)
|
|
trap #0
|
|
.short 12
|
|
bra sys3
|
|
|
|
_mknod: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st244
|
|
#endif
|
|
trap #0
|
|
.short 14
|
|
lea 16(sp),sp
|
|
bra sys4
|
|
|
|
_chmod: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st243
|
|
#endif
|
|
trap #0
|
|
.short 15
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_chown: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st244
|
|
#endif
|
|
trap #0
|
|
.short 16
|
|
lea 16(sp),sp
|
|
bra sys4
|
|
|
|
_break: move.l (sp),(a1)
|
|
trap #0
|
|
.short 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)
|
|
|
|
.data
|
|
nd: .long endbss
|
|
.text
|
|
|
|
_stat: move.l (sp),(a1)
|
|
trap #0
|
|
.short 18
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_lseek: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st245
|
|
#endif
|
|
trap #0
|
|
.short 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)
|
|
|
|
|
|
_getpid: move.l (sp),(a1)
|
|
trap #0
|
|
.short 20
|
|
add.l #4,sp
|
|
mov d0,-(sp)
|
|
move.l (a1),a0
|
|
jmp (a0)
|
|
|
|
_mount: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st246
|
|
#endif
|
|
trap #0
|
|
.short 21
|
|
lea 16(sp),sp
|
|
bra sys4
|
|
|
|
_umount: move.l (sp),(a1)
|
|
trap #0
|
|
.short 22
|
|
bra sys3
|
|
|
|
_setuid: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 23
|
|
bra sys3
|
|
|
|
_getuid: move.l (sp),(a1)
|
|
trap #0
|
|
.short 24
|
|
sys7: add.l #4,sp
|
|
mov d1,-(sp)
|
|
mov d0,-(sp)
|
|
move.l (a1),a0
|
|
jmp (a0)
|
|
|
|
_stime: move.l (sp),(a1)
|
|
trap #0
|
|
.short 25
|
|
bra sys3
|
|
|
|
_ptrace: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st247
|
|
#endif
|
|
trap #0
|
|
.short 26
|
|
lea 20(sp),sp
|
|
bra sys5
|
|
|
|
_alarm: move.l (sp),(a1)
|
|
#ifndef lword
|
|
sub.l #2,sp
|
|
clr.w 4(sp)
|
|
#endif
|
|
trap #0
|
|
.short 27
|
|
lea 8(sp),sp
|
|
mov d0,-(sp)
|
|
move.l (a1),a0
|
|
jmp (a0)
|
|
|
|
_fstat: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 28
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_pause: trap #0
|
|
.short 29
|
|
rts
|
|
|
|
_utime: move.l (sp),(a1)
|
|
trap #0
|
|
.short 30
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_access: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st248
|
|
#endif
|
|
trap #0
|
|
.short 33
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_nice:
|
|
#ifndef lword
|
|
bsr 241
|
|
#endif
|
|
trap #0
|
|
.short 34
|
|
move.l (sp)+,(sp)
|
|
rts
|
|
|
|
_ftime: move.l (sp),(a1)
|
|
trap #0
|
|
.short 35
|
|
bra sys3
|
|
|
|
_sync: trap #0
|
|
.short 36
|
|
rts
|
|
|
|
_kill: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st248
|
|
#endif
|
|
trap #0
|
|
.short 37
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_dup: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st248
|
|
#endif
|
|
trap #0
|
|
.short 38
|
|
bra sys1
|
|
|
|
_pipe: move.l (sp),(a1)
|
|
trap #0
|
|
.short 42
|
|
bra sys6
|
|
|
|
_times: trap #0
|
|
.short 43
|
|
move.l (sp),a0
|
|
add.l #8,sp
|
|
jmp (a0)
|
|
|
|
_profil: trap #0
|
|
.short 44
|
|
move.l (sp),a0
|
|
lea 20(sp),sp
|
|
jmp (a0)
|
|
|
|
_setgid: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 46
|
|
bra sys3
|
|
|
|
_getgid: move.l (sp),(a1)
|
|
trap #0
|
|
.short 47
|
|
bra sys7
|
|
|
|
|
|
_signal: move.l (sp)+,retaddr
|
|
mov (sp)+,d4
|
|
extend d4
|
|
move.l d4,-(sp)
|
|
move.l retaddr,-(sp)
|
|
trap #0
|
|
.short 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)
|
|
.data
|
|
retaddr: .long 0
|
|
.text
|
|
|
|
_acct: move.l (sp),(a1)
|
|
trap #0
|
|
.short 51
|
|
bra sys3
|
|
_lock: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 53
|
|
bra sys3
|
|
|
|
_ioctl: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st248
|
|
#endif
|
|
trap #0
|
|
.short 54
|
|
lea 16(sp),sp
|
|
bra sys4
|
|
|
|
_mpxcall: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 56
|
|
lea 12(sp),sp
|
|
bra sys4
|
|
|
|
_exece: move.l (sp),(a1)
|
|
trap #0
|
|
.short 59
|
|
lea 16(sp),sp
|
|
bra sys4
|
|
|
|
_umask: move.l (sp),(a1)
|
|
#ifndef lword
|
|
bsr st241
|
|
#endif
|
|
trap #0
|
|
.short 60
|
|
add.l #8,sp
|
|
mov d0,-(sp)
|
|
move.l (a1),a0
|
|
jmp (a0)
|
|
|
|
_chroot: move.l (sp),(a1)
|
|
trap #0
|
|
.short 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
|