Print this page
de-linting of .s files


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #if !defined(lint)
  28 #include <sys/asm_linkage.h>
  29 #include "assym.h"
  30 #endif
  31 
  32 #include <sys/sun4asi.h>
  33 #include <sys/machparam.h>
  34 #include <vm/hat_sfmmu.h>
  35 
  36 /*
  37  * This file contains a kmdb-support function which retrieves the TTE for a
  38  * given VA/context pair, and returns it to the caller if the TTE is valid.
  39  * The code here is essentially an assembly implementation of the unix-tte
  40  * word used to allow OBP to do the same thing.
  41  *
  42  * Depending on the invocation context, the translator may be invoked either
  43  * as a normal function (kdi_vatotte) or as a trap handler fragment
  44  * (kdi_trap_vatotte).
  45  */
  46 
  47 /*
  48  * uint64_t
  49  * kdi_hme_hash_function(sfmmu_t *sfmmup, uintptr_t va, uint_t hmeshift)
  50  * {


 233  *      for (i = 1; i < DEFAULT_MAX_HASHCNT + 1; i++) {
 234  *              hmebpa = kdi_c_hme_hash_function(sfmmup, va, HME_HASH_SHIFT(i));
 235  *              hmetag = kdi_c_hme_hash_tag(i, va);
 236  *              hmeblkpa = kdi_c_hme_hash_table_search(sfmmup, hmebpa, hmetag);
 237  *
 238  *              if (hmeblkpa != NULL) {
 239  *                      uint64_t tte = lddphys(kdi_c_hblk_to_ttep(hmeblkpa, 
 240  *                          va));
 241  *
 242  *                      if ((int64_t)tte < 0)
 243  *                              return (tte);
 244  *                      else
 245  *                              return (0);
 246  *              }
 247  *      }
 248  *
 249  *      return (0);
 250  * }
 251  */
 252 
 253 #if defined(lint)
 254 /*ARGSUSED*/
 255 int
 256 kdi_vatotte(uintptr_t va, int cnum, tte_t *ttep)
 257 {
 258         return (0);
 259 }
 260 
 261 void
 262 kdi_trap_vatotte(void)
 263 {
 264 }
 265 
 266 #else
 267 
 268         /*
 269          * Invocation in normal context as a VA-to-TTE translator
 270          * for kernel context only. This routine returns 0 on
 271          * success and -1 on error.
 272          *
 273          * %o0 = VA, input register
 274          * %o1 = KCONTEXT
 275          * %o2 = ttep, output register
 276          */
 277         ENTRY_NP(kdi_vatotte)
 278         mov     %o0, %g1                /* VA in %g1 */
 279         mov     %o1, %g2                /* cnum in %g2 */
 280 
 281         set     kdi_trap_vatotte, %g3
 282         jmpl    %g3, %g7                /* => %g1: TTE or 0 */
 283         add     %g7, 8, %g7
 284 
 285         brz     %g1, 1f
 286         nop
 287 


 326 
 327         KDI_HBLK_TO_TTEP                /* %g1, %g4 => TTE PA in %g2 */
 328         ldxa    [%g2]ASI_MEM, %g1
 329         brgez,a %g1, 4f
 330         clr     %g1
 331 4:      ba,a    6f
 332 
 333 5:      add     %g3, 1, %g3
 334         set     mmu_hashcnt, %g4
 335         lduw    [%g4], %g4
 336         cmp     %g3, %g4
 337         ble     1b
 338         nop
 339 
 340         clr     %g1
 341 
 342 6:      jmp     %g7
 343         nop
 344         SET_SIZE(kdi_trap_vatotte)
 345 
 346 #endif  /* lint */


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 

  27 #include <sys/asm_linkage.h>
  28 #include "assym.h"

  29 
  30 #include <sys/sun4asi.h>
  31 #include <sys/machparam.h>
  32 #include <vm/hat_sfmmu.h>
  33 
  34 /*
  35  * This file contains a kmdb-support function which retrieves the TTE for a
  36  * given VA/context pair, and returns it to the caller if the TTE is valid.
  37  * The code here is essentially an assembly implementation of the unix-tte
  38  * word used to allow OBP to do the same thing.
  39  *
  40  * Depending on the invocation context, the translator may be invoked either
  41  * as a normal function (kdi_vatotte) or as a trap handler fragment
  42  * (kdi_trap_vatotte).
  43  */
  44 
  45 /*
  46  * uint64_t
  47  * kdi_hme_hash_function(sfmmu_t *sfmmup, uintptr_t va, uint_t hmeshift)
  48  * {


 231  *      for (i = 1; i < DEFAULT_MAX_HASHCNT + 1; i++) {
 232  *              hmebpa = kdi_c_hme_hash_function(sfmmup, va, HME_HASH_SHIFT(i));
 233  *              hmetag = kdi_c_hme_hash_tag(i, va);
 234  *              hmeblkpa = kdi_c_hme_hash_table_search(sfmmup, hmebpa, hmetag);
 235  *
 236  *              if (hmeblkpa != NULL) {
 237  *                      uint64_t tte = lddphys(kdi_c_hblk_to_ttep(hmeblkpa, 
 238  *                          va));
 239  *
 240  *                      if ((int64_t)tte < 0)
 241  *                              return (tte);
 242  *                      else
 243  *                              return (0);
 244  *              }
 245  *      }
 246  *
 247  *      return (0);
 248  * }
 249  */
 250 















 251         /*
 252          * Invocation in normal context as a VA-to-TTE translator
 253          * for kernel context only. This routine returns 0 on
 254          * success and -1 on error.
 255          *
 256          * %o0 = VA, input register
 257          * %o1 = KCONTEXT
 258          * %o2 = ttep, output register
 259          */
 260         ENTRY_NP(kdi_vatotte)
 261         mov     %o0, %g1                /* VA in %g1 */
 262         mov     %o1, %g2                /* cnum in %g2 */
 263 
 264         set     kdi_trap_vatotte, %g3
 265         jmpl    %g3, %g7                /* => %g1: TTE or 0 */
 266         add     %g7, 8, %g7
 267 
 268         brz     %g1, 1f
 269         nop
 270 


 309 
 310         KDI_HBLK_TO_TTEP                /* %g1, %g4 => TTE PA in %g2 */
 311         ldxa    [%g2]ASI_MEM, %g1
 312         brgez,a %g1, 4f
 313         clr     %g1
 314 4:      ba,a    6f
 315 
 316 5:      add     %g3, 1, %g3
 317         set     mmu_hashcnt, %g4
 318         lduw    [%g4], %g4
 319         cmp     %g3, %g4
 320         ble     1b
 321         nop
 322 
 323         clr     %g1
 324 
 325 6:      jmp     %g7
 326         nop
 327         SET_SIZE(kdi_trap_vatotte)
 328