Annotation of researchv10no/cmd/basic/bas/enter.s, revision 1.1

1.1     ! root        1: # enter(&prog,arg)
        !             2: # will execute prog(arg) and return zero
        !             3: # if a "leave(str)" is executed, an immediate return
        !             4: # from the caller to the lowest level enter will be
        !             5: # executed, and will return(str) to the caller of enter.
        !             6: 
        !             7:        .globl  _write
        !             8:        .globl  _exit
        !             9: 
        !            10:        .text
        !            11: 
        !            12:        .globl  _enter
        !            13: _enter:
        !            14:        .word   0
        !            15:        pushl   savesp          # save previous stack pointer
        !            16:        pushl   fp              # save the current frame pointer
        !            17:        movl    sp,savesp       # the saved stack pointer
        !            18:        pushl   8(ap)           # fetch the argument
        !            19:        calls   $1,*4(ap)       # call the function
        !            20:        clrl    r0              # normal return
        !            21: rtn:
        !            22:        movl    savesp,sp       # get old stack
        !            23:        movl    (sp)+,fp        # and old fp
        !            24:        movl    (sp)+,savesp    # and restore old exit
        !            25:        ret
        !            26: 
        !            27:        .globl  _leave
        !            28: 
        !            29: _leave:
        !            30:        .word   0
        !            31:        movl    4(ap),r0        # fetch return value
        !            32:        tstl    savesp
        !            33:        bneq    rtn             # and exit
        !            34:        pushl   $18
        !            35:        pushl   $msg
        !            36:        pushl   $2
        !            37:        calls   $3,_write
        !            38:        clrl    -(sp)
        !            39:        calls   $1,_exit
        !            40: 
        !            41:        .data
        !            42: msg:
        !            43:        .ascii  "bad call to leave\12"
        !            44: 
        !            45:        .text
        !            46:        .lcomm  savesp,4

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.