1*35169Smarc .file "syscall.s" 2*35169Smarc# @(#)syscall.s 1.4 3*35169Smarc# syscall(number, arg0, arg1, ... ) 4*35169Smarc 5*35169Smarc .globl syscall 6*35169Smarcsyscall: 7*35169Smarc save &0 8*35169Smarc addw2 &12,%sp # get a place to store a call 9*35169Smarc movh code,0(%fp) # copy the "ost" to the stack 10*35169Smarc movh code+2,2(%fp) 11*35169Smarc movh code+4,4(%fp) 12*35169Smarc movw &return,8(%fp) # store the "return" address 13*35169Smarc movb 3(%ap),1(%fp) # set the call code 14*35169Smarc addw2 &4,%ap # point to the first arg 15*35169Smarc jmp 0(%fp) # execute the call 16*35169Smarccode: 17*35169Smarc ost &0 # this code is copied to the stack 18*35169Smarc jmp *8(%fp) 19*35169Smarcreturn: 20*35169Smarc jcs error 21*35169Smarc subw2 &4,%ap # "ap" must be restored! 22*35169Smarc cmpw &0,&1 # clear the carry flag 23*35169Smarc jmp _csysret 24*35169Smarcerror: 25*35169Smarc subw2 &4,%ap 26*35169Smarc cmpw &1,&1 # set the carry flag 27*35169Smarc jmp _csysret 28