[parisc-linux] Generic light-weight syscall.

Carlos O'Donell carlos@baldric.uwo.ca
Fri, 25 Jul 2003 02:37:40 -0400


pa,

Any thoughts about how one should implement some type of lightweight
syscall for our glibc to use?

We already have the makings of a simple system for SET_THREAD_SELF (e.g.
seting cr27, the thread register, from userpsace), and I want to extend
this to:

exchange_and_add (volatile uint32_t *mem, int val)
atomic_add (volatile uint32_t *mem, int val)
compare_and_swap (volatile long int *p, long int oldval, long int newval)

o---> libc 
 --> exchange_and_add 
  ==> Params into kernel
   ==> disable interrupts on the current processor
    ==> take a semaphore to keep other cpu's out
    ==> do work 
    ==> release semaphore
   ==> reenable i-bit
  --> back into userspace and done.

This _must_ be very very fast, and appear atomic to userspace.

Perhaps adding other pages instead of 0xE0 for set_thread_self might be
the simplest way to do this? The area after the linux gateway page
perhaps? Which seems to be the start of the next 4k page? Would this be
possible? e.g. branch to 0x1000 (not 0x100 which is the current syscall
branch).

c.