Re: [RFC -tip 2/4] x86: uaccess: introduce __{get|put}_userexception handling framework

From: Ingo Molnar
Date: Tue Dec 23 2008 - 09:31:19 EST



* Hiroshi Shimamoto <h-shimamoto@xxxxxxxxxxxxx> wrote:

> From: Hiroshi Shimamoto <h-shimamoto@xxxxxxxxxxxxx>
>
> Impact: introduce new framework
>
> Introduce exception handling framework.
> __{get|put}_user_ex_try() begins exception block and
> __{get|put}_user_ex_catch() ends block and if an exception occurred in this
> block using __{get|put}_user_ex, direct jump to __{get|put}_user_ex_catch()
> and err is set to specified value.

ha, this tickled ~12 year old memories: back then Linus came up with a
very, very similar scheme, for user-copy exception handling.

Such a scheme would be elegant, creates more compact code (we can use
conditional results directly in branch instructions instead of having to
export them into registers), and it makes sense syntactically, but it
doesnt work: GCC is free to reorder (or eliminate) basic blocks and these
labels can lose their relationship.

So this cannot be done via inline assembly right now, it needs some
compiler help. Sniff :)

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/