Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sparc/v9/ml/float.s
          +++ new/usr/src/uts/sparc/v9/ml/float.s
↓ open down ↓ 24 lines elided ↑ open up ↑
  25   25  
  26   26  #ident  "%Z%%M% %I%     %E% SMI"
  27   27  
  28   28  #include <sys/asm_linkage.h>
  29   29  #include <sys/trap.h>
  30   30  #include <sys/machpcb.h>
  31   31  #include <sys/machtrap.h>
  32   32  #include <sys/machsig.h>
  33   33  #include <sys/machthread.h>
  34   34  
  35      -#if !defined(lint) && !defined(__lint)
  36   35  #include "assym.h"
  37      -#endif  /* lint */
  38   36  
  39   37  /*
  40   38   * Floating point trap handling.
  41   39   *
  42   40   *      The FPU is always in a V9 current configuration.
  43   41   *
  44   42   *      When a user process is first started via exec,
  45   43   *      floating point operations will be disabled by default.
  46   44   *      Upon execution of the first floating point instruction,
  47   45   *      a fp_disabled trap will be generated; then a word in
↓ open down ↓ 26 lines elided ↑ open up ↑
  74   72   *              the libc bcopy routines. Then reboot the system and you
  75   73   *              should see the bootup message "FPU not in use".
  76   74   *      3. To run kaos, you must comment out the code which sets the
  77   75   *              version number of the fsr to 7, in fldst: stfsr/stxfsr
  78   76   *              (unless you are running against a comparison system that
  79   77   *              has the same fsr version number).
  80   78   *      4. The stqf{a}/ldqf{a} instructions cause kaos errors, for reasons
  81   79   *              that appear to be a kaos bug, so don't use them!
  82   80   */
  83   81  
  84      -#if defined(lint) || defined(__lint)
  85      -
  86      -#ifdef FP_DISABLED
  87      -int fpu_exists = 0;
  88      -#else
  89      -int fpu_exists = 1;
  90      -#endif
  91      -
  92      -#else   /* lint */
  93      -
  94   82          .section ".data"
  95   83          .align  8
  96   84  fsrholder:
  97   85          .word   0                       ! dummy place to write fsr
  98   86          .word   0
  99   87  
 100   88          DGDEF(fpu_exists)               ! always exists for V9
 101   89  #ifdef FP_DISABLED
 102   90          .word   0
 103   91  #else
 104   92          .word   1                       ! sundiag (gack) uses this variable
 105   93  #endif
 106   94  
 107   95          DGDEF(fpu_version)
 108   96          .word   -1
 109   97  
 110      -#endif  /* lint */
 111      -
 112   98  /*
 113   99   * FPU probe - read the %fsr and get fpu_version.
 114  100   * Called from autoconf. If a %fq is created for
 115  101   * future cpu versions, a fq_exists variable
 116  102   * could be created by this function.
 117  103   */
 118  104  
 119      -#if defined(lint) || defined(__lint)
 120      -
 121      -/*ARGSUSED*/
 122      -void
 123      -fpu_probe(void)
 124      -{}
 125      -
 126      -#else   /* lint */
 127      -
 128  105          ENTRY_NP(fpu_probe)
 129  106          wr      %g0, FPRS_FEF, %fprs    ! enable fpu in fprs
 130  107          rdpr    %pstate, %g2            ! read pstate, save value in %g2
 131  108          or      %g2, PSTATE_PEF, %g1    ! new pstate with fpu enabled
 132  109          wrpr    %g1, %g0, %pstate       ! write pstate
 133  110  
 134  111          sethi   %hi(fsrholder), %g2
 135  112          stx     %fsr, [%g2 + %lo(fsrholder)]
 136  113          ldx     [%g2 + %lo(fsrholder)], %g2     ! snarf the FSR
 137  114          set     FSR_VER, %g1
 138  115          and     %g2, %g1, %g2                   ! get version
 139  116          srl     %g2, FSR_VER_SHIFT, %g2         ! and shift it down
 140  117          sethi   %hi(fpu_version), %g3           ! save the FPU version
 141  118          st      %g2, [%g3 + %lo(fpu_version)]
 142  119  
 143  120          ba      fp_kstat_init           ! initialize the fpu_kstat
 144  121          wr      %g0, %g0, %fprs         ! disable fpu and clear fprs
 145  122          SET_SIZE(fpu_probe)
 146  123  
 147      -#endif  /* lint */
 148      -
 149  124  /*
 150  125   * fp_clearregs(fp)
 151  126   *      struct v9_fpu *fp;
 152  127   *
 153  128   * Initialization for the hardware fpu.
 154  129   * Clear the fsr and initialize registers to NaN (-1)
 155  130   * The caller (fp_disabled) is supposed to update the fprs
 156  131   * so when the return to userland is made, the fpu is enabled.
 157  132   */
 158  133  
 159      -#if defined(lint) || defined(__lint)
 160      -
 161      -/*ARGSUSED*/
 162      -void
 163      -fp_clearregs(kfpu_t *fp)
 164      -{}
 165      -
 166      -#else   /* lint */
 167      -
 168  134          ENTRY_NP(fp_clearregs)
 169  135          ldx     [%o0 + FPU_FSR], %fsr           ! load fsr
 170  136  
 171  137          mov     -1, %g2                         ! -1 is NaN
 172  138          stx     %g2, [%o0]                      ! initialize %f0
 173  139          ldd     [%o0], %d0
 174  140          ldd     [%o0], %d2
 175  141          ldd     [%o0], %d4
 176  142          ldd     [%o0], %d6
 177  143          ldd     [%o0], %d8
↓ open down ↓ 20 lines elided ↑ open up ↑
 198  164          ldd     [%o0], %d50
 199  165          ldd     [%o0], %d52
 200  166          ldd     [%o0], %d54
 201  167          ldd     [%o0], %d56
 202  168          ldd     [%o0], %d58
 203  169          ldd     [%o0], %d60
 204  170          retl
 205  171          ldd     [%o0], %d62
 206  172          SET_SIZE(fp_clearregs)
 207  173  
 208      -#endif  /* lint */
 209      -
 210  174  /*
 211  175   * void _fp_read_pfreg(pf, n)
 212  176   *      uint32_t        *pf;    Old freg value.
 213  177   *      unsigned        n;      Want to read register n
 214  178   *
 215  179   * {
 216  180   *      *pf = %f[n];
 217  181   * }
 218  182   *
 219  183   * void
 220  184   * _fp_write_pfreg(pf, n)
 221  185   *      uint32_t        *pf;    New freg value.
 222  186   *      unsigned        n;      Want to write register n.
 223  187   *
 224  188   * {
 225  189   *      %f[n] = *pf;
 226  190   * }
 227  191   */
 228  192  
 229      -#if defined(lint) || defined(__lint)
 230      -
 231      -/*ARGSUSED*/
 232      -void
 233      -_fp_read_pfreg(uint32_t *pf, u_int n)
 234      -{}
 235      -
 236      -/*ARGSUSED*/
 237      -void
 238      -_fp_write_pfreg(uint32_t *pf, u_int n)
 239      -{}
 240      -
 241      -#else   /* lint */
 242      -
 243  193          ENTRY_NP(_fp_read_pfreg)
 244  194          sll     %o1, 3, %o1             ! Table entries are 8 bytes each.
 245  195          set     .stable, %g1            ! g1 gets base of table.
 246  196          jmp     %g1 + %o1               ! Jump into table
 247  197          nop                             ! Can't follow CTI by CTI.
 248  198  
 249  199          ENTRY_NP(_fp_write_pfreg)
 250  200          sll     %o1, 3, %o1             ! Table entries are 8 bytes each.
 251  201          set     .ltable, %g1            ! g1 gets base of table.
 252  202          jmp     %g1 + %o1               ! Jump into table
↓ open down ↓ 66 lines elided ↑ open up ↑
 319  269          LOADFP(25)
 320  270          LOADFP(26)
 321  271          LOADFP(27)
 322  272          LOADFP(28)
 323  273          LOADFP(29)
 324  274          LOADFP(30)
 325  275          LOADFP(31)
 326  276          SET_SIZE(_fp_read_pfreg)
 327  277          SET_SIZE(_fp_write_pfreg)
 328  278  
 329      -#endif  /* lint */
 330      -
 331  279  /*
 332  280   * void _fp_read_pdreg(
 333  281   *      uint64_t        *pd,    Old dreg value.
 334  282   *      u_int   n)              Want to read register n
 335  283   *
 336  284   * {
 337  285   *      *pd = %d[n];
 338  286   * }
 339  287   *
 340  288   * void
 341  289   * _fp_write_pdreg(
 342  290   *      uint64_t        *pd,    New dreg value.
 343  291   *      u_int   n)              Want to write register n.
 344  292   *
 345  293   * {
 346  294   *      %d[n] = *pd;
 347  295   * }
 348  296   */
 349  297  
 350      -#if defined(lint) || defined(__lint)
 351      -
 352      -/*ARGSUSED*/
 353      -void
 354      -_fp_read_pdreg(uint64_t *pd, u_int n)
 355      -{}
 356      -
 357      -/*ARGSUSED*/
 358      -void
 359      -_fp_write_pdreg(uint64_t *pd, u_int n)
 360      -{}
 361      -
 362      -#else   /* lint */
 363      -
 364  298          ENTRY_NP(_fp_read_pdreg)
 365  299          sll     %o1, 3, %o1             ! Table entries are 8 bytes each.
 366  300          set     .dstable, %g1           ! g1 gets base of table.
 367  301          jmp     %g1 + %o1               ! Jump into table
 368  302          nop                             ! Can't follow CTI by CTI.
 369  303  
 370  304          ENTRY_NP(_fp_write_pdreg)
 371  305          sll     %o1, 3, %o1             ! Table entries are 8 bytes each.
 372  306          set     .dltable, %g1           ! g1 gets base of table.
 373  307          jmp     %g1 + %o1               ! Jump into table
↓ open down ↓ 66 lines elided ↑ open up ↑
 440  374          LOADDP(50)
 441  375          LOADDP(52)
 442  376          LOADDP(54)
 443  377          LOADDP(56)
 444  378          LOADDP(58)
 445  379          LOADDP(60)
 446  380          LOADDP(62)
 447  381          SET_SIZE(_fp_read_pdreg)
 448  382          SET_SIZE(_fp_write_pdreg)
 449  383  
 450      -#endif  /* lint */
 451      -
 452      -#if defined(lint) || defined(__lint)
 453      -
 454      -/*ARGSUSED*/
 455      -void
 456      -_fp_write_pfsr(uint64_t *fsr)
 457      -{}
 458      -
 459      -#else   /* lint */
 460      -
 461  384          ENTRY_NP(_fp_write_pfsr)
 462  385          retl
 463  386          ldx     [%o0], %fsr
 464  387          SET_SIZE(_fp_write_pfsr)
 465  388  
 466      -#endif  /* lint */
 467      -
 468      -#if defined(lint) || defined(__lint)
 469      -
 470      -/*ARGSUSED*/
 471      -void
 472      -_fp_read_pfsr(uint64_t *fsr)
 473      -{}
 474      -
 475      -#else   /* lint */
 476      -
 477  389          ENTRY_NP(_fp_read_pfsr)
 478  390          retl
 479  391          stx     %fsr, [%o0]
 480  392          SET_SIZE(_fp_read_pfsr)
 481  393  
 482      -#endif  /* lint */
 483      -
 484      -#if defined(lint) || defined(__lint)
 485      -
 486      -/*ARGSUSED*/
 487      -void
 488      -_fp_write_fprs(u_int fprs_val)
 489      -{}
 490      -
 491      -#else   /* lint */
 492      -
 493  394          ENTRY_NP(_fp_write_fprs)
 494  395          retl
 495  396          wr      %o0, %g0, %fprs                 ! write fprs
 496  397          SET_SIZE(_fp_write_fprs)
 497  398  
 498      -#endif  /* lint */
 499      -
 500      -#if defined(lint) || defined(__lint)
 501      -
 502      -unsigned
 503      -_fp_read_fprs(void)
 504      -{return 0;}
 505      -
 506      -#else   /* lint */
 507      -
 508  399          ENTRY_NP(_fp_read_fprs)
 509  400          retl
 510  401          rd      %fprs, %o0                      ! save fprs
 511  402          SET_SIZE(_fp_read_fprs)
 512  403  
 513      -#endif  /* lint */
 514      -
 515      -#if defined(lint) || defined(__lint)
 516      -
 517      -unsigned
 518      -_fp_subcc_ccr(void)
 519      -{return 0;}
 520      -
 521      -#else   /* lint */
 522      -
 523  404          ENTRY_NP(_fp_subcc_ccr)
 524  405          subcc   %o0, %o1, %g0
 525  406          retl
 526  407          rd      %ccr, %o0                       ! save ccr
 527  408          SET_SIZE(_fp_subcc_ccr)
 528  409  
 529      -#endif  /* lint */
 530      -
 531  410  /*
 532  411   * Floating Point Exceptions handled according to type:
 533  412   *      2) unfinished_fpop
 534  413   *              re-execute the faulty instruction(s) using
 535  414   *              software emulation (must do every instruction in FQ)
 536  415   *      3) unimplemented_fpop
 537  416   *              an unimplemented instruction, if it is legal,
 538  417   *              will cause emulation of the instruction (and all
 539  418   *              other instuctions in the FQ)
 540  419   *      4) sequence_error
 541  420   *              panic, this should not happen, and if it does it
 542  421   *              it is the result of a kernel bug
 543  422   *
 544  423   * This code assumes the trap preamble has set up the window environment
 545  424   * for execution of kernel code.
 546  425   * Note: this code could be changed to be part of the cpu-specific
 547  426   * (ie, Spitfire-specific) module code before final release.
 548  427   */
 549  428  
 550      -#if defined(lint)
 551      -
 552      -/* ARGSUSED */
 553      -void
 554      -_fp_exception(struct regs *rp, uint64_t fsr)
 555      -{}
 556      -
 557      -#else   /* lint */
 558      -
 559  429          ENTRY_NP(_fp_exception)
 560  430          mov     %o7, %l0                ! saved return address
 561  431          mov     %o0, %l1                ! saved *rp
 562  432          set     FSR_FTT, %o4            ! put FSR_FTT in %o4
 563  433          xor     %o4, 0xffffffffffffffff, %o3 ! xor FSR_FTT to get
 564  434          and     %o1, %o3, %o2           ! an fsr with a zero'd ftt
 565  435          ldn     [THREAD_REG + T_LWP], %o3 ! get lwp
 566  436          ldn     [%o3 + LWP_FPU], %l3    ! get lwp_fpu
 567  437          stx     %o2, [%l3 + FPU_FSR]    ! save floating point status
 568  438          and     %o1, %o4, %g2           ! get the ftt trap type
↓ open down ↓ 39 lines elided ↑ open up ↑
 608  478          SET_SIZE(_fp_exception)
 609  479  
 610  480  .badfpexcpmsg:
 611  481          .asciz  "unexpected floating point exception %x"
 612  482  
 613  483  #ifdef  DEBUG
 614  484  .badfpfttmsg:
 615  485          .asciz  "No floating point ftt, fsr %llx"
 616  486  #endif  /* DEBUG */
 617  487  
 618      -#endif  /* lint */
 619      -
 620  488  /*
 621  489   * Floating Point Exceptions.
 622  490   * handled according to type:
 623  491   *      1) IEEE_exception
 624  492   *              re-execute the faulty instruction(s) using
 625  493   *              software emulation (must do every instruction in FQ)
 626  494   *
 627  495   * This code assumes the trap preamble has set up the window environment
 628  496   * for execution of kernel code.
 629  497   */
 630  498  
 631      -#if defined(lint)
 632      -
 633      -/* ARGSUSED */
 634      -void
 635      -_fp_ieee_exception(struct regs *rp, uint64_t fsr)
 636      -{}
 637      -
 638      -#else   /* lint */
 639      -
 640  499          ENTRY_NP(_fp_ieee_exception)
 641  500          mov     %o7, %l0                ! saved return address
 642  501          mov     %o0, %l1                ! saved *rp
 643  502          mov     %o1, %l2                ! saved fsr
 644  503          set     FSR_FTT, %o4            ! put FSR_FTT in %o4
 645  504          xor     %o4, 0xffffffffffffffff, %o3 ! ! xor FSR_FTT to get
 646  505          and     %o1, %o3, %o2           ! an fsr with a zero'd ftt
 647  506          ldn     [THREAD_REG + T_LWP], %o3 ! get lwp
 648  507          ldn     [%o3 + LWP_FPU], %l3    ! get lwp_fpu
 649  508          stx     %o2, [%l3 + FPU_FSR]    ! save floating point status
↓ open down ↓ 66 lines elided ↑ open up ↑
 716  575  
 717  576          rd      %fprs, %g1              ! read fprs, save value in %g1
 718  577          st      %g1, [%l3 + FPU_FPRS]   ! save fprs
 719  578          jmp     %l0 + 8                 ! jump to saved return address
 720  579          stx     %fsr, [%l3 + FPU_FSR]   ! save fsr
 721  580          SET_SIZE(_fp_ieee_exception)
 722  581  
 723  582  .badfpcexcmsg:
 724  583          .asciz  "No floating point exception, fsr %llx"
 725  584  
 726      -#endif  /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX