\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}
\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta, shapes.geometric}

\setup{Systems Programming and Computer Architecture}

\usepackage{lmodern}
\setFontType{sans}

\usepackage{multirow}

\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{center}
    \begin{Large}
        Rust and the like have an \texttt{unsafe} block... \lC's equivalent to this is
    \end{Large}
    \begin{code}{c}
        int main( int argc, char *argv[] ) {
            // Unsafe code goes here
        }
    \end{code}
    \begin{Large}
        i.e. \bi{YOU are the one that makes \lC\ code safe!}
    \end{Large}
\end{center}


\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}


% ── x86 assembly ────────────────────────────────────────────────────
\newpage
\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}
\input{parts/00_asm/06_unorthodox-control-flow.tex}
\input{parts/00_asm/07_coroutines.tex}


% ── Intro to C ──────────────────────────────────────────────────────
\newpage
\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}
\input{parts/01_c/06_floating-point/00_intro.tex}
\input{parts/01_c/06_floating-point/01_binary.tex}
\input{parts/01_c/06_floating-point/02_representation.tex}
\input{parts/01_c/06_floating-point/03_properties.tex}
\input{parts/01_c/06_floating-point/04_rounding.tex}
\input{parts/01_c/06_floating-point/05_operations.tex}
\input{parts/01_c/06_floating-point/06_math-properties_in-c.tex}


% ── GCC ─────────────────────────────────────────────────────────────
\newpage
\section{The gcc toolchain}
\input{parts/02_toolchain/00_intro.tex}
\input{parts/02_toolchain/01_compiler-optimizations.tex}
\input{parts/02_toolchain/02_linking.tex}
\input{parts/02_toolchain/03_file_types.tex}


% ── Hardware recap ──────────────────────────────────────────────────
\newsection
\section{Hardware}
\input{parts/03_hw/00_intro.tex}
\input{parts/03_hw/01_code-optim.tex}
\input{parts/03_hw/02_vec-op.tex}
\input{parts/03_hw/03_caches/00_intro.tex}
\input{parts/03_hw/03_caches/01_perf-metrics.tex}
\input{parts/03_hw/03_caches/02_misses.tex}
\input{parts/03_hw/03_caches/03_organization.tex}
\input{parts/03_hw/03_caches/04_reads.tex}
\input{parts/03_hw/03_caches/05_writes.tex}
\input{parts/03_hw/03_caches/06_optimizations.tex}
\input{parts/03_hw/03_caches/07_addressing-schemes.tex}
\input{parts/03_hw/04_virtual-memory/00_intro.tex}
\input{parts/03_hw/04_virtual-memory/01_address-translation.tex}
\input{parts/03_hw/04_virtual-memory/02_multilevel.tex}
\input{parts/03_hw/04_virtual-memory/03_x86.tex}
% \input{parts/03_hw/04_virtual-memory/}
\input{parts/03_hw/05_exceptions.tex}
\input{parts/03_hw/06_multicore/00_background.tex}
\input{parts/03_hw/06_multicore/01_limitations.tex}
\input{parts/03_hw/06_multicore/02_consistency-coherencey.tex}
\input{parts/03_hw/06_multicore/03_relaxing-seq-consistency.tex}
\input{parts/03_hw/06_multicore/04_sync.tex}
\input{parts/03_hw/06_multicore/05_smp.tex}
\input{parts/03_hw/06_multicore/06_numa.tex}
\input{parts/03_hw/06_multicore/07_optim.tex}
\input{parts/03_hw/07_dev.tex}



\end{document}
