Michael Schnell wrote:
> > The vsyscall trick is a good one, and works with/without MMU, and
> > with/without permission to disable interrupts in userspace.  
> 
> Unfortunately I don't find something about the "vsyscall trick" in the
> Kernel sources not in the glibC sources.

Look in arch/arm/kernel/entry-armv.S for __kernel_cmpxchg,
kuser_cmpxchg_fixup, and all the places where kuser_cmpxchg_fixup is
called in that file.

I haven't read the relevant glibc sources, but I have written code
which uses __kernel_cmpxchg from my own application.

> nor other hints on doing atomic operation
> with the help of the vsyscall page (that is described as a memory area
> that all processes can access, so it seems atomic operations are
> required here, not provided).

The vsyscall page is shared among all processes, but read only.  (And
sometimes per-CPU).  Of course of you don't have an MMU or MPU then it
can be written, but that's not meant to happen.

kernel_cmpxchg accesses memory in your own process, that is, inside your
own pthread_mutex_t structs, not in the vsyscall page.

The point is that the code for kernel_cmpxchg is in the vsyscall page.
That's part of the trick that makes it possible.

-- Jamie
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to