Skip to content

Commit dbe9217

Browse files
committed
Halfway done with updating spec to explicitly update all of the RFLAGS
register on any instruction that updates a field.
1 parent 3431e45 commit dbe9217

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

chap-cheri-x86-64.tex

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,8 @@ \subsection{New CHERI Instructions}
736736

737737
\subsubsection{Capability-Inspection Instructions}
738738

739-
These instructions would set the \texttt{ZF} flag in \RFLAGS{}
740-
according to the integer field
741-
extracted from the capability.
739+
These instructions would set the \RFLAGS{} field
740+
according to the value written to an integer register.
742741

743742
\begin{itemize}
744743
\item \insnref{CGetPerm} r64, r/mc
@@ -748,9 +747,7 @@ \subsubsection{Capability-Inspection Instructions}
748747

749748
\item \insnref{CGetType} r64, r/mc
750749

751-
Set \emph{r64} to the \textbf{otype} field of \emph{r/mc}. In
752-
addition to \texttt{ZF}, this instruction should also set
753-
\texttt{SF} in \RFLAGS{}.
750+
Set \emph{r64} to the \textbf{otype} field of \emph{r/mc}.
754751

755752
\item \insnref{CGetBase} r64, r/mc
756753

@@ -830,8 +827,8 @@ \subsubsection{Capability-Modification Instructions}
830827
contained within the bounds of the original value of \emph{r/mc},
831828
clear the \textbf{tag} field in the resulting capability.
832829

833-
Set \texttt{ZF} in \RFLAGS{} to the value of \textbf{tag} field
834-
in the resulting value of \emph{r/mc}.
830+
Set \RFLAGS{} according to the value of \textbf{tag} field
831+
in the resulting value of \emph{r/mc} (only \texttt{ZF} is useful).
835832

836833
\item \insnref{CSetBoundsExact} r/mc, r64
837834

@@ -845,8 +842,8 @@ \subsubsection{Capability-Modification Instructions}
845842
resulting capability cannot be represented exactly, clear the
846843
\textbf{tag} field in the resulting capability.
847844

848-
Set \texttt{ZF} in \RFLAGS{} to the value of \textbf{tag} field
849-
in the resulting value of \emph{r/mc}.
845+
Set \RFLAGS{} according to the value of \textbf{tag} field
846+
in the resulting value of \emph{r/mc} (only \texttt{ZF} is useful).
850847

851848
\item \insnref{CClearTag} r/mc
852849

@@ -862,8 +859,8 @@ \subsubsection{Capability-Modification Instructions}
862859
construction of the desired capability, set \emph{rca} equal to
863860
\emph{rcb} with the \textbf{tag} field cleared.
864861

865-
Set \texttt{ZF} in \RFLAGS{} to the value of \textbf{tag} field
866-
of \emph{rca}.
862+
Set \RFLAGS{} according to the value of \textbf{tag} field
863+
in the resulting value of \emph{rca} (only \texttt{ZF} is useful).
867864

868865
\item \insnref{CCopyType} rca, r/mc, rcb
869866

@@ -873,60 +870,63 @@ \subsubsection{Capability-Modification Instructions}
873870
\emph{rca} to the \textbf{NULL} capability with the
874871
\textbf{address} field set to \emph{rcb}.\textbf{otype}.
875872

876-
Set \texttt{ZF} in \RFLAGS{} to the value of \textbf{tag} field
877-
of \emph{rca}.
873+
Set \RFLAGS{} according to the value of \textbf{tag} field
874+
in the resulting value of \emph{rca} (only \texttt{ZF} is useful).
878875

879876
\item \insnref{CCSeal} rca, r/mc, rcb
880877

881878
Set \emph{rca} to \emph{r/mc} conditionally sealed with
882879
\textbf{otype} equal to the \textbf{address} field of \emph{rcb}.
883880
If \emph{rca} is not sealed with \emph{rcb}.\textbf{otype}, it
884-
will be set equal to \emph{r/mc}. Set \texttt{ZF} in \RFLAGS{} to
885-
1 if \emph{rca} is sealed with \emph{rcb}.\textbf{otype} or 0
886-
otherwise.
881+
will be set equal to \emph{r/mc}. Set \RFLAGS{} according to
882+
the resulting type field of \emph{rca} (e.g. \texttt{SF}
883+
will be 1 if the result is unsealed).
887884

888885
\item \insnref{CSealEntry} r/mc
889886

890887
Seal \emph{r/mc} as a sentry. On failure, leave \emph{r/mc}
891-
unchanged. Set \texttt{ZF} in \RFLAGS{} to 1 if \emph{r/mc} if
892-
\emph{r/mc} is sealed as a sentry or 0 otherwise.
888+
unchanged. Set \texttt{ZF} in \RFLAGS{} to 1 if
889+
\emph{r/mc} is sealed as a sentry or 0 otherwise; set the rest
890+
of \RFLAGS{} according to the resulting type field of \emph{r/mc}.
893891
\end{itemize}
894892

895893
\subsubsection{Pointer-Arithmetic Instructions}
896894

897-
These instructions should set \texttt{ZF} in \RFLAGS{} to indicate
898-
success (set) or failure (clear). If one of these instructions fails, it
895+
These instructions should set \RFLAGS{} to indicate
896+
success or failure. If one of these instructions fails, it
899897
should not raise an exception.
900898

901899
\begin{itemize}
902900
\item \insnref{CToPtr} r64, rc, r/mc
903901

904902
If the \textbf{tag} field of \emph{r/mc} is not set or \emph{rc}
905-
is sealed and tagged, then set \emph{r64} to 0 and clear
906-
\texttt{ZF} in \RFLAGS{}.
903+
is sealed and tagged, then set \emph{r64} to 0.
907904

908905
If the \textbf{tag} field of \emph{rc} is not set, then set
909-
\emph{r64} to 0 and set \texttt{ZF} in \RFLAGS{} to 1; otherwise,
906+
\emph{r64} to 0; otherwise,
910907
set \emph{r64} to \emph{rc}.\textbf{address} -
911-
\emph{r/mc}.\textbf{base} and set \texttt{ZF} in \RFLAGS{} to 1.
908+
\emph{r/mc}.\textbf{base}.
909+
910+
\RFLAGS{} is set according to the value of \emph{r64}.
912911

913912
\item \insnref{CFromPtr} rc, r/mc, r64
914913

915-
If \emph{r64} is 0, then set \emph{rc} to \textbf{NULL} and set
916-
\texttt{ZF} to 1.
914+
If \emph{r64} is 0, then set \emph{rc} to \textbf{NULL}.
917915

918916
If \emph{r/mc} is untagged or sealed, then set \emph{rc} to the
919917
\textbf{NULL} capability with the \textbf{address} field set to
920-
\emph{r64} and set \texttt{ZF} to 0.
918+
\emph{r64}.
921919

922920
Otherwise, set \emph{rc} to \emph{r/mc} with its \textbf{offset}
923-
replaced by \emph{r64} and set \texttt{ZF} to 1.
921+
replaced by \emph{r64}.
922+
923+
\RFLAGS{} is set according to the address field of \emph{rc}.
924924
\end{itemize}
925925

926926
\subsubsection{Pointer-Comparison Instructions}
927927

928-
For these instructions, the result of the comparison should be written
929-
to the \texttt{ZF} field of \RFLAGS{} instead of to a destination
928+
For these instructions, \RFLAGS{} should be updated according to
929+
the result of the comparison rather than using a destination
930930
register as is done in CHERI-RISC-V.
931931

932932
\begin{itemize}

0 commit comments

Comments
 (0)