tech-kern archive

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

Re: [PATCH] swapcontext vs libpthread

On Aug 25,  4:11am, (Emmanuel Dreyfus) wrote:
-- Subject: Re: [PATCH] swapcontext vs libpthread

| On Fri, Aug 24, 2012 at 11:26:24PM -0400, Christos Zoulas wrote:
| > In lib/libc/sys/, move setcontext.S from the ASM section to the
| > WEAKASM section. This will define for you a _sys_setcontext() to use 
| Right, this is the easy part. If you run this you see the hard part:
| grep -r setcontect src/lib/libc/arch
| We have many setcontext system calls in assembly that need to be turned
| into calls to _C_LABEL(setcontext).

$ fgrep -r setcontext . | grep -v _C_LABEL | grep -v sigtramp | fgrep -v .c:
[ skip _C_LABEL, sigtramp is ok since it uses the machine generated context,
  c files are ok too ]

FIX: ./alpha/gen/swapcontext.S:      CALL(setcontext)                /* 
setcontext(ucp) */

FIX: ./hppa/gen/swapcontext.S:       SYSCALL(setcontext)

OK: ./i386/gen/resumecontext.S:     pushl   %ecx    /* argument for exit() or 
setcontext() */
OK: ./i386/gen/swapcontext.S:       /* No need to error-check: setcontext() 
must have failed. */

FIX: ./mips/gen/_resumecontext.S:    SYSTRAP(setcontext)                        
     #   yes, become it.
FIX: ./mips/gen/swapcontext.S:       SYSTRAP(setcontext)

FIX?: ./sh3/gen/swapcontext.S:        mov.l   .L_setcontext, r2
FIX?: ./sh3/gen/swapcontext.S:2:      CALL    r2                      /* 
setcontext(ucp) */
OK: ./sh3/gen/swapcontext.S:        /* if we get here, return error from 
setcontext */

FIX: ./sparc/gen/swapcontext.S:      mov     SYS_setcontext|SYSCALL_G2RFLAG, %g1

FIX: ./sparc64/gen/swapcontext.S:    mov     SYS_setcontext|SYSCALL_G5RFLAG, %g1

FIX: ./powerpc64/gen/swapcontext.S:  bl      .setcontext                     # 

So swapcontext needs to be fixed in a few archs I think...
Some of the fixes are trivial.


Home | Main Index | Thread Index | Old Index