Annotation of cci/sys/tahoe/Kcvtlf.x, revision 1.1.1.1

1.1       root        1: #include       "fp.h"
                      2: #include       "fp_in_krnl.h"
                      3: 
                      4:        .text
                      5:        .globl  _Kcvtlf     # _Kcvtlf(acc_most,acc_least,op_most,op_least,hfs)
                      6: _Kcvtlf:       .word   0x003c          # we use r2,r3,r4,r5
                      7: 
                      8:  #
                      9:  #Some initializations:
                     10:  #
                     11:        clrl    r1
                     12:        clrl    r4              # r4 - negative flag.
                     13:        clrl    r2              # r2 - exponent.
                     14:        movl    12(fp),r0       # fetch operand.
                     15:        movl    r0,r5           # need another copy.
                     16:        jeql    retzero         # return zero.
                     17:        jgtr    positive
                     18:        mnegl   r0,r0
                     19:        jvs     retmin          # return minimum integer.
                     20:        incl    r4              # remember it was negative.
                     21:        movl    r0,r5           # remember the negated value.
                     22:  #
                     23:  #Compute exponent:
                     24:  #
                     25: positive:
                     26:        ffs     r0,r1
                     27:        incl    r1
                     28:        addl2   r1,r2
                     29:        shrl    r1,r0,r0
                     30:        jneq    positive        # look for more set bits.
                     31:  #
                     32:  #we have the exponent in r2.
                     33:  #
                     34:        movl    r5,r0           # r0 will hold the resulting f.p. number.
                     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:        shrl    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:        ret
                     58: 
                     59: retmin:
                     60:        movl    $0xd0000000,r0
                     61:        ret
                     62: 
                     63: 
                     64:        

unix.superglobalmegacorp.com

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