Skip to content

Commit

Permalink
Add a CHERI-x86-64 instruction-set reference chapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdjhb committed May 22, 2023
1 parent 9170c5f commit cb655ef
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PREVEOUS=../branches/20150624-cheri-architecture-1-13

SAIL_LATEX_RISCV_DIR=sail_latex_riscv

SOURCES=$(wildcard *.tex insn-riscv/*.tex $(SAIL_LATEX_RISCV_DIR)/*.tex cheri_concentrate_listings/*.bsv cheri_concentrate_listings/*.tex) cheri.bib LICENSE LICENSE-sail-cheri-riscv LICENSE-sail-riscv
SOURCES=$(wildcard *.tex insn-riscv/*.tex insn-x86-64/*.tex $(SAIL_LATEX_RISCV_DIR)/*.tex cheri_concentrate_listings/*.bsv cheri_concentrate_listings/*.tex) cheri.bib LICENSE LICENSE-sail-cheri-riscv LICENSE-sail-riscv
DIFFDIR=diff
DIFFTEX=$(SOURCES:%=${DIFFDIR}/%)
DIFFPARAM=--type=UNDERLINE --packages=amsmath,hyperref --math-markup=1
Expand Down Expand Up @@ -67,6 +67,7 @@ diffdir:
@(test -d ${DIFFDIR} || mkdir ${DIFFDIR})
@(test -d ${DIFFDIR}/cheri_concentrate_listings || mkdir ${DIFFDIR}/cheri_concentrate_listings)
@(test -d ${DIFFDIR}/insn-riscv || mkdir ${DIFFDIR}/insn-riscv)
@(test -d ${DIFFDIR}/insn-x86-64 || mkdir ${DIFFDIR}/insn-x86-64)
@(test -d ${DIFFDIR}/sail_latex_riscv || mkdir ${DIFFDIR}/sail_latex_riscv)

${DIFFDIR}/$(TARGET): $(DIFFTEX)
Expand Down
5 changes: 5 additions & 0 deletions chap-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ \section{Document Structure}
Chapter~\ref{chap:isaref-riscv} provides a detailed description of each
CHERI-RISC-V instruction.

\medskip
\noindent
Chapter~\ref{chap:isaref-x86-64} provides a detailed description of each
CHERI-x86-64 instruction.

\medskip
\noindent
Chapter~\ref{chap:rationale} discusses the design rationale for many aspects
Expand Down
106 changes: 106 additions & 0 deletions chap-isaref-x86-64.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
\chapter{The CHERI-x86-64 Instruction-Set Reference}
\label{chap:isaref-x86-64}

\newcolumntype{Y}{>{\centering\arraybackslash}X}
\newcolumntype{Z}{>{\raggedright\arraybackslash}X}

\newenvironment{x86opcodetable}{%
\tabularx{\textwidth}{| l | l | p{2.0em} | p{2.5em} | p{2.5em} | Z |} \hline
\textbf{Opcode} & \textbf{Instruction} & \textbf{Op/ En} &
\textbf{Cap Mode} & \textbf{64-bit Mode} & \textbf{Description}\\
\hline
}{%
\endtabularx
}

\newcommand{\xopcode}[6]{%
#1 & #2 & #3 & #4 & #5 & #6\\
\hline
}

\newenvironment{x86opentable}{%
\bigskip
\noindent
\tabularx{\textwidth}{| c | Y | Y | Y | Y |}
\multicolumn{5}{c}{\bfseries Instruction Operand Encoding}\\
\hline
Op/En & Operand 1 & Operand 2 & Operand 3 & Operand 4\\
\hline
}{%
\endtabularx
}

\newcommand{\xopen}[5]{%
#1 & #2 & #3 & #4 & #5\\
\hline
}

In this chapter, we specify new CHERI instructions as well as
extensions to existing instructions to support capability-sized
operands. Instructions are described using similar syntax to Volume 2
of Intel's Software Developer's Manual~\cite{intel-sdm-vol2} with a
few extensions.

An additional symbol is defined to represent object code in the
``Opcode'' column:

\begin{itemize}
\item \textbf{CAP} { }---{ } Indicates the use of the capability
operand prefix.
\end{itemize}

Additional symbols are defined to represent operands in the
``Instruction'' column:

\begin{itemize}
\item \textbf{rc} { }---{ } One of the general-purpose capability
registers: \CAX{}, \CBX{}, \CCX{}, \CDX{}, \CDI{}, \CSI{}, \CBP{},
\CSP{}, \creg{8}-\creg{15}.

\item \textbf{r/mc} { }---{ } A capability operand that is either
the contents of one of the capability registers for \textbf{rc} or
a capability in memory.
\end{itemize}

In addition, all of these instructions are either invalid or not
encodable in Compatibility/Legacy mode, so that column is omitted from
opcode tables. However, a new column is added to describe capability
mode support using one of the following annotations:

\begin{itemize}
\item \textbf{V} { }---{ } Supported.
\item \textbf{I} { }---{ } Not supported.
\end{itemize}

\clearpage
\section{Extensions to x86-64 Instructions}

This section contains extensions to existing instructions to support
capability operands. For each of these instructions, the instruction
description should be treated as an extension to the description of
the existing instruction in Volume 2 of Intel's Software Developer's
Manual. Many of the instruction descriptions in this section reuse
language from Intel's manual to highlight the similarity in semantics
between the base instructions and their CHERI extensions.

\clearpage
\section{CHERI-x86-64 Instructions}

This section contains new instructions added to support operations on
capabilities. The opcode assignments in this section are tentative
and subject to change. Single byte opcodes have been used for
instructions which we believe may either be used frequently or in
frequently-accessed code paths.

\clearpage
\section{Summary of New Opcodes}

The following new opcodes are added in 64-bit mode and are also
available in capability mode.

\bigskip
\noindent
\begin{tabular}{| l | l |} \hline
\textbf{Opcode} & \textbf{Instruction}\\
\hline
\end{tabular}
2 changes: 1 addition & 1 deletion chap-research.tex
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ \section{Protection Model and Architecture}
specific mapping into the 32-bit and 64-bit RISC-V ISA for the purposes of experimentation
and evaluation (Chapters~\ref{chap:architecture}, ~\ref{chap:cheri-riscv}
and~\ref{chap:isaref-riscv}), and architectural sketches for potential integration
into other ISAs (Chapter~\ref{chap:cheri-x86-64} on CHERI-x86-64 and Arm
into other ISAs (Chapters~\ref{chap:cheri-x86-64} and~\ref{chap:isaref-x86-64} on CHERI-x86-64 and Arm
Morello~\cite{arm-morello}).
However, we have taken a ``ground-up'' approach utilizing hardware-software
co-design to ensure that concrete mapping exist that
Expand Down
1 change: 1 addition & 0 deletions cheri-architecture.tex
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
\input{chap-cheri-x86-64}
\input{chap-sail}
\input{chap-isaref-riscv}
\input{chap-isaref-x86-64}
\input{chap-rationale}
\input{chap-assurance}
\input{chap-microarchitecture}
Expand Down
3 changes: 3 additions & 0 deletions preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
\usepackage{bitset}
\usepackage{comment}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{marginnote}
\usepackage{booktabs}
\usepackage{ifthen}
Expand Down Expand Up @@ -436,6 +437,8 @@
\newcommand{\@makeinsncmds}[1]{\@makeinsncmds@explicit{#1}{#1}}

\@makeinsncmds{riscv}
% Cannot use more intuitive x86 in command names
\@makeinsncmds{xes}

\newcommand{\definsnarch}[1]{\def\@definsnarch{#1}}
\@makeinsncmds@explicit{}{\@definsnarch}
Expand Down

0 comments on commit cb655ef

Please sign in to comment.