[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH ARM v3 7/7] mini-os: initial ARM support



On Wed, 2014-06-11 at 21:24 +0200, Samuel Thibault wrote:
> > +static inline unsigned long __xchg(unsigned long x, volatile void * ptr, 
> > int size)
> > +{
> > +    //TODO
> > +    unsigned volatile long y, tmp = 0;
> > +    switch(size){
> > +    case 1:
> > +#if CPU_EXCLUSIVE_LDST
> > +        __asm__ __volatile__("1:ldrexb %0, [%1]\n"
> > +            "strexb %3, %2, [%1]\n"
> > +            "cmp %3, #1\n"
> > +            "beq 1b\n\n"
> > +            "dmb\n":"=&r"(y):"r"(ptr), "r"(x), "r"(tmp):"memory");
> > +#else
> > +        y = (*(char *)ptr) & 0x000000ff;
> > +        *((char *)ptr) = (char)x;
> 
> The second version is very fragile :) I'd rather put a strong #warning
> here, to make sure nobody ever uses that code for anything close to
> production level.

ldrexb is guaranteed to be available on any platform which can run Xen.
For one thing xen uses them (unconditionally) itself.

I can't remember if it is the virt extensions themselves or the LPAE
extension (which is in turn required by the virt extensions) which add
this architectural requirement.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.