Hi all, On page 26 of the manual (1.2) there's an instruction on how to restart a thread following a capability fault. The program counter where the faulting thread should pick up execution is said to be message register 0. What I'm trying to do is to restart the execution on the next instruction following the system call instruction so as to skip it. Try as I might, it will not work and the faulting thread is stuck in an endless number of faults. Below is the relevant code: seL4_Word pc = seL4_GetMR(0); printf("cap fault, pc: %08x, on %s\n",pc,seL4_GetMR(2)?"wait":"send"); //assert(!faultnum++); seL4_MessageInfo_t info = seL4_MessageInfo_new (seL4_CapFault,0,0,1); seL4_SetMR(0,pc + 4); seL4_Reply(info); It does restart, but immediately cap-faults again at the very same program counter. Is it supposed to work? What did I do wrong? Cheers, David
Hi David, You are pretty close. The problem is that the fault message contains the instruction pointer that the fault occured in MR1, sending a message back in MR1 will not change the current instruction pointer for the thread. Instead, you need to do the following to alter the instruction pointer of the thread: seL4_UserContext_t context; error = seL4_TCB_ReadRegisters(faulting_thread_tcb, false, 0, sizeof(seL4_UserContext)/sizeof(seL4_Word), ®s); assert(error == seL4_NoError); context.pc += 4 // this will work for arm, it's 2 and eip on x86 error = seL4_TCB_WriteRegisters(faulting_thread_tcb, true, 0, sizeof(seL4_UserContext)/sizeof(seL4_Word), ®s); assert(error != seL4_NoError); seL4_Reply(info); Cheers, Anna. On 10/03/2016 12:05 pm, Qiwei Wen wrote: Hi all, On page 26 of the manual (1.2) there's an instruction on how to restart a thread following a capability fault. The program counter where the faulting thread should pick up execution is said to be message register 0. What I'm trying to do is to restart the execution on the next instruction following the system call instruction so as to skip it. Try as I might, it will not work and the faulting thread is stuck in an endless number of faults. Below is the relevant code: seL4_Word pc = seL4_GetMR(0); printf("cap fault, pc: %08x, on %s\n",pc,seL4_GetMR(2)?"wait":"send"); //assert(!faultnum++); seL4_MessageInfo_t info = seL4_MessageInfo_new (seL4_CapFault,0,0,1); seL4_SetMR(0,pc + 4); seL4_Reply(info); It does restart, but immediately cap-faults again at the very same program counter. Is it supposed to work? What did I do wrong? Cheers, David _______________________________________________ Devel mailing list Devel@sel4.systemsmailto:Devel@sel4.systems https://sel4.systems/lists/listinfo/devel ________________________________ The information in this e-mail may be confidential and subject to legal professional privilege and/or copyright. National ICT Australia Limited accepts no liability for any damage caused by this email or its attachments.
participants (2)
-
Anna Lyons
-
Qiwei Wen