home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.gcc.help
- Path: sparky!uunet!elroy.jpl.nasa.gov!news.claremont.edu!jarthur!jason
- From: jason@jarthur.claremont.edu (Jason Merrill)
- Subject: asm syntax in gcc?
- Message-ID: <JASON.92Dec12163621@it.claremont.edu>
- Sender: news@muddcs.claremont.edu (The News System)
- Organization: Minimal
- Date: 12 Dec 92 16:36:21
- Lines: 35
-
- Some of the system headers on our machine (Sequent Symmetry, Dynix 3.1.2)
- seem to use a different syntax for "asm" directives. For instance:
-
- asm void S_LOCK(laddr)
- {
- %reg laddr; lab loop, spin, done;
- /PEEPOFF
- loop: movb $L_LOCKED, %al
- xchgb %al, (laddr) /* an atomic "test and set" */
- cmpb $L_UNLOCKED, %al
- je done /* if equal, we got the lock */
- spin: cmpb $L_UNLOCKED, (laddr) /* spin in cache until unlocked */
- je loop /* then, try get lock again */
- jmp spin
- done:
- /PEEPON
- %mem laddr; lab loop, spin, done;
- /PEEPOFF
- loop: movb $L_LOCKED, %al
- movl laddr, %ecx
- xchgb %al, (%ecx) /* an atomic "test and set" */
- cmpb $L_UNLOCKED, %al
- je done /* if equal, we got the lock */
- spin: cmpb $L_UNLOCKED, (%ecx) /* spin in cache until unlocked */
- je loop /* then, try get lock again */
- jmp spin
- done:
- /PEEPON
- }
-
- How does this differ from the gcc asm syntax? What would be equivalent
- code that gcc would accept?
-
- --
- Jason Merrill jason@jarthur.claremont.edu
-