lkml.org 
[lkml]   [2009]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectQ: put_user_try & co (Was: [PATCH 1/5] Split wait_noreap_copyout())
On 05/11, Ingo Molnar wrote:
>
> See the (new) put_user_try / put_user_ex() / put_user_catch()
> abstraction in arch/x86/include/asm/uaccess.h, and how all the x86
> signal code makes use of that to optimize such patterns of per field
> user copies.

Just curious, can't we simplify put_user_{try,ex,catch} ?

Pseudo-code:

#define put_user_try \
do { \
__label__ __efault_label; \


#define put_user_catch(err) \
err = 0; \
if (0) { \
__efault_label: \
err = -EFAULT; \
} \
while (0)


#define __put_user_asm_ex(...) \
asm volatile( \
"1: mov ..." \
_ASM_EXTABLE(1b, &__efault_label) \
: : ...)


Now, we don't need thread_info->uaccess_err, and we don't need the
special "if (fixup->fixup < 16)" hack in fixup_exception(). Once
any put_user_ex() fails, we jump to the __efault_label and set
err = -EFAULT.

This also means that we skip other put_user_ex's after the faulted
one. Not very important, this is unlikely case, but imho nice anyway.

Can this work? (warning: my asm skills is almost zero ;)

Oleg.



\
 
 \ /
  Last update: 2009-05-20 21:11    [W:0.205 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site