From 18836eac489a689fc7da694e5ee5e1fc5f112003 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sun, 2 Dec 2007 15:26:30 +0000 Subject: 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 MFC After: 3 days --- sys/arm/arm/pmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/arm') diff --git a/sys/arm/arm/pmap.c b/sys/arm/arm/pmap.c index 71d74291ad6e..27ff426a48ff 100644 --- a/sys/arm/arm/pmap.c +++ b/sys/arm/arm/pmap.c @@ -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--; /* -- cgit v1.2.3