In https://github.com/mabl/ChibiOS/blob/ma ... _v7m.c#L58 the code shows that the SVC instruction ignores the value of #n.
This is the correct way to intercept SVC call and make "!CORTEX_SIMPLIFIED_PRIORITY" mode continuing work?:
Code: Select all
void SVCallVector(void) {
switch(getSVCn()) {
case 0: doSVCallVector(); break; /* return???? */
case 1: doStuff(); break;
case 2: doOherStuff(); break;
....anithing...
}
/* port_unlock_from_isr(); ?????? */
}
/* This code posibly make a new stack context. It is rigth? */
void doSVCallVector(void) {
struct extctx *ctxp;
/* Current PSP value.*/
asm volatile ("mrs %0, PSP" : "=r" (ctxp) : : "memory");
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
ctxp++;
#if CORTEX_USE_FPU
/* Restoring the special register SCB_FPCCR.*/
SCB_FPCCR = (uint32_t)ctxp->fpccr;
SCB_FPCAR = SCB_FPCAR + sizeof (struct extctx);
#endif
asm volatile ("msr PSP, %0" : : "r" (ctxp) : "memory");
port_unlock_from_isr(); /* Where is this going?!!!?*/
}Wath is the diference with CORTEX_SIMPLIFIED_PRIORITY? Who lost in this mode?
The MSP is used only in kernel handler mode? The code only work with the PSP registrer
Many thanks!