Assembly language for Linux

Hi gurus,

I want to write a device driver for Linux and I must embed some
assembly language in my driver. As far as I know Linux uses AT&T
assembly language. I just know the the MASM assembly language.
What is the difference of this two assembly language and where can
I find the material or some resources of AT&T assembly language?
Any help will be appreciated.

Michael
b???.???????&?v?'?ׯj?.n?Qyȩf??]?:.?˛???m??֛???zf???%y?ޞ?^?˛??^r*Lzfެ?…???l??ܢ

At 09:59 AM 8/20/2001 +0800, you wrote:

I want to write a device driver for Linux and I must embed some
assembly language in my driver. As far as I know Linux uses AT&T
assembly language. I just know the the MASM assembly language.
What is the difference of this two assembly language and where can
I find the material or some resources of AT&T assembly language?

By definition, Assembly language is based on (and defined by) the CPU. So
if you’re running on an Intel CPU, the Assembly language is defined by
Intel… on an Athlon, it’s defined by AMD… and so forth. I’m not aware
of any AT&T CPU’s running Linux so I don’t think you need language
data from AT&T. More likely, what you want is information on the Gnu
language tools which normally come with whatever version of Linux you’re
running.

RLH


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Michael,

Check out this site :
http://linuxassembly.org

Based on the assembler that you want to use on the linux system, you can use
AT&T or Intel assembly language syntax.
Or you also have the option of using NASM.

Hope this helps
Taher

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Michael Zhu
Sent: Monday, August 20, 2001 7:29 AM
To: NT Developers Interest List
Subject: [ntdev] Assembly language for Linux

Hi gurus,

I want to write a device driver for Linux and I must embed some
assembly language in my driver. As far as I know Linux uses AT&T
assembly language. I just know the the MASM assembly language.
What is the difference of this two assembly language and where can
I find the material or some resources of AT&T assembly language?
Any help will be appreciated.

Michael
b???v?j?zj?.?˛???m??֛???zf???y?ޞ?^?o5?b??(??(


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Machine instructions must be the same, but pesudo instructions may be greatly different. MASM/TASM/ASM are very different from AT&T assembly language.

----- Original Message -----
From: “Richard L Hartman”
To: “NT Developers Interest List”
Cc:
Sent: Monday, August 20, 2001 11:11 AM
Subject: [ntdev] Re: Assembly language for Linux

> At 09:59 AM 8/20/2001 +0800, you wrote:
> >I want to write a device driver for Linux and I must embed some
> >assembly language in my driver. As far as I know Linux uses AT&T
> >assembly language. I just know the the MASM assembly language.
> >What is the difference of this two assembly language and where can
> >I find the material or some resources of AT&T assembly language?
>
> By definition, Assembly language is based on (and defined by) the CPU. So
> if you’re running on an Intel CPU, the Assembly language is defined by
> Intel… on an Athlon, it’s defined by AMD… and so forth. I’m not aware
> of any AT&T CPU’s running Linux so I don’t think you need language
> data from AT&T. More likely, what you want is information on the Gnu
> language tools which normally come with whatever version of Linux you’re
> running.
>
> RLH
>
>
> —
> You are currently subscribed to ntdev as: leezhiwei@263.net
> To unsubscribe send a blank email to xxxxx@lists.osr.com
(???r??z{e?˛???m?m?{]z???&j)@u?Ӣ?칻?&ޱ??i?Z?G?j)m?W???u?칻-E?"?Ǧm??(Z?X???,??&

Richards point was that the CPUs machine language is defined by the maker of
the CPU and not the OS or telephone company. Intel makes CPUs, AT&T makes
telephones. To run an Intel CPU you must use the Intel machine code for that
CPU. Assemblers take human understandable source files and convert them into
intermediate files which are then passed to linkers to produce functional
programs. That’s programming 101 in any college curriculum.

Given that, and knowing that AT&T makes telephones, there ain’t no such
thing as an AT&T assembly language. There MIGHT be an AT&T assembler that
produces Intel machine code. In the 70’s there might have been an AT&T CPU
requiring an AT&T machine language, but it went the way of the T-Rex many
decades ago.

By the way, Microsoft’s assembler, ML, is in the DDK, and that is a free
download. Given a decent assembler you can write programs for anything you
want, if you then have the support libraries you also need to link (remember
the linker?).

Gary

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of leezhiwei
Sent: Monday, March 19, 2001 7:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Assembly language for Linux

Machine instructions must be the same, but pesudo instructions may be
greatly different. MASM/TASM/ASM are very different from AT&T assembly
language.

----- Original Message -----
From: “Richard L Hartman”
To: “NT Developers Interest List”
Cc:
Sent: Monday, August 20, 2001 11:11 AM
Subject: [ntdev] Re: Assembly language for Linux

> At 09:59 AM 8/20/2001 +0800, you wrote:
> >I want to write a device driver for Linux and I must embed some
> >assembly language in my driver. As far as I know Linux uses AT&T
> >assembly language. I just know the the MASM assembly language.
> >What is the difference of this two assembly language and where can
> >I find the material or some resources of AT&T assembly language?
>
> By definition, Assembly language is based on (and defined by) the CPU. So
> if you’re running on an Intel CPU, the Assembly language is defined by
> Intel… on an Athlon, it’s defined by AMD… and so forth. I’m not aware
> of any AT&T CPU’s running Linux so I don’t think you need language
> data from AT&T. More likely, what you want is information on the Gnu
> language tools which normally come with whatever version of Linux you’re
> running.
>
> RLH
>
>
> —
> You are currently subscribed to ntdev as: leezhiwei@263.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
??آ?“y?”???-+.n?+?*???u?ڳ?%??e{???(c)??w?N???r??zǧu??jy-™???^j???
^???f?-±??,??(


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

xxxxx@inland.net said:

Richards point was that the CPUs machine language is defined by the
maker of the CPU and not the OS or telephone company.

The *machine language* is defined by the maker of the CPU. The assembly
language is suggested by the CPU manufacturer, but is left to the
implementer of the assembler. There may be many, and in the case of
the i386 there are many.

xxxxx@inland.net said:

Given that, and knowing that AT&T makes telephones, there ain’t no
such thing as an AT&T assembly language. There MIGHT be an AT&T
assembler that produces Intel machine code. In the 70’s there might
have been an AT&T CPU requiring an AT&T machine language, but it went
the way of the T-Rex many decades ago.

Completely missed the point.

AT&T, along with telephones (actually, Western Electric made the
telephones) used to make operating systems and compilers. And micro-
processors. (Actually, Western Electric made these too.) They devised
an assembly language syntax that was used at Bell Labs in their UNIX
environments.

As UNIX progressed, assemblers were written for various processors,
using the opcodes from the processor manufacturer and the operand syntax
and pseudo-ops from “AT&T” assemblers.

The GNU assembler (gas) supports “AT&T” syntax for various processors,
including (I think) the Intel processors. This is the assembler that
Linux systems generally use. Microsoft probably uses the assembly syntax
defined by Intel. Many other CPU vendors choose not to buck the trend
and use AT&T syntax (and gas) from the start.

Thus, people often use “AT&T assembly language” to mean “AT&T assembly
language *syntax*” and gas supports this syntax for a variety of processors.

The answer to the original poster’s question is that (s)he should look
up the documentation for gas in order to program assembly under Linux.

Steve Williams “The woods are lovely, dark and deep.
xxxxx@icarus.com But I have promises to keep,
xxxxx@picturel.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep.”


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

AT&T is a common assembler syntax for any CPU/opcode set.
x86 mnemonics also can be written in AT&T syntax.

AT&T assembler syntax is used in Linux/UNIX world of portable code.
It is the inline assembler syntax supported by GCC.

Max

----- Original Message -----
From: “Gary G. Little”
To: “NT Developers Interest List”
Sent: Friday, August 24, 2001 8:01 PM
Subject: [ntdev] Re: Assembly language for Linux

Richards point was that the CPUs machine language is defined by the maker of
the CPU and not the OS or telephone company. Intel makes CPUs, AT&T makes
telephones. To run an Intel CPU you must use the Intel machine code for that
CPU. Assemblers take human understandable source files and convert them into
intermediate files which are then passed to linkers to produce functional
programs. That’s programming 101 in any college curriculum.

Given that, and knowing that AT&T makes telephones, there ain’t no such
thing as an AT&T assembly language. There MIGHT be an AT&T assembler that
produces Intel machine code. In the 70’s there might have been an AT&T CPU
requiring an AT&T machine language, but it went the way of the T-Rex many
decades ago.

By the way, Microsoft’s assembler, ML, is in the DDK, and that is a free
download. Given a decent assembler you can write programs for anything you
want, if you then have the support libraries you also need to link (remember
the linker?).

Gary

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of leezhiwei
Sent: Monday, March 19, 2001 7:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Assembly language for Linux

Machine instructions must be the same, but pesudo instructions may be
greatly different. MASM/TASM/ASM are very different from AT&T assembly
language.

----- Original Message -----
From: “Richard L Hartman”
To: “NT Developers Interest List”
Cc:
Sent: Monday, August 20, 2001 11:11 AM
Subject: [ntdev] Re: Assembly language for Linux

> At 09:59 AM 8/20/2001 +0800, you wrote:
> >I want to write a device driver for Linux and I must embed some
> >assembly language in my driver. As far as I know Linux uses AT&T
> >assembly language. I just know the the MASM assembly language.
> >What is the difference of this two assembly language and where can
> >I find the material or some resources of AT&T assembly language?
>
> By definition, Assembly language is based on (and defined by) the CPU. So
> if you’re running on an Intel CPU, the Assembly language is defined by
> Intel… on an Athlon, it’s defined by AMD… and so forth. I’m not aware
> of any AT&T CPU’s running Linux so I don’t think you need language
> data from AT&T. More likely, what you want is information on the Gnu
> language tools which normally come with whatever version of Linux you’re
> running.
>
> RLH
>
>
> —
> You are currently subscribed to ntdev as: leezhiwei@263.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
ÿÿØ¢æ"yË"­éí-+.nÇ+?*¶?íuëÚ³ø%SÛe{ø§.(c)Ýþw­N<§²æìr¸>zǧu¦åjy-™¨¥¶?^j÷ÿz×
^¿ýõÛfÿ-±³ú,¯÷(


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

It ain’t quite so. The instruction set is defined by the maker of the CPU,
but the assembly language, not necessarily. In this case, the Unix/Linux
AT&T assembler, uses a slightly different syntax. This is probably due to
the need of supporting it with GCC and reusing the inline assembly facility
that’s already there.

And, for the record, AT&T created Unix!

So, for example, you say “movl $1,%eax” instead of “mov eax,1”: immediate
values are prefixed with a dollar sign, and register names begin with a
percent sign. Also, the operand sequence is different: you say “mov src,dst”
instead of “mov dst,src”. Indirect operands use round brackets instead of
square brackets: "movl (%ebx),$3. Hex values are stated as “0x30” instead of
“30h”. Instruction lengths are embedded in the opcode: “movl %al,%bl”
instead of “mov al,bl”. Syntax such as “far ptr” does not exist. Segments
aren’t supported, Unix wants only one code control section. This syntax also
extends into the gcc compiler, so, if you use gcc to generate code you will
need to use AT&T syntax for inline assembly even if you’re compiling code
for Windows.

The AT&T standard is probably as old as the 8086, and it’s not source
compatible with the Intel/IBM standard that was born with DOS 1.0. For more
details, take a look at http://www.linuxassembly.org/linasm.html. You can
also go to http://www.linuxassembly.org/resources.html#tutorials for lots of
links and tutorial material.

Hope this helps!

Alberto.

-----Original Message-----
From: Gary G. Little [mailto:xxxxx@inland.net]
Sent: Friday, August 24, 2001 12:02 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Assembly language for Linux

Richards point was that the CPUs machine language is defined by the maker of
the CPU and not the OS or telephone company. Intel makes CPUs, AT&T makes
telephones. To run an Intel CPU you must use the Intel machine code for that
CPU. Assemblers take human understandable source files and convert them into
intermediate files which are then passed to linkers to produce functional
programs. That’s programming 101 in any college curriculum.

Given that, and knowing that AT&T makes telephones, there ain’t no such
thing as an AT&T assembly language. There MIGHT be an AT&T assembler that
produces Intel machine code. In the 70’s there might have been an AT&T CPU
requiring an AT&T machine language, but it went the way of the T-Rex many
decades ago.

By the way, Microsoft’s assembler, ML, is in the DDK, and that is a free
download. Given a decent assembler you can write programs for anything you
want, if you then have the support libraries you also need to link (remember
the linker?).

Gary

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of leezhiwei
Sent: Monday, March 19, 2001 7:17 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Assembly language for Linux

Machine instructions must be the same, but pesudo instructions may be
greatly different. MASM/TASM/ASM are very different from AT&T assembly
language.

----- Original Message -----
From: “Richard L Hartman”
To: “NT Developers Interest List”
Cc:
Sent: Monday, August 20, 2001 11:11 AM
Subject: [ntdev] Re: Assembly language for Linux

> At 09:59 AM 8/20/2001 +0800, you wrote:
> >I want to write a device driver for Linux and I must embed some
> >assembly language in my driver. As far as I know Linux uses AT&T
> >assembly language. I just know the the MASM assembly language.
> >What is the difference of this two assembly language and where can
> >I find the material or some resources of AT&T assembly language?
>
> By definition, Assembly language is based on (and defined by) the CPU. So
> if you’re running on an Intel CPU, the Assembly language is defined by
> Intel… on an Athlon, it’s defined by AMD… and so forth. I’m not aware
> of any AT&T CPU’s running Linux so I don’t think you need language
> data from AT&T. More likely, what you want is information on the Gnu
> language tools which normally come with whatever version of Linux you’re
> running.
>
> RLH
>
>
> —
> You are currently subscribed to ntdev as: leezhiwei@263.net
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
ÿÿØ¢æ"yË"­éí-+.nÇ+?¶?íuëÚ³ø%SÛe{ø§(c)Ýþw­N<§²æìr¸>zǧu¦åjy-™¨¥¶?^j÷ÿz×
^¿ýõÛfÿ-±³ú,¯÷(


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com