>> +static void test_iep(void) >> +{ >> + uint16_t *code; >> + uint8_t *iepbuf = NULL; >> + void (*fn)(void); >> + >> + /* Enable IEP */ >> + ctl_set_bit(0, 20); >> + >> + /* Get and protect a page with the IEP bit */ >> + iepbuf = alloc_page(); >> + protect_page(iepbuf, PAGE_ENTRY_IEP); >> + >> + /* Code branches into r14 which contains the return address. */ >> + code = (uint16_t *)iepbuf; >> + *code = 0x07fe; >> + fn = (void *)code; > > Not sure if I've got Christian's comment wrt to ipte right, but if I did > (Christian, please correct me if I'm wrong), I think it's better to move > the "protect_page(iepbuf, PAGE_ENTRY_IEP)" here, so that the ipte is > called after you've modified the contents of the page. Why? When we replace the entry (protect), we do an ipte. Next access will reload the right page table entry including protection. What am I missing? -- Thanks, David / dhildenb