Skip to content
Commit 00a9634c authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Anas Nashif
Browse files

riscv: new TLS-based arch_is_user_context() implementation



This reverts the bulk of commit c8bfc2af ("riscv: make
arch_is_user_context() SMP compatible") and replaces it with a flag
stored in the thread local storage (TLS) area, therefore making TLS
mandatory for userspace support on RISC-V.

This has many advantages:

- The tp (x4) register is already dedicated by the standard for this
  purpose, making TLS support almost free.

- This is very efficient, requiring only a single instruction to clear
  and 2 instructions to set.

- This makes the SMP case much more efficient. No need for funky
  exception code any longer.

- SMP and non-SMP now use the same implementation making maintenance
  easier.

- The is_user_mode variable no longer requires a dedicated PMP mapping
  and therefore freeing one PMP slot for other purposes.

Signed-off-by: default avatarNicolas Pitre <npitre@baylibre.com>

5f65dbcc9dab3d39473b05397e05.
parent 3f8e326d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment