summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2002-02-27 00:21:04 +0000
committerjake <jake@FreeBSD.org>2002-02-27 00:21:04 +0000
commitaec950ed91b8b8213beef80d37b79183490697d3 (patch)
tree9694484fd890994f0ad4b37a22a46ed7fe961c05 /sys/sparc64
parentcc951d5968f59364cb20b34e3d9cae4fe628aaf0 (diff)
downloadFreeBSD-src-aec950ed91b8b8213beef80d37b79183490697d3.zip
FreeBSD-src-aec950ed91b8b8213beef80d37b79183490697d3.tar.gz
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.
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 bcd1af7..13eb625 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 bd0f2a4..72cf69c 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 edbfabe..09dc4bd 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 acd6f7f..a738c73 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 039882e..2a29a23 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 c2d6c0b..c69d153 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 c2d6c0b..c69d153 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
OpenPOWER on IntegriCloud