Print this page
de-linting of .s files


  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 /*
  28  * This file is through cpp before being used as
  29  * an inline.  It contains support routines used
  30  * only by DR for the copy-rename sequence.
  31  */
  32 
  33 #if defined(lint)
  34 #include <sys/types.h>
  35 #else
  36 #include "assym.h"
  37 #include "drmach_offsets.h"
  38 #endif /* lint */
  39 
  40 #include <sys/asm_linkage.h>
  41 #include <sys/param.h>
  42 #include <sys/privregs.h>
  43 #include <sys/spitregs.h>
  44 #include <sys/mmu.h>
  45 #include <sys/machthread.h>
  46 #include <sys/pte.h>
  47 #include <sys/stack.h>
  48 #include <sys/vis.h>
  49 #include <sys/intreg.h>
  50 #include <sys/cheetahregs.h>
  51 #include <sys/drmach.h>
  52 #include <sys/sbd_ioctl.h>
  53 
  54 #if !defined(lint)
  55 
  56 /*
  57  * turn off speculative mode to prevent unwanted memory access
  58  * when we are in the FMEM loops
  59  */
  60 
  61 #define FJSV_SPECULATIVE_OFF(reg, tmp1, tmp2)                           \
  62         rdpr    %pstate, reg                                            ;\
  63         andn    reg, PSTATE_IE, tmp1                                    ;\
  64         wrpr    %g0, tmp1, %pstate                                      ;\
  65         ldxa    [%g0]ASI_MCNTL, tmp1                                    ;\
  66         set     1, tmp2                                                 ;\
  67         sllx    tmp2, MCNTL_SPECULATIVE_SHIFT, tmp2                                             ;\
  68         or      tmp1, tmp2, tmp1                                        ;\
  69         stxa    tmp1, [%g0]ASI_MCNTL                                    ;\
  70         membar #Sync
  71 #endif
  72 
  73 
  74 #if defined(lint)
  75 /*ARGSUSED*/
  76 void
  77 drmach_fmem_loop_script(caddr_t critical, int size, caddr_t stat)
  78 { return; }
  79 #else /* lint */
  80         .align  8
  81         ENTRY_NP(drmach_fmem_loop_script)
  82         /* turn off speculative mode */
  83         FJSV_SPECULATIVE_OFF(%o5, %o3, %o4);
  84 
  85         /* read the critical region to get everything in the cache */
  86         mov     %o0, %o3
  87 0:
  88         ldx     [%o3], %o4
  89         sub     %o1, 8, %o1
  90         brnz    %o1, 0b
  91          add    %o3, 8, %o3
  92 
  93         /* clear L2_CTRL_UGE_TRAP error bit */
  94         mov     ASI_L2_CTRL_RW_ADDR, %o1
  95         ldxa    [%o1]ASI_L2_CTRL, %o3
  96         sethi   %hi(ASI_L2_CTRL_UGE_TRAP), %o4
  97         btst    %o3, %o4
  98         bz,pn   %xcc, 1f
  99          nop


 141         andn    %o0, %o1, %o0
 142         ba      4f
 143          nop
 144 .align 32
 145 4:
 146         stxa    %o0, [%g0]ASI_MCNTL
 147         membar  #Sync
 148         wrpr    %g0, %o5, %pstate
 149         retl
 150          mov    %o4, %o0
 151 .align 8
 152 5:
 153         ALTENTRY(drmach_fmem_loop_script_rtn)
 154         /*
 155          * busy wait will affect sibling strands so
 156          * we put sleep instruction in the delay slot
 157          */
 158         ba      2b
 159 .word    0x81b01060
 160         SET_SIZE(drmach_fmem_loop_script)
 161 #endif /* lint */
 162 
 163 #if defined(lint)
 164 /*ARGSUSED*/
 165 void
 166 drmach_flush_icache(void)
 167 { return; }
 168 #else /* lint */
 169         .align  8
 170         ENTRY_NP(drmach_flush_icache)
 171         stxa    %g0, [%g0]ASI_ALL_FLUSH_L1I
 172         membar  #Sync
 173         retl
 174          nop
 175         SET_SIZE(drmach_flush_icache)
 176 #endif
 177 
 178 #if defined(lint)
 179 /*ARGSUSED*/
 180 int
 181 drmach_fmem_exec_script(caddr_t critical, int size)
 182 { return (0); }
 183 #else /* lint */
 184 .align 32
 185         ENTRY_NP(drmach_fmem_exec_script)
 186         /* turn off speculative mode */
 187         FJSV_SPECULATIVE_OFF(%o5, %o3, %o4);
 188         /* save locals to save area */
 189         add     %o0, SAVE_LOCAL, %o2
 190         stx     %l0, [%o2+8*0]
 191         stx     %l1, [%o2+8*1]
 192         stx     %l2, [%o2+8*2]
 193         stx     %l3, [%o2+8*3]
 194         stx     %l4, [%o2+8*4]
 195         stx     %l5, [%o2+8*5]
 196         stx     %l6, [%o2+8*6]
 197         stx     %l7, [%o2+8*7]
 198         mov     %o5, %l6
 199         /* l7 is set only when FMEM cmd is issued to SCF */
 200         mov     %g0, %l7
 201 
 202         /* read the critical region to put everything in the cache */
 203         mov     %o0, %o2


 438         btst    %o3, %o4
 439         be      %xcc, 5f                ! CMD_COMPLETE is not set
 440          nop
 441         stha    %o3, [%o1]ASI_IO        ! Now we are done and clear it
 442         ba      %xcc, 6f
 443          mov    ESBD_NOERROR, %o4
 444 
 445         /* timeout delay checking */
 446 5:
 447         rd      STICK, %l2
 448         cmp     %l5, %l2
 449         bge     %xcc, 3b
 450          nop
 451         set     EOPL_FMEM_TIMEOUT, %o4
 452 
 453         /* we are done or timed out */
 454 6:
 455         ba,a    1b
 456          nop
 457         SET_SIZE(drmach_fmem_exec_script)
 458 #endif /* lint */
 459 
 460 #if defined(lint)
 461 /*ARGSUSED*/
 462 void
 463 drmach_fmem_exec_script_end(caddr_t critical, int size)
 464 { return; }
 465 #else /* lint */
 466         ENTRY_NP(drmach_fmem_exec_script_end)
 467         nop
 468         SET_SIZE(drmach_fmem_exec_script_end)
 469 #endif /* lint */
 470 
 471 #if defined(lint)
 472 uint64_t
 473 patch_inst(uint64_t *x, uint64_t y)
 474 {
 475         *x = y;
 476         return (0);
 477 }
 478 
 479 #else   /* lint */
 480 
 481         ENTRY_NP(patch_inst)
 482         ldx     [%o0], %o2
 483         casx    [%o0], %o2, %o1
 484         flush   %o0
 485         membar #Sync
 486         ldx     [%o0], %o2
 487         retl
 488          mov    %o2, %o0
 489         SET_SIZE(patch_inst)
 490 
 491 #endif /* lint */
 492 
 493 #if defined(lint)
 494 void
 495 drmach_sys_trap()
 496 {
 497 }
 498 #else   /* lint */
 499         ENTRY_NP(drmach_sys_trap)
 500         mov     -1, %g4
 501         set     sys_trap, %g5
 502         jmp     %g5
 503          nop
 504         SET_SIZE(drmach_sys_trap)
 505 #endif /* lint */
 506 
 507 #if defined(lint)
 508 uint64_t
 509 drmach_get_stick()
 510 {
 511         return (0);
 512 }
 513 #else   /* lint */
 514         ENTRY_NP(drmach_get_stick)
 515         retl
 516         rd      STICK, %o0
 517         SET_SIZE(drmach_get_stick)
 518 #endif /* lint */
 519 
 520 #if defined(lint)
 521 /*ARGSUSED*/
 522 void
 523 drmach_flush(drmach_copy_rename_critical_t *x, uint_t y)
 524 {}
 525 
 526 #else /* lint */
 527         ENTRY_NP(drmach_flush)
 528         mov     %o0, %o2
 529 0:
 530         flush   %o2
 531         sub     %o1, 8, %o1
 532         brnz    %o1, 0b
 533          add    %o2, 8, %o2
 534         retl
 535          nop
 536         SET_SIZE(drmach_flush)
 537 #endif /* lint */


  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 /*
  28  * This file is through cpp before being used as
  29  * an inline.  It contains support routines used
  30  * only by DR for the copy-rename sequence.
  31  */
  32 



  33 #include "assym.h"
  34 #include "drmach_offsets.h"

  35 
  36 #include <sys/asm_linkage.h>
  37 #include <sys/param.h>
  38 #include <sys/privregs.h>
  39 #include <sys/spitregs.h>
  40 #include <sys/mmu.h>
  41 #include <sys/machthread.h>
  42 #include <sys/pte.h>
  43 #include <sys/stack.h>
  44 #include <sys/vis.h>
  45 #include <sys/intreg.h>
  46 #include <sys/cheetahregs.h>
  47 #include <sys/drmach.h>
  48 #include <sys/sbd_ioctl.h>
  49 


  50 /*
  51  * turn off speculative mode to prevent unwanted memory access
  52  * when we are in the FMEM loops
  53  */
  54 
  55 #define FJSV_SPECULATIVE_OFF(reg, tmp1, tmp2)                           \
  56         rdpr    %pstate, reg                                            ;\
  57         andn    reg, PSTATE_IE, tmp1                                    ;\
  58         wrpr    %g0, tmp1, %pstate                                      ;\
  59         ldxa    [%g0]ASI_MCNTL, tmp1                                    ;\
  60         set     1, tmp2                                                 ;\
  61         sllx    tmp2, MCNTL_SPECULATIVE_SHIFT, tmp2                                             ;\
  62         or      tmp1, tmp2, tmp1                                        ;\
  63         stxa    tmp1, [%g0]ASI_MCNTL                                    ;\
  64         membar #Sync

  65 
  66 






  67         .align  8
  68         ENTRY_NP(drmach_fmem_loop_script)
  69         /* turn off speculative mode */
  70         FJSV_SPECULATIVE_OFF(%o5, %o3, %o4);
  71 
  72         /* read the critical region to get everything in the cache */
  73         mov     %o0, %o3
  74 0:
  75         ldx     [%o3], %o4
  76         sub     %o1, 8, %o1
  77         brnz    %o1, 0b
  78          add    %o3, 8, %o3
  79 
  80         /* clear L2_CTRL_UGE_TRAP error bit */
  81         mov     ASI_L2_CTRL_RW_ADDR, %o1
  82         ldxa    [%o1]ASI_L2_CTRL, %o3
  83         sethi   %hi(ASI_L2_CTRL_UGE_TRAP), %o4
  84         btst    %o3, %o4
  85         bz,pn   %xcc, 1f
  86          nop


 128         andn    %o0, %o1, %o0
 129         ba      4f
 130          nop
 131 .align 32
 132 4:
 133         stxa    %o0, [%g0]ASI_MCNTL
 134         membar  #Sync
 135         wrpr    %g0, %o5, %pstate
 136         retl
 137          mov    %o4, %o0
 138 .align 8
 139 5:
 140         ALTENTRY(drmach_fmem_loop_script_rtn)
 141         /*
 142          * busy wait will affect sibling strands so
 143          * we put sleep instruction in the delay slot
 144          */
 145         ba      2b
 146 .word    0x81b01060
 147         SET_SIZE(drmach_fmem_loop_script)

 148 






 149         .align  8
 150         ENTRY_NP(drmach_flush_icache)
 151         stxa    %g0, [%g0]ASI_ALL_FLUSH_L1I
 152         membar  #Sync
 153         retl
 154          nop
 155         SET_SIZE(drmach_flush_icache)

 156 






 157 .align 32
 158         ENTRY_NP(drmach_fmem_exec_script)
 159         /* turn off speculative mode */
 160         FJSV_SPECULATIVE_OFF(%o5, %o3, %o4);
 161         /* save locals to save area */
 162         add     %o0, SAVE_LOCAL, %o2
 163         stx     %l0, [%o2+8*0]
 164         stx     %l1, [%o2+8*1]
 165         stx     %l2, [%o2+8*2]
 166         stx     %l3, [%o2+8*3]
 167         stx     %l4, [%o2+8*4]
 168         stx     %l5, [%o2+8*5]
 169         stx     %l6, [%o2+8*6]
 170         stx     %l7, [%o2+8*7]
 171         mov     %o5, %l6
 172         /* l7 is set only when FMEM cmd is issued to SCF */
 173         mov     %g0, %l7
 174 
 175         /* read the critical region to put everything in the cache */
 176         mov     %o0, %o2


 411         btst    %o3, %o4
 412         be      %xcc, 5f                ! CMD_COMPLETE is not set
 413          nop
 414         stha    %o3, [%o1]ASI_IO        ! Now we are done and clear it
 415         ba      %xcc, 6f
 416          mov    ESBD_NOERROR, %o4
 417 
 418         /* timeout delay checking */
 419 5:
 420         rd      STICK, %l2
 421         cmp     %l5, %l2
 422         bge     %xcc, 3b
 423          nop
 424         set     EOPL_FMEM_TIMEOUT, %o4
 425 
 426         /* we are done or timed out */
 427 6:
 428         ba,a    1b
 429          nop
 430         SET_SIZE(drmach_fmem_exec_script)

 431 






 432         ENTRY_NP(drmach_fmem_exec_script_end)
 433         nop
 434         SET_SIZE(drmach_fmem_exec_script_end)

 435 










 436         ENTRY_NP(patch_inst)
 437         ldx     [%o0], %o2
 438         casx    [%o0], %o2, %o1
 439         flush   %o0
 440         membar #Sync
 441         ldx     [%o0], %o2
 442         retl
 443          mov    %o2, %o0
 444         SET_SIZE(patch_inst)
 445 








 446         ENTRY_NP(drmach_sys_trap)
 447         mov     -1, %g4
 448         set     sys_trap, %g5
 449         jmp     %g5
 450          nop
 451         SET_SIZE(drmach_sys_trap)

 452 







 453         ENTRY_NP(drmach_get_stick)
 454         retl
 455         rd      STICK, %o0
 456         SET_SIZE(drmach_get_stick)

 457 







 458         ENTRY_NP(drmach_flush)
 459         mov     %o0, %o2
 460 0:
 461         flush   %o2
 462         sub     %o1, 8, %o1
 463         brnz    %o1, 0b
 464          add    %o2, 8, %o2
 465         retl
 466          nop
 467         SET_SIZE(drmach_flush)