[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070304030339.GA5921@linux-mips.org>
Date: Sun, 4 Mar 2007 03:03:39 +0000
From: Ralf Baechle <ralf@...ux-mips.org>
To: Robert Hancock <hancockr@...w.ca>
Cc: "remi.chateauneu@...il.com" <remi.chateauneu@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: asm/atomic.h and user code
On Sat, Mar 03, 2007 at 08:09:47PM -0600, Robert Hancock wrote:
> Date: Sat, 03 Mar 2007 20:09:47 -0600
> From: Robert Hancock <hancockr@...w.ca>
> Subject: Re: asm/atomic.h and user code
> To: "remi.chateauneu@...il.com" <remi.chateauneu@...il.com>,
> linux-kernel <linux-kernel@...r.kernel.org>
> Content-type: text/plain; charset=ISO-8859-1; format=flowed
>
> remi.chateauneu@...il.com wrote:
> >Is it me or it seems it is not possible anymore to use asm/atomic.h in
> >non-kernel code ? Thanks.
>
> The atomic functions, as with any internal kernel data structures, were
> never intended to be used in userspace. In particular, the atomic
> functions depend on config settings like CONFIG_SMP in order to actually
> be atomic, and that's not guaranteed in userspace.
Some of the atomic headers use constructs such as disabling interrupts
which are not permitted in user space and if they were, would _silently_
fail. Other atomic operations such as <asm/bitops.h>, <asm/spinlock.h>
and xchg() <asm/system.h> have the same restriction.
Another trap is that in userspace PIC code may be used while in the kernel
it generally is not used and therefore much of the inline assembler code in
the kernel might fail.
In short, the kernel is a different universe :-)
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists