Annotation of cci/sys/tahoe/Kdivf.x, revision 1.1.1.2

1.1       root        1: 
                      2: #include       "fp.h"
                      3: #include       "fp_in_krnl.h"
                      4: 
                      5: 
                      6:                        # here we count from 0 not from 1 as in fp.h
                      7: #define        HIDDEN  23      
                      8: 
                      9:        .text
                     10:        .globl  _Kdivf      # _Kdivf(acc_most,acc_least,op_most,op_least,hfs)
                     11: _Kdivf:        .word   0xffc
                     12:        clrl    r1
                     13:        clrl    r3              # r3 - sign: 0 for positive,1 for negative.
                     14:        movl    4(fp),r0
                     15:        jgeq    1f
                     16:        movl    $1,r3
                     17: 1:     movl    12(fp),r2
                     18:        jgeq    2f
                     19:        bbc     $0,r3,1f        # seconed operand is negative.
                     20:        clrl    r3              # if first was negative, make result positive.
                     21:        jmp     2f
                     22: 1:     movl    $1,r3           # if first was positive, make result negative.
                     23: 2:     andl2   $EXPMASK,r0     # compute first 'pure'exponent.
                     24:        jeql    retz
                     25:        shrl    $EXPSHIFT,r0,r0
                     26:        subl2   $BIAS,r0        
                     27:        andl2   $EXPMASK,r2     # compute seconed 'pure'exponent.
                     28:        jeql    retz2
                     29:        shrl    $EXPSHIFT,r2,r2
                     30:        subl2   $BIAS,r2
                     31:        subl3   r2,r0,r2        # subtruct the exponents.
                     32:        addl2   $BIAS,r2
                     33:        jleq    underf
                     34:                                # normalization can make the exp. smaller.
                     35:  #
                     36:  #     We have the sign in r3,the exponent in r2,now is the time to
                     37:  #     perform the division...
                     38:  #
                     39:        # fetch dividend. (r0)
                     40:        andl3   $(0!(EXPMASK | SIGNBIT)),4(fp),r0
                     41:        orl2    $(0!CLEARHID),r0
                     42:        clrl    r1
                     43:  
                     44:        # fetch divisor : (r6)
                     45:        andl3   $(0!(EXPMASK | SIGNBIT)),12(fp),r6
                     46:        orl2    $(0!CLEARHID),r6
                     47: 
                     48:        shll    $2,r6,r6        # make the divisor bigger so we will not
                     49:                                # get overflow at the divission.
                     50:        ediv    r6,r0,r0,r7     # quo to r0, rem to r7
                     51:        subl2   $6,r2           # to compensate for: normalization (-24),
                     52:                                # ediv (+32), shifting r6 (-2).
                     53:        
                     54: over:
1.1.1.2 ! root       55:        pushal  20(fp)
1.1       root       56:        callf   $8,Kfnorm       # we can use fnorm because we have data
                     57:                                # at r1 as well.(sfnorm takes care only 
                     58:                                # of r0).
                     59: sign:
                     60: 1:     bbc     $0,r3,done
                     61:        orl2    $SIGNBIT,r0
                     62: done:  ret
                     63: 
                     64: retz:
                     65:        clrl    r0
                     66:        ret
                     67: 
                     68: retz2: bbc     $31,12(fp),z_div
                     69:        clrl    r0
                     70:        ret
                     71: 
                     72: underf:
                     73:        orl2    $HFS_UNDF,*20(fp)       
1.1.1.2 ! root       74:        movl    $0x800000,r0
        !            75:        bbc     $0,r3,1f
        !            76:        orl2    $SIGNBIT,r0
        !            77: 1:     ret
1.1       root       78: z_div:
                     79:        orl2    $HFS_DIVZ,*20(fp)
1.1.1.2 ! root       80:        jmp     retz

unix.superglobalmegacorp.com

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