SMP - Free PDE slots are split among CPU

- cross-address space copies use these slots to map user memory for
  kernel. This avoid any collisions between CPUs

- well, we only have a single CPU running at a time, this is just to
  be safe for the future
This commit is contained in:
Tomas Hruby 2010-09-15 14:10:36 +00:00
parent 1e273f640e
commit 93b9873a56

View file

@ -31,7 +31,8 @@ PUBLIC int i386_paging_enabled = 0;
PRIVATE int psok = 0;
#define MAX_FREEPDES (3 * CONFIG_MAX_CPUS)
#define FREE_PDES_PER_CPU 3
#define MAX_FREEPDES (FREE_PDES_PER_CPU * CONFIG_MAX_CPUS)
PRIVATE int nfreepdes = 0, freepdes[MAX_FREEPDES];
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
@ -79,7 +80,12 @@ PRIVATE phys_bytes createpde(
phys_bytes offset;
int pde;
assert(free_pde_idx >= 0 && free_pde_idx < nfreepdes);
assert(free_pde_idx >= 0 && free_pde_idx < FREE_PDES_PER_CPU);
/* make the index CPU local */
free_pde_idx += cpuid * FREE_PDES_PER_CPU;
assert(free_pde_idx < nfreepdes);
pde = freepdes[free_pde_idx];
assert(pde >= 0 && pde < 1024);