summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2001-09-03 23:18:02 +0000
committerjake <jake@FreeBSD.org>2001-09-03 23:18:02 +0000
commit63fd66633ffeb6c7c7b55040a5fcdaf107a6be40 (patch)
tree3631965113170b8113f1d47a7bb3c25ac593ad76 /sys
parent653a513c7f48eeddc26ad80a9409809c25c5967b (diff)
downloadFreeBSD-src-63fd66633ffeb6c7c7b55040a5fcdaf107a6be40.zip
FreeBSD-src-63fd66633ffeb6c7c7b55040a5fcdaf107a6be40.tar.gz
Add ktr traces to copy{in,out} and cpu_switch.
Context switch the cwp value. The register usage in cpu_switch will be updated shortly to better reflect the fact that the current window may change.
Diffstat (limited to 'sys')
-rw-r--r--sys/sparc64/sparc64/support.S32
-rw-r--r--sys/sparc64/sparc64/support.s32
-rw-r--r--sys/sparc64/sparc64/swtch.S70
-rw-r--r--sys/sparc64/sparc64/swtch.s70
4 files changed, 198 insertions, 6 deletions
diff --git a/sys/sparc64/sparc64/support.S b/sys/sparc64/sparc64/support.S
index 15c7a68..41469f5 100644
--- a/sys/sparc64/sparc64/support.S
+++ b/sys/sparc64/sparc64/support.S
@@ -28,6 +28,8 @@
#include <machine/asi.h>
#include <machine/asmacros.h>
+#include <machine/ktr.h>
+#include <machine/pstate.h>
#include "assym.s"
@@ -181,6 +183,14 @@ END(memcpy)
*/
ENTRY(copyin)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyin: ua=%#lx ka=%#lx len=%ld"
+ , %o3, %o4, %o5, 7, 8, 9)
+ stx %o0, [%o3 + KTR_PARM1]
+ stx %o1, [%o3 + KTR_PARM2]
+ stx %o2, [%o3 + KTR_PARM3]
+9:
+#endif
COPYIN(%o0, %o1, %o2)
CATCH_END()
retl
@@ -192,6 +202,15 @@ END(copyin)
*/
ENTRY(copyinstr)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyinstr: ua=%#lx ka=%#lx len=%ld done=%p"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ stx %o1, [%g1 + KTR_PARM2]
+ stx %o2, [%g1 + KTR_PARM3]
+ stx %o3, [%g1 + KTR_PARM4]
+9:
+#endif
COPYINSTR(%o0, %o1, %o2, %o3)
CATCH_END()
retl
@@ -203,6 +222,14 @@ END(copyinstr)
*/
ENTRY(copyout)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyout: ka=%#lx ua=%#lx len=%ld"
+ , %o3, %o4, %o5, 7, 8, 9)
+ stx %o0, [%o3 + KTR_PARM1]
+ stx %o1, [%o3 + KTR_PARM2]
+ stx %o2, [%o3 + KTR_PARM3]
+9:
+#endif
COPYOUT(%o0, %o1, %o2)
CATCH_END()
retl
@@ -211,6 +238,11 @@ END(copyout)
.Lefault:
CATCH_END()
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copy{in,out}: return efault"
+ , %o0, %o1, %o2, 7, 8, 9)
+9:
+#endif
retl
mov EFAULT, %o0
diff --git a/sys/sparc64/sparc64/support.s b/sys/sparc64/sparc64/support.s
index 15c7a68..41469f5 100644
--- a/sys/sparc64/sparc64/support.s
+++ b/sys/sparc64/sparc64/support.s
@@ -28,6 +28,8 @@
#include <machine/asi.h>
#include <machine/asmacros.h>
+#include <machine/ktr.h>
+#include <machine/pstate.h>
#include "assym.s"
@@ -181,6 +183,14 @@ END(memcpy)
*/
ENTRY(copyin)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyin: ua=%#lx ka=%#lx len=%ld"
+ , %o3, %o4, %o5, 7, 8, 9)
+ stx %o0, [%o3 + KTR_PARM1]
+ stx %o1, [%o3 + KTR_PARM2]
+ stx %o2, [%o3 + KTR_PARM3]
+9:
+#endif
COPYIN(%o0, %o1, %o2)
CATCH_END()
retl
@@ -192,6 +202,15 @@ END(copyin)
*/
ENTRY(copyinstr)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyinstr: ua=%#lx ka=%#lx len=%ld done=%p"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ stx %o1, [%g1 + KTR_PARM2]
+ stx %o2, [%g1 + KTR_PARM3]
+ stx %o3, [%g1 + KTR_PARM4]
+9:
+#endif
COPYINSTR(%o0, %o1, %o2, %o3)
CATCH_END()
retl
@@ -203,6 +222,14 @@ END(copyinstr)
*/
ENTRY(copyout)
CATCH_SETUP(.Lefault)
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copyout: ka=%#lx ua=%#lx len=%ld"
+ , %o3, %o4, %o5, 7, 8, 9)
+ stx %o0, [%o3 + KTR_PARM1]
+ stx %o1, [%o3 + KTR_PARM2]
+ stx %o2, [%o3 + KTR_PARM3]
+9:
+#endif
COPYOUT(%o0, %o1, %o2)
CATCH_END()
retl
@@ -211,6 +238,11 @@ END(copyout)
.Lefault:
CATCH_END()
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "copy{in,out}: return efault"
+ , %o0, %o1, %o2, 7, 8, 9)
+9:
+#endif
retl
mov EFAULT, %o0
diff --git a/sys/sparc64/sparc64/swtch.S b/sys/sparc64/sparc64/swtch.S
index 1a5d554..e3d7466 100644
--- a/sys/sparc64/sparc64/swtch.S
+++ b/sys/sparc64/sparc64/swtch.S
@@ -28,6 +28,8 @@
#include <machine/asmacros.h>
#include <machine/asi.h>
+#include <machine/ktr.h>
+#include <machine/tstate.h>
#include "assym.s"
@@ -71,7 +73,7 @@ ENTRY(cpu_throw)
call chooseproc
ldx [PCPU(CURPROC)], %l0
flushw
- b,a sw1
+ b,a .Lsw1
END(cpu_throw)
ENTRY(cpu_switch)
@@ -82,6 +84,17 @@ ENTRY(cpu_switch)
save %sp, -CCFSZ, %sp
call chooseproc
ldx [PCPU(CURPROC)], %l0
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: from=%p (%s) to=%p (%s)"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %l0, [%g1 + KTR_PARM1]
+ add %l0, P_COMM, %g2
+ stx %g2, [%g1 + KTR_PARM2]
+ stx %o0, [%g1 + KTR_PARM3]
+ add %o0, P_COMM, %g2
+ stx %g2, [%g1 + KTR_PARM4]
+9:
+#endif
cmp %l0, %o0
be,pn %xcc, 3f
EMPTY
@@ -109,6 +122,8 @@ ENTRY(cpu_switch)
*/
1: flushw
wrpr %g0, 0, %cleanwin
+ rdpr %cwp, %l3
+ stx %l3, [%l2 + PCB_CWP]
stx %fp, [%l2 + PCB_FP]
stx %i7, [%l2 + PCB_PC]
@@ -116,7 +131,30 @@ ENTRY(cpu_switch)
* Load the new process's frame pointer and program counter, and set
* the current process and pcb.
*/
-sw1: ldx [%o0 + P_ADDR], %o1
+.Lsw1: ldx [%o0 + P_ADDR], %o1
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: to=%p pc=%#lx fp=%#lx sp=%#lx cwp=%#lx"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ ldx [%o1 + U_PCB + PCB_PC], %g2
+ stx %g2, [%g1 + KTR_PARM2]
+ ldx [%o1 + U_PCB + PCB_FP], %g2
+ stx %g2, [%g1 + KTR_PARM3]
+ sub %g2, CCFSZ, %g2
+ stx %g2, [%g1 + KTR_PARM4]
+ ldx [%o1 + U_PCB + PCB_CWP], %g2
+ stx %g2, [%g1 + KTR_PARM5]
+9:
+#endif
+#if 1
+ mov %o0, %g4
+ mov %l0, %g5
+ ldx [%o1 + U_PCB + PCB_CWP], %o2
+ wrpr %o2, %cwp
+ mov %g4, %o0
+ mov %g5, %l0
+#endif
+ ldx [%o0 + P_ADDR], %o1
ldx [%o1 + U_PCB + PCB_FP], %fp
ldx [%o1 + U_PCB + PCB_PC], %i7
sub %fp, CCFSZ, %sp
@@ -129,6 +167,14 @@ sw1: ldx [%o0 + P_ADDR], %o1
*/
ldx [%o0 + P_VMSPACE], %o2
lduw [%o2 + VM_PMAP + PM_CONTEXT], %o3
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: to=%p vm=%p context=%#x"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ stx %o2, [%g1 + KTR_PARM2]
+ stx %o3, [%g1 + KTR_PARM3]
+9:
+#endif
brz,pn %o3, 3f
EMPTY
@@ -155,6 +201,14 @@ sw1: ldx [%o0 + P_ADDR], %o1
*/
ldx [%l0 + P_VMSPACE], %l1
lduw [%l1 + VM_PMAP + PM_CONTEXT], %l3
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: from=%p vm=%p context=%#x"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %l0, [%g1 + KTR_PARM1]
+ stx %l1, [%g1 + KTR_PARM2]
+ stx %l3, [%g1 + KTR_PARM3]
+9:
+#endif
cmp %l3, %o3
be,pn %xcc, 3f
EMPTY
@@ -191,7 +245,17 @@ sw1: ldx [%o0 + P_ADDR], %o1
/*
* Done. Return and load the new process's window from the stack.
*/
-3: ret
+3:
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: return p=%p (%s)"
+ , %g1, %g2, %g3, 7, 8, 9)
+ ldx [PCPU(CURPROC)], %g2
+ stx %g2, [%g1 + KTR_PARM1]
+ add %g2, P_COMM, %g3
+ stx %g3, [%g1 + KTR_PARM2]
+9:
+#endif
+ ret
restore
END(cpu_switch)
diff --git a/sys/sparc64/sparc64/swtch.s b/sys/sparc64/sparc64/swtch.s
index 1a5d554..e3d7466 100644
--- a/sys/sparc64/sparc64/swtch.s
+++ b/sys/sparc64/sparc64/swtch.s
@@ -28,6 +28,8 @@
#include <machine/asmacros.h>
#include <machine/asi.h>
+#include <machine/ktr.h>
+#include <machine/tstate.h>
#include "assym.s"
@@ -71,7 +73,7 @@ ENTRY(cpu_throw)
call chooseproc
ldx [PCPU(CURPROC)], %l0
flushw
- b,a sw1
+ b,a .Lsw1
END(cpu_throw)
ENTRY(cpu_switch)
@@ -82,6 +84,17 @@ ENTRY(cpu_switch)
save %sp, -CCFSZ, %sp
call chooseproc
ldx [PCPU(CURPROC)], %l0
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: from=%p (%s) to=%p (%s)"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %l0, [%g1 + KTR_PARM1]
+ add %l0, P_COMM, %g2
+ stx %g2, [%g1 + KTR_PARM2]
+ stx %o0, [%g1 + KTR_PARM3]
+ add %o0, P_COMM, %g2
+ stx %g2, [%g1 + KTR_PARM4]
+9:
+#endif
cmp %l0, %o0
be,pn %xcc, 3f
EMPTY
@@ -109,6 +122,8 @@ ENTRY(cpu_switch)
*/
1: flushw
wrpr %g0, 0, %cleanwin
+ rdpr %cwp, %l3
+ stx %l3, [%l2 + PCB_CWP]
stx %fp, [%l2 + PCB_FP]
stx %i7, [%l2 + PCB_PC]
@@ -116,7 +131,30 @@ ENTRY(cpu_switch)
* Load the new process's frame pointer and program counter, and set
* the current process and pcb.
*/
-sw1: ldx [%o0 + P_ADDR], %o1
+.Lsw1: ldx [%o0 + P_ADDR], %o1
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: to=%p pc=%#lx fp=%#lx sp=%#lx cwp=%#lx"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ ldx [%o1 + U_PCB + PCB_PC], %g2
+ stx %g2, [%g1 + KTR_PARM2]
+ ldx [%o1 + U_PCB + PCB_FP], %g2
+ stx %g2, [%g1 + KTR_PARM3]
+ sub %g2, CCFSZ, %g2
+ stx %g2, [%g1 + KTR_PARM4]
+ ldx [%o1 + U_PCB + PCB_CWP], %g2
+ stx %g2, [%g1 + KTR_PARM5]
+9:
+#endif
+#if 1
+ mov %o0, %g4
+ mov %l0, %g5
+ ldx [%o1 + U_PCB + PCB_CWP], %o2
+ wrpr %o2, %cwp
+ mov %g4, %o0
+ mov %g5, %l0
+#endif
+ ldx [%o0 + P_ADDR], %o1
ldx [%o1 + U_PCB + PCB_FP], %fp
ldx [%o1 + U_PCB + PCB_PC], %i7
sub %fp, CCFSZ, %sp
@@ -129,6 +167,14 @@ sw1: ldx [%o0 + P_ADDR], %o1
*/
ldx [%o0 + P_VMSPACE], %o2
lduw [%o2 + VM_PMAP + PM_CONTEXT], %o3
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: to=%p vm=%p context=%#x"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %o0, [%g1 + KTR_PARM1]
+ stx %o2, [%g1 + KTR_PARM2]
+ stx %o3, [%g1 + KTR_PARM3]
+9:
+#endif
brz,pn %o3, 3f
EMPTY
@@ -155,6 +201,14 @@ sw1: ldx [%o0 + P_ADDR], %o1
*/
ldx [%l0 + P_VMSPACE], %l1
lduw [%l1 + VM_PMAP + PM_CONTEXT], %l3
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: from=%p vm=%p context=%#x"
+ , %g1, %g2, %g3, 7, 8, 9)
+ stx %l0, [%g1 + KTR_PARM1]
+ stx %l1, [%g1 + KTR_PARM2]
+ stx %l3, [%g1 + KTR_PARM3]
+9:
+#endif
cmp %l3, %o3
be,pn %xcc, 3f
EMPTY
@@ -191,7 +245,17 @@ sw1: ldx [%o0 + P_ADDR], %o1
/*
* Done. Return and load the new process's window from the stack.
*/
-3: ret
+3:
+#if KTR_COMPILE & KTR_CT1
+ CATR(KTR_CT1, "cpu_switch: return p=%p (%s)"
+ , %g1, %g2, %g3, 7, 8, 9)
+ ldx [PCPU(CURPROC)], %g2
+ stx %g2, [%g1 + KTR_PARM1]
+ add %g2, P_COMM, %g3
+ stx %g3, [%g1 + KTR_PARM2]
+9:
+#endif
+ ret
restore
END(cpu_switch)
OpenPOWER on IntegriCloud