This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Difference between SWI and SVC

Hi Experts,

In RTX RTOS I could find some functions based on SVC and SWI handlers. What do they actually mean for ?

Where it is actually used ?

Parents
  • They're the same thing, SWI is the older name and stood for software interrupt.

    SVC stands for supervisor call and that's what it is for. It is there so user programs can call a system routine like open a file or read data. Those routines need extra privilege and SVC switches to a more privileged mode where such things can be done.

Reply
  • They're the same thing, SWI is the older name and stood for software interrupt.

    SVC stands for supervisor call and that's what it is for. It is there so user programs can call a system routine like open a file or read data. Those routines need extra privilege and SVC switches to a more privileged mode where such things can be done.

Children
  • Hi daith,

    Thanks for the reply.

    One more query.will the mode switch took place in single clock cycle or there will be latency ?

  • As you're actually calling an interrupt, the standard interrupt latency applies here.

    Eg. at least 12 clock cycles (16 or 15 on Cortex-M0/Cortex-M0+).

    That means when you issue SVC #imm, the SVC_Handler is executed "immediately" (well, a higher priority interrupt could in fact precede the SVC_Handler interrupt service routine, increasing the latency to 'anything').

    I'd like to point you to A Beginner’s Guide on Interrupt Latency, in case you haven't seen it; it is an excellent document that covers all this; it also gives you insight in some of the internal workings of the processor, which is very good to have in mind while writing time critical code.

    PS: Please mark daith's answer correct.