lkml.org 
[lkml]   [1999]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: __asm__
On Fri, 16 Jul 1999, Colin Coe wrote:

> Hi all
>
> How would I use the __asm__ macro to execute to following assember?
>
> mov ax, <some_variable>
> mov es, ax
> sub ax, ax
> xchg ax, es:[<some_variable>]
>

The gcc asm uses the ATT command-set. Therefore it's backwards from
Intel Assembler.

The asm extension puts text into the intermediate code that gcc
generates, i.e., do `gcc -S -o att.asm program.c`. The result is
that you have to put in some '%' characters to show that registers
are registers. There are numerous examples of such assembler in
../linux/arch/i386/* and ../linux/include/asm/*.h

FYI, your code snippet above sets a segment register from the contents
of some memory operand. This is something that you probably don't want
to do in Linux. If you do, you move it directly :

mov es, [some_variable]

Cheers,
Dick Johnson
FILE SYSTEM MODIFIED
Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.070 / U:0.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site