🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #741

asm syntax in gcc?

#741
From: Jason Merrill
Date: Sat, 12 Dec 1992 16:36
35 lines
1357 bytes
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
Technical Details
Message-ID: <JASON.92Dec12163621@it.claremont.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!news.claremont.edu!jarthur!jason

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!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