\documentclass{article}

\input{~/projects/latex/dist/full.tex}

\renewcommand{\authorTitle}{Robin Bacher, Janis Hutz\\\url{https://github.com/janishutz/eth-summaries}}
\renewcommand{\authorHeaders}{Robin Bacher, Janis Hutz}
\setup{Systems Programming and Computer Architecture}

\usepackage{lmodern}
\setFontType{sans}


\newcommand{\lC}{\texttt{C}}
\newcommand{\content}[1]{\shade{blue}{#1}}
\newcommand{\warn}[1]{\bg{orange}{#1}}
\newcommand{\danger}[1]{\shade{red}{#1}}

\setNumberingStyle{0}

\begin{document}
\startDocument
\usetcolorboxes


\vspace{2cm}
\begin{Huge}
    \begin{center}
        TITLE PAGE COMING SOON
    \end{center}
\end{Huge}


\vspace{4cm}
\begin{center}
    \begin{Large}
        ``\textit{If you are using CMake to solve the exercises... First off, sorry that you like CMake}``
    \end{Large}

    \hspace{3cm} - Timothy Roscoe, 2025
\end{center}

\vspace{3cm}
\begin{center}
    HS2025, ETHZ\\[0.2cm]
    \begin{Large}
        Summary of the Lectures and Lecture Slides
    \end{Large}\\[0.2cm]
\end{center}


%          ╭────────────────────────────────────────────────╮
%          │                     Quotes                     │
%          ╰────────────────────────────────────────────────╯
\input{parts/quotes.tex}


%          ╭────────────────────────────────────────────────╮
%          │               Table of contents                │
%          ╰────────────────────────────────────────────────╯
\newpage
\printtoc{magenta}


%          ╭────────────────────────────────────────────────╮
%          │                    Content                     │
%          ╰────────────────────────────────────────────────╯
% ── Intro to x86 asm ────────────────────────────────────────────────
\newsection
\section{Introduction}
This summary tries to summarize everything that is important to know for this course.
It aims to be a full replacement for the slides, but as with all my summaries, there may be missing or incorrect information in here,
so use at your own risk. You have been warned!

The summary does \textit{not} follow the order the lecture does.
This is to make related information appear more closely to each other than they have in the lecture and the summary assumes you have already seen
the concepts in the lectures or elsewhere (or are willing to be thrown in the deep end).

The target semester for this summary is HS2025, so there might have been changes in your year.
If there are changes and you'd like to update this summary, please open a pull request in the summary's repo at

\begin{center}
    \hlurl{https://github.com/janishutz/eth-summaries}
\end{center}


\newsection
\section{x86 Assembly}
\input{parts/00_asm/00_intro.tex}
\input{parts/00_asm/01_syntax/00_intro.tex}
\input{parts/00_asm/01_syntax/01_registers.tex}
\input{parts/00_asm/01_syntax/02_instructions.tex}
\input{parts/00_asm/02_dtype-dstruct/00_data-types.tex}
\input{parts/00_asm/02_dtype-dstruct/01_arrays.tex}
\input{parts/00_asm/02_dtype-dstruct/02_structs.tex}
\input{parts/00_asm/02_dtype-dstruct/03_nested-arrays.tex}
\input{parts/00_asm/02_dtype-dstruct/04_multi-level-arrays.tex}
\input{parts/00_asm/02_dtype-dstruct/05_unions.tex}
\input{parts/00_asm/03_operations/00_intro.tex}
\input{parts/00_asm/03_operations/01_arithmetic.tex}
\input{parts/00_asm/03_operations/02_condition-codes.tex}
\input{parts/00_asm/03_operations/03_jumping.tex}
\input{parts/00_asm/04_control-flow.tex}
\input{parts/00_asm/05_stack.tex}


% ── Intro to C ──────────────────────────────────────────────────────
\newsection
\section{The C Programming Language}
\input{parts/01_c/00_intro.tex}
\input{parts/01_c/01_basics/00_intro.tex}
\input{parts/01_c/01_basics/01_control-flow.tex}
\input{parts/01_c/01_basics/02_declarations.tex}
\input{parts/01_c/01_basics/03_operators.tex}
\input{parts/01_c/01_basics/04_arrays.tex}
\input{parts/01_c/01_basics/05_strings.tex}
\input{parts/01_c/01_basics/06_integers.tex}
\input{parts/01_c/01_basics/07_pointers.tex}
\input{parts/01_c/02_preprocessor.tex}
\input{parts/01_c/03_memory/00_intro.tex}
\input{parts/01_c/03_memory/01_allocation.tex}
\input{parts/01_c/03_memory/02_gc.tex}
\input{parts/01_c/03_memory/03_pitfalls.tex}
\input{parts/01_c/04_variadic.tex}
\input{parts/01_c/05_vulnerabilities.tex}


\newsection
\section{The gcc toolchain}
\input{parts/02_toolchain/00_intro.tex}
\input{parts/02_toolchain/01_linking.tex}
\input{parts/02_toolchain/02_file_types.tex}


% ── Hardware recap ──────────────────────────────────────────────────
\newsection
\section{Hardware}
\input{parts/03_hw/00_intro.tex}


\newpage
Remember: Rust and the like have an \texttt{unsafe} block... \lC's equivalent to this is
\begin{code}{c}
int main( int argc, char *argv[] ) {
    // Unsafe code goes here
}
\end{code}
i.e. \bi{YOU are the one that makes \lC\ code safe!}

\end{document}
