Annotation of cci/sys/tahoe/Kcvtld.x, revision 1.1

1.1     ! root        1: #include       "fp.h"
        !             2: #include       "fp_in_krnl.h"
        !             3: 
        !             4:        .text
        !             5:        .globl  _Kcvtld     # _Kcvtld(acc_most,acc_least,op_most,op_least,hfs)
        !             6: _Kcvtld:       .word   0x003c          # we use r2,r3,r4,r5
        !             7: 
        !             8:  #
        !             9:  #Some initializations:
        !            10:  #
        !            11:        clrl    r4              # r4 - negative flag.
        !            12:        clrl    r2              # r2 - exponent.
        !            13:        movl    12(fp),r0       # fetch operand.
        !            14:        movl    r0,r5           # need another copy.
        !            15:        jeql    retzero         # return zero.
        !            16:        jgtr    positive
        !            17:        mnegl   r0,r0
        !            18:        jvs     retmin          # return minimum integer.
        !            19:        incl    r4              # remember it was negative.
        !            20:        movl    r0,r5           # remember the negated value.
        !            21:  #
        !            22:  #Compute exponent:
        !            23:  #
        !            24: positive:
        !            25:        ffs     r0,r1
        !            26:        incl    r1
        !            27:        addl2   r1,r2
        !            28:        shrl    r1,r0,r0
        !            29:        jneq    positive        # look for more set bits.
        !            30:  #
        !            31:  #we have the exponent in r2.
        !            32:  #
        !            33:        movl    r5,r0           # r0,r1 will hold the resulting f.p. number.
        !            34:        clrl    r1
        !            35:  #
        !            36:  #Shift the fraction part to its proper place:
        !            37:  #
        !            38:        subl3   r2,$HID_POS,r3
        !            39:        jlss    shiftr          # if less then zero we have to shift right.
        !            40:        shll    r3,r0,r0        # else we shift left.
        !            41:        jmp     shifted
        !            42: shiftr:
        !            43:        mnegl   r3,r3
        !            44:        shrq    r3,r0,r0
        !            45: shifted:
        !            46:        andl2   $CLEARHID,r0    # clear the hidden bit.
        !            47:        shal    $EXPSHIFT,r2,r2 # shift the exponent to its proper place.
        !            48:        orl2    $EXPSIGN,r2     # set the exponent sign bit(to bias it).
        !            49:        orl2    r2,r0           # combine exponent & fraction.
        !            50:        bbc     $0,r4,sign_ok   # do we  have to set the sign bit?
        !            51:        orl2    $SIGNBIT,r0     # yes...
        !            52: sign_ok:
        !            53:        ret
        !            54: 
        !            55: retzero:
        !            56:        clrl    r0
        !            57:        clrl    r1
        !            58:        ret
        !            59: 
        !            60: retmin:
        !            61:        movl    $0xd0000000,r0
        !            62:        clrl    r1
        !            63:        ret
        !            64: 
        !            65: 
        !            66:        

unix.superglobalmegacorp.com

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