--- /dev/null
+ ! Two system calls (gtty and stty) in the m68000 tail_mon library
+ ! were not really system calls but they used _ioctl. The m68020 machine
+ ! the table was tested on used real system calls, and we'll use
+ ! them here.
+ ! There were also three calls (ftime, lock and dup2) that were in the
+ ! m68000 library, but were not included in the list of system calls
+ ! for the m68020 that was given to me. We'll include them anyway.
+ ! The original gtty and stty files are included here.
+ ! Note however that the 68000 machine (the Mantra) needs the parameters
+ ! to system calls in registers, while the m68020 machine this table was
+ ! tested on wanted the parameters on the stack
+ !
+ ! Also read the comments in the signal.s file!
+! ------------------- dup2.s
+! .define _dup2
+! .extern _dup2
+! .sect .text
+! .sect .rom
+! .sect .data
+! .sect .bss
+! .sect .text
+! _dup2: move.w #0x29,d0
+! move.l (4,sp),a0
+! move.l (8,sp),d1
+! add.l #0x40,a0
+! jmp (call)
+!
+!
+! ! ------------------- gtty.s
+! .define _gtty
+! .extern _gtty
+! .sect .text
+! .sect .rom
+! .sect .data
+! .sect .bss
+! .sect .text
+! _gtty:
+! tst.b (-40,sp)
+! link a6,#-0
+! move.l (12,a6),-(sp)
+! move.l #29704,-(sp)
+! move.l (8,a6),-(sp)
+! jsr (_ioctl)
+! add.l #12,sp
+! unlk a6
+! rts
+!
+!
+! ! ------------------- stty.s
+! .define _stty
+! .extern _stty
+! .sect .text
+! .sect .rom
+! .sect .data
+! .sect .bss
+! .sect .text
+! _stty:
+! tst.b (-40,sp)
+! link a6,#-0
+! move.l (12,a6),-(sp)
+! move.l #29705,-(sp)
+! move.l (8,a6),-(sp)
+! jsr (_ioctl)
+! add.l #12,sp
+! unlk a6
+! rts
--- /dev/null
+.define __exit
+.extern __exit
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__exit: move.l #0x1,d0
+ trap #0
+ stop #0 ! was there in 68020 routine
--- /dev/null
+.define _access
+.extern _access
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_access: move.l #0x21,d0
+ jmp (callc)
--- /dev/null
+.define _acct
+.extern _acct
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_acct: move.l #0x33,d0
+ jmp (callc)
--- /dev/null
+.define _alarm
+.extern _alarm
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_alarm: move.l #0x1B,d0
+ trap #0
+ rts
--- /dev/null
+.define _brk
+.define _sbrk
+.extern _brk
+.extern _sbrk
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_sbrk: move.l (.reghp),d0
+ add.l d0,(4,sp)
+ move.l #0x11,d0
+ trap #0
+ bcs lcerror
+ move.l (.reghp),d0
+ move.l d0,a0
+ move.l (4,sp),(.reghp)
+ rts
+lcerror: jmp (cerror)
+_brk: move.l #0x11,d0
+ trap #0
+ bcs lcerror
+ move.l (4,sp),(.reghp)
+ clr.l d0
+ rts
--- /dev/null
+.define call
+.define callc
+.define calle
+.define cerror
+.extern call
+.extern callc
+.extern calle
+.extern cerror
+.extern _errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+call: trap #0
+ bcs cerror
+ rts
+callc:
+ trap #0
+ bcs cerror
+ clr.l d0
+ rts
+calle:
+ trap #0
+cerror:
+ move.l d0,(_errno)
+ move.l #-1,d0
+ rts
--- /dev/null
+.define _chdir
+.extern _chdir
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_chdir: move.l #0xC,d0
+ jmp (callc)
--- /dev/null
+.define _chmod
+.extern _chmod
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_chmod: move.l #0xF,d0
+ jmp (callc)
--- /dev/null
+.define _chown
+.extern _chown
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_chown: move.l #0x10,d0
+ jmp (callc)
--- /dev/null
+.define _chroot
+.extern _chroot
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_chroot: move.l #0x3D,d0
+ jmp (callc)
--- /dev/null
+.define __cleanup
+.extern __cleanup
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+__cleanup:
+tst.b (-40,sp)
+link a6,#-0
+unlk a6
+rts
--- /dev/null
+.define _close
+.extern _close
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_close: move.l #0x6,d0
+ jmp (callc)
--- /dev/null
+if ${MACH?} -c $1 1>&2
+then echo `basename $1 $2`.o
+else exit 1
+fi
--- /dev/null
+.define _creat
+.extern _creat
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_creat: move.l #0x8,d0
+ jmp (call)
--- /dev/null
+.define _dup
+.extern _dup
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_dup: move.l #0x29,d0
+ jmp (call)
--- /dev/null
+.define _dup2
+.extern _dup2
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_dup2: move.l #0x29,d0
+ add.l #0x40,(4,sp) ! ???
+ jmp (call)
--- /dev/null
+.define _errno
+.extern _errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .bss
+_errno: .space 4
+.sect .text
--- /dev/null
+.define _execl
+.extern _execl
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_execl: link a6,#0
+ tst.b (-132,sp)
+ move.l (_environ),-(sp)
+ pea (12,sp)
+ move.l (8,a6),-(sp)
+ jsr (_execve)
+ add.l #0xC,sp
+ unlk a6
+ rts
--- /dev/null
+.define _execve
+.extern _execve
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_execve: move.l #0x3B,d0
+ jmp (calle)
--- /dev/null
+.define _exit
+.extern _exit
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_exit:
+tst.b (-40,sp)
+link a6,#-0
+jsr (__cleanup)
+move.l (8,a6),-(sp)
+jsr (__exit)
+add.l #4,sp
+unlk a6
+rts
--- /dev/null
+.define _fcntl
+.extern _fcntl
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_fcntl: move.l #0x3E,d0
+ jmp (callc)
--- /dev/null
+.define _fork
+.extern _fork
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_fork: move.l #0x2,d0
+ trap #0
+ bcc 1f ! 68020 way to do it
+ jmp (cerror)
+1:
+ tst.b d1
+ beq 2f
+ clr.l d0
+2:
+ rts
--- /dev/null
+.define _fstat
+.extern _fstat
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_fstat: move.l #0x1C,d0
+ jmp (callc)
--- /dev/null
+.define _ftime
+.extern _ftime
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_ftime: move.l #0x23,d0
+ jmp (callc)
--- /dev/null
+.define _getegid
+.extern _getegid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_getegid: move.l #0x2F,d0
+ trap #0
+ move.l d1,d0
+ rts
--- /dev/null
+.define _getgid
+.extern _getgid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_getgid: move.l #0x2F,d0
+ trap #0
+ rts
--- /dev/null
+.define _getpid
+.extern _getpid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_getpid: move.l #0x14,d0
+ trap #0
+ rts
--- /dev/null
+.define _getuid
+.extern _getuid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_getuid: move.l #0x18,d0
+ trap #0
+ rts
--- /dev/null
+.define _gtty
+.extern _gtty
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_gtty: move.l #0x20, d0
+ jmp (call)
--- /dev/null
+.define _ioctl
+.extern _ioctl
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_ioctl: move.l #0x36,d0
+ jmp (call)
--- /dev/null
+.define _kill
+.extern _kill
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_kill: move.l #0x25,d0
+ jmp (callc)
--- /dev/null
+.define _link
+.extern _link
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_link: move.l #0x9,d0
+ jmp (callc)
--- /dev/null
+.define _lock
+.extern _lock
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_lock: move.l #0x35,d0
+ jmp (callc)
--- /dev/null
+.define _lseek
+.extern _lseek
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_lseek: move.l #0x13,d0
+ jmp (call)
--- /dev/null
+.define _mknod
+.extern _mknod
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_mknod: move.l #0xE,d0
+ jmp (callc)
--- /dev/null
+.define _mount
+.extern _mount
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_mount: move.l #0x15,d0
+ jmp (callc)
--- /dev/null
+.define _nice
+.extern _nice
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_nice: move.l #0x22,d0
+ jmp (call)
--- /dev/null
+.define _open
+.extern _open
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_open: move.l #0x5,d0
+ jmp (call)
--- /dev/null
+.define _pause
+.extern _pause
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_pause: move.l #0x1D,d0
+ jmp (callc)
--- /dev/null
+.define _pipe
+.extern _pipe
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_pipe:
+ move.l #0x2A,d0
+ trap #0
+ bcc 1f
+ jmp (cerror)
+1:
+ move.l (4,sp),a0
+ move.l d0,(a0)+
+ move.l d1,(a0)
+ clr.l d0
+ rts
--- /dev/null
+.define _profil
+.extern _profil
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_profil: move.l #0x2C,d0
+ trap #0
+ rts
--- /dev/null
+.define _ptrace
+.extern _ptrace
+.extern _errno
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_ptrace: move.l #0x1A,d0
+ clr.l (_errno)
+ jmp (call)
--- /dev/null
+.define _read
+.extern _read
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_read: move.l #0x3,d0
+ jmp (call)
--- /dev/null
+.define _setgid
+.extern _setgid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_setgid: move.l #0x2E,d0
+ jmp (callc)
--- /dev/null
+.define _setuid
+.extern _setuid
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_setuid: move.l #0x17,d0
+ jmp (callc)
--- /dev/null
+.define _signal
+.extern _signal
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_signal:
+ move.l #0x30,d0
+ jmp (callc)
+! NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+!
+! Just as in the m68000 tail_mon library the acual signal system call
+! is not called directly by the user, but an `interface'. This `interface'
+! does the actual system call. On the m68020 machine the table was tested on
+! this `interface' did things that I did not understand, e.g. it called
+! a sytem call with number 38, called `_sysm68k'. I couldn't get the signal
+! system call get to work properly on that machine, but as it is clear
+! that this is in no way to blame to my back end table.
+! The system call as presented here does not reset the catch routine: a
+! signal that is caught by a user function will be caught every time, not
+! just once. I couldn't change this.
--- /dev/null
+.define _stat
+.extern _stat
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_stat: move.l #0x12,d0
+ jmp (callc)
--- /dev/null
+.define _stime
+.extern _stime
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_stime: move.l #0x19,d0
+ move.l ([4,sp]),(4,sp)
+ jmp (callc)
--- /dev/null
+.define _stty
+.extern _stty
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_stty: move.l #0x21, d0
+ jmp (call)
--- /dev/null
+.define _sync
+.extern _sync
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_sync: move.l #0x24,d0
+ trap #0
+ rts
--- /dev/null
+.define _time
+.extern _time
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_time: move.l #0xD,d0
+ trap #0
+ tst.l (4,sp)
+ beq 1f
+ move.l d0,([4,sp])
+1:
+ rts
--- /dev/null
+.define _times
+.extern _times
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_times: move.l #0x2B,d0
+ trap #0
+ jmp (call)
--- /dev/null
+.define _umask
+.extern _umask
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_umask: move.l #0x3C,d0
+ jmp (call)
--- /dev/null
+.define _umount
+.extern _umount
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_umount: move.l #0x16,d0
+ jmp (callc)
--- /dev/null
+.define _unlink
+.extern _unlink
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_unlink: move.l #0xA,d0
+ jmp (callc)
--- /dev/null
+.define _utime
+.extern _utime
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_utime: move.l #0x1E,d0
+ jmp (callc)
--- /dev/null
+.define _wait
+.extern _wait
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_wait: move.l #0x7,d0
+ trap #0
+ bcs cerror
+ tst.l (4,sp)
+ beq 1f
+ move.l d1,([4,sp])
+1:
+ rts
--- /dev/null
+.define _write
+.extern _write
+.sect .text
+.sect .rom
+.sect .data
+.sect .bss
+.sect .text
+_write: move.l #0x4,d0
+ jmp (call)