aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64
diff options
context:
space:
mode:
authorJake Burkholder <jake@FreeBSD.org>2002-02-27 00:21:04 +0000
committerJake Burkholder <jake@FreeBSD.org>2002-02-27 00:21:04 +0000
commit5d60dc233a8551a64fd7ba853fea452dd8ac4850 (patch)
tree9694484fd890994f0ad4b37a22a46ed7fe961c05 /sys/sparc64
parent7a8ee66881c176ecfa2ba7958b8f6418975543b8 (diff)
downloadsrc-5d60dc233a8551a64fd7ba853fea452dd8ac4850.tar.gz
src-5d60dc233a8551a64fd7ba853fea452dd8ac4850.zip
Add a macro for shift of an integer (1 << shift == sizeof). Move the pointer
define to live alongside it. For kicks assert at compile time that they are correct. Use these instead of magic numbers.
Notes
Notes: svn path=/head/; revision=91336
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/include/frame.h1
-rw-r--r--sys/sparc64/include/param.h3
-rw-r--r--sys/sparc64/sparc64/genassym.c4
-rw-r--r--sys/sparc64/sparc64/machdep.c3
-rw-r--r--sys/sparc64/sparc64/rwindow.c1
-rw-r--r--sys/sparc64/sparc64/swtch.S4
-rw-r--r--sys/sparc64/sparc64/swtch.s4
7 files changed, 13 insertions, 7 deletions
diff --git a/sys/sparc64/include/frame.h b/sys/sparc64/include/frame.h
index bcd1af7720c4..13eb625ad6db 100644
--- a/sys/sparc64/include/frame.h
+++ b/sys/sparc64/include/frame.h
@@ -29,7 +29,6 @@
#ifndef _MACHINE_FRAME_H_
#define _MACHINE_FRAME_H_
-#define PTR_SHIFT 3
#define RW_SHIFT 7
#define SPOFF 2047
diff --git a/sys/sparc64/include/param.h b/sys/sparc64/include/param.h
index bd0f2a486946..72cf69c28039 100644
--- a/sys/sparc64/include/param.h
+++ b/sys/sparc64/include/param.h
@@ -82,6 +82,9 @@
#define MAXCPU 1
#endif /* SMP */
+#define INT_SHIFT 2
+#define PTR_SHIFT 3
+
#define ALIGNBYTES _ALIGNBYTES
#define ALIGN(p) _ALIGN(p)
diff --git a/sys/sparc64/sparc64/genassym.c b/sys/sparc64/sparc64/genassym.c
index edbfabe72d45..09dc4bd2a75a 100644
--- a/sys/sparc64/sparc64/genassym.c
+++ b/sys/sparc64/sparc64/genassym.c
@@ -97,6 +97,9 @@ ASSYM(TSB_BUCKET_ADDRESS_BITS, TSB_BUCKET_ADDRESS_BITS);
ASSYM(TSB_BUCKET_SHIFT, TSB_BUCKET_SHIFT);
ASSYM(TSB_KERNEL_MASK, TSB_KERNEL_MASK);
+ASSYM(INT_SHIFT, INT_SHIFT);
+ASSYM(PTR_SHIFT, PTR_SHIFT);
+
ASSYM(PAGE_SHIFT, PAGE_SHIFT);
ASSYM(PAGE_MASK, PAGE_MASK);
@@ -187,7 +190,6 @@ ASSYM(P_SFLAG, offsetof(struct proc, p_sflag));
ASSYM(P_VMSPACE, offsetof(struct proc, p_vmspace));
ASSYM(RW_SHIFT, RW_SHIFT);
-ASSYM(PTR_SHIFT, PTR_SHIFT);
ASSYM(KE_FLAGS, offsetof(struct kse, ke_flags));
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index acd6f7f2f498..a738c730735f 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -137,6 +137,9 @@ void sparc64_shutdown_final(void *dummy, int howto);
static void cpu_startup(void *);
SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
+CTASSERT((1 << INT_SHIFT) == sizeof(int));
+CTASSERT((1 << PTR_SHIFT) == sizeof(char *));
+
CTASSERT(sizeof(struct pcpu) <= (PAGE_SIZE / 2));
static void
diff --git a/sys/sparc64/sparc64/rwindow.c b/sys/sparc64/sparc64/rwindow.c
index 039882e42076..2a29a23ceda4 100644
--- a/sys/sparc64/sparc64/rwindow.c
+++ b/sys/sparc64/sparc64/rwindow.c
@@ -38,7 +38,6 @@
#include <machine/frame.h>
CTASSERT((1 << RW_SHIFT) == sizeof(struct rwindow));
-CTASSERT((1 << PTR_SHIFT) == sizeof(char *));
int
rwindow_load(struct thread *td, struct trapframe *tf, int n)
diff --git a/sys/sparc64/sparc64/swtch.S b/sys/sparc64/sparc64/swtch.S
index c2d6c0b2352f..c69d153706f5 100644
--- a/sys/sparc64/sparc64/swtch.S
+++ b/sys/sparc64/sparc64/swtch.S
@@ -136,7 +136,7 @@ ENTRY(cpu_switch)
* tsb.
*/
lduw [PCPU(CPUID)], %l3
- sllx %l3, 2, %l3
+ sllx %l3, INT_SHIFT, %l3
add %l2, VM_PMAP + PM_CONTEXT, %l4
lduw [%l3 + %l4], %l5
brz,a,pn %l5, 3f
@@ -164,7 +164,7 @@ ENTRY(cpu_switch)
* If the new process has nucleus context we are done.
*/
3: lduw [PCPU(CPUID)], %o3
- sllx %o3, 2, %o3
+ sllx %o3, INT_SHIFT, %o3
add %o2, VM_PMAP + PM_CONTEXT, %o4
lduw [%o3 + %o4], %o5
brz,a,pn %o5, 4f
diff --git a/sys/sparc64/sparc64/swtch.s b/sys/sparc64/sparc64/swtch.s
index c2d6c0b2352f..c69d153706f5 100644
--- a/sys/sparc64/sparc64/swtch.s
+++ b/sys/sparc64/sparc64/swtch.s
@@ -136,7 +136,7 @@ ENTRY(cpu_switch)
* tsb.
*/
lduw [PCPU(CPUID)], %l3
- sllx %l3, 2, %l3
+ sllx %l3, INT_SHIFT, %l3
add %l2, VM_PMAP + PM_CONTEXT, %l4
lduw [%l3 + %l4], %l5
brz,a,pn %l5, 3f
@@ -164,7 +164,7 @@ ENTRY(cpu_switch)
* If the new process has nucleus context we are done.
*/
3: lduw [PCPU(CPUID)], %o3
- sllx %o3, 2, %o3
+ sllx %o3, INT_SHIFT, %o3
add %o2, VM_PMAP + PM_CONTEXT, %o4
lduw [%o3 + %o4], %o5
brz,a,pn %o5, 4f