From 71fdadc8588d480c5e33d33f77dff30165292ad8 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Sat, 14 Dec 2019 11:19:39 +0100 Subject: Add cheat sheets for x86 windows --- cdecl-contents.tex | 8 ++++++++ cdecl.tex | 5 +++++ linux-x64.tex | 2 +- mac.tex | 2 +- overview.tex | 45 ++++++++++++++++++++++++++++++--------------- registers-x64.tex | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ registers-x86.tex | 30 ++++++++++++++++++++++++++++++ registers.tex | 48 ------------------------------------------------ windows-x64.tex | 2 +- windows-x86.tex | 8 ++++++++ 10 files changed, 132 insertions(+), 66 deletions(-) create mode 100644 cdecl-contents.tex create mode 100644 cdecl.tex create mode 100644 registers-x64.tex create mode 100644 registers-x86.tex delete mode 100644 registers.tex create mode 100644 windows-x86.tex diff --git a/cdecl-contents.tex b/cdecl-contents.tex new file mode 100644 index 0000000..d1b126b --- /dev/null +++ b/cdecl-contents.tex @@ -0,0 +1,8 @@ +Arguments: & \multicolumn{6}{l|}{right-to-left on the stack} \\ + & \multicolumn{6}{l|}{popped by caller} \\ +\hline +Result: & eax &&&&& \\ + & d0 &&&&& \\ +\hline +Callee-saved: & ebx & ebp & esp & esi & edi & \\ + & d1 & a2 & sp & a3 & a4 & diff --git a/cdecl.tex b/cdecl.tex new file mode 100644 index 0000000..0856721 --- /dev/null +++ b/cdecl.tex @@ -0,0 +1,5 @@ +\setlength{\tabcolsep}{.2em}% +\begin{tabular}{lcccccc} + \multicolumn{7}{c}{\textbf{\CallingConventionHeader}}\\\hline + \csname @@input\endcsname cdecl-contents % +\end{tabular}% diff --git a/linux-x64.tex b/linux-x64.tex index 4caa812..f15cdf1 100644 --- a/linux-x64.tex +++ b/linux-x64.tex @@ -1,7 +1,7 @@ \documentclass{cheatsheet} \begin{document} \cheatsheettitle[x64]{Linux} -\input{registers} +\input{registers-x64} \bigskip \cheatsheetbox{\input{system-v-abi}} diff --git a/mac.tex b/mac.tex index edd6272..e9f4412 100644 --- a/mac.tex +++ b/mac.tex @@ -1,7 +1,7 @@ \documentclass{cheatsheet} \begin{document} \cheatsheettitle{Mac} -\input{registers} +\input{registers-x64} \bigskip \cheatsheetbox{\input{system-v-abi}} diff --git a/overview.tex b/overview.tex index d448579..1a78155 100644 --- a/overview.tex +++ b/overview.tex @@ -1,6 +1,6 @@ \documentclass{cheatsheet} -\geometry{a5paper,landscape} +\geometry{a5paper} \begin{document} \begin{center} @@ -8,30 +8,45 @@ \end{center} \hfill -\begin{minipage}[t][][b]{.3\textwidth}% +\begin{minipage}[t][][b]{.5\textwidth}% \centering% - \textbf{Registers} + \textbf{Registers, x64} \bigskip - \input{registers} + \input{registers-x64} \end{minipage}% -\hfill \begin{minipage}[t][][b]{.5\textwidth}% + \centering% + \textbf{Registers, x86} + \bigskip + + \input{registers-x86} + + \bigskip \tabularwrappingfalse% \setlength{\tabcolsep}{.2em}% - \begin{tabular}{|lcccccccc|}% - \multicolumn{9}{c}{\textbf{{\CallingConventionHeader}s}}\\ - \multicolumn{1}{c}{}\\[-1em] - \multicolumn{9}{c}{\textit{System V}}\\\hline - \csname @@input\endcsname system-v-abi-contents \\\hline - - \multicolumn{1}{c}{}\\ - \multicolumn{9}{c}{\textit{Microsoft x64}}\\\hline - \csname @@input\endcsname microsoft-x64-contents \\\hline - \end{tabular}% + \begin{tabular}{|lcccccc|}% + \multicolumn{7}{c}{\textit{Cdecl Calling Convention}}\\\hline + \csname @@input\endcsname cdecl-contents \\\hline + \end{tabular} \end{minipage}% \hfill +\bigskip +\tabularwrappingfalse% +\setlength{\tabcolsep}{.2em}% +\begin{tabular}{|lcccccccc|}% + \multicolumn{9}{c}{\textbf{x64 {\CallingConventionHeader}s}}\\ + \multicolumn{1}{c}{}\\[-1em] + \multicolumn{9}{c}{\textit{System V}}\\\hline + \csname @@input\endcsname system-v-abi-contents \\\hline + + \multicolumn{1}{c}{}\\ + \multicolumn{9}{c}{\textit{Microsoft x64}}\\\hline + \csname @@input\endcsname microsoft-x64-contents \\\hline +\end{tabular}% +\hfill + \bigskip \end{document} diff --git a/registers-x64.tex b/registers-x64.tex new file mode 100644 index 0000000..0fd363f --- /dev/null +++ b/registers-x64.tex @@ -0,0 +1,48 @@ +{\hfill% +\fcolorbox{black}{white}{% + \begin{tabular}{ll} + A0 & rcx \\ + A1 & rdx \\ + A2 & r8 \\ + \hline + B0 & rax \\ + B1 & rbx \\ + B2 & r10 \\ + B3 & r11 \\ + B4 & r12 \\ + B5 & r13 \\ + B6 & r14 \\ + \hline + asp & rsi \\ + bsp & rsp \\ + hp & rdi \\ + free & r15 \\ + \hline + scratch & rbp \\ + scratch & r9 \\ + \end{tabular}% +}% +\hfill% +\fcolorbox{black}{white}{% + \begin{tabular}{ll} + rax & B0 \\ + rbx & B1 \\ + rcx & A0 \\ + rdx & A1 \\ + \hline + rbp & scratch \\ + rdi & hp \\ + rsi & asp \\ + rsp & bsp \\ + \hline + r8 & A2 \\ + r9 & scratch \\ + r10 & B2 \\ + r11 & B3 \\ + r12 & B4 \\ + r13 & B5 \\ + r14 & B6 \\ + r15 & free \\ + \end{tabular}% +}% +\hfill}% diff --git a/registers-x86.tex b/registers-x86.tex new file mode 100644 index 0000000..b0d714f --- /dev/null +++ b/registers-x86.tex @@ -0,0 +1,30 @@ +{\hfill% +\fcolorbox{black}{white}{% + \begin{tabular}{ll} + A0 & ecx \\ + A1 & edx \\ + A2 & ebp \\ + \hline + B0 & eax \\ + B1 & ebx \\ + \hline + asp & esi \\ + bsp & esp \\ + hp & edi \\ + \end{tabular}% +}% +\hfill% +\fcolorbox{black}{white}{% + \begin{tabular}{ll} + eax & B0 \\ + ebx & B1 \\ + ecx & A0 \\ + edx & A1 \\ + \hline + ebp & A2 \\ + edi & hp \\ + esi & asp \\ + esp & bsp \\ + \end{tabular}% +}% +\hfill}% diff --git a/registers.tex b/registers.tex deleted file mode 100644 index 0fd363f..0000000 --- a/registers.tex +++ /dev/null @@ -1,48 +0,0 @@ -{\hfill% -\fcolorbox{black}{white}{% - \begin{tabular}{ll} - A0 & rcx \\ - A1 & rdx \\ - A2 & r8 \\ - \hline - B0 & rax \\ - B1 & rbx \\ - B2 & r10 \\ - B3 & r11 \\ - B4 & r12 \\ - B5 & r13 \\ - B6 & r14 \\ - \hline - asp & rsi \\ - bsp & rsp \\ - hp & rdi \\ - free & r15 \\ - \hline - scratch & rbp \\ - scratch & r9 \\ - \end{tabular}% -}% -\hfill% -\fcolorbox{black}{white}{% - \begin{tabular}{ll} - rax & B0 \\ - rbx & B1 \\ - rcx & A0 \\ - rdx & A1 \\ - \hline - rbp & scratch \\ - rdi & hp \\ - rsi & asp \\ - rsp & bsp \\ - \hline - r8 & A2 \\ - r9 & scratch \\ - r10 & B2 \\ - r11 & B3 \\ - r12 & B4 \\ - r13 & B5 \\ - r14 & B6 \\ - r15 & free \\ - \end{tabular}% -}% -\hfill}% diff --git a/windows-x64.tex b/windows-x64.tex index c5aa155..76cecf3 100644 --- a/windows-x64.tex +++ b/windows-x64.tex @@ -1,7 +1,7 @@ \documentclass{cheatsheet} \begin{document} \cheatsheettitle[x64]{Windows} -\input{registers} +\input{registers-x64} \bigskip \cheatsheetbox{\input{microsoft-x64}} diff --git a/windows-x86.tex b/windows-x86.tex new file mode 100644 index 0000000..25c0f83 --- /dev/null +++ b/windows-x86.tex @@ -0,0 +1,8 @@ +\documentclass{cheatsheet} +\begin{document} +\cheatsheettitle[x86]{Windows} +\input{registers-x86} + +\bigskip +\cheatsheetbox{\input{cdecl}} +\end{document} -- cgit v1.2.3