Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4v/cpu/generic_copy.s
          +++ new/usr/src/uts/sun4v/cpu/generic_copy.s
↓ open down ↓ 27 lines elided ↑ open up ↑
  28   28  #include <sys/param.h>
  29   29  #include <sys/errno.h>
  30   30  #include <sys/asm_linkage.h>
  31   31  #include <sys/vtrace.h>
  32   32  #include <sys/machthread.h>
  33   33  #include <sys/clock.h>
  34   34  #include <sys/asi.h>
  35   35  #include <sys/fsr.h>
  36   36  #include <sys/privregs.h>
  37   37  
  38      -#if !defined(lint)
  39   38  #include "assym.h"
  40      -#endif  /* lint */
  41   39  
  42   40  
  43   41  /*
  44   42   * Less then or equal this number of bytes we will always copy byte-for-byte
  45   43   */
  46   44  #define SMALL_LIMIT     7
  47   45  
  48   46  /*
  49   47   * LOFAULT_SET : Flag set by kzero and kcopy to indicate that t_lofault
  50   48   * handler was set
↓ open down ↓ 2 lines elided ↑ open up ↑
  53   51  
  54   52  
  55   53  /*
  56   54   * Copy a block of storage, returning an error code if `from' or
  57   55   * `to' takes a kernel pagefault which cannot be resolved.
  58   56   * Returns errno value on pagefault error, 0 if all ok
  59   57   */
  60   58  
  61   59  
  62   60  
  63      -#if defined(lint)
  64      -
  65      -/* ARGSUSED */
  66      -int
  67      -kcopy(const void *from, void *to, size_t count)
  68      -{ return(0); }
  69      -
  70      -#else   /* lint */
  71      -
  72   61          .seg    ".text"
  73   62          .align  4
  74   63  
  75   64          ENTRY(kcopy)
  76   65  
  77   66          save    %sp, -SA(MINFRAME), %sp
  78   67          set     .copyerr, %l7                   ! copyerr is lofault value
  79   68          ldn     [THREAD_REG + T_LOFAULT], %o5   ! save existing handler
  80   69          or      %o5, LOFAULT_SET, %o5
  81   70          membar  #Sync                           ! sync error barrier
↓ open down ↓ 8 lines elided ↑ open up ↑
  90   79          ! The kcopy() *always* sets a t_lofault handler and it ORs LOFAULT_SET
  91   80          ! into %o5 to indicate it has set t_lofault handler. Need to clear
  92   81          ! LOFAULT_SET flag before restoring the error handler.
  93   82          andn    %o5, LOFAULT_SET, %o5
  94   83          membar  #Sync                   ! sync error barrier
  95   84          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
  96   85          ret
  97   86          restore %g1, 0, %o0
  98   87  
  99   88          SET_SIZE(kcopy)
 100      -#endif  /* lint */
 101   89  
 102   90  
 103   91  /*
 104   92   * Copy a block of storage - must not overlap (from + len <= to).
 105   93   */
 106      -#if defined(lint)
 107   94  
 108      -/* ARGSUSED */
 109      -void
 110      -bcopy(const void *from, void *to, size_t count)
 111      -{}
 112      -
 113      -#else   /* lint */
 114      -
 115   95          ENTRY(bcopy)
 116   96  
 117   97          save    %sp, -SA(MINFRAME), %sp
 118   98          clr     %o5                     ! flag LOFAULT_SET is not set for bcopy
 119   99  
 120  100  .do_copy:
 121  101          mov     %i1, %g5                ! save dest addr start
 122  102  
 123  103          mov     %i2, %l6                ! save size
 124  104  
↓ open down ↓ 243 lines elided ↑ open up ↑
 368  348          dec     %i2                     ! dec count
 369  349  .alignit:
 370  350          btst    %o0, %i0                ! %o0 is bit mask to check for alignment
 371  351          bnz,a   1b
 372  352          ldub    [%i0], %o4              ! read next byte
 373  353  
 374  354          retl
 375  355          andn    %i2, %o0, %i3           ! return size of aligned bytes
 376  356          SET_SIZE(bcopy)
 377  357  
 378      -#endif  /* lint */
 379      -
 380  358  /*
 381  359   * Block copy with possibly overlapped operands.
 382  360   */
 383  361  
 384      -#if defined(lint)
 385      -
 386      -/*ARGSUSED*/
 387      -void
 388      -ovbcopy(const void *from, void *to, size_t count)
 389      -{}
 390      -
 391      -#else   /* lint */
 392      -
 393  362          ENTRY(ovbcopy)
 394  363          tst     %o2                     ! check count
 395  364          bgu,a   %ncc, 1f                ! nothing to do or bad arguments
 396  365          subcc   %o0, %o1, %o3           ! difference of from and to address
 397  366  
 398  367          retl                            ! return
 399  368          nop
 400  369  1:
 401  370          bneg,a  %ncc, 2f
 402  371          neg     %o3                     ! if < 0, make it positive
↓ open down ↓ 22 lines elided ↑ open up ↑
 425  394  .ov_bkwd:
 426  395          deccc   %o2                     ! dec count
 427  396          ldub    [%o0 + %o2], %o3        ! get byte at end of src
 428  397          bgu     %ncc, .ov_bkwd          ! loop till done
 429  398          stb     %o3, [%o1 + %o2]        ! delay slot, store at end of dst
 430  399  
 431  400          retl                            ! return
 432  401          nop
 433  402          SET_SIZE(ovbcopy)
 434  403  
 435      -#endif  /* lint */
 436      -
 437  404  /*
 438  405   * hwblkpagecopy()
 439  406   *
 440  407   * Copies exactly one page.  This routine assumes the caller (ppcopy)
 441  408   * has already disabled kernel preemption and has checked
 442  409   * use_hw_bcopy.
 443  410   */
 444      -#ifdef lint
 445      -/*ARGSUSED*/
 446      -void
 447      -hwblkpagecopy(const void *src, void *dst)
 448      -{ }
 449      -#else /* lint */
 450  411          ENTRY(hwblkpagecopy)
 451  412          save    %sp, -SA(MINFRAME), %sp
 452  413  
 453  414          ! %i0 - source address (arg)
 454  415          ! %i1 - destination address (arg)
 455  416          ! %i2 - length of region (not arg)
 456  417  
 457  418          set     PAGESIZE, %i2
 458  419          mov     %i1,    %o0     ! store destination address for flushing
 459  420  
↓ open down ↓ 42 lines elided ↑ open up ↑
 502  463  
 503  464          ! %o0 contains the dest. address
 504  465          set     PAGESIZE, %o1
 505  466          call    sync_icache
 506  467          nop
 507  468  
 508  469          membar #Sync
 509  470          ret
 510  471          restore %g0, 0, %o0
 511  472          SET_SIZE(hwblkpagecopy)
 512      -#endif  /* lint */
 513  473  
 514  474  
 515  475  /*
 516  476   * Transfer data to and from user space -
 517  477   * Note that these routines can cause faults
 518  478   * It is assumed that the kernel has nothing at
 519  479   * less than KERNELBASE in the virtual address space.
 520  480   *
 521  481   * Note that copyin(9F) and copyout(9F) are part of the
 522  482   * DDI/DKI which specifies that they return '-1' on "errors."
↓ open down ↓ 49 lines elided ↑ open up ↑
 572  532   * to do the work specific to the invidual operation.  The handler
 573  533   * for copyOP and xcopyOP are found at the end of individual function.
 574  534   * The handlers for xcopyOP_little are found at the end of xcopyin_little.
 575  535   * The handlers for copyOP_noerr are found at the end of copyin_noerr.
 576  536   */
 577  537  
 578  538  /*
 579  539   * Copy kernel data to user space (copyout/xcopyout/xcopyout_little).
 580  540   */
 581  541  
 582      -#if defined(lint)
 583      -
 584      -/*ARGSUSED*/
 585      -int
 586      -copyout(const void *kaddr, void *uaddr, size_t count)
 587      -{ return (0); }
 588      -
 589      -#else   /* lint */
 590      -
 591  542  /*
 592  543   * We save the arguments in the following registers in case of a fault:
 593  544   *      kaddr - %g2
 594  545   *      uaddr - %g3
 595  546   *      count - %g4
 596  547   */
 597  548  #define SAVE_SRC        %g2
 598  549  #define SAVE_DST        %g3
 599  550  #define SAVE_COUNT      %g4
 600  551  
↓ open down ↓ 213 lines elided ↑ open up ↑
 814  765          brz     %o4, 2f
 815  766          nop
 816  767          ldn     [%o4 + CP_COPYOUT], %g2
 817  768          jmp     %g2
 818  769          nop
 819  770  2:
 820  771          retl
 821  772          mov     -1, %o0
 822  773          SET_SIZE(copyout)
 823  774  
 824      -#endif  /* lint */
 825  775  
 826      -
 827      -#ifdef  lint
 828      -
 829      -/*ARGSUSED*/
 830      -int
 831      -xcopyout(const void *kaddr, void *uaddr, size_t count)
 832      -{ return (0); }
 833      -
 834      -#else   /* lint */
 835      -
 836  776          ENTRY(xcopyout)
 837  777          sethi   %hi(.xcopyout_err), REAL_LOFAULT
 838  778          b       .do_copyout
 839  779            or    REAL_LOFAULT, %lo(.xcopyout_err), REAL_LOFAULT
 840  780  .xcopyout_err:
 841  781          ldn     [THREAD_REG + T_COPYOPS], %o4
 842  782          brz     %o4, 2f
 843  783          nop
 844  784          ldn     [%o4 + CP_XCOPYOUT], %g2
 845  785          jmp     %g2
 846  786          nop
 847  787  2:
 848  788          retl
 849  789          mov     %g1, %o0
 850  790          SET_SIZE(xcopyout)
 851  791  
 852      -#endif  /* lint */
 853      -        
 854      -#ifdef  lint
 855      -
 856      -/*ARGSUSED*/
 857      -int
 858      -xcopyout_little(const void *kaddr, void *uaddr, size_t count)
 859      -{ return (0); }
 860      -
 861      -#else   /* lint */
 862      -
 863  792          ENTRY(xcopyout_little)
 864  793          sethi   %hi(.little_err), %o4
 865  794          ldn     [THREAD_REG + T_LOFAULT], %o5
 866  795          or      %o4, %lo(.little_err), %o4
 867  796          membar  #Sync                   ! sync error barrier
 868  797          stn     %o4, [THREAD_REG + T_LOFAULT]
 869  798  
 870  799          subcc   %g0, %o2, %o3
 871  800          add     %o0, %o2, %o0
 872  801          bz,pn   %ncc, 2f                ! check for zero bytes
↓ open down ↓ 7 lines elided ↑ open up ↑
 880  809          sub     %o0, 2, %o0             ! get next byte
 881  810          bcc,a,pt %ncc, 1b
 882  811            ldub  [%o0+%o3], %o4
 883  812  
 884  813  2:      membar  #Sync                   ! sync error barrier
 885  814          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
 886  815          retl
 887  816          mov     %g0, %o0                ! return (0)
 888  817          SET_SIZE(xcopyout_little)
 889  818  
 890      -#endif  /* lint */
 891      -
 892  819  /*
 893  820   * Copy user data to kernel space (copyin/xcopyin/xcopyin_little)
 894  821   */
 895  822  
 896      -#if defined(lint)
 897      -
 898      -/*ARGSUSED*/
 899      -int
 900      -copyin(const void *uaddr, void *kaddr, size_t count)
 901      -{ return (0); }
 902      -
 903      -#else   /* lint */
 904      -
 905  823          ENTRY(copyin)
 906  824          sethi   %hi(.copyin_err), REAL_LOFAULT
 907  825          or      REAL_LOFAULT, %lo(.copyin_err), REAL_LOFAULT
 908  826  
 909  827  .do_copyin:
 910  828          !
 911  829          ! Check the length and bail if zero.
 912  830          !
 913  831          tst     %o2
 914  832          bnz,pt  %ncc, 1f
↓ open down ↓ 169 lines elided ↑ open up ↑
1084 1002          brz     %o4, 2f
1085 1003          nop
1086 1004          ldn     [%o4 + CP_COPYIN], %g2
1087 1005          jmp     %g2
1088 1006          nop
1089 1007  2:
1090 1008          retl
1091 1009          mov     -1, %o0
1092 1010          SET_SIZE(copyin)
1093 1011  
1094      -#endif  /* lint */
1095      -
1096      -#ifdef  lint
1097      -
1098      -/*ARGSUSED*/
1099      -int
1100      -xcopyin(const void *uaddr, void *kaddr, size_t count)
1101      -{ return (0); }
1102      -
1103      -#else   /* lint */
1104      -
1105 1012          ENTRY(xcopyin)
1106 1013          sethi   %hi(.xcopyin_err), REAL_LOFAULT
1107 1014          b       .do_copyin
1108 1015            or    REAL_LOFAULT, %lo(.xcopyin_err), REAL_LOFAULT
1109 1016  .xcopyin_err:
1110 1017          ldn     [THREAD_REG + T_COPYOPS], %o4
1111 1018          brz     %o4, 2f
1112 1019          nop
1113 1020          ldn     [%o4 + CP_XCOPYIN], %g2
1114 1021          jmp     %g2
1115 1022          nop
1116 1023  2:
1117 1024          retl
1118 1025          mov     %g1, %o0
1119 1026          SET_SIZE(xcopyin)
1120 1027  
1121      -#endif  /* lint */
1122      -
1123      -#ifdef  lint
1124      -
1125      -/*ARGSUSED*/
1126      -int
1127      -xcopyin_little(const void *uaddr, void *kaddr, size_t count)
1128      -{ return (0); }
1129      -
1130      -#else   /* lint */
1131      -
1132 1028          ENTRY(xcopyin_little)
1133 1029          sethi   %hi(.little_err), %o4
1134 1030          ldn     [THREAD_REG + T_LOFAULT], %o5
1135 1031          or      %o4, %lo(.little_err), %o4
1136 1032          membar  #Sync                           ! sync error barrier
1137 1033          stn     %o4, [THREAD_REG + T_LOFAULT]   
1138 1034  
1139 1035          subcc   %g0, %o2, %o3
1140 1036          add     %o0, %o2, %o0
1141 1037          bz,pn   %ncc, 2f                ! check for zero bytes
↓ open down ↓ 13 lines elided ↑ open up ↑
1155 1051          retl
1156 1052          mov     %g0, %o0                ! return (0)
1157 1053  
1158 1054  .little_err:
1159 1055          membar  #Sync                           ! sync error barrier
1160 1056          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
1161 1057          retl
1162 1058          mov     %g1, %o0
1163 1059          SET_SIZE(xcopyin_little)
1164 1060  
1165      -#endif  /* lint */
1166 1061  
1167      -
1168 1062  /*
1169 1063   * Copy a block of storage - must not overlap (from + len <= to).
1170 1064   * No fault handler installed (to be called under on_fault())
1171 1065   */
1172      -#if defined(lint)
1173 1066  
1174      -/* ARGSUSED */
1175      -void
1176      -copyin_noerr(const void *ufrom, void *kto, size_t count)
1177      -{}
1178      -
1179      -#else   /* lint */
1180      -
1181 1067          ENTRY(copyin_noerr)
1182 1068          sethi   %hi(.copyio_noerr), REAL_LOFAULT
1183 1069          b       .do_copyin
1184 1070            or    REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT
1185 1071  .copyio_noerr:
1186 1072          jmp     SAVED_LOFAULT
1187 1073            nop
1188 1074          SET_SIZE(copyin_noerr)
1189 1075  
1190      -#endif /* lint */
1191      -
1192 1076  /*
1193 1077   * Copy a block of storage - must not overlap (from + len <= to).
1194 1078   * No fault handler installed (to be called under on_fault())
1195 1079   */
1196 1080  
1197      -#if defined(lint)
1198      -
1199      -/* ARGSUSED */
1200      -void
1201      -copyout_noerr(const void *kfrom, void *uto, size_t count)
1202      -{}
1203      -
1204      -#else   /* lint */
1205      -
1206 1081          ENTRY(copyout_noerr)
1207 1082          sethi   %hi(.copyio_noerr), REAL_LOFAULT
1208 1083          b       .do_copyout
1209 1084            or    REAL_LOFAULT, %lo(.copyio_noerr), REAL_LOFAULT
1210 1085          SET_SIZE(copyout_noerr)
1211 1086  
1212      -#endif /* lint */
1213      -
1214      -#if defined(lint)
1215      -
1216      -int use_hw_bcopy = 1;
1217      -int use_hw_bzero = 1;
1218      -
1219      -#else /* !lint */
1220      -
1221 1087          .align  4
1222 1088          DGDEF(use_hw_bcopy)
1223 1089          .word   1
1224 1090          DGDEF(use_hw_bzero)
1225 1091          .word   1
1226 1092  
1227 1093          .align  64
1228 1094          .section ".text"
1229      -#endif /* !lint */
1230 1095  
1231 1096  
1232 1097  /*
1233 1098   * hwblkclr - clears block-aligned, block-multiple-sized regions that are
1234 1099   * longer than 256 bytes in length. For the generic module we will simply
1235 1100   * call bzero and return 1 to ensure that the pages in cache should be
1236 1101   * flushed to ensure integrity.
1237 1102   * Caller is responsible for ensuring use_hw_bzero is true and that
1238 1103   * kpreempt_disable() has been called.
1239 1104   */
1240      -#ifdef lint
1241      -/*ARGSUSED*/
1242      -int
1243      -hwblkclr(void *addr, size_t len)
1244      -{ 
1245      -        return(0);
1246      -}
1247      -#else /* lint */
1248 1105          ! %i0 - start address
1249 1106          ! %i1 - length of region (multiple of 64)
1250 1107  
1251 1108          ENTRY(hwblkclr)
1252 1109          save    %sp, -SA(MINFRAME), %sp
1253 1110  
1254 1111          ! Simply call bzero and notify the caller that bzero was used
1255 1112          mov     %i0, %o0
1256 1113          call    bzero
1257 1114            mov   %i1, %o1
1258 1115          ret
1259 1116          restore %g0, 1, %o0     ! return (1) - did not use block operations
1260 1117  
1261 1118          SET_SIZE(hwblkclr)
1262      -#endif  /* lint */
1263 1119  
1264      -#ifdef  lint
1265      -/* Copy 32 bytes of data from src to dst using physical addresses */
1266      -/*ARGSUSED*/
1267      -void
1268      -hw_pa_bcopy32(uint64_t src, uint64_t dst)
1269      -{}
1270      -#else   /*!lint */
1271      -
1272 1120          /*
1273 1121           * Copy 32 bytes of data from src (%o0) to dst (%o1)
1274 1122           * using physical addresses.
1275 1123           */
1276 1124          ENTRY_NP(hw_pa_bcopy32)
1277 1125          rdpr    %pstate, %g1
1278 1126          andn    %g1, PSTATE_IE, %g2
1279 1127          wrpr    %g0, %g2, %pstate
1280 1128  
1281 1129          ldxa    [%o0]ASI_MEM, %o2
↓ open down ↓ 8 lines elided ↑ open up ↑
1290 1138          stxa    %o3, [%o1]ASI_MEM
1291 1139          add     %o1, 8, %o1
1292 1140          stxa    %o4, [%o1]ASI_MEM
1293 1141          add     %o1, 8, %o1
1294 1142          stxa    %o5, [%o1]ASI_MEM
1295 1143  
1296 1144          membar  #Sync
1297 1145          retl
1298 1146            wrpr    %g0, %g1, %pstate
1299 1147          SET_SIZE(hw_pa_bcopy32)
1300      -#endif /* lint */
1301 1148  
1302 1149  /*
1303 1150   * Zero a block of storage.
1304 1151   *
1305 1152   * uzero is used by the kernel to zero a block in user address space.
1306 1153   */
1307 1154  
1308 1155  
1309      -#if defined(lint)
1310      -
1311      -/* ARGSUSED */
1312      -int
1313      -kzero(void *addr, size_t count)
1314      -{ return(0); }
1315      -
1316      -/* ARGSUSED */
1317      -void
1318      -uzero(void *addr, size_t count)
1319      -{}
1320      -
1321      -#else   /* lint */
1322      -
1323 1156          ENTRY(uzero)
1324 1157          !
1325 1158          ! Set a new lo_fault handler only if we came in with one
1326 1159          ! already specified.
1327 1160          !
1328 1161          wr      %g0, ASI_USER, %asi
1329 1162          ldn     [THREAD_REG + T_LOFAULT], %o5
1330 1163          tst     %o5
1331 1164          bz,pt   %ncc, .do_zero
1332 1165          sethi   %hi(.zeroerr), %o2
↓ open down ↓ 52 lines elided ↑ open up ↑
1385 1218          ! before we either simply return the error or we invoke the
1386 1219          ! previously specified handler.
1387 1220          !
1388 1221          be      %ncc, 2b
1389 1222          stn     %o5, [THREAD_REG + T_LOFAULT]
1390 1223          jmp     %o5                     ! goto real handler
1391 1224            nop
1392 1225          SET_SIZE(kzero)
1393 1226          SET_SIZE(uzero)
1394 1227  
1395      -#endif  /* lint */
1396      -
1397 1228  /*
1398 1229   * Zero a block of storage.
1399 1230   */
1400 1231  
1401      -#if defined(lint)
1402      -
1403      -/* ARGSUSED */
1404      -void
1405      -bzero(void *addr, size_t count)
1406      -{}
1407      -
1408      -#else   /* lint */
1409      -
1410 1232          ENTRY(bzero)
1411 1233          wr      %g0, ASI_P, %asi
1412 1234  
1413 1235          ldn     [THREAD_REG + T_LOFAULT], %o5   ! save old vector
1414 1236          tst     %o5
1415 1237          bz,pt   %ncc, .do_zero
1416 1238          sethi   %hi(.zeroerr), %o2
1417 1239          or      %o2, %lo(.zeroerr), %o2
1418 1240          membar  #Sync                           ! sync error barrier
1419 1241          stn     %o2, [THREAD_REG + T_LOFAULT]   ! install new vector
↓ open down ↓ 169 lines elided ↑ open up ↑
1589 1411          tst     %o5
1590 1412          bz      %ncc, 1f
1591 1413          andn    %o5, LOFAULT_SET, %o5
1592 1414          membar  #Sync                           ! sync error barrier
1593 1415          stn     %o5, [THREAD_REG + T_LOFAULT]   ! restore old t_lofault
1594 1416  1:
1595 1417          retl
1596 1418          clr     %o0                     ! return (0)
1597 1419  
1598 1420          SET_SIZE(bzero)
1599      -#endif  /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX