Print this page
de-linting of .s files

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/sun4v/ml/mach_locore.s
          +++ new/usr/src/uts/sun4v/ml/mach_locore.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 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26      -#if defined(lint)
  27      -#include <sys/types.h>
  28      -#include <sys/t_lock.h>
  29      -#include <sys/promif.h>
  30      -#include <sys/prom_isa.h>
  31      -#endif  /* lint */
  32      -
  33   26  #include <sys/asm_linkage.h>
  34   27  #include <sys/intreg.h>
  35   28  #include <sys/ivintr.h>
  36   29  #include <sys/mmu.h>
  37   30  #include <sys/machpcb.h>
  38   31  #include <sys/machtrap.h>
  39   32  #include <sys/machlock.h>
  40   33  #include <sys/fdreg.h>
  41   34  #include <sys/vis.h>
  42   35  #include <sys/traptrace.h>
  43   36  #include <sys/panic.h>
  44   37  #include <sys/machasi.h>
  45   38  #include <sys/privregs.h>
  46   39  #include <sys/hypervisor_api.h>
  47   40  #include <sys/clock.h>
  48   41  
  49      -#if defined(lint)
  50      -
  51      -#include <sys/thread.h>
  52      -#include <sys/time.h>
  53      -
  54      -#else   /* lint */
  55      -
  56   42  #include "assym.h"
  57   43  
  58   44  
  59   45  !
  60   46  ! REGOFF must add up to allow double word access to r_tstate.
  61   47  ! PCB_WBUF must also be aligned.
  62   48  !
  63   49  #if (REGOFF & 7) != 0
  64   50  #error "struct regs not aligned"
  65   51  #endif
↓ open down ↓ 109 lines elided ↑ open up ↑
 175  161  #ifdef  NOPROM
 176  162          .global availmem
 177  163  availmem:
 178  164          .word   0
 179  165  #endif  /* NOPROM */
 180  166  
 181  167          .align  8
 182  168  _local_p1275cis:
 183  169          .nword  0
 184  170  
 185      -#endif  /* lint */
 186      -
 187      -#if defined(lint)
 188      -
 189      -void
 190      -_start(void)
 191      -{}
 192      -
 193      -#else /* lint */
 194      -
 195  171          .seg    ".data"
 196  172  
 197  173          .global nwindows, nwin_minus_one, winmask
 198  174  nwindows:
 199  175          .word   8
 200  176  nwin_minus_one:
 201  177          .word   7
 202  178  winmask:
 203  179          .word   8
 204  180  
↓ open down ↓ 152 lines elided ↑ open up ↑
 357  333          !
 358  334          set     .mainretmsg, %o0
 359  335          call    panic
 360  336          nop
 361  337          SET_SIZE(_start)
 362  338  
 363  339  .mainretmsg:
 364  340          .asciz  "main returned"
 365  341          .align  4
 366  342  
 367      -#endif  /* lint */
 368  343  
 369      -
 370  344  /*
 371  345   * Generic system trap handler.
 372  346   *
 373  347   * Some kernel trap handlers save themselves from buying a window by
 374  348   * borrowing some of sys_trap's unused locals. %l0 thru %l3 may be used
 375  349   * for this purpose, as user_rtt and priv_rtt do not depend on them.
 376  350   * %l4 thru %l7 should NOT be used this way.
 377  351   *
 378  352   * Entry Conditions:
 379  353   *      %pstate         am:0 priv:1 ie:0
↓ open down ↓ 15 lines elided ↑ open up ↑
 395  369   * Called function prototype variants:
 396  370   *
 397  371   *      func(struct regs *rp);
 398  372   *      func(struct regs *rp, uintptr_t arg1 [%g2], uintptr_t arg2 [%g3])
 399  373   *      func(struct regs *rp, uintptr_t arg1 [%g2],
 400  374   *          uint32_t arg2 [%g3.l], uint32_t arg3 [%g3.h])
 401  375   *      func(struct regs *rp, uint32_t arg1 [%g2.l],
 402  376   *          uint32_t arg2 [%g3.l], uint32_t arg3 [%g3.h], uint32_t [%g2.h])
 403  377   */
 404  378  
 405      -#if defined(lint)
 406      -
 407      -void
 408      -sys_trap(void)
 409      -{}
 410      -
 411      -#else   /* lint */
 412      -
 413  379          ENTRY_NP(sys_trap)
 414  380  #ifdef DEBUG
 415  381          ! Assert gl == 1
 416  382          rdpr    %gl, %g5
 417  383          cmp     %g5, 1
 418  384          bne,a,pn %xcc, ptl1_panic
 419  385            mov   PTL1_BAD_GL, %g1
 420  386  #endif
 421  387  
 422  388          !
↓ open down ↓ 617 lines elided ↑ open up ↑
1040 1006          ! set %tstate to the correct %cwp
1041 1007          ! retry resumes prom execution
1042 1008          !
1043 1009          rdpr    %cwp, %g1
1044 1010          wrpr    %g1, %g7, %tstate
1045 1011          retry
1046 1012          /* NOTREACHED */
1047 1013          SET_SIZE(priv_rtt)
1048 1014          SET_SIZE(ktl0)
1049 1015  
1050      -#endif  /* lint */
1051      -
1052      -#ifndef lint
1053      -
1054 1016  #ifdef DEBUG
1055 1017          .seg    ".data"
1056 1018          .align  4
1057 1019  
1058 1020          .global bad_g4_called
1059 1021  bad_g4_called:
1060 1022          .word   0
1061 1023  
1062 1024  sys_trap_wrong_pil:
1063 1025          .asciz  "sys_trap: %g4(%d) is lower than %pil(%d)"
1064 1026          .align  4
1065 1027          .seg    ".text"
1066 1028  
1067 1029          ENTRY_NP(bad_g4)
1068 1030          mov     %o1, %o0
1069 1031          mov     %o2, %o1
1070 1032          call    panic
1071 1033          mov     %o3, %o2
1072 1034          SET_SIZE(bad_g4)
1073 1035  #endif /* DEBUG */
1074      -#endif /* lint */
1075 1036  
1076 1037  /*
1077 1038   * sys_tl1_panic can be called by traps at tl1 which
1078 1039   * really want to panic, but need the rearrangement of
1079 1040   * the args as provided by this wrapper routine.
1080 1041   */
1081      -#if defined(lint)
1082      -
1083      -void
1084      -sys_tl1_panic(void)
1085      -{}
1086      -
1087      -#else   /* lint */
1088 1042          ENTRY_NP(sys_tl1_panic)
1089 1043          mov     %o1, %o0
1090 1044          mov     %o2, %o1
1091 1045          call    panic
1092 1046          mov     %o3, %o2
1093 1047          SET_SIZE(sys_tl1_panic)
1094      -#endif /* lint */
1095 1048  
1096 1049  
1097 1050  /*
1098 1051   * Flush all windows to memory, except for the one we entered in.
1099 1052   * We do this by doing NWINDOW-2 saves then the same number of restores.
1100 1053   * This leaves the WIM immediately before window entered in.
1101 1054   * This is used for context switching.
1102 1055   */
1103 1056  
1104      -#if defined(lint)
1105      -
1106      -void
1107      -flush_windows(void)
1108      -{}
1109      -
1110      -#else   /* lint */
1111      -
1112 1057          ENTRY_NP(flush_windows)
1113 1058          retl
1114 1059          flushw
1115 1060          SET_SIZE(flush_windows)
1116 1061  
1117      -#endif  /* lint */
1118      -
1119      -#if defined(lint)
1120      -
1121      -void
1122      -debug_flush_windows(void)
1123      -{}
1124      -
1125      -#else   /* lint */
1126      -
1127 1062          ENTRY_NP(debug_flush_windows)
1128 1063          set     nwindows, %g1
1129 1064          ld      [%g1], %g1
1130 1065          mov     %g1, %g2
1131 1066  
1132 1067  1:
1133 1068          save    %sp, -WINDOWSIZE, %sp
1134 1069          brnz    %g2, 1b
1135 1070          dec     %g2
1136 1071  
↓ open down ↓ 1 lines elided ↑ open up ↑
1138 1073  2:
1139 1074          restore
1140 1075          brnz    %g2, 2b
1141 1076          dec     %g2
1142 1077  
1143 1078          retl
1144 1079          nop
1145 1080  
1146 1081          SET_SIZE(debug_flush_windows)
1147 1082  
1148      -#endif  /* lint */
1149      -
1150 1083  /*
1151 1084   * flush user windows to memory.
1152 1085   */
1153 1086  
1154      -#if defined(lint)
1155      -
1156      -void
1157      -flush_user_windows(void)
1158      -{}
1159      -
1160      -#else   /* lint */
1161      -
1162 1087          ENTRY_NP(flush_user_windows)
1163 1088          rdpr    %otherwin, %g1
1164 1089          brz     %g1, 3f
1165 1090          clr     %g2
1166 1091  1:
1167 1092          save    %sp, -WINDOWSIZE, %sp
1168 1093          rdpr    %otherwin, %g1
1169 1094          brnz    %g1, 1b
1170 1095          add     %g2, 1, %g2
1171 1096  2:
1172 1097          sub     %g2, 1, %g2             ! restore back to orig window
1173 1098          brnz    %g2, 2b
1174 1099          restore
1175 1100  3:
1176 1101          retl
1177 1102          nop
1178 1103          SET_SIZE(flush_user_windows)
1179 1104  
1180      -#endif  /* lint */
1181      -
1182 1105  /*
1183 1106   * Throw out any user windows in the register file.
1184 1107   * Used by setregs (exec) to clean out old user.
1185 1108   * Used by sigcleanup to remove extraneous windows when returning from a
1186 1109   * signal.
1187 1110   */
1188 1111  
1189      -#if defined(lint)
1190      -
1191      -void
1192      -trash_user_windows(void)
1193      -{}
1194      -
1195      -#else   /* lint */
1196      -
1197 1112          ENTRY_NP(trash_user_windows)
1198 1113          rdpr    %otherwin, %g1
1199 1114          brz     %g1, 3f                 ! no user windows?
1200 1115          ldn     [THREAD_REG + T_STACK], %g5
1201 1116  
1202 1117          !
1203 1118          ! There are old user windows in the register file. We disable ints
1204 1119          ! and increment cansave so that we don't overflow on these windows.
1205 1120          ! Also, this sets up a nice underflow when first returning to the
1206 1121          ! new user.
↓ open down ↓ 5 lines elided ↑ open up ↑
1212 1127          add     %g3, %g1, %g3
1213 1128          wrpr    %g0, 0, %otherwin
1214 1129          wrpr    %g0, %g3, %cansave
1215 1130          wrpr    %g0, %g2, %pstate
1216 1131  3:
1217 1132          retl
1218 1133          clr     [%g5 + MPCB_WBCNT]       ! zero window buffer cnt
1219 1134          SET_SIZE(trash_user_windows)
1220 1135  
1221 1136  
1222      -#endif  /* lint */
1223      -
1224 1137  /*
1225 1138   * Setup g7 via the CPU data structure.
1226 1139   */
1227      -#if defined(lint)
1228 1140  
1229      -struct scb *
1230      -set_tbr(struct scb *s)
1231      -{ return (s); }
1232      -
1233      -#else   /* lint */
1234      -
1235 1141          ENTRY_NP(set_tbr)
1236 1142          retl
1237 1143          ta      72              ! no tbr, stop simulation
1238 1144          SET_SIZE(set_tbr)
1239 1145  
1240      -#endif  /* lint */
1241 1146  
1242      -
1243      -#if defined(lint)
1244      -/*
1245      - * These need to be defined somewhere to lint and there is no "hicore.s"...
1246      - */
1247      -char etext[1], end[1];
1248      -#endif  /* lint*/
1249      -
1250      -#if defined (lint)
1251      -
1252      -/* ARGSUSED */
1253      -void
1254      -ptl1_panic(u_int reason)
1255      -{}
1256      -
1257      -#else /* lint */
1258      -
1259 1147  #define PTL1_SAVE_WINDOW(RP)                                            \
1260 1148          stxa    %l0, [RP + RW64_LOCAL + (0 * RW64_LOCAL_INCR)] %asi;    \
1261 1149          stxa    %l1, [RP + RW64_LOCAL + (1 * RW64_LOCAL_INCR)] %asi;    \
1262 1150          stxa    %l2, [RP + RW64_LOCAL + (2 * RW64_LOCAL_INCR)] %asi;    \
1263 1151          stxa    %l3, [RP + RW64_LOCAL + (3 * RW64_LOCAL_INCR)] %asi;    \
1264 1152          stxa    %l4, [RP + RW64_LOCAL + (4 * RW64_LOCAL_INCR)] %asi;    \
1265 1153          stxa    %l5, [RP + RW64_LOCAL + (5 * RW64_LOCAL_INCR)] %asi;    \
1266 1154          stxa    %l6, [RP + RW64_LOCAL + (6 * RW64_LOCAL_INCR)] %asi;    \
1267 1155          stxa    %l7, [RP + RW64_LOCAL + (7 * RW64_LOCAL_INCR)] %asi;    \
1268 1156          stxa    %i0, [RP + RW64_IN + (0 * RW64_IN_INCR)] %asi;          \
↓ open down ↓ 221 lines elided ↑ open up ↑
1490 1378          !
1491 1379          ! enable limited interrupts
1492 1380          !
1493 1381          wrpr    %g0, CLOCK_LEVEL, %pil
1494 1382          wrpr    %g0, PSTATE_KERN, %pstate
1495 1383          !
1496 1384          ba,pt   %xcc, ptl1_panic_handler
1497 1385            mov   %l1, %o0
1498 1386          /*NOTREACHED*/
1499 1387          SET_SIZE(ptl1_panic)
1500      -#endif /* lint */
1501 1388  
1502 1389  #ifdef  PTL1_PANIC_DEBUG
1503      -#if defined (lint)
1504      -/*
1505      - * ptl1_recurse() calls itself a number of times to either set up a known
1506      - * stack or to cause a kernel stack overflow. It decrements the arguments 
1507      - * on each recursion.
1508      - * It's called by #ifdef PTL1_PANIC_DEBUG code in startup.c to set the
1509      - * registers to a known state to facilitate debugging.
1510      - */
1511 1390  
1512      -/* ARGSUSED */
1513      -void 
1514      -ptl1_recurse(int count_threshold, int trap_threshold)
1515      -{}
1516      -
1517      -#else /* lint */
1518      -
1519 1391          ENTRY_NP(ptl1_recurse)
1520 1392          save    %sp, -SA(MINFRAME), %sp
1521 1393  
1522 1394          set     ptl1_recurse_call, %o7
1523 1395          cmp     %o7, %i7                        ! if ptl1_recurse is called
1524 1396          be,pt  %icc, 0f                         ! by itself, then skip
1525 1397            nop                                   ! register initialization
1526 1398  
1527 1399          /* 
1528 1400           * Initialize Out Registers to Known Values 
↓ open down ↓ 44 lines elided ↑ open up ↑
1573 1445  
1574 1446  ptl1_recure_exit:
1575 1447          ret
1576 1448          restore
1577 1449  
1578 1450  ptl1_recurse_trap:
1579 1451          ta      PTL1_DEBUG_TRAP;                ! Trap Always to ptl1_panic()
1580 1452            nop                                   ! NOTREACHED 
1581 1453          SET_SIZE(ptl1_recurse)
1582 1454  
1583      -#endif /* lint */
1584      -
1585      -#if defined (lint)
1586      -
1587      -/* ARGSUSED */
1588      -void
1589      -ptl1_panic_xt(int arg1, int arg2)
1590      -{}
1591      -
1592      -#else /* lint */
1593 1455          /*
1594 1456           * Asm function to handle a cross trap to call ptl1_panic()
1595 1457           */
1596 1458          ENTRY_NP(ptl1_panic_xt)
1597 1459          ba      ptl1_panic
1598 1460            mov   PTL1_BAD_DEBUG, %g1
1599 1461          SET_SIZE(ptl1_panic_xt)
1600 1462  
1601      -#endif /* lint */
1602      -
1603 1463  #endif  /* PTL1_PANIC_DEBUG */
1604 1464  
1605 1465  #ifdef  TRAPTRACE
1606      -#if     defined (lint)
1607 1466  
1608      -void
1609      -trace_ptr_panic(void)
1610      -{
1611      -}
1612      -
1613      -#else   /* lint */
1614      -
1615 1467          ENTRY_NP(trace_ptr_panic)
1616 1468          !
1617 1469          ! freeze the trap trace to disable the assertions.  Otherwise,
1618 1470          ! ptl1_panic is likely to be repeatedly called from there.
1619 1471          ! %g2 and %g3 are used as scratch registers in ptl1_panic.
1620 1472          !
1621 1473          mov     1, %g3
1622 1474          sethi   %hi(trap_freeze), %g2
1623 1475          st      %g3, [%g2 + %lo(trap_freeze)]
1624 1476          !
↓ open down ↓ 1 lines elided ↑ open up ↑
1626 1478          ! save it in trap_freeze_pc for a debugging hint if there is
1627 1479          ! no value saved in it.
1628 1480          !
1629 1481          set     trap_freeze_pc, %g2
1630 1482          casn    [%g2], %g0, %g1
1631 1483  
1632 1484          ba      ptl1_panic
1633 1485          mov     PTL1_BAD_TRACE_PTR, %g1
1634 1486          SET_SIZE(trace_ptr_panic)
1635 1487  
1636      -#endif  /* lint */
1637 1488  #endif  /* TRAPTRACE */
1638 1489  
1639 1490  /*
1640 1491   * The interface for a 32-bit client program that takes over the TBA
1641 1492   * calling the 64-bit romvec OBP.
1642 1493   */
1643 1494  
1644      -#if defined(lint)
1645      -
1646      -/* ARGSUSED */
1647      -int
1648      -client_handler(void *cif_handler, void *arg_array)
1649      -{ return 0; }
1650      -
1651      -#else   /* lint */
1652      -
1653 1495          ENTRY(client_handler)
1654 1496          save    %sp, -SA64(MINFRAME64), %sp     ! 32 bit frame, 64 bit sized
1655 1497          sethi   %hi(tba_taken_over), %l2
1656 1498          ld      [%l2+%lo(tba_taken_over)], %l3
1657 1499          brz     %l3, 1f                         ! is the tba_taken_over = 1 ?
1658 1500          rdpr    %wstate, %l5                    ! save %wstate
1659 1501          andn    %l5, WSTATE_MASK, %l6
1660 1502          wrpr    %l6, WSTATE_KMIX, %wstate
1661 1503  1:      mov     %i1, %o0
1662 1504  1:      rdpr    %pstate, %l4                    ! Get the present pstate value
↓ open down ↓ 2 lines elided ↑ open up ↑
1665 1507          jmpl    %i0, %o7                        ! Call cif handler
1666 1508          nop
1667 1509          wrpr    %l4, 0, %pstate                 ! restore pstate
1668 1510          brz     %l3, 1f                         ! is the tba_taken_over = 1
1669 1511            nop
1670 1512          wrpr    %g0, %l5, %wstate               ! restore wstate
1671 1513  1:      ret                                     ! Return result ...
1672 1514          restore %o0, %g0, %o0                   ! delay; result in %o0
1673 1515          SET_SIZE(client_handler)
1674 1516  
1675      -#endif  /* lint */
1676      -
1677      -#if defined(lint)
1678      -
1679      -/*ARGSUSED*/
1680      -void
1681      -panic_bad_hcall(uint64_t err, uint64_t hcall)
1682      -{}
1683      -
1684      -#else   /* lint */
1685      -
1686 1517          .seg    ".text"
1687 1518  bad_hcall_error:
1688 1519          .asciz  "hypervisor call 0x%x returned an unexpected error %d"
1689 1520  
1690 1521          /*
1691 1522           * panic_bad_hcall is called when a hcall returns
1692 1523           * unexpected error
1693 1524           * %o0 error number
1694 1525           * %o1 hcall number
1695 1526           */
1696 1527  
1697 1528          ENTRY(panic_bad_hcall)
1698 1529          mov     %o0, %o2
1699 1530          sethi   %hi(bad_hcall_error), %o0
1700 1531          or      %o0, %lo(bad_hcall_error), %o0
1701 1532          mov     %o7, %o3
1702 1533          call    panic
1703 1534          mov     %o3, %o7
1704 1535          SET_SIZE(panic_bad_hcall)
1705 1536  
1706      -#endif  /* lint */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX