Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 2000 10:19:34 -0800 (PST)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        current@FreeBSD.ORG
Subject:   Re: __asm help..
Message-ID:  <200012081819.eB8IJYH20561@earth.backplane.com>
References:   <3A31236B.23501A47@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

:I'm trying to write  some experimental mutex operations similar to those
:in -current, but to do differnt things (e.g. a read/write lock)
:however, I am having some problems with the __asm  stuff.
:
:What I want to do is to define some operations that will
:assemble down to:
:	pushfl
:	cli
:	[stuff]
:	popfl
:
:I can generate the code, but it seems to me that there should be 
:a way of telling gcc that you have just pushed an item onto the stack, 
:so that if you were to have some C code between the push and po 
:(of the flags reg) the compiler has a correct idea of where the 
:SP is. I can imagine that it doesn't matter so it may be that there 
:is no constaint for that purpose (I read the gcc asm info pages)
:but I wanted to make sure that that is the case because if it does turn
:out to be important, it may manifest itself as a wierd bug sometime 
:in 2002.
:
:The current pushfl code in the kernel has the following:
:        __asm __volatile("pushfl; popl %0" : "=r" (ef));
:which has no long term effect on the stack pointer so I cannot 
:use it as a guide.
:
:-- 
:      __--_|\  Julian Elischer

    I think all you can do is move the addresses and data used
    by 'stuff' into registers prior to the push, then manipulate
    the registers between the push and the pop.

					    -Matt


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012081819.eB8IJYH20561>