date and time created 88/07/21 17:34:25 by marc
authorMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 22 Jul 1988 08:34:25 +0000 (00:34 -0800)
committerMarc Teitelbaum <marc@ucbvax.Berkeley.EDU>
Fri, 22 Jul 1988 08:34:25 +0000 (00:34 -0800)
SCCS-vsn: local/toolchest/ksh/sh/syscall.s 1.1

usr/src/local/toolchest/ksh/sh/syscall.s [new file with mode: 0644]

diff --git a/usr/src/local/toolchest/ksh/sh/syscall.s b/usr/src/local/toolchest/ksh/sh/syscall.s
new file mode 100644 (file)
index 0000000..36b0d9a
--- /dev/null
@@ -0,0 +1,27 @@
+       .file   "syscall.s"
+#      @(#)syscall.s   1.4
+#      syscall(number, arg0, arg1, ... )
+
+       .globl  syscall
+syscall:
+       save    &0
+       addw2   &12,%sp                 # get a place to store a call
+       movh    code,0(%fp)             # copy the "ost" to the stack
+       movh    code+2,2(%fp)
+       movh    code+4,4(%fp)
+       movw    &return,8(%fp)          # store the "return" address
+       movb    3(%ap),1(%fp)           # set the call code
+       addw2   &4,%ap                  # point to the first arg
+       jmp     0(%fp)                  # execute the call
+code:
+       ost     &0                      # this code is copied to the stack
+       jmp     *8(%fp)
+return:
+       jcs     error
+       subw2   &4,%ap                  # "ap" must be restored!
+       cmpw    &0,&1                   # clear the carry flag
+       jmp     _csysret
+error:
+       subw2   &4,%ap
+       cmpw    &1,&1                   # set the carry flag
+       jmp     _csysret