/* Fill in a next available MPU protection region with a specified mapping. If needed, this swaps out an existing mapping using a simple round-robin algorithm, which affects only MPU regions that have the priority above the barrier (i.e. all regions below barrier are locked).  */
static void mpu_page_map(struct mm_struct *mm, unsigned long a, unsigned int s, unsigned int sz, unsigned int acs, unsigned int srd, unsigned int xn)
/* Fill in a next available MPU protection region with a specified mapping. If needed, this swaps out an existing mapping using a simple round-robin algorithm, which affects only MPU regions that have the priority above the barrier (i.e. all regions below barrier are locked).  */
static void mpu_page_map(struct mm_struct *mm, unsigned long a, unsigned int s, unsigned int sz, unsigned int acs, unsigned int srd, unsigned int xn)
{
	mpu_context_t *p = mpu_context_p(mm);
	unsigned int i = p->indx;
	unsigned int b = a & ~(s - 1);
	unsigned int t = 0x1 | sz<<1 | acs<<24 | srd<<8 | xn<<28;
	p->mpu_regs[i].base = b;
	p->mpu_regs[i].attr = t;
	mpu_region_write(i, b, t);
	p->indx = i == 7 ? p->barrier : i + 1;
}