Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4u/cpu/spitfire_copy.s
          +++ new/usr/src/uts/sun4u/cpu/spitfire_copy.s
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  #include <sys/param.h>
  30   28  #include <sys/errno.h>
  31   29  #include <sys/asm_linkage.h>
  32   30  #include <sys/vtrace.h>
  33   31  #include <sys/machthread.h>
  34   32  #include <sys/clock.h>
  35   33  #include <sys/asi.h>
  36   34  #include <sys/fsr.h>
  37   35  #include <sys/privregs.h>
  38   36  
  39      -#if !defined(lint)
  40   37  #include "assym.h"
  41      -#endif  /* lint */
  42   38  
  43   39  
  44   40  /*
  45   41   * Pseudo-code to aid in understanding the control flow of the
  46   42   * bcopy routine.
  47   43   *
  48   44   * On entry to bcopy:
  49   45   *
  50   46   *      %l6 = curthread->t_lofault;
  51   47   *      used_block_copy = FALSE;                        ! %l6 |= 1
↓ open down ↓ 423 lines elided ↑ open up ↑
 475  471  
 476  472  
 477  473  /*
 478  474   * Copy a block of storage, returning an error code if `from' or
 479  475   * `to' takes a kernel pagefault which cannot be resolved.
 480  476   * Returns errno value on pagefault error, 0 if all ok
 481  477   */
 482  478  
 483  479  
 484  480  
 485      -#if defined(lint)
 486      -
 487      -/* ARGSUSED */
 488      -int
 489      -kcopy(const void *from, void *to, size_t count)
 490      -{ return(0); }
 491      -
 492      -#else   /* lint */
 493      -
 494  481          .seg    ".text"
 495  482          .align  4
 496  483  
 497  484          ENTRY(kcopy)
 498  485  
 499  486          save    %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp
 500  487          set     .copyerr, %l6           ! copyerr is lofault value
 501  488          ldn     [THREAD_REG + T_LOFAULT], %l7   ! save existing handler
 502  489          membar  #Sync                   ! sync error barrier (see copy.s)
 503  490          stn     %l6, [THREAD_REG + T_LOFAULT]   ! set t_lofault
↓ open down ↓ 106 lines elided ↑ open up ↑
 610  597   */
 611  598  fp_panic_msg:
 612  599          .asciz  "Unable to restore fp state after copy operation"
 613  600  
 614  601          .align  4
 615  602  .copyerr2:
 616  603          set     fp_panic_msg, %o0
 617  604          call    panic
 618  605            nop
 619  606          SET_SIZE(kcopy)
 620      -#endif  /* lint */
 621  607  
 622  608  
 623  609  /*
 624  610   * Copy a block of storage - must not overlap (from + len <= to).
 625  611   * Registers: l6 - saved t_lofault
 626  612   *
 627  613   * Copy a page of memory.
 628  614   * Assumes double word alignment and a count >= 256.
 629  615   */
 630      -#if defined(lint)
 631  616  
 632      -/* ARGSUSED */
 633      -void
 634      -bcopy(const void *from, void *to, size_t count)
 635      -{}
 636      -
 637      -#else   /* lint */
 638      -
 639  617          ENTRY(bcopy)
 640  618  
 641  619          save    %sp, -SA(MINFRAME + HWCOPYFRAMESIZE), %sp
 642  620          ldn     [THREAD_REG + T_LOFAULT], %l6   ! save t_lofault
 643  621          tst     %l6
 644  622          !
 645  623          ! We've already captured whether t_lofault was zero on entry.
 646  624          ! We need to mark ourselves as being from bcopy since both
 647  625          ! kcopy and bcopy use the same code path. If BCOPY_FLAG is set
 648  626          ! and the saved lofault was zero, we won't reset lofault on
↓ open down ↓ 1214 lines elided ↑ open up ↑
1863 1841          dec     %i2                     ! dec count
1864 1842  .alignit:
1865 1843          btst    %o0, %i0                ! %o0 is bit mask to check for alignment
1866 1844          bnz,a   1b
1867 1845          ldub    [%i0], %o4              ! read next byte
1868 1846  
1869 1847          retl
1870 1848          andn    %i2, %o0, %i3           ! return size of aligned bytes
1871 1849          SET_SIZE(bcopy)
1872 1850  
1873      -#endif  /* lint */
1874      -
1875 1851  /*
1876 1852   * Block copy with possibly overlapped operands.
1877 1853   */
1878 1854  
1879      -#if defined(lint)
1880      -
1881      -/*ARGSUSED*/
1882      -void
1883      -ovbcopy(const void *from, void *to, size_t count)
1884      -{}
1885      -
1886      -#else   /* lint */
1887      -
1888 1855          ENTRY(ovbcopy)
1889 1856          tst     %o2                     ! check count
1890 1857          bgu,a   %ncc, 1f                ! nothing to do or bad arguments
1891 1858          subcc   %o0, %o1, %o3           ! difference of from and to address
1892 1859  
1893 1860          retl                            ! return
1894 1861          nop
1895 1862  1:
1896 1863          bneg,a  %ncc, 2f
1897 1864          neg     %o3                     ! if < 0, make it positive
↓ open down ↓ 22 lines elided ↑ open up ↑
1920 1887  .ov_bkwd:
1921 1888          deccc   %o2                     ! dec count
1922 1889          ldub    [%o0 + %o2], %o3        ! get byte at end of src
1923 1890          bgu     %ncc, .ov_bkwd          ! loop till done
1924 1891          stb     %o3, [%o1 + %o2]        ! delay slot, store at end of dst
1925 1892  
1926 1893          retl                            ! return
1927 1894          nop
1928 1895          SET_SIZE(ovbcopy)
1929 1896  
1930      -#endif  /* lint */
1931      -
1932 1897  /*
1933 1898   * hwblkpagecopy()
1934 1899   *
1935 1900   * Copies exactly one page.  This routine assumes the caller (ppcopy)
1936 1901   * has already disabled kernel preemption and has checked
1937 1902   * use_hw_bcopy.
1938 1903   */
1939      -#ifdef lint
1940      -/*ARGSUSED*/
1941      -void
1942      -hwblkpagecopy(const void *src, void *dst)
1943      -{ }
1944      -#else /* lint */
1945 1904          ENTRY(hwblkpagecopy)
1946 1905          ! get another window w/space for three aligned blocks of saved fpregs
1947 1906          save    %sp, -SA(MINFRAME + 4*64), %sp
1948 1907  
1949 1908          ! %i0 - source address (arg)
1950 1909          ! %i1 - destination address (arg)
1951 1910          ! %i2 - length of region (not arg)
1952 1911          ! %l0 - saved fprs
1953 1912          ! %l1 - pointer to saved fpregs
1954 1913  
↓ open down ↓ 57 lines elided ↑ open up ↑
2012 1971          add     %l1, 64, %l3
2013 1972          ldda    [%l3]ASI_BLK_P, %d16
2014 1973          add     %l3, 64, %l3
2015 1974          ldda    [%l3]ASI_BLK_P, %d32
2016 1975  
2017 1976  4:      wr      %l0, 0, %fprs           ! restore fprs
2018 1977          membar #Sync
2019 1978          ret
2020 1979          restore %g0, 0, %o0
2021 1980          SET_SIZE(hwblkpagecopy)
2022      -#endif  /* lint */
2023 1981  
2024 1982  
2025 1983  /*
2026 1984   * Transfer data to and from user space -
2027 1985   * Note that these routines can cause faults
2028 1986   * It is assumed that the kernel has nothing at
2029 1987   * less than KERNELBASE in the virtual address space.
2030 1988   *
2031 1989   * Note that copyin(9F) and copyout(9F) are part of the
2032 1990   * DDI/DKI which specifies that they return '-1' on "errors."
↓ open down ↓ 91 lines elided ↑ open up ↑
2124 2082   * to do the work specific to the invidual operation.  The handlers
2125 2083   * for default_copyOP and copyOP_noerr are found at the end of
2126 2084   * default_copyout. The handlers for default_xcopyOP are found at the
2127 2085   * end of xdefault_copyin.
2128 2086   */
2129 2087  
2130 2088  /*
2131 2089   * Copy kernel data to user space (copyout/xcopyout/xcopyout_little).
2132 2090   */
2133 2091  
2134      -#if defined(lint)
2135      -
2136      -/*ARGSUSED*/
2137      -int
2138      -copyout(const void *kaddr, void *uaddr, size_t count)
2139      -{ return (0); }
2140      -
2141      -#else   /* lint */
2142      -
2143 2092  /*
2144 2093   * We save the arguments in the following registers in case of a fault:
2145 2094   *      kaddr - %g2
2146 2095   *      uaddr - %g3
2147 2096   *      count - %g4
2148 2097   */
2149 2098  #define SAVE_SRC        %g2
2150 2099  #define SAVE_DST        %g3
2151 2100  #define SAVE_COUNT      %g4
2152 2101  
↓ open down ↓ 1232 lines elided ↑ open up ↑
3385 3334          brz     %o4, 2f
3386 3335          nop
3387 3336          ldn     [%o4 + CP_COPYOUT], %g2
3388 3337          jmp     %g2
3389 3338          nop
3390 3339  2:
3391 3340          retl
3392 3341          mov     -1, %o0
3393 3342          SET_SIZE(copyout)
3394 3343  
3395      -#endif  /* lint */
3396 3344  
3397      -
3398      -#ifdef  lint
3399      -
3400      -/*ARGSUSED*/
3401      -int
3402      -xcopyout(const void *kaddr, void *uaddr, size_t count)
3403      -{ return (0); }
3404      -
3405      -#else   /* lint */
3406      -
3407 3345          ENTRY(xcopyout)
3408 3346          sethi   %hi(.xcopyout_err), REAL_LOFAULT
3409 3347          b       .do_copyout
3410 3348            or    REAL_LOFAULT, %lo(.xcopyout_err), REAL_LOFAULT
3411 3349  .xcopyout_err:
3412 3350          ldn     [THREAD_REG + T_COPYOPS], %o4
3413 3351          brz     %o4, 2f
3414 3352          nop
3415 3353          ldn     [%o4 + CP_XCOPYOUT], %g2
3416 3354          jmp     %g2
3417 3355          nop
3418 3356  2:
3419 3357          retl
3420 3358          mov     %g1, %o0
3421 3359          SET_SIZE(xcopyout)
3422 3360  
3423      -#endif  /* lint */
3424      -        
3425      -#ifdef  lint
3426      -
3427      -/*ARGSUSED*/
3428      -int
3429      -xcopyout_little(const void *kaddr, void *uaddr, size_t count)
3430      -{ return (0); }
3431      -
3432      -#else   /* lint */
3433      -
3434 3361          ENTRY(xcopyout_little)
3435 3362          sethi   %hi(.little_err), %o4
3436 3363          ldn     [THREAD_REG + T_LOFAULT], %o5
3437 3364          or      %o4, %lo(.little_err), %o4
3438 3365          membar  #Sync                   ! sync error barrier
3439 3366          stn     %o4, [THREAD_REG + T_LOFAULT]
3440 3367  
3441 3368          subcc   %g0, %o2, %o3
3442 3369          add     %o0, %o2, %o0
3443 3370          bz,pn   %ncc, 2f                ! check for zero bytes
↓ open down ↓ 7 lines elided ↑ open up ↑
3451 3378          sub     %o0, 2, %o0             ! get next byte
3452 3379          bcc,a,pt %ncc, 1b
3453 3380            ldub  [%o0+%o3], %o4
3454 3381  
3455 3382  2:      membar  #Sync                   ! sync error barrier
3456 3383          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
3457 3384          retl
3458 3385          mov     %g0, %o0                ! return (0)
3459 3386          SET_SIZE(xcopyout_little)
3460 3387  
3461      -#endif  /* lint */
3462      -
3463 3388  /*
3464 3389   * Copy user data to kernel space (copyin/xcopyin/xcopyin_little)
3465 3390   */
3466 3391  
3467      -#if defined(lint)
3468      -
3469      -/*ARGSUSED*/
3470      -int
3471      -copyin(const void *uaddr, void *kaddr, size_t count)
3472      -{ return (0); }
3473      -
3474      -#else   /* lint */
3475      -
3476 3392          ENTRY(copyin)
3477 3393          sethi   %hi(.copyin_err), REAL_LOFAULT
3478 3394          or      REAL_LOFAULT, %lo(.copyin_err), REAL_LOFAULT
3479 3395  
3480 3396  .do_copyin:
3481 3397          !
3482 3398          ! Check the length and bail if zero.
3483 3399          !
3484 3400          tst     %o2
3485 3401          bnz,pt  %ncc, 1f
↓ open down ↓ 1137 lines elided ↑ open up ↑
4623 4539          brz     %o4, 2f
4624 4540          nop
4625 4541          ldn     [%o4 + CP_COPYIN], %g2
4626 4542          jmp     %g2
4627 4543          nop
4628 4544  2:
4629 4545          retl
4630 4546          mov     -1, %o0
4631 4547          SET_SIZE(copyin)
4632 4548  
4633      -#endif  /* lint */
4634      -
4635      -#ifdef  lint
4636      -
4637      -/*ARGSUSED*/
4638      -int
4639      -xcopyin(const void *uaddr, void *kaddr, size_t count)
4640      -{ return (0); }
4641      -
4642      -#else   /* lint */
4643      -
4644 4549          ENTRY(xcopyin)
4645 4550          sethi   %hi(.xcopyin_err), REAL_LOFAULT
4646 4551          b       .do_copyin
4647 4552            or    REAL_LOFAULT, %lo(.xcopyin_err), REAL_LOFAULT
4648 4553  .xcopyin_err:
4649 4554          ldn     [THREAD_REG + T_COPYOPS], %o4
4650 4555          brz     %o4, 2f
4651 4556          nop
4652 4557          ldn     [%o4 + CP_XCOPYIN], %g2
4653 4558          jmp     %g2
4654 4559          nop
4655 4560  2:
4656 4561          retl
4657 4562          mov     %g1, %o0
4658 4563          SET_SIZE(xcopyin)
4659 4564  
4660      -#endif  /* lint */
4661      -
4662      -#ifdef  lint
4663      -
4664      -/*ARGSUSED*/
4665      -int
4666      -xcopyin_little(const void *uaddr, void *kaddr, size_t count)
4667      -{ return (0); }
4668      -
4669      -#else   /* lint */
4670      -
4671 4565          ENTRY(xcopyin_little)
4672 4566          sethi   %hi(.little_err), %o4
4673 4567          ldn     [THREAD_REG + T_LOFAULT], %o5
4674 4568          or      %o4, %lo(.little_err), %o4
4675 4569          membar  #Sync                           ! sync error barrier
4676 4570          stn     %o4, [THREAD_REG + T_LOFAULT]   
4677 4571  
4678 4572          subcc   %g0, %o2, %o3
4679 4573          add     %o0, %o2, %o0
4680 4574          bz,pn   %ncc, 2f                ! check for zero bytes
↓ open down ↓ 13 lines elided ↑ open up ↑
4694 4588          retl
4695 4589          mov     %g0, %o0                ! return (0)
4696 4590  
4697 4591  .little_err:
4698 4592          membar  #Sync                           ! sync error barrier
4699 4593          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
4700 4594          retl
4701 4595          mov     %g1, %o0
4702 4596          SET_SIZE(xcopyin_little)
4703 4597  
4704      -#endif  /* lint */
4705 4598  
4706      -
4707 4599  /*
4708 4600   * Copy a block of storage - must not overlap (from + len <= to).
4709 4601   * No fault handler installed (to be called under on_fault())
4710 4602   */
4711      -#if defined(lint)
4712 4603  
4713      -/* ARGSUSED */
4714      -void
4715      -copyin_noerr(const void *ufrom, void *kto, size_t count)
4716      -{}
4717      -
4718      -#else   /* lint */
4719      -
4720 4604          ENTRY(copyin_noerr)
4721 4605          sethi   %hi(.copyio_noerr), REAL_LOFAULT
4722 4606          b       .do_copyin
4723 4607            or    REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT
4724 4608  .copyio_noerr:
4725 4609          jmp     SAVED_LOFAULT
4726 4610            nop
4727 4611          SET_SIZE(copyin_noerr)
4728 4612  
4729      -#endif /* lint */
4730      -
4731 4613  /*
4732 4614   * Copy a block of storage - must not overlap (from + len <= to).
4733 4615   * No fault handler installed (to be called under on_fault())
4734 4616   */
4735 4617  
4736      -#if defined(lint)
4737      -
4738      -/* ARGSUSED */
4739      -void
4740      -copyout_noerr(const void *kfrom, void *uto, size_t count)
4741      -{}
4742      -
4743      -#else   /* lint */
4744      -
4745 4618          ENTRY(copyout_noerr)
4746 4619          sethi   %hi(.copyio_noerr), REAL_LOFAULT
4747 4620          b       .do_copyout
4748 4621            or    REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT
4749 4622          SET_SIZE(copyout_noerr)
4750 4623  
4751      -#endif /* lint */
4752      -
4753      -#if defined(lint)
4754      -
4755      -int use_hw_bcopy = 1;
4756      -int use_hw_copyio = 1;
4757      -int use_hw_bzero = 1;
4758      -uint_t hw_copy_limit_1 = 0;
4759      -uint_t hw_copy_limit_2 = 0;
4760      -uint_t hw_copy_limit_4 = 0;
4761      -uint_t hw_copy_limit_8 = 0;
4762      -
4763      -#else /* !lint */
4764      -
4765 4624          .align  4
4766 4625          DGDEF(use_hw_bcopy)
4767 4626          .word   1
4768 4627          DGDEF(use_hw_copyio)
4769 4628          .word   1
4770 4629          DGDEF(use_hw_bzero)
4771 4630          .word   1
4772 4631          DGDEF(hw_copy_limit_1)
4773 4632          .word   0
4774 4633          DGDEF(hw_copy_limit_2)
4775 4634          .word   0
4776 4635          DGDEF(hw_copy_limit_4)
4777 4636          .word   0
4778 4637          DGDEF(hw_copy_limit_8)
4779 4638          .word   0
4780 4639  
4781 4640          .align  64
4782 4641          .section ".text"
4783      -#endif /* !lint */
4784 4642  
4785 4643  
4786 4644  /*
4787 4645   * hwblkclr - clears block-aligned, block-multiple-sized regions that are
4788 4646   * longer than 256 bytes in length using spitfire's block stores.  If
4789 4647   * the criteria for using this routine are not met then it calls bzero
4790 4648   * and returns 1.  Otherwise 0 is returned indicating success.
4791 4649   * Caller is responsible for ensuring use_hw_bzero is true and that
4792 4650   * kpreempt_disable() has been called.
4793 4651   */
4794      -#ifdef lint
4795      -/*ARGSUSED*/
4796      -int
4797      -hwblkclr(void *addr, size_t len)
4798      -{ 
4799      -        return(0);
4800      -}
4801      -#else /* lint */
4802 4652          ! %i0 - start address
4803 4653          ! %i1 - length of region (multiple of 64)
4804 4654          ! %l0 - saved fprs
4805 4655          ! %l1 - pointer to saved %d0 block
4806 4656          ! %l2 - saved curthread->t_lwp
4807 4657  
4808 4658          ENTRY(hwblkclr)
4809 4659          ! get another window w/space for one aligned block of saved fpregs
4810 4660          save    %sp, -SA(MINFRAME + 2*64), %sp
4811 4661  
↓ open down ↓ 79 lines elided ↑ open up ↑
4891 4741  
4892 4742          ! restore fpregs from stack
4893 4743          ldda    [%l1]ASI_BLK_P, %d0
4894 4744          membar  #Sync
4895 4745          wr      %l0, 0, %fprs           ! restore fprs
4896 4746  
4897 4747  .pz_finished:
4898 4748          ret
4899 4749          restore %g0, 0, %o0             ! return (bzero or not)
4900 4750          SET_SIZE(hwblkclr)
4901      -#endif  /* lint */
4902 4751  
4903      -#ifdef  lint
4904      -/* Copy 32 bytes of data from src to dst using physical addresses */
4905      -/*ARGSUSED*/
4906      -void
4907      -hw_pa_bcopy32(uint64_t src, uint64_t dst)
4908      -{}
4909      -#else   /*!lint */
4910      -
4911 4752          /*
4912 4753           * Copy 32 bytes of data from src (%o0) to dst (%o1)
4913 4754           * using physical addresses.
4914 4755           */
4915 4756          ENTRY_NP(hw_pa_bcopy32)
4916 4757          rdpr    %pstate, %g1
4917 4758          andn    %g1, PSTATE_IE, %g2
4918 4759          wrpr    %g0, %g2, %pstate
4919 4760  
4920 4761          ldxa    [%o0]ASI_MEM, %o2
↓ open down ↓ 8 lines elided ↑ open up ↑
4929 4770          stxa    %o3, [%o1]ASI_MEM
4930 4771          add     %o1, 8, %o1
4931 4772          stxa    %o4, [%o1]ASI_MEM
4932 4773          add     %o1, 8, %o1
4933 4774          stxa    %o5, [%o1]ASI_MEM
4934 4775  
4935 4776          membar  #Sync
4936 4777          retl
4937 4778            wrpr    %g0, %g1, %pstate
4938 4779          SET_SIZE(hw_pa_bcopy32)
4939      -#endif /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX