Terms of Service | Privacy Policy | Cookie Policy

Commit 1df75bb2 authored by Uwe Plonus's avatar Uwe Plonus

Merge branch 'master' into 'master'

Removed LFS storage

See merge request !6
parents 47d1430d 38b4a0e3
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.nw linguist-language=tex
% Acronyms Tutorial
\newacronym{bcd}{BCD}{binary coded decimal}
\newacronym{acr-cli}{CLI}{command line interface}
\newacronym{dvcs}{dVCS}{distibuted version control system}
\newacronym{fpu}{FPU}{floating point unit}
\newacronym{gdb}{GDB}{GNU Debugger}
......@@ -13,4 +16,6 @@
\newacronym{tlb}{TLB}{translation lookaside buffer}
\newacronym{vcs}{VCS}{version control system}
\newacronym{vm}{VM}{virtual machine}
......@@ -114,7 +114,7 @@ which is needed for every bootloader at the \gls{x86} architectur.
bits 16
cpu 8086
<<license>>
<<license-header>>
@
......@@ -1602,7 +1602,7 @@ Public License instead of this License. But first, please read
This is a code chunk to be included by the generated asm files.
<<license>>=
<<license-header>>=
; A Simple Bootloader - For 80x86 Tutorials
; Copyright (C) 2018 U. Plonus
;
......
No preview for this file type
% Glossary Tutorial
\newglossaryentry{bootloader}{
name=bootloader,
description={a program that runs at the start of a computer and loads further code}
}
\newglossaryentry{centos}{
name=CentOS,
description={a Linux distribution}
}
\newglossaryentry{clone}{
name=clone,
description={coping the repository in a \gls{dvcs}}
}
\newglossaryentry{debian}{
name=debian,
description={the Linux distribution used in this book for the \gls{vm}}
......@@ -16,7 +28,7 @@
\newglossaryentry{git}{
name=git,
description={a version control system}
description={a \gls{dvcs}}
}
\newglossaryentry{git-lfs}{
......@@ -49,11 +61,6 @@
description={a virtualization software running on different \gls{os}}
}
\newglossaryentry{vmware}{
name=VMWare,
description={a virtualization software running on different \gls{os}}
}
\newglossaryentry{x86}{
name=x86,
description={a microprocessor architecture based on the 8086/8088 from Intel}
......
% Instruction Glossary Tutorial
\newglossaryentry{aaa}{
type=ins-glo,
name=\texttt{AAA},
......
......@@ -114,6 +114,7 @@ Additionally this book has several appendices. The appendices have the following
\vspace{1ex}
\begin{tabular}{|l|l|}
\hline
\ref{ch:Assembly Syntax} & Differences in AT\&T syntax and Intel syntax \\ \hline
\ref{glo:main} & Main glossary \\ \hline
\ref{glo:acronym} & Acronyms \\ \hline
\ref{glo:ins-glo} & Instructions with a short description \\ \hline
......@@ -161,8 +162,8 @@ In either case after setup you should go the section
If you already use a \gls{linux} system and know how to use the \gls{acr-cli} then you need to ensure that some software
is installed.
The following software is included in the standard repositories of most distributions, at least \gls{centos},
\gls{debian} and \gls{ubuntu} have the software in the repositories.
The following software is included in the standard repositories of most distributions, at least \gls{centos} (with
epel), \gls{debian} and \gls{ubuntu} have the software in the repositories.
\begin{itemize}
\item \gls{nasm}
......@@ -175,7 +176,22 @@ You additionally need to setup an additional repository to install \gls{git-lfs}
setting up the repository for \gls{centos}, \gls{debian} and \gls{ubuntu} can be found at
\url{https://github.com/git-lfs/git-lfs/wiki/Installation}.
TBD manual setup\marginnote{TBD manual setup}
Next is it advisable to \gls{clone} the repository of this tutorial (from
\url{https://github.com/osdevelopment-info/tutorial-x86}). This repository contains a subfolder \verb|bootloader/|
wich contains a \gls{bootloader} that helps us and also a shell script that creates a floppy disk for booting.
Additionally you can create a subfolder in your home that contains all tutorial code that you write. In the course of
this book I expect the folder to be \verb|tutorial/|.
Finally creating a file \verb|~/.gdbinit| with the following content will help us during development.
\begin{Verbatim}
set auto-load safe-path /home/<username>
\end{Verbatim}
You can restrict the path for autoloading further to the subfolder that you create for the tutorial code.
Now please check you setup with section \ref{sec:environment/test setup}~\nameref{sec:environment/test setup}.
\section{VM}
\label{sec:environment/vm}
......@@ -183,15 +199,23 @@ TBD manual setup\marginnote{TBD manual setup}
If you are not using \gls{linux} or not used to use the \gls{acr-cli} on a daily base then the \gls{vm} created for this
tutorial is perhaps helpfull for you.
TBD download instructions\marginnote{TBD Download}
The link to download the \gls{vm} can be found at the projects
page\footnote{\url{https://osdevelopment-info.github.io/tutorial-x86/}}.
I created the \gls{vm} using \gls{vbox} and also checked it with \gls{vmware} Player. For \gls{vmware} an additional
step is needed which is explained later in this section. The software should also run with other virtualization software
but this is not tested.
I created the \gls{vm} using \gls{vbox}. The software should also run with other virtualization software but this is not
tested.
The \gls{vm} is a \gls{debian} installation with all additional software installed. The \gls{vm} does not contain a
\gls{gui} and is only installed with \gls{acr-cli}.
To install the downloaded \gls{vm} you have to follow the following steps. I explain these steps for \gls{vbox}.
To install the downloaded \gls{vm} in \gls{vbox} start \gls{vbox} and select "Import Appliance..." in the menu
"File". Select the downloaded file in the import settings and click "Next\textgreater" to go to the settings screen.
There click "Import" to import the \gls{vm}. After that the \gls{vm} is ready to start.
So to help you with using this tutorial I created a toolset that may help you. Basically I created a \gls{vm} that
contains everything that you need to see the instructions work as explained in this book. The \gls{vm} contains a basic
\gls{debian} and all tools needed to run the examples. The tools installed are \gls{nasm} (used to assemble your
......@@ -292,7 +316,7 @@ cat bootloader test > floppy
qemu-system-i386 -s -S -drive format=raw,file=floppy,if=floppy \
-cpu 486 -display curses
\end{verbatim}
\Ctrl+\keystroke{F2}
\Alt+\keystroke{F2}
\begin{verbatim}
gdbtui
\end{verbatim}
......@@ -1414,12 +1438,12 @@ There are two different syntaxes for assembly language for the \gls{x86} assembl
AT\&T\index[idx]{Assembly Syntax!AT\&T|(} syntax and the other is the Intel\index[idx]{Assembly Syntax!Intel|(} syntax.
The difference looks like this:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movw %DX,%AX
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov AX,DX
\end{Verbatim}
......@@ -1434,16 +1458,16 @@ In the remaining section I will explain all differences between the syntaxes.
\section{Register Naming}
The registers have a plain name in Intel, like \verb|AX| or \verb|RAX|. In AT\&T syntax each register is prefixed with
\verb|%| so the registers would be named \verb|%AX| or \verb|%RAX|.
The registers have a plain name in Intel syntax, like \verb|AX| or \verb|RAX|. In AT\&T syntax each register is prefixed
with \verb|%| so the registers would be named \verb|%AX| or \verb|%RAX|.
Example:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
%AX
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
AX
\end{Verbatim}
......@@ -1458,12 +1482,12 @@ immediates must be prefixed with \verb|0x|. If you start an immediate with \verb
interpreted as octal in AT\&T syntax whereas in Intel syntax you prefix the immediate with \verb|0o| or \verb|0q|.
Example for moving a binary value to \verb|BL|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb $0b00111100,%BL
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov BL,0b00111100
\end{Verbatim}
......@@ -1471,12 +1495,12 @@ mov BL,0b00111100
\vspace{1ex}
Example for moving an octal value to \verb|BL|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb $0123,%BL
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov BL,0o123
\end{Verbatim}
......@@ -1484,12 +1508,12 @@ mov BL,0o123
\vspace{1ex}
Example for moving a decimal value to \verb|BL|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb $15,%BL
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov BL,15
\end{Verbatim}
......@@ -1497,12 +1521,12 @@ mov BL,15
\vspace{1ex}
Example for moving a hexadecimal value to \verb|BL|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb $0xab,%BL
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov BL,0xab
\end{Verbatim}
......@@ -1515,12 +1539,12 @@ The order of operands are reversed between AT\&T syntax and Intel syntax. In AT\
first and the target last. In Intel syntax the target is named first and then the source operand(s).
Example to move a value from \verb|AX| to \verb|BX|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movl %AX,%BX
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov BX,AX
\end{Verbatim}
......@@ -1539,12 +1563,12 @@ In Intel sytax you only determine the operand size if it is not deferable by the
\verb|qword| for a quad word (64~bit).
Example to move a byte to a register:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb $0x80,%AL
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov AL,0x80
\end{Verbatim}
......@@ -1552,12 +1576,12 @@ mov AL,0x80
\vspace{1ex}
Example to move a word into a memory location:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movw $0x8080,(%EAX)
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov word[EAX],0x8080
\end{Verbatim}
......@@ -1570,12 +1594,12 @@ When accessing the memory with an address in a register the syntax also differs.
register with round brackets (\verb|()|). In Intel syntax you use square brackets for this (\verb|[]|).
Example to load the byte from the address stored in \verb|ESI| to \verb|AH|:\\
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=AT\&T Syntax]
movb (%ESI),%AH
\end{Verbatim}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{minipage}[t]{0.49\textwidth}
\begin{Verbatim}[frame=single,label=Intel Syntax]
mov AH,[ESI]
\end{Verbatim}
......@@ -2743,7 +2767,7 @@ Public License instead of this License. But first, please read
This is a code chunk to be included by the generated asm files.
<<license>>=
; Meltdown and Spectre - Samples Written in Assembly
; x86 Assembly Tutorial - From 8086 to Intel~Core~Processors
; Copyright (C) 2018 U. Plonus
;
; This program is free software: you can redistribute it and/or modify
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment