summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2011-05-11 21:10:43 +0000
committermarius <marius@FreeBSD.org>2011-05-11 21:10:43 +0000
commit0bddc6598ec0e5296369283d3869b75e140109dd (patch)
treec7ce021fb885f7a6841b0bbcb20e996f0b2f32e5 /sys/sparc64
parentb9d59669da825f7c04b5808e9576c387e2a66a35 (diff)
downloadFreeBSD-src-0bddc6598ec0e5296369283d3869b75e140109dd.zip
FreeBSD-src-0bddc6598ec0e5296369283d3869b75e140109dd.tar.gz
Update for the fact that pm_active and pc_cpumask were changed to cpuset_t.
This now calculates pc_cpumask based on pc_cpuid itself as the former is slated for being deorbited. This branch now at least boots UP again. MP needs more things converted and the existing conversion from cpumask_t to cpuset_t still has bugs.
Diffstat (limited to 'sys/sparc64')
-rw-r--r--sys/sparc64/sparc64/genassym.c3
-rw-r--r--sys/sparc64/sparc64/swtch.S40
2 files changed, 32 insertions, 11 deletions
diff --git a/sys/sparc64/sparc64/genassym.c b/sys/sparc64/sparc64/genassym.c
index c0d268b..752f38b 100644
--- a/sys/sparc64/sparc64/genassym.c
+++ b/sys/sparc64/sparc64/genassym.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/smp.h>
#include <sys/vmmeter.h>
+#include <sys/_cpuset.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
@@ -66,6 +67,8 @@ ASSYM(PCPU_PAGES, PCPU_PAGES);
ASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT);
+ASSYM(_NCPUBITS, _NCPUBITS);
+
#ifdef SUN4U
ASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL);
#endif
diff --git a/sys/sparc64/sparc64/swtch.S b/sys/sparc64/sparc64/swtch.S
index ea13779..7515734 100644
--- a/sys/sparc64/sparc64/swtch.S
+++ b/sys/sparc64/sparc64/swtch.S
@@ -164,20 +164,29 @@ ENTRY(cpu_switch)
* If there was no non-kernel pmap, don't try to deactivate it.
*/
brz,pn %l2, 3f
- lduw [PCPU(CPUMASK)], %l4
+ lduw [PCPU(CPUID)], %l3
/*
* Mark the pmap of the last non-kernel vmspace to run as no longer
* active on this CPU.
*/
- lduw [%l2 + PM_ACTIVE], %l3
- andn %l3, %l4, %l3
- stw %l3, [%l2 + PM_ACTIVE]
+ mov _NCPUBITS, %l5
+ mov %g0, %y
+ udiv %l3, %l5, %l6
+ srl %l6, 0, %l4
+ sllx %l4, PTR_SHIFT, %l4
+ add %l4, PM_ACTIVE, %l4
+ smul %l6, %l5, %l5
+ sub %l3, %l5, %l5
+ mov 1, %l6
+ sllx %l6, %l5, %l5
+ ldx [%l2 + %l4], %l6
+ andn %l6, %l5, %l6
+ stx %l6, [%l2 + %l4]
/*
* Take away its context number.
*/
- lduw [PCPU(CPUID)], %l3
sllx %l3, INT_SHIFT, %l3
add %l2, PM_CONTEXT, %l4
mov -1, %l5
@@ -210,18 +219,27 @@ ENTRY(cpu_switch)
/*
* Set the new context number in the pmap.
*/
- lduw [PCPU(CPUID)], %i4
- sllx %i4, INT_SHIFT, %i4
+ lduw [PCPU(CPUID)], %l3
+ sllx %l3, INT_SHIFT, %i4
add %l1, PM_CONTEXT, %i5
stw %i3, [%i4 + %i5]
/*
* Mark the pmap as active on this CPU.
*/
- lduw [%l1 + PM_ACTIVE], %i4
- lduw [PCPU(CPUMASK)], %i5
- or %i4, %i5, %i4
- stw %i4, [%l1 + PM_ACTIVE]
+ mov _NCPUBITS, %l5
+ mov %g0, %y
+ udiv %l3, %l5, %l6
+ srl %l6, 0, %l4
+ sllx %l4, PTR_SHIFT, %l4
+ add %l4, PM_ACTIVE, %l4
+ smul %l6, %l5, %l5
+ sub %l3, %l5, %l5
+ mov 1, %l6
+ sllx %l6, %l5, %l5
+ ldx [%l1 + %l4], %l6
+ or %l6, %l5, %l6
+ stx %l6, [%l1 + %l4]
/*
* Make note of the change in pmap.
OpenPOWER on IntegriCloud