Fix a potential bug in pmap :

We used to allocate the domains 0-14 for userland, and leave the domain 15
for the kernel. Now supersections requires the use of domain 0, so we
switched the kernel domain to 0, and use 1-15 for userland.
How it's done currently, the kernel domain could be allocated for a
userland process.
So switch back to the previous way we did things, set the first available
domain to 0, and just add 1 to get the real domain number in the struct pmap.

Reported by:	Mark Tinguely <tinguely AT casselton DOT net>
MFC After:	3 days
This commit is contained in:
Olivier Houchard 2007-12-02 15:26:30 +00:00
parent 35af41b0a6
commit 18836eac48

View File

@ -430,10 +430,10 @@ pmap_init_l1(struct l1_ttable *l1, pd_entry_t *l1pt)
l1->l1_kva = l1pt;
l1->l1_domain_use_count = 0;
l1->l1_domain_first = 1;
l1->l1_domain_first = 0;
for (i = 0; i < PMAP_DOMAINS; i++)
l1->l1_domain_free[i] = i + 2;
l1->l1_domain_free[i] = i + 1;
/*
* Copy the kernel's L1 entries to each new L1.
@ -787,7 +787,7 @@ pmap_alloc_l1(pmap_t pm)
* Fix up the relevant bits in the pmap structure
*/
pm->pm_l1 = l1;
pm->pm_domain = domain;
pm->pm_domain = domain + 1;
}
/*
@ -810,8 +810,8 @@ pmap_free_l1(pmap_t pm)
/*
* Free up the domain number which was allocated to the pmap
*/
l1->l1_domain_free[pm->pm_domain] = l1->l1_domain_first;
l1->l1_domain_first = pm->pm_domain;
l1->l1_domain_free[pm->pm_domain - 1] = l1->l1_domain_first;
l1->l1_domain_first = pm->pm_domain - 1;
l1->l1_domain_use_count--;
/*