lkml.org 
[lkml]   [2007]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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@shaw.ca>
> Subject: Re: asm/atomic.h and user code
> To: "remi.chateauneu@gmail.com" <remi.chateauneu@gmail.com>,
> linux-kernel <linux-kernel@vger.kernel.org>
> Content-type: text/plain; charset=ISO-8859-1; format=flowed
>
> remi.chateauneu@gmail.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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-04 05:31    [W:0.027 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site