Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Dec 1996 11:44:25 +0900 (JST)
From:      Michael Hancock <michaelh@cet.co.jp>
To:        FreeBSD Hackers <Hackers@FreeBSD.ORG>
Subject:   Implementing atomic DCAS on Intel for NBS
Message-ID:  <Pine.SV4.3.95.961213112940.12235A-100000@parkplace.cet.co.jp>

next in thread | raw e-mail | index | archive | help
It doesn't look like the P5 has DCAS which is important for NBS because it
wants to atomically manipulate a structure and update it's version
number.

Here's some pseudo code:

int
DCAS(	int *p1, int *p2,
	int old1, int old2
	int new1, int new2)
{
	<begin atomic>	
	if ((*p1 == old1) && (*p2 == old2)) {
		*p1 = new1;
		*p2 = new2;
		return TRUE;
	} else {
		return FALSE;
	}
	<end atomic>
}

Is there an an assembler guru out there who can tell us how many
instructions would be necessary to implement this for a P5? 

Here's a link for an R4000 version:

http://www-dsg.stanford.edu/papers/non-blocking-osdi/node11.html

Regards,


Mike Hancock




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.961213112940.12235A-100000>