Doc on GNU ASSEMBLER

Doc on GNU ASSEMBLER

Post by Xanr » Thu, 18 Feb 1999 04:00:00



Ineed to write a few simple asm lines for pgms I am porting to Linux from DOS
where the int86(..) function was handy.

I realise that the syntax of the GNU Assembler is completely different from
MASM
or TASM, especially to access tne INTEL registers.

Thanks to the good soul which could tell me where I can find the necessary doc.
(book or otherwise).

 
 
 

Doc on GNU ASSEMBLER

Post by David Z. Maz » Thu, 18 Feb 1999 04:00:00


Xanrov> Ineed to write a few simple asm lines for pgms I am porting to
Xanrov> Linux from DOS where the int86(..) function was handy.

Simple answer 1: pretend interrupts just don't work in Linux.  (That's
close enough to reality anyways.)

Simple answer 2: embedding assembly in your code means you're not
porting to Linux, you're porting to an inherently nonportable
i386-based Linux.  IMHO unless you're the kernel the latter is quite
inexcusable.

Xanrov> Thanks to the good soul which could tell me where I can find
Xanrov> the necessary doc.

Have you looked in Info?

--

"Hey, Doug, do you mind if I push the Emergency Booth Self-Destruct Button?"
"Oh, sure, Dave, whatever...you _do_ know what that does, right?"

 
 
 

1. GNU assembler to Solaris assembler

I would like to covert one inline assembly function included in SPARC
Linux to Solaris assembler syntax. The function is written in GNU
assembler syntax.
Two syntax errors are reported due to pseudo operators when I compile
using gcc on Solaris.

inline void spin_lock(unsigned char *lock)
{
  __asm__ __volatile__("
1:  ldstub  [%0], %%g2
  orcc  %%g2, 0x0, %%g0
  bne,a 2f
   ldub [%0], %%g2
  .text 2                         <==
2:  orcc  %%g2, 0x0, %%g0
  bne,a 2b
   ldub [%0], %%g2
  b,a 1b
        .previous                       <==
" :
  : "r" (lock)
  : "g2", "memory", "cc");

/usr/ccs/bin/as: "/var/tmp/cc030Gpt.s", line 18: error: quoted-string operand required
/usr/ccs/bin/as: "/var/tmp/cc030Gpt.s", line 23: error: unknown opcode ".previous"
/usr/ccs/bin/as: "/var/tmp/cc030Gpt.s", line 23: error: statement syntax

How can I convert the function to Solaris assembler syntax? In
particular I cannot find '.previous' pseudo operator in GNU assembler
info manual.
I have confirmed that gcc + GNU assembler can compile this function on
Solaris.

    <--------->    Computational Science Laboratory
                   The Institute of Physics and Chemistry(RIKEN)
    >---------<    Susukita Ryutaro

2. Password Synchronisation

3. "man" Help needed

4. doc for hp9ks300 assembler pseudo-ops for cdb ...

5. Help on Message Queue (System V IPC)

6. Docs on assembler programming under Linux

7. Wierd PASV FTP

8. Am I the first one to try the assembler example from the Sun docs ?

9. Assembler Docs for 64 Bit

10. GNU assembler 2.5.2.6

11. GNU Assembler

12. GNU Binary Utilities 2.5.1 released: now includes assembler (gas)