mirror of https://github.com/tLDP/LDP
version 0.6f
This commit is contained in:
parent
ebcb00b4ba
commit
31652cfef9
|
@ -1,6 +1,6 @@
|
||||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
|
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
|
||||||
|
|
||||||
<!ENTITY version "0.6e">
|
<!ENTITY version "0.6f">
|
||||||
|
|
||||||
<!ENTITY s-intro "<link linkend=s-intro>Introduction</link>">
|
<!ENTITY s-intro "<link linkend=s-intro>Introduction</link>">
|
||||||
<!ENTITY s-doyou "<link linkend=s-doyou>Do you need assembly?</link>">
|
<!ENTITY s-doyou "<link linkend=s-doyou>Do you need assembly?</link>">
|
||||||
|
@ -230,6 +230,18 @@ and am pleased to announce
|
||||||
|
|
||||||
</simplesect>
|
</simplesect>
|
||||||
|
|
||||||
|
<simplesect><title>Translations</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Korean translation of this HOWTO is avalilable at
|
||||||
|
<ulink url="http://kldp.org/HOWTO/html/Assembly-HOWTO/">
|
||||||
|
http://kldp.org/HOWTO/html/Assembly-HOWTO/</ulink>.
|
||||||
|
Also, there was French translation of the early HOWTO versions,
|
||||||
|
but I couldn't find it now.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</simplesect>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="s-doyou" xreflabel="Do you need assembly?">
|
<chapter id="s-doyou" xreflabel="Do you need assembly?">
|
||||||
|
@ -616,7 +628,7 @@ So, one of the possible ways is to rewrite some
|
||||||
and this will really save you a lot of space.
|
and this will really save you a lot of space.
|
||||||
For instance, a simple <command>httpd</command> written in assembly
|
For instance, a simple <command>httpd</command> written in assembly
|
||||||
can take less than 600 bytes;
|
can take less than 600 bytes;
|
||||||
you can fit a webserver, consisting of kernel and httpd,
|
you can fit a server consisting of kernel, httpd and ftpd
|
||||||
in 400 KB or less... Think about it.
|
in 400 KB or less... Think about it.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -903,14 +915,11 @@ GAS is the GNU Assembler, that GCC relies upon.
|
||||||
<section><title>Where to find it</title>
|
<section><title>Where to find it</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Find it at the same place where you found GCC,
|
Find it at the same place where you've found GCC,
|
||||||
in a package named binutils.
|
in the binutils package.
|
||||||
</para>
|
The latest version of binutils is available from
|
||||||
|
<ulink url="http://sources.redhat.com/binutils/">
|
||||||
<para>
|
http://sources.redhat.com/binutils/
|
||||||
The latest version is available from HJLu at
|
|
||||||
<ulink url="ftp://ftp.varesearch.com/pub/support/hjl/binutils/">
|
|
||||||
ftp://ftp.varesearch.com/pub/support/hjl/binutils/
|
|
||||||
</ulink>.
|
</ulink>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -969,7 +978,7 @@ as in <function>addl $5,%eax</function>
|
||||||
(add immediate long value 5 to register <literal>%eax</literal>).
|
(add immediate long value 5 to register <literal>%eax</literal>).
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Missing operand prefix indicates it is a memory-address;
|
Missing operand prefix indicates that it is memory-contents;
|
||||||
hence <function>movl $foo,%eax</function>
|
hence <function>movl $foo,%eax</function>
|
||||||
puts the <emphasis>address</emphasis> of variable <literal>foo</literal>
|
puts the <emphasis>address</emphasis> of variable <literal>foo</literal>
|
||||||
into register <literal>%eax</literal>,
|
into register <literal>%eax</literal>,
|
||||||
|
@ -990,8 +999,8 @@ from the cell pointed to by <literal>%ebp</literal>).
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<anchor id="p-convert">
|
<anchor id="p-convert">
|
||||||
Note: There are <link linkend="s-res">few programs</link>
|
Note: There are <link linkend="s-res">few programs</link> which may help you
|
||||||
which may help you to convert source code between AT&T and Intel assembler syntaxes;
|
to convert source code between AT&T and Intel assembler syntaxes;
|
||||||
some of the are capable of performing conversion in both directions.
|
some of the are capable of performing conversion in both directions.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -1012,7 +1021,7 @@ Again, the sources for Linux (the OS kernel) come in as excellent examples;
|
||||||
see under <filename>linux/arch/i386/</filename> the following files:
|
see under <filename>linux/arch/i386/</filename> the following files:
|
||||||
<filename>kernel/*.S</filename>,
|
<filename>kernel/*.S</filename>,
|
||||||
<filename>boot/compressed/*.S</filename>,
|
<filename>boot/compressed/*.S</filename>,
|
||||||
<filename>mathemu/*.S</filename>.
|
<filename>math-emu/*.S</filename>.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -1105,7 +1114,7 @@ to eventually support all known syntaxes and object formats.
|
||||||
<title>Where to find NASM</title>
|
<title>Where to find NASM</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<ulink url="http://nasm.2y.net">http://nasm.2y.net</ulink>,
|
<ulink url="http://nasm.sourceforge.net">http://nasm.sourceforge.net</ulink>,
|
||||||
<ulink url="http://www.cryogen.com/nasm/">http://www.cryogen.com/nasm/</ulink>
|
<ulink url="http://www.cryogen.com/nasm/">http://www.cryogen.com/nasm/</ulink>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -1273,6 +1282,18 @@ http://www.tortall.net/projects/yasm/</ulink>.
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section><title>FASM</title>
|
||||||
|
<para>
|
||||||
|
FASM (flat assembler) is a fast, efficient 80x86 assembler
|
||||||
|
that runs in 'flat real mode'. Unlike many other 80x86 assemblers,
|
||||||
|
FASM only requires the source code to include the information it really needs.
|
||||||
|
It is written in itself and is very small and fast.
|
||||||
|
It runs on DOS/Windows/Linux and can produce
|
||||||
|
flat binary, DOS EXE, Win32 PE and COFF output.
|
||||||
|
See <ulink url="http://fasm.sourceforge.net">http://fasm.sourceforge.net</ulink>.
|
||||||
|
</para>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section><title>OSIMPA (SHASM)</title>
|
<section><title>OSIMPA (SHASM)</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -1311,6 +1332,59 @@ http://www.penguin.cz/~niki/tdasm/</ulink>.
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section><title>HLA</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<ulink url="http://webster.cs.ucr.edu">HLA</ulink> is a
|
||||||
|
<emphasis remap="bold">H</Emphasis>igh
|
||||||
|
<emphasis remap="bold">L</Emphasis>evel
|
||||||
|
<emphasis remap="bold">A</Emphasis>ssembly language.
|
||||||
|
It uses a high level language like syntax
|
||||||
|
(similar to Pascal, C/C++, and other HLLs) for variable declarations,
|
||||||
|
procedure declarations, and procedure calls. It uses a modified
|
||||||
|
assembly language syntax for the standard machine instructions.
|
||||||
|
It also provides several high level language style control structures
|
||||||
|
(if, while, repeat..until, etc.) that help you write much more readable code.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
HLA is free and comes with source, Linux and Win32 versions available.
|
||||||
|
On Win32 you need MASM and a 32-bit version of MS-link on Win32,
|
||||||
|
on Linux you nee GAS, because HLA produces specified assembler code
|
||||||
|
and uses that assembler for final assembling and linking.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section><title>TALC</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<ulink url="http://www.cs.cornell.edu/talc/">TALC</ulink>
|
||||||
|
is another free MASM/Win32 based compiler
|
||||||
|
(however it supports ELF output, does it?).
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
TAL stands for
|
||||||
|
<emphasis>T</emphasis>yped
|
||||||
|
<emphasis>A</Emphasis>ssembly
|
||||||
|
<emphasis>L</Emphasis>anguage.
|
||||||
|
It extends traditional untyped assembly languages with typing annotations,
|
||||||
|
memory management primitives, and a sound set of typing rules, to guarantee
|
||||||
|
the memory safety, control flow safety,and type safety of TAL programs.
|
||||||
|
Moreover, the typing constructs are expressive enough to encode
|
||||||
|
most source language programming features including records and structures,
|
||||||
|
arrays, higher-order and polymorphic functions, exceptions, abstract data types,
|
||||||
|
subtyping, and modules. Just as importantly,
|
||||||
|
TAL is flexible enough to admit many low-level compiler optimizations.
|
||||||
|
Consequently, TAL is an ideal target platform for type-directed compilers
|
||||||
|
that want to produce verifiably safe code
|
||||||
|
for use in secure mobile code applications
|
||||||
|
or extensible operating system kernels.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
<section><title>Free Pascal</title>
|
<section><title>Free Pascal</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -1409,62 +1483,6 @@ improvement over many of its successors. -John"
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section><title>HLA</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
<ulink url="http://webster.cs.ucr.edu">HLA</ulink> is a
|
|
||||||
<emphasis remap="bold">H</Emphasis>igh
|
|
||||||
<emphasis remap="bold">L</Emphasis>evel
|
|
||||||
<emphasis remap="bold">A</Emphasis>ssembly language.
|
|
||||||
It uses a high level language like syntax
|
|
||||||
(similar to Pascal, C/C++, and other HLLs) for variable declarations,
|
|
||||||
procedure declarations, and procedure calls. It uses a modified
|
|
||||||
assembly language syntax for the standard machine instructions.
|
|
||||||
It also provides several high level language style control structures
|
|
||||||
(if, while, repeat..until, etc.) that help you write much more readable code.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
HLA is free, but runs only under Win32.
|
|
||||||
You need MASM and a 32-bit version of MS-link,
|
|
||||||
because HLA produces MASM code and uses MASM for final
|
|
||||||
assembling and linking. However it comes with
|
|
||||||
<command>m2t</command> (MASM to TASM)
|
|
||||||
post-processor program that converts the HLA MASM output to a form
|
|
||||||
that will compile under TASM. Unfortunately, NASM is not supported.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section><title>TALC</title>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
<ulink url="http://www.cs.cornell.edu/talc/">TALC</ulink>
|
|
||||||
is another free MASM/Win32 based compiler
|
|
||||||
(however it supports ELF output, does it?).
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<para>
|
|
||||||
TAL stands for
|
|
||||||
<emphasis>T</emphasis>yped
|
|
||||||
<emphasis>A</Emphasis>ssembly
|
|
||||||
<emphasis>L</Emphasis>anguage.
|
|
||||||
It extends traditional untyped assembly languages with typing annotations,
|
|
||||||
memory management primitives, and a sound set of typing rules, to guarantee
|
|
||||||
the memory safety, control flow safety,and type safety of TAL programs.
|
|
||||||
Moreover, the typing constructs are expressive enough to encode
|
|
||||||
most source language programming features including records and structures,
|
|
||||||
arrays, higher-order and polymorphic functions, exceptions, abstract data types,
|
|
||||||
subtyping, and modules. Just as importantly,
|
|
||||||
TAL is flexible enough to admit many low-level compiler optimizations.
|
|
||||||
Consequently, TAL is an ideal target platform for type-directed compilers
|
|
||||||
that want to produce verifiably safe code
|
|
||||||
for use in secure mobile code applications
|
|
||||||
or extensible operating system kernels.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section><title>Non-free and/or Non-32bit x86 assemblers</title>
|
<section><title>Non-free and/or Non-32bit x86 assemblers</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -1744,6 +1762,10 @@ are callee-saved, other registers are caller-saved;
|
||||||
<para>
|
<para>
|
||||||
FP stack: I'm not sure, but I think result is in
|
FP stack: I'm not sure, but I think result is in
|
||||||
<literal>st(0)</literal>, whole stack caller-saved.
|
<literal>st(0)</literal>, whole stack caller-saved.
|
||||||
|
The SVR4 i386 ABI specs at
|
||||||
|
<ulink url="http://www.caldera.com/developer/devspecs/">
|
||||||
|
http://www.caldera.com/developer/devspecs/</ulink>
|
||||||
|
is a good reference point if you want more details.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -2396,7 +2418,7 @@ _start:
|
||||||
.data # section declaration
|
.data # section declaration
|
||||||
|
|
||||||
msg:
|
msg:
|
||||||
.string "Hello, world!\n" # our dear string
|
.ascii "Hello, world!\n" # our dear string
|
||||||
len = . - msg # length of our dear string
|
len = . - msg # length of our dear string
|
||||||
|
|
||||||
.text # section declaration
|
.text # section declaration
|
||||||
|
@ -3033,6 +3055,18 @@ that need not to be repeatedly mentioned every time.
|
||||||
|
|
||||||
<para><revhistory>
|
<para><revhistory>
|
||||||
|
|
||||||
|
<revision>
|
||||||
|
<revnumber>0.6f</revnumber><date>17 Aug 2002</date><authorinitials>konst</authorinitials>
|
||||||
|
<revremark>
|
||||||
|
Added FASM,
|
||||||
|
added URL to Korean translation,
|
||||||
|
added URL to SVR4 i386 ABI specs,
|
||||||
|
update on HLA/Linux,
|
||||||
|
small fix in hello.S example,
|
||||||
|
misc URL updates;
|
||||||
|
</revremark>
|
||||||
|
</revision>
|
||||||
|
|
||||||
<revision>
|
<revision>
|
||||||
<revnumber>0.6e</revnumber><date>12 Jan 2002</date><authorinitials>konst</authorinitials>
|
<revnumber>0.6e</revnumber><date>12 Jan 2002</date><authorinitials>konst</authorinitials>
|
||||||
<revremark>
|
<revremark>
|
||||||
|
|
Loading…
Reference in New Issue