# # DOMINO:conofacevu.s DATE: 5-86 # O'Leary, Stewart, Van de Geijn University of Maryland # # Programmed by O'Leary # # This is conoface # (awaken, pause, invoke, and finis) # for the Vax using the cc compiler # and the as assembler under Unix. # # "awaken (nodep)" activates "nodeprog (nodep, initialp)", which # returns control either by a "return" (to set status=0), a # "pause()" (to set status=1), or a "finis()" (to set status=2). # # "invoke (funct, arg1, ..., argn)" has the same effect as # "funct (arg1, ... , argn)", except that the system stack is # used for local storage in funct instead of the stack for the # node program. # # Register usage: # # r9 20(r10) = address of node.program # r10 4(ap) = address of node # r11 4(r10) = node.status # 28(r10) = address of top of stack for node # 32(r10) = address of bottom of stack for node # .globl _awaken _awaken: .word 07774 # Get node information. movl 4(ap),r10 # get node pointer movl 20(r10),r9 # get call address movl 4(r10),r11 # get status # Save system environment. pushl ap # save system ap pushl fp # save system fp moval 0(sp),syssp # save sp in syssp # cmpl r11,$0 # check status beql norestore # go to norestore if status=0 # # status=1: restore node # environment and return # to node program # movl 28(r10),sp # restore node stack pointer movl (sp)+,fp # restore fp register movl (sp)+,ap # restore ap register ret # return to node program # # status=0: call node prog norestore: movl $1,4(r10) # node.status = 1 movl 32(r10),sp # get node stack pointer moval _initial,-(sp) # put address of initial on stack as argument pushl r10 # put nodep on stack as argument calls $2,(r9) # call subroutine # # node program "return": # set status=0, restore # system environment, and # return to system. norm: movl syssp,sp # restore system sp movl (sp)+,fp # restore fp register movl (sp)+,ap # restore ap register movl $0,4(r10) # node.status=0 ret # return to control # # pause: save node envirn., # restore system environment, # return to system. .globl _pause _pause: .word 07774 pushl ap # save node's ap pushl fp # save node's fp movl sp,ap # copy node stack pointer to ap movl syssp,sp # restore system stack pointer moval 0(ap),28(r10) # save node stack pointer movl (sp)+,fp # restore system fp movl (sp)+,ap # restore system ap ret # return to control # # finis: set status=2, restore # system environment, return # to system. .globl _finis _finis: .word 0 movl syssp,sp # restore system stack pointer movl (sp)+,fp # restore system fp movl (sp)+,ap # restore system ap movl $2,4(r10) # node.status = 2 ret # return to control # .comm syssp,4 # # r9 (ap) number of words of arguments to invoke; also used for scratch # r10 address of arguments # r11 sp calling program's stackpointer # # .globl _invoke _invoke: .word 07000 moval (sp),r11 # save calling program's stackpointer movl syssp,sp # restore system sp moval 0(ap),r10 # ap copied to r10 movl (ap),r9 # get number of words of arguments mull2 $4,r9 # compute number of bytes used by arguments addl2 r9,r10 # compute address of last argument movl (ap),r9 # restore r9 to no. of words of args. to invoke loop: decl r9 # compute number of args remaining to be moved bleq out # if == 0, go to out pushl (r10) # put next argument on stack subl2 $4,r10 # compute address of next argument brb loop # go to loop out: movl (ap),r9 # restore r9 to no. of words of args. to invoke decl r9 # r9 is the no. of words of args. to funct movl 4(ap),r10 # r10 is the address of funct calls r9,(r10) # funct (arg1,...,argn) movl r11,sp # restore calling program's stackpointer ret # return to calling program