Page MenuHomeFreeBSD

D16893.id47270.diff
No OneTemporary

D16893.id47270.diff

Index: sys/amd64/amd64/mp_machdep.c
===================================================================
--- sys/amd64/amd64/mp_machdep.c
+++ sys/amd64/amd64/mp_machdep.c
@@ -58,7 +58,6 @@
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_kern.h>
-#include <vm/vm_map.h>
#include <vm/vm_extern.h>
#include <x86/apicreg.h>
@@ -343,7 +342,6 @@
while (atomic_load_acq_int(&aps_ready) == 0)
ia32_pause();
- pmap_activate_boot(vmspace_pmap(proc0.p_vmspace));
init_secondary_tail();
}
Index: sys/i386/i386/pmap.c
===================================================================
--- sys/i386/i386/pmap.c
+++ sys/i386/i386/pmap.c
@@ -2000,9 +2000,9 @@
#endif
pmap->pm_root.rt_root = 0;
CPU_ZERO(&pmap->pm_active);
- PCPU_SET(curpmap, pmap);
TAILQ_INIT(&pmap->pm_pvchunk);
bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
+ pmap_activate_boot(pmap);
}
/*
@@ -5804,6 +5804,20 @@
critical_exit();
}
+void
+pmap_activate_boot(pmap_t pmap)
+{
+ u_int cpuid;
+
+ cpuid = PCPU_GET(cpuid);
+#if defined(SMP)
+ CPU_SET_ATOMIC(cpuid, &pmap->pm_active);
+#else
+ CPU_SET(cpuid, &pmap->pm_active);
+#endif
+ PCPU_SET(curpmap, pmap);
+}
+
void
pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz)
{
Index: sys/i386/i386/swtch.s
===================================================================
--- sys/i386/i386/swtch.s
+++ sys/i386/i386/swtch.s
@@ -74,9 +74,6 @@
*/
ENTRY(cpu_throw)
movl PCPU(CPUID), %esi
- movl 4(%esp),%ecx /* Old thread */
- testl %ecx,%ecx /* no thread? */
- jz 1f
/* release bit from old pm_active */
movl PCPU(CURPMAP), %ebx
#ifdef SMP
Index: sys/i386/include/pmap.h
===================================================================
--- sys/i386/include/pmap.h
+++ sys/i386/include/pmap.h
@@ -373,6 +373,7 @@
* is called: pmap_kenter(), pmap_kextract(), pmap_kremove(), vtophys(), and
* vtopte().
*/
+void pmap_activate_boot(pmap_t pmap);
void pmap_bootstrap(vm_paddr_t);
int pmap_cache_bits(pmap_t, int mode, boolean_t is_pde);
int pmap_change_attr(vm_offset_t, vm_size_t, int);
Index: sys/x86/x86/mp_x86.c
===================================================================
--- sys/x86/x86/mp_x86.c
+++ sys/x86/x86/mp_x86.c
@@ -62,6 +62,7 @@
#include <vm/pmap.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
+#include <vm/vm_map.h>
#include <x86/apicreg.h>
#include <machine/clock.h>
@@ -967,6 +968,8 @@
{
u_int cpuid;
+ pmap_activate_boot(vmspace_pmap(proc0.p_vmspace));
+
/*
* On real hardware, switch to x2apic mode if possible. Do it
* after aps_ready was signalled, to avoid manipulating the

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 27, 7:02 PM (7 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16199501
Default Alt Text
D16893.id47270.diff (2 KB)

Event Timeline