- When syncing smp pagetable entries, sync with reference ptab.

This commit is contained in:
Jan Stoess 2008-01-08 16:45:00 +01:00
parent e86e396e72
commit 0d972ce1e5
2 changed files with 16 additions and 13 deletions

View File

@ -1,6 +1,6 @@
/*********************************************************************
*
* Copyright (C) 2002, 2004-2007, Karlsruhe University
* Copyright (C) 2002, 2004-2008, Karlsruhe University
*
* File path: glue/v4-x86/x32/space.cc
* Description: address space management
@ -42,6 +42,7 @@
#include INC_ARCH(trapgate.h)
#include INC_ARCH(pgent.h)
#include INC_GLUE(cpu.h)
#include INC_GLUE(memory.h)
#include INC_GLUE(space.h)
#include INC_API(kernelinterface.h)
@ -159,13 +160,13 @@ void pgent_t::smp_sync(space_t * space, pgsize_e pgsize)
{
if (pgsize != size_4m) return;
for (cpuid_t cpu = 0; cpu < CONFIG_SMP_MAX_CPUS; cpu++)
if (cpu != current_cpu && space->data.cpu_ptab[cpu].top_pdir)
for (cpuid_t cpu = 0; cpu < cpu_t::count; cpu++)
if (cpu != space->data.reference_ptab && space->data.cpu_ptab[cpu].top_pdir)
{
//TRACEF("smp sync %d / %x -> %d / %x\n",
// current_cpu, space->pgent(idx(), current_cpu),
// cpu, space->pgent(idx(), cpu));
*space->pgent(idx(), cpu) = *space->pgent(idx(), current_cpu);
TRACE("smp sync %d / %x -> %d / %x\n",
space->data.reference_ptab, space->pgent(idx(), space->data.reference_ptab),
cpu, space->pgent(idx(), cpu));
*space->pgent(idx(), cpu) = *space->pgent(idx(), space->data.reference_ptab);
}
}

View File

@ -43,6 +43,7 @@
#include INC_ARCH(trapgate.h)
#include INC_ARCH(pgent.h)
#include INC_GLUE(cpu.h)
#include INC_GLUE(memory.h)
#include INC_GLUE(space.h)
@ -70,13 +71,13 @@ void pgent_t::smp_sync(space_t * space, pgsize_e pgsize)
{
case size_512g:
for (cpuid_t cpu = 0; cpu < CONFIG_SMP_MAX_CPUS; cpu++)
if (cpu != current_cpu && space->get_top_pdir(cpu))
if (cpu != space->data.reference_ptab && space->get_top_pdir(cpu))
{
//TRACEF("smp sync pml4 %d / %x -> %d / %x\n",
// current_cpu, space->pgent(idx(), current_cpu),
// space->data.reference_ptab, space->pgent(idx(), space->data.reference_ptab),
// cpu, space->pgent(idx(), cpu));
*space->pgent(idx(), cpu) = *space->pgent(idx(), current_cpu);
*space->pgent(idx(), cpu) = *space->pgent(idx(), space->data.reference_ptab);
}
break;
case size_1g:
@ -84,16 +85,17 @@ void pgent_t::smp_sync(space_t * space, pgsize_e pgsize)
if (!is_cpulocal(space, size_1g) &&
(this - idx() == space->get_top_pdir()->get_kernel_pdp_pgent()))
{
ASSERT(space->get_top_pdir(current_cpu)->get_kernel_pdp());
ASSERT(space->get_top_pdir(space->data.reference_ptab)->get_kernel_pdp());
for (cpuid_t cpu = 0; cpu < CONFIG_SMP_MAX_CPUS; cpu++)
if (cpu != current_cpu && space->get_top_pdir(cpu) && space->get_top_pdir(cpu)->get_kernel_pdp_pgent())
if (cpu != space->data.reference_ptab && space->get_top_pdir(cpu) &&
space->get_top_pdir(cpu)->get_kernel_pdp_pgent())
{
//TRACEF("smp sync kernel pdp %x idx %d cpu %d cpulocal = %s\n",
// this - idx(), idx(), cpu,
// (is_cpulocal(s, size_2m) ? "cpulocal" : "global"));
*space->get_top_pdir(cpu)->get_kernel_pdp_pgent()->next(space, size_2m, idx()) =
*space->get_top_pdir(current_cpu)->get_kernel_pdp_pgent()->next(space, size_2m, idx());
*space->get_top_pdir(space->data.reference_ptab)->get_kernel_pdp_pgent()->next(space, size_2m, idx());
}
break;
}