5

how to write an svc handler in C to call SMC(monitor mode) instruction to switch to monitor mode for arm cortex a9? i.e from supervisor mode to monitor mode what all needs to be done in svc handler,how to write the same in C. Detailed answers appreciated...

artless noise
  • 21,212
  • 6
  • 68
  • 105
  • You can not do this in `C`. At the very least you need inline assembler. This depends on the compiler. – artless noise Feb 24 '13 at 16:31
  • 1
    hi,iam not talking about the language in context,ofcourse i will have a code compiled in instructions set understood by processor whether it is C or NMemonics,iam just asking how to change mode from Supervisor to Monitor mode,what could be the possible procedure? – Mohit Narain Chaudhary Feb 24 '13 at 17:06

1 Answers1

3

Examples can be found in the Linux source tree for the OMAP2 platform.

See also: LWN's KS2012: ARM: Secure monitor API Kernel summit 2012 notes on ARM SMC modes.

Basically, what ever interface people dream up for an SWI or SVC interface can be used by the SMC interface. Otherwise, this question is impossible to answer specifically.


SMC calling conventions is an advisory from ARM to allow secure world software vendors to make something that is compatible/inter-operable. NOTE: No one has to follow this advice.

This was published after the original question was asked. Some software does follow this advice such as ARM Trusted Firmware.

artless noise
  • 21,212
  • 6
  • 68
  • 105