Annotation of 41BSD/cmd/px/34err.s, revision 1.1

1.1     ! root        1: #
        !             2: # Copyright (c) 1979 Regents of the University of California
        !             3: #
        !             4: # char sccsid[] = "@(#)34err.s 4.1 10/10/80";
        !             5: #
        !             6:        .set    EARGV ,1
        !             7:        .set    EASRT ,2
        !             8:        .set    EASSIGN ,3
        !             9:        .set    EBADFNUM ,4
        !            10:        .set    EBADINUM ,5
        !            11:        .set    EBADOP ,6
        !            12:        .set    EBUILTIN ,7
        !            13:        .set    ECASE ,8
        !            14:        .set    ECHR ,9
        !            15:        .set    ECLOSE,10
        !            16:        .set    ECREATE,11
        !            17:        .set    EFIXADD,13
        !            18:        .set    EFIXDIV,14
        !            19:        .set    EFIXMUL,15
        !            20:        .set    EFIXNEG,16
        !            21:        .set    EFIXSUB,17
        !            22:        .set    EFLTADD,18
        !            23:        .set    EFLTDIV,19
        !            24:        .set    EFLTMUL,20
        !            25:        .set    EFLTSUB,21
        !            26:        .set    EFMTSIZE,22
        !            27:        .set    EGOTO,23
        !            28:        .set    EHALT,24
        !            29:        .set    EINTR,25
        !            30:        .set    ELLIMIT,26
        !            31:        .set    ELN,27
        !            32:        .set    EMODDIV,28
        !            33:        .set    ENAMESIZE,29
        !            34:        .set    ENAMRNG,30
        !            35:        .set    ENILPTR,31
        !            36:        .set    ENUMNTFD,32
        !            37:        .set    EOPEN,33
        !            38:        .set    EOUTOFMEM,34
        !            39:        .set    EPACK,35
        !            40:        .set    EPASTEOF,36
        !            41:        .set    ERANGE,37
        !            42:        .set    EREADIT,38
        !            43:        .set    EREFINAF,39
        !            44:        .set    EREMOVE,40
        !            45:        .set    ESEEK,41
        !            46:        .set    ESQRT,42
        !            47:        .set    ESTKNEMP,43
        !            48:        .set    ESTKOVFLO,44
        !            49:        .set    ESTLIM,45
        !            50:        .set    ESUBSCR,46
        !            51:        .set    ESYSTEM,47
        !            52:        .set    ETRASHHEAP,48
        !            53:        .set    EUNPACK,49
        !            54:        .set    EWRITE,50
        !            55:        .set    EWRITEIT,51
        !            56:        .set    ECTLWR,12
        !            57:        .set    ECTUPR,52
        !            58:        .set    ECTSNG,53
        !            59:        .set    ENARGS,54
        !            60: #
        !            61: # Fielding interrupts and processing errors
        !            62: #
        !            63: # Process interpreter detected errors
        !            64: #
        !            65: error:
        !            66:        movzwl  _perrno,-(sp)
        !            67:        calls   $1,_error
        !            68:        jmp     (r8)
        !            69: 
        !            70: _endinterpret:
        !            71:        .byte   'e,'n,'d, 0
        !            72: 
        !            73: #
        !            74: # Keyboard interrupts
        !            75: #
        !            76:        .align  1
        !            77:        .globl  _intr
        !            78: _intr:
        !            79:        .word   0
        !            80:        pushal  _intr           #reset interrupt signal
        !            81:        pushl   $SIGINT
        !            82:        calls   $2,_signal
        !            83:        pushl   $EINTR
        !            84:        calls   $1,_error
        !            85:        ret
        !            86: #
        !            87: # Segmentation Violations => No more memory available for the stack
        !            88: #
        !            89:        .align  1
        !            90:        .globl  _memsize
        !            91: _memsize:
        !            92:        .word   0
        !            93:        pushl   $ESTKOVFLO
        !            94:        calls   $1,_error
        !            95:        ret
        !            96: #
        !            97: # Die gracefully on unexpected signals
        !            98: #
        !            99:        .align  1
        !           100:        .globl  _syserr
        !           101: _syserr:
        !           102:        .word   0
        !           103:        pushl   $ESYSTEM
        !           104:        calls   $1,_error
        !           105:        ret
        !           106: #
        !           107: # Process computational errors
        !           108: #
        !           109:        .align  1
        !           110:        .globl  _except
        !           111: _except:
        !           112:        .word   0
        !           113:        pushal  _except         #reset signal
        !           114:        pushl   $SIGFPE
        !           115:        calls   $2,_signal
        !           116:        movl    16(ap),r0       #r0 has PC at point following error
        !           117:        moval   errtbl-4,r1     #r1 points to error offset table
        !           118: l3404:
        !           119:        addl2   $4,r1           #determine cause of error
        !           120:        cmpl    r0,(r1)+
        !           121:        blssu   l3405           #not in table => system error
        !           122:        cmpl    r0,(r1)+
        !           123:        bgtru   l3404
        !           124:        movzwl  (r1),-(sp)      #select error message
        !           125:        brb     l3406
        !           126: l3405:
        !           127:        pushl   $ESYSTEM
        !           128: l3406:
        !           129:        calls   $1,_error
        !           130:        ret
        !           131: #
        !           132: # Table of offsets and their associated errors
        !           133: #
        !           134:        .align  1
        !           135: errtbl:
        !           136:        .long   _AS2, _OFF, EASSIGN
        !           137:        .long   _ADD2, _ADD28, EFIXADD
        !           138:        .long   _ADD28, _SUB2, EFLTADD
        !           139:        .long   _SUB2, _SUB28, EFIXSUB
        !           140:        .long   _SUB28, _MUL2, EFLTSUB
        !           141:        .long   _MUL2, _MUL28, EFIXMUL
        !           142:        .long   _MUL28, _DIV2, EFLTMUL
        !           143:        .long   _DIV2, _MOD2, EFIXDIV
        !           144:        .long   _MOD2, _ABS2, EMODDIV
        !           145:        .long   _ABS2, _ABS8, EFIXNEG
        !           146:        .long   _DVD2, _IND1, EFLTDIV
        !           147:        .long   _STOI, _UNDEF, EBUILTIN
        !           148:        .long   0xffffffff
        !           149: #
        !           150: # recover values of dp and lino from the stack
        !           151: #
        !           152:        .globl  _fetchdp
        !           153: 
        !           154: _fetchdp:
        !           155:        .word   R2|R3|R4|R5|R6|R7|R8|R9|R10|R11
        !           156:        pushl   fp              #sift through the stack to get the
        !           157:        movl    sp,oldsp        # values of dp and lino
        !           158: l3401:
        !           159:        bicw3   $0xf000,MASK(fp),mask   #register save mask
        !           160:        moval   REGS(fp),sp             #point to saved registers
        !           161:        popr    mask                    #pop them
        !           162:        cmpl    PC(fp),$_interpret      #check for interpreter frame
        !           163:        blss    l3402                   #not found
        !           164:        cmpl    PC(fp),$_endinterpret   #check for end of interpreter
        !           165:        blss    l3403                   #found
        !           166: l3402:
        !           167:        movl    FP(fp),fp       #get next frames registers
        !           168:        jbr     l3401
        !           169: l3403:
        !           170:        movl    oldsp,sp        #restore current frame
        !           171:        movl    (sp)+,fp
        !           172:        movl    r9,*4(ap)       #return dp
        !           173:        movl    r11,*8(ap)      #return lino
        !           174:        ret
        !           175:        .data
        !           176: oldsp: .space  4               #old value of sp
        !           177: mask:  .space  2               #register pop mask
        !           178:        .text

unix.superglobalmegacorp.com

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