Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4/ml/copy.s
          +++ new/usr/src/uts/sun4/ml/copy.s
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  27      -
  28   26  #include <sys/param.h>
  29   27  #include <sys/errno.h>
  30   28  #include <sys/asm_linkage.h>
  31   29  #include <sys/vtrace.h>
  32   30  #include <sys/machthread.h>
  33   31  #include <sys/clock.h>
  34   32  #include <sys/asi.h>
  35   33  #include <sys/fsr.h>
  36   34  #include <sys/privregs.h>
  37   35  
  38      -#if !defined(lint)
  39   36  #include "assym.h"
  40      -#endif  /* lint */
  41   37  
  42   38  /*
  43   39   * Error barrier:
  44   40   * We use membar sync to establish an error barrier for
  45   41   * deferred errors. Membar syncs are added before any update
  46   42   * to t_lofault to ensure that deferred errors from earlier
  47   43   * accesses will not be reported after the membar. This error
  48   44   * isolation is important when we try to recover from async
  49   45   * errors which tries to distinguish kernel accesses to user
  50   46   * data.
↓ open down ↓ 2 lines elided ↑ open up ↑
  53   49  /*
  54   50   * Copy a null terminated string from one point to another in
  55   51   * the kernel address space.
  56   52   * NOTE - don't use %o5 in this routine as copy{in,out}str uses it.
  57   53   *
  58   54   * copystr(from, to, maxlength, lencopied)
  59   55   *      caddr_t from, to;
  60   56   *      u_int maxlength, *lencopied;
  61   57   */
  62   58  
  63      -#if defined(lint)
  64      -
  65      -/* ARGSUSED */
  66      -int
  67      -copystr(const char *from, char *to, size_t maxlength, size_t *lencopied)
  68      -{ return(0); }
  69      -
  70      -#else   /* lint */
  71      -
  72   59          ENTRY(copystr)
  73   60          orcc    %o2, %g0, %o4           ! save original count
  74   61          bg,a    %ncc, 1f
  75   62            sub   %o0, %o1, %o0           ! o0 gets the difference of src and dst
  76   63  
  77   64          !
  78   65          ! maxlength <= 0
  79   66          !
  80   67          bz      %ncc, .cs_out           ! maxlength = 0
  81   68          mov     ENAMETOOLONG, %o0
↓ open down ↓ 24 lines elided ↑ open up ↑
 106   93  .cs_out:
 107   94          tst     %o3
 108   95          bz      %ncc, 2f
 109   96          sub     %o4, %o2, %o4           ! compute length and store it
 110   97          stn     %o4, [%o3]
 111   98  2:
 112   99          retl
 113  100          nop
 114  101          SET_SIZE(copystr)
 115  102  
 116      -#endif  /* lint */
 117  103  
 118      -
 119  104  /*
 120  105   * Copy a null terminated string from the user address space into
 121  106   * the kernel address space.
 122  107   */
 123      -#if defined(lint)
 124  108  
 125      -/* ARGSUSED */
 126      -int
 127      -copyinstr(const char *uaddr, char *kaddr, size_t maxlength,
 128      -    size_t *lencopied)
 129      -{ return (0); }
 130      -
 131      -#else   /* lint */
 132      -
 133  109          ENTRY(copyinstr)
 134  110          sethi   %hi(.copyinstr_err), %o4
 135  111          ldn     [THREAD_REG + T_LOFAULT], %o5   ! catch faults
 136  112          or      %o4, %lo(.copyinstr_err), %o4
 137  113          membar  #Sync                           ! sync error barrier
 138  114          stn     %o4, [THREAD_REG + T_LOFAULT]
 139  115  
 140  116          brz,a,pn %o2, .copyinstr_out
 141  117          mov     ENAMETOOLONG, %o0
 142  118  
↓ open down ↓ 44 lines elided ↑ open up ↑
 187  163  .copyinstr_out:
 188  164          tst     %o3                     ! want length?
 189  165          bz      %ncc, 2f
 190  166          sub     %o2, %g3, %o2           ! compute length and store it
 191  167          stn     %o2, [%o3]
 192  168  2:
 193  169          membar  #Sync                   ! sync error barrier
 194  170          retl
 195  171          stn     %o5, [THREAD_REG + T_LOFAULT]   ! stop catching faults
 196  172          SET_SIZE(copyinstr)
 197      -#endif
 198  173  
 199      -#if defined(lint)
 200      -
 201      -/* ARGSUSED */
 202      -int
 203      -copyinstr_noerr(const char *uaddr, char *kaddr, size_t maxlength,
 204      -    size_t *lencopied)
 205      -{ return (0); }
 206      -
 207      -#else   /* lint */
 208      -
 209  174          ENTRY(copyinstr_noerr)
 210  175          mov     %o2, %o4                ! save original count
 211  176  
 212  177          ! maxlength is unsigned so the only error is if it's 0
 213  178          brz,a,pn %o2, .copyinstr_noerr_out
 214  179          mov     ENAMETOOLONG, %o0
 215  180  
 216  181          b       1f
 217  182          sub     %o0, %o1, %o0           ! o0 gets the difference of src and dst
 218  183  
↓ open down ↓ 21 lines elided ↑ open up ↑
 240  205  .copyinstr_noerr_out:
 241  206          tst     %o3                     ! want length?
 242  207          bz      %ncc, 2f
 243  208          sub     %o4, %o2, %o4
 244  209          stn     %o4, [%o3]
 245  210  2:
 246  211          retl
 247  212          nop
 248  213          SET_SIZE(copyinstr_noerr)
 249  214  
 250      -#endif  /* lint */
 251      -
 252  215  /*
 253  216   * Copy a null terminated string from the kernel
 254  217   * address space to the user address space.
 255  218   */
 256  219  
 257      -#if defined(lint)
 258      -
 259      -/* ARGSUSED */
 260      -int
 261      -copyoutstr(const char *kaddr, char *uaddr, size_t maxlength,
 262      -    size_t *lencopied)
 263      -{ return (0); }
 264      -
 265      -#else   /* lint */
 266      -
 267  220          ENTRY(copyoutstr)
 268  221          sethi   %hi(.copyoutstr_err), %o5
 269  222          ldn     [THREAD_REG + T_LOFAULT], %o4   ! catch faults
 270  223          or      %o5, %lo(.copyoutstr_err), %o5
 271  224          membar  #Sync                           ! sync error barrier
 272  225          stn     %o5, [THREAD_REG + T_LOFAULT]
 273  226          mov     %o4, %o5
 274  227  
 275  228          brz,a,pn %o2, .copyoutstr_out
 276  229          mov     ENAMETOOLONG, %o0
↓ open down ↓ 46 lines elided ↑ open up ↑
 323  276          tst     %o3                     ! want length?
 324  277          bz      %ncc, 2f
 325  278          sub     %o2, %g3, %o2           ! compute length and store it
 326  279          stn     %o2, [%o3]
 327  280  2:
 328  281          membar  #Sync                   ! sync error barrier
 329  282          retl
 330  283          stn     %o5, [THREAD_REG + T_LOFAULT]   ! stop catching faults
 331  284          SET_SIZE(copyoutstr)
 332  285  
 333      -#endif  /* lint */
 334      -
 335      -#if defined(lint)
 336      -
 337      -/* ARGSUSED */
 338      -int
 339      -copyoutstr_noerr(const char *kaddr, char *uaddr, size_t maxlength,
 340      -    size_t *lencopied)
 341      -{ return (0); }
 342      -
 343      -#else   /* lint */
 344      -
 345  286          ENTRY(copyoutstr_noerr)
 346  287          mov     %o2, %o4                ! save original count
 347  288  
 348  289          brz,a,pn %o2, .copyoutstr_noerr_out
 349  290          mov     ENAMETOOLONG, %o0
 350  291  
 351  292          b       1f
 352  293          sub     %o0, %o1, %o0           ! o0 gets the difference of src and dst
 353  294  
 354  295          !
↓ open down ↓ 20 lines elided ↑ open up ↑
 375  316  .copyoutstr_noerr_out:
 376  317          tst     %o3                     ! want length?
 377  318          bz      %ncc, 2f
 378  319          sub     %o4, %o2, %o4
 379  320          stn     %o4, [%o3]
 380  321  2:
 381  322          retl
 382  323          nop
 383  324          SET_SIZE(copyoutstr_noerr)
 384  325  
 385      -#endif  /* lint */
 386  326  
 387      -
 388  327  /*
 389  328   * Copy a block of storage.  If the source and target regions overlap,
 390  329   * one or both of the regions will be silently corrupted.
 391  330   * No fault handler installed (to be called under on_fault())
 392  331   */
 393  332  
 394      -#if defined(lint)
 395      - 
 396      -/* ARGSUSED */
 397      -void
 398      -ucopy(const void *ufrom, void *uto, size_t ulength)
 399      -{}
 400      - 
 401      -#else /* lint */
 402      - 
 403  333          ENTRY(ucopy)
 404  334          save    %sp, -SA(MINFRAME), %sp ! get another window
 405  335  
 406  336          subcc   %g0, %i2, %i3
 407  337          add     %i0, %i2, %i0
 408  338          bz,pn   %ncc, 5f
 409  339          add     %i1, %i2, %i1
 410  340          lduba   [%i0 + %i3]ASI_USER, %i4
 411  341  4:      stba    %i4, [%i1 + %i3]ASI_USER
 412  342          inccc   %i3
 413  343          bcc,a,pt %ncc, 4b
 414  344          lduba  [%i0 + %i3]ASI_USER, %i4
 415  345  5:
 416  346          ret
 417  347          restore %g0, 0, %o0             ! return (0)
 418  348  
 419  349          SET_SIZE(ucopy)
 420      -#endif /* lint */
 421  350  
 422  351  /*
 423  352   * Copy a user-land string.  If the source and target regions overlap,
 424  353   * one or both of the regions will be silently corrupted.
 425  354   * No fault handler installed (to be called under on_fault())
 426  355   */
 427  356  
 428      -#if defined(lint)
 429      - 
 430      -/* ARGSUSED */
 431      -void
 432      -ucopystr(const char *ufrom, char *uto, size_t umaxlength, size_t *ulencopied)
 433      -{}
 434      - 
 435      -#else /* lint */
 436      - 
 437  357          ENTRY(ucopystr)
 438  358          save    %sp, -SA(MINFRAME), %sp ! get another window
 439  359  
 440  360          brz     %i2, 5f
 441  361          clr     %i5
 442  362  
 443  363          lduba   [%i0 + %i5]ASI_USER, %i4
 444  364  4:      stba    %i4, [%i1 + %i5]ASI_USER
 445  365          brz,pn  %i4, 5f
 446  366          inc     %i5
↓ open down ↓ 1 lines elided ↑ open up ↑
 448  368          bnz,a,pt %ncc, 4b
 449  369          lduba   [%i0 + %i5]ASI_USER, %i4
 450  370  5:
 451  371          brnz,a,pt %i3, 6f
 452  372          stn     %i5, [%i3]
 453  373  6:
 454  374          ret
 455  375          restore %g0, 0, %o0             ! return (0)
 456  376  
 457  377          SET_SIZE(ucopystr)
 458      -#endif /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX