Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4u/cpu/common_asm.s
          +++ new/usr/src/uts/sun4u/cpu/common_asm.s
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  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 (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
  25      -#if !defined(lint)
  26   25  #include "assym.h"
  27      -#endif  /* !lint */
  28   26  
  29   27  /*
  30   28   * General assembly language routines.
  31   29   * It is the intent of this file to contain routines that are
  32   30   * specific to cpu architecture.
  33   31   */
  34   32  
  35   33  /*
  36   34   * WARNING: If you add a fast trap handler which can be invoked by a
  37   35   * non-privileged user, you may have to use the FAST_TRAP_DONE macro
↓ open down ↓ 168 lines elided ↑ open up ↑
 206  204          rd      TICK_COMPARE, %g0
 207  205  #else   /* BB_ERRATA_1 */
 208  206  #define WR_TICKCMPR(in,scr1,scr2,label)         \
 209  207          wr      in, TICK_COMPARE
 210  208  #endif  /* BB_ERRATA_1 */
 211  209  
 212  210  #endif  /* !CHEETAH && !HUMMINGBIRD */
 213  211  
 214  212  #include <sys/clock.h>
 215  213  
 216      -#if defined(lint)
 217      -#include <sys/types.h>
 218      -#include <sys/scb.h>
 219      -#include <sys/systm.h>
 220      -#include <sys/regset.h>
 221      -#include <sys/sunddi.h>
 222      -#include <sys/lockstat.h>
 223      -#endif  /* lint */
 224  214  
 225      -
 226  215  #include <sys/asm_linkage.h>
 227  216  #include <sys/privregs.h>
 228  217  #include <sys/machparam.h>      /* To get SYSBASE and PAGESIZE */
 229  218  #include <sys/machthread.h>
 230  219  #include <sys/clock.h>
 231  220  #include <sys/intreg.h>
 232  221  #include <sys/psr_compat.h>
 233  222  #include <sys/isa_defs.h>
 234  223  #include <sys/dditypes.h>
 235  224  #include <sys/intr.h>
 236  225  
 237      -#if !defined(lint)
 238  226  #include "assym.h"
 239      -#endif  /* !lint */
 240  227  
 241      -#if defined(lint)
 242      -
 243      -uint_t
 244      -get_impl(void)
 245      -{ return (0); }
 246      -
 247      -#else   /* lint */
 248      -
 249  228          ENTRY(get_impl)
 250  229          GET_CPU_IMPL(%o0)
 251  230          retl
 252  231          nop
 253  232          SET_SIZE(get_impl)
 254  233  
 255      -#endif  /* lint */
 256      -
 257      -#if defined(lint)
 258      -/*
 259      - * Softint generated when counter field of tick reg matches value field 
 260      - * of tick_cmpr reg
 261      - */
 262      -/*ARGSUSED*/
 263      -void
 264      -tickcmpr_set(uint64_t clock_cycles)
 265      -{}
 266      -
 267      -#else   /* lint */
 268      -
 269  234          ENTRY_NP(tickcmpr_set)
 270  235          ! get 64-bit clock_cycles interval
 271  236          mov     %o0, %o2
 272  237          mov     8, %o3                  ! A reasonable initial step size
 273  238  1:
 274  239          WR_TICKCMPR(%o2,%o4,%o5,__LINE__)       ! Write to TICK_CMPR
 275  240  
 276  241          GET_NATIVE_TIME(%o0, %o4, %o5)  ! Read %tick to confirm the
 277  242          sllx    %o0, 1, %o0             !   value we wrote was in the future.
 278  243          srlx    %o0, 1, %o0
↓ open down ↓ 1 lines elided ↑ open up ↑
 280  245          cmp     %o2, %o0                ! If the value we wrote was in the
 281  246          bg,pt   %xcc, 2f                !   future, then blow out of here.
 282  247          sllx    %o3, 1, %o3             ! If not, then double our step size,
 283  248          ba,pt   %xcc, 1b                !   and take another lap.
 284  249          add     %o0, %o3, %o2           !
 285  250  2:
 286  251          retl
 287  252          nop
 288  253          SET_SIZE(tickcmpr_set)
 289  254  
 290      -#endif  /* lint */
 291      -
 292      -#if defined(lint)
 293      -
 294      -void
 295      -tickcmpr_disable(void)
 296      -{}
 297      -
 298      -#else   /* lint */
 299      -
 300  255          ENTRY_NP(tickcmpr_disable)
 301  256          mov     1, %g1
 302  257          sllx    %g1, TICKINT_DIS_SHFT, %o0
 303  258          WR_TICKCMPR(%o0,%o4,%o5,__LINE__)       ! Write to TICK_CMPR
 304  259          retl
 305  260          nop
 306  261          SET_SIZE(tickcmpr_disable)
 307  262  
 308      -#endif  /* lint */
 309      -
 310      -#if defined(lint)
 311      -
 312      -/*
 313      - * tick_write_delta() increments %tick by the specified delta.  This should
 314      - * only be called after a CPR event to assure that gethrtime() continues to
 315      - * increase monotonically.  Obviously, writing %tick needs to de done very
 316      - * carefully to avoid introducing unnecessary %tick skew across CPUs.  For
 317      - * this reason, we make sure we're i-cache hot before actually writing to
 318      - * %tick.
 319      - */
 320      -/*ARGSUSED*/
 321      -void
 322      -tick_write_delta(uint64_t delta)
 323      -{}
 324      -
 325      -#else   /* lint */
 326      -
 327  263  #ifdef DEBUG
 328  264          .seg    ".text"
 329  265  tick_write_panic:
 330  266          .asciz  "tick_write_delta: interrupts already disabled on entry"
 331  267  #endif  /* DEBUG */
 332  268  
 333  269          ENTRY_NP(tick_write_delta)
 334  270          rdpr    %pstate, %g1
 335  271  #ifdef DEBUG
 336  272          andcc   %g1, PSTATE_IE, %g0     ! If DEBUG, check that interrupts
↓ open down ↓ 6 lines elided ↑ open up ↑
 343  279  0:      wrpr    %g1, PSTATE_IE, %pstate ! Disable interrupts
 344  280          mov     %o0, %o2
 345  281          ba      0f                      ! Branch to cache line-aligned instr.
 346  282          nop
 347  283          .align  16
 348  284  0:      nop                             ! The next 3 instructions are now hot.
 349  285          DELTA_NATIVE_TIME(%o2, %o3, %o4, %o5, %g2)      ! read/inc/write %tick
 350  286  
 351  287          retl                            ! Return
 352  288          wrpr    %g0, %g1, %pstate       !     delay: Re-enable interrupts
 353      -#endif  /* lint */
 354  289  
 355      -#if defined(lint)
 356      -/*
 357      - *  return 1 if disabled
 358      - */
 359      -
 360      -int
 361      -tickcmpr_disabled(void)
 362      -{ return (0); }
 363      -
 364      -#else   /* lint */
 365      -
 366  290          ENTRY_NP(tickcmpr_disabled)
 367  291          RD_TICKCMPR(%g1, %o0)
 368  292          retl
 369  293          srlx    %g1, TICKINT_DIS_SHFT, %o0
 370  294          SET_SIZE(tickcmpr_disabled)
 371  295  
 372      -#endif  /* lint */
 373      -
 374  296  /*
 375  297   * Get current tick
 376  298   */
 377      -#if defined(lint)
 378  299  
 379      -u_longlong_t
 380      -gettick(void)
 381      -{ return (0); }
 382      -
 383      -u_longlong_t
 384      -randtick(void)
 385      -{ return (0); }
 386      -
 387      -#else   /* lint */
 388      -
 389  300          ENTRY(gettick)
 390  301          ALTENTRY(randtick)
 391  302          GET_NATIVE_TIME(%o0, %o2, %o3)
 392  303          retl
 393  304          nop
 394  305          SET_SIZE(randtick)
 395  306          SET_SIZE(gettick)
 396  307  
 397      -#endif  /* lint */
 398  308  
 399      -
 400  309  /*
 401  310   * Return the counter portion of the tick register.
 402  311   */
 403  312  
 404      -#if defined(lint)
 405      -
 406      -uint64_t
 407      -gettick_counter(void)
 408      -{ return(0); }
 409      -
 410      -#else   /* lint */
 411      -
 412  313          ENTRY_NP(gettick_counter)
 413  314          rdpr    %tick, %o0
 414  315          sllx    %o0, 1, %o0
 415  316          retl
 416  317          srlx    %o0, 1, %o0             ! shake off npt bit
 417  318          SET_SIZE(gettick_counter)
 418      -#endif  /* lint */
 419  319  
 420  320  /*
 421  321   * Provide a C callable interface to the trap that reads the hi-res timer.
 422  322   * Returns 64-bit nanosecond timestamp in %o0 and %o1.
 423  323   */
 424  324  
 425      -#if defined(lint)
 426      -
 427      -hrtime_t
 428      -gethrtime(void)
 429      -{
 430      -        return ((hrtime_t)0);
 431      -}
 432      -
 433      -hrtime_t
 434      -gethrtime_unscaled(void)
 435      -{
 436      -        return ((hrtime_t)0);
 437      -}
 438      -
 439      -hrtime_t
 440      -gethrtime_max(void)
 441      -{
 442      -        return ((hrtime_t)0);
 443      -}
 444      -
 445      -void
 446      -scalehrtime(hrtime_t *hrt)
 447      -{
 448      -        *hrt = 0;
 449      -}
 450      -
 451      -void
 452      -gethrestime(timespec_t *tp)
 453      -{
 454      -        tp->tv_sec = 0;
 455      -        tp->tv_nsec = 0;
 456      -}
 457      -
 458      -time_t
 459      -gethrestime_sec(void)
 460      -{
 461      -        return (0);
 462      -}
 463      -
 464      -void
 465      -gethrestime_lasttick(timespec_t *tp)
 466      -{
 467      -        tp->tv_sec = 0;
 468      -        tp->tv_nsec = 0;
 469      -}
 470      -
 471      -/*ARGSUSED*/
 472      -void
 473      -hres_tick(void)
 474      -{
 475      -}
 476      -
 477      -void
 478      -panic_hres_tick(void)
 479      -{
 480      -}
 481      -
 482      -#else   /* lint */
 483      -
 484  325          ENTRY_NP(gethrtime)
 485  326          GET_HRTIME(%g1, %o0, %o1, %o2, %o3, %o4, %o5, %g2)
 486  327                                                          ! %g1 = hrtime
 487  328          retl
 488  329          mov     %g1, %o0
 489  330          SET_SIZE(gethrtime)
 490  331  
 491  332          ENTRY_NP(gethrtime_unscaled)
 492  333          GET_NATIVE_TIME(%g1, %o2, %o3)                  ! %g1 = native time
 493  334          retl
↓ open down ↓ 271 lines elided ↑ open up ↑
 765  606          ld      [%l4 + %lo(hres_lock)], %i1
 766  607          inc     %i1
 767  608          st      %i1, [%l4 + %lo(hres_lock)]
 768  609  
 769  610          sethi   %hi(hrtime_base_panic), %o0
 770  611          call    panic
 771  612          or      %o0, %lo(hrtime_base_panic), %o0
 772  613  
 773  614          SET_SIZE(hres_tick)
 774  615  
 775      -#endif  /* lint */
 776      -
 777      -#if !defined(lint) && !defined(__lint)
 778      -
 779  616          .seg    ".text"
 780  617  kstat_q_panic_msg:
 781  618          .asciz  "kstat_q_exit: qlen == 0"
 782  619  
 783  620          ENTRY(kstat_q_panic)
 784  621          save    %sp, -SA(MINFRAME), %sp
 785  622          sethi   %hi(kstat_q_panic_msg), %o0
 786  623          call    panic
 787  624          or      %o0, %lo(kstat_q_panic_msg), %o0
 788  625          /*NOTREACHED*/
↓ open down ↓ 89 lines elided ↑ open up ↑
 878  715          ENTRY(kstat_runq_back_to_waitq)
 879  716          GET_NATIVE_TIME(%g1, %g2, %g3)
 880  717  #if defined(DEBUG)
 881  718          KSTAT_Q_UPDATE(sub, BRZPN, kstat_q_panic, 1:, KSTAT_IO_R)
 882  719  #else
 883  720          KSTAT_Q_UPDATE_ND(sub, 1:, KSTAT_IO_R)
 884  721  #endif
 885  722          KSTAT_Q_UPDATE(add, BRZPT, 1f, 1:retl, KSTAT_IO_W)
 886  723          SET_SIZE(kstat_runq_back_to_waitq)
 887  724  
 888      -#endif  /* !(lint || __lint) */
 889      -
 890      -#ifdef lint     
 891      -
 892      -int64_t timedelta;
 893      -hrtime_t hres_last_tick;
 894      -volatile timestruc_t hrestime;
 895      -int64_t hrestime_adj;
 896      -volatile int hres_lock;
 897      -uint_t nsec_scale;
 898      -hrtime_t hrtime_base;
 899      -int traptrace_use_stick;
 900      -
 901      -#else   /* lint */
 902  725          /*
 903  726           *  -- WARNING --
 904  727           *
 905  728           * The following variables MUST be together on a 128-byte boundary.
 906  729           * In addition to the primary performance motivation (having them all
 907  730           * on the same cache line(s)), code here and in the GET*TIME() macros
 908  731           * assumes that they all have the same high 22 address bits (so
 909  732           * there's only one sethi).
 910  733           */
 911  734          .seg    ".data"
↓ open down ↓ 17 lines elided ↑ open up ↑
 929  752          .word   0
 930  753  hrtime_base:
 931  754          .word   0, 0
 932  755  traptrace_use_stick:
 933  756          .word   0
 934  757  nsec_shift:
 935  758          .word   NSEC_SHIFT
 936  759  adj_shift:
 937  760          .word   ADJ_SHIFT
 938  761  
 939      -#endif  /* lint */
 940  762  
 941      -
 942  763  /*
 943  764   * drv_usecwait(clock_t n)      [DDI/DKI - section 9F]
 944  765   * usec_delay(int n)            [compatibility - should go one day]
 945  766   * Delay by spinning.
 946  767   *
 947  768   * delay for n microseconds.  numbers <= 0 delay 1 usec
 948  769   *
 949  770   * With UltraSPARC-III the combination of supporting mixed-speed CPUs
 950  771   * and variable clock rate for power management requires that we
 951  772   * use %stick to implement this routine.
 952  773   *
 953  774   * For OPL platforms that support the "sleep" instruction, we
 954  775   * conditionally (ifdef'ed) insert a "sleep" instruction in
 955  776   * the loop. Note that theoritically we should have move (duplicated)
 956  777   * the code down to spitfire/us3/opl specific asm files - but this
 957  778   * is alot of code duplication just to add one "sleep" instruction.
 958  779   * We chose less code duplication for this.
 959  780   */
 960  781  
 961      -#if defined(lint)
 962      -
 963      -/*ARGSUSED*/
 964      -void
 965      -drv_usecwait(clock_t n)
 966      -{}
 967      -
 968      -/*ARGSUSED*/
 969      -void
 970      -usec_delay(int n)
 971      -{}
 972      -
 973      -#else   /* lint */
 974      -
 975  782          ENTRY(drv_usecwait)
 976  783          ALTENTRY(usec_delay)
 977  784          brlez,a,pn %o0, 0f
 978  785          mov     1, %o0
 979  786  0:
 980  787          sethi   %hi(sticks_per_usec), %o1
 981  788          lduw    [%o1 + %lo(sticks_per_usec)], %o1
 982  789          mulx    %o1, %o0, %o1           ! Scale usec to ticks
 983  790          inc     %o1                     ! We don't start on a tick edge
 984  791          GET_NATIVE_TIME(%o2, %o3, %o4)
↓ open down ↓ 4 lines elided ↑ open up ↑
 989  796          .word 0x81b01060                ! insert "sleep" instruction
 990  797  #endif /* _OPL */                       ! use byte code for now
 991  798          cmp     %o1, %o2
 992  799          GET_NATIVE_TIME(%o2, %o3, %o4)
 993  800          bgeu,pt %xcc, 1b
 994  801          nop
 995  802          retl
 996  803          nop
 997  804          SET_SIZE(usec_delay)
 998  805          SET_SIZE(drv_usecwait)
 999      -#endif  /* lint */
1000  806  
1001      -#if defined(lint)
1002      -
1003      -/* ARGSUSED */
1004      -void
1005      -pil14_interrupt(int level)
1006      -{}
1007      -
1008      -#else   /* lint */
1009      -
1010  807  /*
1011  808   * Level-14 interrupt prologue.
1012  809   */
1013  810          ENTRY_NP(pil14_interrupt)
1014  811          CPU_ADDR(%g1, %g2)
1015  812          rdpr    %pil, %g6                       ! %g6 = interrupted PIL
1016  813          stn     %g6, [%g1 + CPU_PROFILE_PIL]    ! record interrupted PIL
1017  814          rdpr    %tstate, %g6
1018  815          rdpr    %tpc, %g5
1019  816          btst    TSTATE_PRIV, %g6                ! trap from supervisor mode?
↓ open down ↓ 69 lines elided ↑ open up ↑
1089  886          cmp     %o5, %o0                        ! In the future?
1090  887          bg,a,pt %xcc, 2f                        ! Yes, drive on.
1091  888          wrpr    %g0, %g5, %pstate               !    delay: enable vec intr
1092  889          ba      1b                              ! No, try again.
1093  890          sllx    %o4, 1, %o4                     !    delay: double step size
1094  891  
1095  892  2:      ba      current_thread_complete
1096  893          nop
1097  894          SET_SIZE(tick_rtt)
1098  895  
1099      -#endif  /* lint */
1100      -
1101      -#if defined(lint)
1102      -
1103      -/* ARGSUSED */
1104      -void
1105      -pil15_interrupt(int level)
1106      -{}
1107      -
1108      -#else  /* lint */
1109      -
1110  896  /*
1111  897   * Level-15 interrupt prologue.
1112  898   */
1113  899         ENTRY_NP(pil15_interrupt)
1114  900         CPU_ADDR(%g1, %g2)
1115  901         rdpr    %tstate, %g6
1116  902         rdpr    %tpc, %g5
1117  903         btst    TSTATE_PRIV, %g6                ! trap from supervisor mode?
1118  904         bnz,a,pt %xcc, 1f
1119  905         stn     %g5, [%g1 + CPU_CPCPROFILE_PC]  ! if so, record kernel PC
1120  906         stn     %g5, [%g1 + CPU_CPCPROFILE_UPC] ! if not, record user PC
1121  907         ba      pil15_epilogue                  ! must be large-disp branch
1122  908         stn     %g0, [%g1 + CPU_CPCPROFILE_PC]  ! zero kernel PC
1123  909  1:     ba      pil15_epilogue                  ! must be large-disp branch
1124  910         stn     %g0, [%g1 + CPU_CPCPROFILE_UPC] ! zero user PC
1125  911         SET_SIZE(pil15_interrupt)
1126  912  
1127      -#endif /* lint */
1128      -
1129      -#if defined(lint) || defined(__lint)
1130      -
1131      -/* ARGSUSED */
1132      -uint64_t
1133      -find_cpufrequency(volatile uchar_t *clock_ptr)
1134      -{
1135      -        return (0);
1136      -}
1137      -
1138      -#else   /* lint */
1139      -
1140  913  #ifdef DEBUG
1141  914          .seg    ".text"
1142  915  find_cpufreq_panic:
1143  916          .asciz  "find_cpufrequency: interrupts already disabled on entry"
1144  917  #endif  /* DEBUG */
1145  918  
1146  919          ENTRY_NP(find_cpufrequency)
1147  920          rdpr    %pstate, %g1
1148  921  
1149  922  #ifdef DEBUG
↓ open down ↓ 27 lines elided ↑ open up ↑
1177  950  
1178  951          brz,pn  %o4, 0b                 ! if the minutes just rolled over,
1179  952                                          ! the last second could have been
1180  953                                          ! inaccurate; try again.
1181  954          wrpr    %g0, %g1, %pstate       !   delay: re-enable interrupts
1182  955  
1183  956          retl
1184  957          sub     %o5, %o3, %o0           ! return the difference in ticks
1185  958          SET_SIZE(find_cpufrequency)
1186  959  
1187      -#endif  /* lint */
1188      -
1189      -#if defined(lint)
1190      -/*
1191      - * Prefetch a page_t for write or read, this assumes a linear
1192      - * scan of sequential page_t's.
1193      - */
1194      -/*ARGSUSED*/
1195      -void
1196      -prefetch_page_w(void *pp)
1197      -{}
1198      -
1199      -/*ARGSUSED*/
1200      -void
1201      -prefetch_page_r(void *pp)
1202      -{}
1203      -#else   /* lint */
1204      -
1205  960  #if defined(CHEETAH) || defined(CHEETAH_PLUS) || defined(JALAPENO) || \
1206  961          defined(SERRANO)
1207  962          !
1208  963          ! On US-III, the prefetch instruction queue is 8 entries deep.
1209  964          ! Also, prefetches for write put data in the E$, which has
1210  965          ! lines of 512 bytes for an 8MB cache. Each E$ line is further
1211  966          ! subblocked into 64 byte chunks.
1212  967          !
1213  968          ! Since prefetch can only bring in 64 bytes at a time (See Sparc
1214  969          ! v9 Architecture Manual pp.204) and a page_t is 128 bytes,
↓ open down ↓ 136 lines elided ↑ open up ↑
1351 1106          prefetch        [%o0+STRIDE1], #n_writes
1352 1107          retl
1353 1108          prefetch        [%o0+STRIDE2], #n_writes
1354 1109          SET_SIZE(prefetch_page_r)
1355 1110  #else   /* OLYMPUS_C */
1356 1111  
1357 1112  #error "You need to fix this for your new cpu type."
1358 1113  
1359 1114  #endif  /* OLYMPUS_C */
1360 1115  
1361      -#endif  /* lint */
1362      -
1363      -#if defined(lint)
1364      -/*
1365      - * Prefetch struct smap for write. 
1366      - */
1367      -/*ARGSUSED*/
1368      -void
1369      -prefetch_smap_w(void *smp)
1370      -{}
1371      -#else   /* lint */
1372      -
1373 1116  #if defined(CHEETAH) || defined(CHEETAH_PLUS) || defined(JALAPENO) || \
1374 1117          defined(SERRANO)
1375 1118  
1376 1119  #define PREFETCH_Q_LEN 8
1377 1120  
1378 1121  #elif defined(SPITFIRE) || defined(HUMMINGBIRD)
1379 1122  
1380 1123  #define PREFETCH_Q_LEN 3
1381 1124  
1382 1125  #elif defined(OLYMPUS_C)
↓ open down ↓ 31 lines elided ↑ open up ↑
1414 1157  #define SMAP_SIZE 48
1415 1158  #define SMAP_STRIDE (PREFETCH_Q_LEN * SMAP_SIZE)
1416 1159  
1417 1160  #endif  /* SEGKPM_SUPPORT */
1418 1161  
1419 1162          ENTRY(prefetch_smap_w)
1420 1163          retl
1421 1164          prefetch        [%o0-SMAP_STRIDE], #n_writes
1422 1165          SET_SIZE(prefetch_smap_w)
1423 1166  
1424      -#endif  /* lint */
1425      -
1426      -#if defined(lint) || defined(__lint)
1427      -
1428      -/* ARGSUSED */
1429      -uint64_t
1430      -getidsr(void)
1431      -{ return 0; }
1432      -
1433      -#else   /* lint */
1434      -
1435 1167          ENTRY_NP(getidsr)
1436 1168          retl
1437 1169          ldxa    [%g0]ASI_INTR_DISPATCH_STATUS, %o0
1438 1170          SET_SIZE(getidsr)
1439 1171  
1440      -#endif  /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX