Date: Fri, 28 Jul 2006 00:59:08 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 102621 for review Message-ID: <200607280059.k6S0x8l0051550@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=102621 Change 102621 by jb@jb_freebsd2 on 2006/07/28 00:58:37 Include the common asm source which is separeately included inline in other asm code. Affected files ... .. //depot/projects/dtrace/src/sys/sun4v/sun4v/cpu_snapshot_save.S#3 edit Differences ... ==== //depot/projects/dtrace/src/sys/sun4v/sun4v/cpu_snapshot_save.S#3 (text+ko) ==== @@ -2,151 +2,14 @@ #include <machine/asi.h> #include <machine/asmacros.h> #include <machine/cpu_snapshot.h> -#ifdef _KERNEL #include "assym.s" -#endif -#define STACK_G1 SPOFF -#define STACK_G2 SPOFF + 0x08 -#define STACK_G3 SPOFF + 0x10 -#define STACK_G4 SPOFF + 0x18 -#define STACK_FREEC SPOFF + 0x20 -#define STACK_FREEB SPOFF + 0x28 -#define STACK_FREEA SPOFF + 0x30 -#define STACK_FREE9 SPOFF + 0x38 -#define STACK_FREE8 SPOFF + 0x40 -#define STACK_FREE7 SPOFF + 0x48 -#define STACK_FREE6 SPOFF + 0x50 -#define STACK_FREE5 SPOFF + 0x58 -#define STACK_FREE4 SPOFF + 0x60 -#define STACK_FREE3 SPOFF + 0x68 -#define STACK_FREE2 SPOFF + 0x70 -#define STACK_FREE1 SPOFF + 0x78 -#define STACK_SIZE 0x80 +#define CPU_SNAPSHOT_FUNC ENTRY(cpu_snapshot_save) - /* Create room on the stack for this leaf-function. */ - sub %sp, STACK_SIZE, %sp - /* Save registers used in this function on the stack. */ - stx %g1, [ %sp + STACK_G1 ] ! cpu - stx %g2, [ %sp + STACK_G2 ] ! Ptr to struct cpu_snapshot - stx %g3, [ %sp + STACK_G3 ] ! i - stx %g4, [ %sp + STACK_G4 ] ! Temporary value. - - /* Get the current CPU number. */ -#ifdef _KERNEL - lduw [ PCPU(CPUID) ], %g1 -#else - mov %g0, %g1 -#endif - - /* - * Multiply the CPU ID by the size of the per-cpu array entry - * to get the offset to the start of the CPU specific array. - */ - sllx %g1, N_CPU_SNAPSHOT_BITS + CPU_SNAPSHOT_BITS, %g1 - - /* Get the address of cpu_snapshot_data. */ - sethi %hi(cpu_snapshot_data), %g2 - or %g2, %lo(cpu_snapshot_data), %g2 - - /* - * Offset the cpu_snapshot_data point to get the address of - * cpu_snapshot_data[cpuid][0]. - */ - add %g2, %g1, %g2 - - /* Initialise the loop variable (i). */ - mov %g0, %g3 - - /* Enter a loop... */ - cmp %g3, N_CPU_SNAPSHOT - bge,pn %icc, .cpu_snapshot_save_4 - -.cpu_snapshot_save_1: - /* if p->r_o7 == 0, goto .cpu_snapshot_save_2 */ - ldx [ %g2 + CPU_SNAPSHOT_R_O7 ], %g4 - brz,pn %g4, .cpu_snapshot_save_2 - nop - - /* if p->r_o7 == %o7 goto .cpu_snapshot_save_2 */ - cmp %g4, %o7 - be,pn %icc, .cpu_snapshot_save_2 - nop - - ba,a .cpu_snapshot_save_3 - nop +#include "machine/cpu_snapshot_save.h" -.cpu_snapshot_save_2: - /* Increment the call count. */ - ldx [ %g2 + CPU_SNAPSHOT_COUNT ], %g4 - inc %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_COUNT ] - - /* Save the registers in struct cpu_snapshot. */ - stx %i0, [ %g2 + CPU_SNAPSHOT_R_I0 ] - stx %i1, [ %g2 + CPU_SNAPSHOT_R_I1 ] - stx %i2, [ %g2 + CPU_SNAPSHOT_R_I2 ] - stx %i3, [ %g2 + CPU_SNAPSHOT_R_I3 ] - stx %i4, [ %g2 + CPU_SNAPSHOT_R_I4 ] - stx %i5, [ %g2 + CPU_SNAPSHOT_R_I5 ] - stx %i6, [ %g2 + CPU_SNAPSHOT_R_I6 ] - stx %i7, [ %g2 + CPU_SNAPSHOT_R_I7 ] - stx %o0, [ %g2 + CPU_SNAPSHOT_R_O0 ] - stx %o1, [ %g2 + CPU_SNAPSHOT_R_O1 ] - stx %o2, [ %g2 + CPU_SNAPSHOT_R_O2 ] - stx %o3, [ %g2 + CPU_SNAPSHOT_R_O3 ] - stx %o4, [ %g2 + CPU_SNAPSHOT_R_O4 ] - stx %o5, [ %g2 + CPU_SNAPSHOT_R_O5 ] - stx %o6, [ %g2 + CPU_SNAPSHOT_R_O6 ] - stx %o7, [ %g2 + CPU_SNAPSHOT_R_O7 ] - stx %o7, [ %g2 + CPU_SNAPSHOT_R_O7 ] - ldx [ %sp + STACK_G1 ], %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_R_G1 ] - ldx [ %sp + STACK_G2 ], %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_R_G2 ] - ldx [ %sp + STACK_G3 ], %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_R_G3 ] - ldx [ %sp + STACK_G4 ], %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_R_G4 ] - stx %g5, [ %g2 + CPU_SNAPSHOT_R_G5 ] - stx %g6, [ %g2 + CPU_SNAPSHOT_R_G6 ] - stx %g7, [ %g2 + CPU_SNAPSHOT_R_G7 ] -#ifdef _KERNEL - rdpr %pstate, %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_PSTATE ] - rdpr %tick, %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_TICK ] - rdpr %pil, %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_PIL ] - rdpr %tl, %g4 - stx %g4, [ %g2 + CPU_SNAPSHOT_TL ] -#endif - - ba,a .cpu_snapshot_save_4 - nop - -.cpu_snapshot_save_3: - /* Increment the loop variable. */ - inc %g3 - - /* Point to the next array entry. */ - add %g2, CPU_SNAPSHOT_SIZE, %g2 - - cmp %g3, N_CPU_SNAPSHOT - bl %icc, .cpu_snapshot_save_1 - -.cpu_snapshot_save_4: - - /* Restore saved registers. */ - ldx [ %sp + STACK_G1 ], %g1 - ldx [ %sp + STACK_G2 ], %g2 - ldx [ %sp + STACK_G3 ], %g3 - ldx [ %sp + STACK_G4 ], %g4 - - /* Restore the stack before returning. */ - add %sp, STACK_SIZE, %sp retl - nop + nop END(cpu_snapshot_save)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607280059.k6S0x8l0051550>