🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Jason Merrill Sat, 12 Dec 1992 16:36
asm syntax in gcc?
#741
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads