As i said in the title what's differences between privileged mode and unprivileged mode in the RTX RTOS? And why in privileged mode threads has allowed full access to the cortex M processor?


From the RTX Documentation

Processor Mode for Thread Execution

CMSIS-RTOS RTX allows to execute threads in unprivileged or privileged processor mode. The processor mode is controlled with the #define OS_RUNPRIV.

In unprivileged processor mode, the software:

  • has limited access to the MSR and MRS instructions, and cannot use the CPS instruction.
  • cannot access the system timer, NVIC, or system control block.
  • might have restricted access to memory or peripherals.

In privileged processor mode the software can use all the instructions and has access to all resources.

Note It is recommended to use the privileged processor mode.

Privileged and Unprivileged mode is really a feature of the ARM core and RTX is simply making that feature available. If your application has a reason to restrict privileges for threads than you might choose unprivileged mode. But I suspect most applications use privileged mode and allow all threads full privilege.

  • \$\begingroup\$ Is it possible some high important threads use privileged mode and the others use unprivileged ? \$\endgroup\$ – Mahmoud Hosseinipour Nov 7 '15 at 2:14
  • \$\begingroup\$ there are 2 definition for MSR and MRS,which one do you mean? 1-Move to system coprocessor register from ARM register. 2-Load an immediate value, or the contents of a general-purpose register, into specified fields of a Program Status Register (PSR). MRS has 2 definition too! \$\endgroup\$ – Mahmoud Hosseinipour Nov 7 '15 at 6:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.