/* Calculate settings for sub-regions in a 32K page  */
static int mpu_page_srd(struct mm_struct *mm, unsigned long a, unsigned long f)
/* Calculate settings for sub-regions in a 32K page  */
static int mpu_page_srd(struct mm_struct *mm, unsigned long a, unsigned long f)
{
	mpu_addr_region_t *r;
	unsigned long pb;
	unsigned long pt;
	unsigned long p;
	unsigned int srd;
	unsigned int x;
	int s;
	r = mpu_addr_region_find(a);
	if (! r) {
		goto Done;
	}
	pb = a & PAGE32K_MASK;
	pt = pb + PAGE32K_SIZE;
	for (srd = 0xFF, s = 0, p = pb + PAGE_SIZE-1;
	     p < pt; p += PAGE_SIZE, s ++) {
		x = mpu_context_addr_valid_for_region(mm, r, p, f);
		srd &= ~(x << s);
	}
Done:	return srd;
}