Re: Significance of __iomem"

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

 



yes, i think u are right.

Basically below are listed the different types of memory ranges:

#ifdef __CHECKER__
# define __user         __attribute__((noderef, address_space(1)))
# define __kernel       /* default address space */
# define __safe         __attribute__((safe))
# define __force        __attribute__((force))
# define __nocast       __attribute__((nocast))
# define __iomem        __attribute__((noderef, address_space(2)))
# define __acquires(x)  __attribute__((context(x,0,1)))
# define __releases(x)  __attribute__((context(x,1,0)))
# define __acquire(x)   __context__(x,1)
# define __release(x)   __context__(x,-1)
# define __cond_lock(x,c)       ((c) ? ({ __acquire(x); 1; }) : 0)
extern void __chk_user_ptr(const volatile void __user *);
extern void __chk_io_ptr(const volatile void __iomem *);
#else

and this automated checking done by GCC is explained in links below:

http://lkml.org/lkml/2004/9/12/249 (by linus)
http://lkml.indiana.edu/hypermail/linux/kernel/0409.1/1537.html
Documentation/sparse.txt
http://lkml.org/lkml/2004/3/28/127 (item (10) basically summarizes the
answer for your question I think).

and its insertion done in patches like:

http://lkml.org/lkml/2004/10/2/55

On Thu, Apr 23, 2009 at 5:06 AM, Pei Lin <telent997@xxxxxxxxx> wrote:
> i think this use to diff kernel space or user space or iomem  like cpu
> ring 0 to ring 3.
>
> include/Linux/compiler.h:
> #ifdef __CHECKER__
> # define __user __attribute__((noderef, address_space(1)))
> # define __kernel /* default address space */
> # define __iomem __attribute__((noderef, address_space(2)))
> .......
>
> BRs
> lin
>
> 2009/4/23 Arjun Joshi <arjun.joshi@xxxxxxxxxxxxxx>:
>> Hi,
>>
>> I recently came across the below #define
>>
>> # define __iomem      __attribute__((noderef, address_space(2)))
>>
>> Browsing the internet I could find the following detail:
>>
>> "iomem" means two separate things: it means that sparse should complain
>> if the pointer is ever dereferenced (it's a "noderef" pointer) directly,
>> and it's in "address space 2" as opposed to the normal address space (0).
>>
>> My query : what does this address_space(2) or address_space(0) mean?
>>
>> Thanks in advance,
>> Arjun

-- 
Regards,
Peter Teoh

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux