From 75c6786401f0df2509ad51707f788c8044433887 Mon Sep 17 00:00:00 2001 From: Jake Burkholder Date: Sun, 30 Sep 2001 18:42:56 +0000 Subject: [PATCH] Don't overflow the ktr buffer . --- sys/sparc64/include/ktr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/sparc64/include/ktr.h b/sys/sparc64/include/ktr.h index 4b8e7df6a7a4..7a48503a5e87 100644 --- a/sys/sparc64/include/ktr.h +++ b/sys/sparc64/include/ktr.h @@ -47,6 +47,7 @@ /* * XXX doesn't do timestamp or ktr_cpu. + * XXX could really use another register. */ #define ATR(desc, r1, r2, r3, l1, l2) \ .sect .rodata ; \ @@ -55,6 +56,9 @@ l1 ## : .asciz desc ; \ set ktr_idx, r1 ; \ lduw [r1], r2 ; \ l2 ## : add r2, 1, r3 ; \ + set KTR_ENTRIES - 1, r1 ; \ + and r3, r1, r3 ; \ + set ktr_idx, r1 ; \ casa [r1] ASI_N, r2, r3 ; \ cmp r2, r3 ; \ bne %icc, l2 ## b ; \