mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-03-14 17:00:05 +01:00
[SPCA] Fixes a few errors
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
\newpage
|
||||
\subsection{The syntax}
|
||||
There are two common styles: AT\&T syntax (common on UNIX) and Intel syntax (common on Windows)
|
||||
There are two common styles: AT\&T syntax (common on UNIX) and Intel syntax (common on Windows).
|
||||
The most obvious difference between the two is that they invert the order of operands,
|
||||
i.e. where the AT\&T syntax has the destination as the second argument, the Intel syntax puts it first.
|
||||
|
||||
The state that is visible to us is:
|
||||
\begin{itemize}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
\subsection{Data types}
|
||||
Assembly supports the following integer types (where GAS stands for GNU Assembly).
|
||||
If they are signed or unsigned does not matter (as we have seen), so it's up to you to interpret them as one or the other
|
||||
If they are signed or unsigned does not matter (as we will see in section \ref{sec:c-integers}), so it's up to you to interpret them as one or the other
|
||||
\begin{tables}{llll}{Intel & GAS & Bytes & \lC}
|
||||
byte & \texttt{b} & 1 & \texttt{[unsigned] char} \\
|
||||
word & \texttt{w} & 2 & \texttt{[unsigned] short} \\
|
||||
@@ -15,5 +15,5 @@ They are stored and operated on in floating point registers.
|
||||
double & \texttt{l} & 8 & \texttt{double} \\
|
||||
extended & \texttt{t} & 16 & \texttt{long double} \\
|
||||
\end{tables}
|
||||
Assembly does not support any aggregate types (such as arrays, structs, etc) natively.
|
||||
You can however (obviously) make your own. In the following section we will cover how \lC\ datatypes are compiled into assembly.
|
||||
Assembly does not support any aggregate types (such as arrays, structs, etc) natively. You can however (obviously) make your own.
|
||||
In the following section we will cover how \lC\ datatypes are compiled into assembly.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
\newpage
|
||||
\subsubsection{Nested / Multidimensional arrays, Struct arrays}
|
||||
All of these arrays have similar underlying concepts in the way they are allocated, yet all are a bit different
|
||||
|
||||
\content{Common ideas} Each of the array's elements are allocated in contiguous regions of memory, with the elemnts also in contiguous regions of memory.
|
||||
\content{Common ideas} Each of the array's elements are allocated in contiguous regions of memory, with the elements also in contiguous regions of memory.
|
||||
(Imagine it as lining up all elements on a band, i.e. as going through the array in a nested loop and printing all the elements into a single line.)
|
||||
The size of the array is determined by \texttt{n * sizeof(T)}, where \texttt{T} is the type of the elements of the array (or outer array).
|
||||
This is what is different for the lot (as well as accessing elements):
|
||||
|
||||
@@ -20,6 +20,9 @@ and \texttt{OF} is set as above, where \texttt{t = a - b}.
|
||||
Another instruction that is used is \texttt{testX src2, src1} (X again a size postfix, easier: \texttt{testX b, a}), and acts like computing \texttt{a \& b} and where \texttt{ZF} is set if \texttt{a \& b == 0}
|
||||
and \texttt{SF} is set if \texttt{a \& b < 0}.
|
||||
|
||||
\content{Zeroing register} We can use a move instruction, but that is less efficient than using \texttt{xorl reg, reg}, where \texttt{reg} is the 32-bit version of the reg we want to zero.
|
||||
\content{Zeroing register} We can use a move instruction, but that is less efficient than using \texttt{xorl reg, reg},
|
||||
where \texttt{reg} is the 32-bit version of the reg we want to zero. This works because on 32-bit operations,
|
||||
the upper 32 bit of the 64 bit register will be zeroed.
|
||||
|
||||
\content{Reading condition codes} To read condition codes, we can use the \texttt{setC} instructions, where the \texttt{C} is to be substituted by an element of table \ref{tab:condition-codes}
|
||||
\content{Reading condition codes} To read condition codes, we can use the \texttt{setC} instructions,
|
||||
where the \texttt{C} is to be substituted by an element of table \ref{tab:condition-codes}
|
||||
|
||||
Reference in New Issue
Block a user