The software stack on a Sanctum machine, shown in
Figure~\ref{fig:software_stack}, resembles the SGX stack
with one notable exception: SGX's microcode is replaced by a trusted software
component, the \textbf{security monitor}, which is protected from compromised system software, as it runs at the highest privilege
level (machine level in RISC-V).

\begin{figure}[htb]
  \centering
  \includegraphics[width=80mm]{figures/software_stack.pdf}
  \caption{
    Software stack on a Sanctum machine; The blue text represents additions
    required by Sanctum. The bolded elements are in the software TCB.
  }
  \label{fig:software_stack}
%\EndFigure
\end{figure}

Sanctum relegates the management of computation resources,
such as DRAM and execution cores, to untrusted system software (as does SGX). In Sanctum, the
security monitor checks the system software's allocation decisions for
correctness and commits them into the hardware's configuration registers. For
simplicity, we refer to the software that manages resources as an \textit{OS
(operating system)}, even though it may be a combination of a hypervisor and a
guest OS kernel.

Figure~\ref{fig:software_stack} is representative of today's popular software
stacks, where an operating system handles scheduling and demand paging, and
the hypervisor multiplexes the computer's CPU cores. Sanctum is easy to
integrate in such a stack, because the API calls that make up the security
monitor's interface were designed with multiplexing in mind. Furthermore,
a security-conscious hypervisor can use Sanctum's cache isolation primitive (DRAM region) to protect against cross-VM cache timing
attacks~\citep{groka14crossvm}.
