All of lore.kernel.org
 help / color / mirror / Atom feed
* Confusing in Address
@ 2012-02-11  9:52 hz hanks
  2012-02-11 16:08 ` cheng chen
  2012-02-12 11:26 ` Mulyadi Santosa
  0 siblings, 2 replies; 4+ messages in thread
From: hz hanks @ 2012-02-11  9:52 UTC (permalink / raw)
  To: kernelnewbies

Hi, all

I'm confused with different addresses in Linux, such as virtual
address and hardware address. For example, which kind of address one
can get when using "&num" in application layer programming? How about
that in kernel, such as in device driver? Which kind of address one
can get when using "void _ _user *to" in device driver? And which kind
of address the kernel is working with when using "mmap"? And which
kind of address we are talking about when divide the memory into user
space and kernel space?

It's quite tedious but thank you so much for helping me!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Confusing in Address
  2012-02-11  9:52 Confusing in Address hz hanks
@ 2012-02-11 16:08 ` cheng chen
  2012-02-11 17:33   ` Alexandru Juncu
  2012-02-12 11:26 ` Mulyadi Santosa
  1 sibling, 1 reply; 4+ messages in thread
From: cheng chen @ 2012-02-11 16:08 UTC (permalink / raw)
  To: kernelnewbies

Me too. good question.
Which header may define these addresses?

On Sat, Feb 11, 2012 at 10:52 AM, hz hanks <hankshz@gmail.com> wrote:

> Hi, all
>
> I'm confused with different addresses in Linux, such as virtual
> address and hardware address. For example, which kind of address one
> can get when using "&num" in application layer programming? How about
> that in kernel, such as in device driver? Which kind of address one
> can get when using "void _ _user *to" in device driver? And which kind
> of address the kernel is working with when using "mmap"? And which
> kind of address we are talking about when divide the memory into user
> space and kernel space?
>
> It's quite tedious but thank you so much for helping me!
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Cheng(?\)
>From  ????????http://pinglun.la ??

My Page:  http://freakrobot.wordpress.com <http://freakrobot.blogbus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120211/6d68014e/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Confusing in Address
  2012-02-11 16:08 ` cheng chen
@ 2012-02-11 17:33   ` Alexandru Juncu
  0 siblings, 0 replies; 4+ messages in thread
From: Alexandru Juncu @ 2012-02-11 17:33 UTC (permalink / raw)
  To: kernelnewbies

2012/2/11 cheng chen <basaka.chen@gmail.com>:
> Me too. good question.
> Which header may define these addresses?
>
>
> On Sat, Feb 11, 2012 at 10:52 AM, hz hanks <hankshz@gmail.com> wrote:
>>
>> Hi, all
>>
>> I'm confused with different addresses in Linux, such as virtual
>> address and hardware address. For example, which kind of address one
>> can get when using "&num" in application layer programming? How about
>> that in kernel, such as in device driver? Which kind of address one
>> can get when using "void _ _user *to" in device driver? And which kind
>> of address the kernel is working with when using "mmap"? And which
>> kind of address we are talking about when divide the memory into user
>> space and kernel space?
>>
>> It's quite tedious but thank you so much for helping me!


Both in the userpace and in the kernel space of a process, all
addresses are virtual. Inside the kernel, you _can_ use physical
address but few cases need that.

-- 
Alexandru Juncu

ROSEdu
http://rosedu.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Confusing in Address
  2012-02-11  9:52 Confusing in Address hz hanks
  2012-02-11 16:08 ` cheng chen
@ 2012-02-12 11:26 ` Mulyadi Santosa
  1 sibling, 0 replies; 4+ messages in thread
From: Mulyadi Santosa @ 2012-02-12 11:26 UTC (permalink / raw)
  To: kernelnewbies

Hi :)

Let me try to help ...

On Sat, Feb 11, 2012 at 16:52, hz hanks <hankshz@gmail.com> wrote:
> Hi, all
>
> I'm confused with different addresses in Linux, such as virtual
> address and hardware address.

very very likely you will deal with virtual address, because you're in
protected mode and MMU (Memory Management Unit) give you that virtual
address. It is the MMU task that translate such virtual address into
physical address with the help of page tables.

>For example, which kind of address one
> can get when using "&num" in application layer programming?

Virtual address.... precisely inside user space. Application could
only touch its own user address space, not kernel's.

>How about
> that in kernel, such as in device driver?

kernel too access virtual address. However, since there's identical
mapping for kernel address space (address 3 gigabyte and above in x86
32 bit architecture), say you are accessing address 0xC0000001, you
are actually accessing physical address 1. For 0xC0000002, it's
physical address is 2 and so on.

>Which kind of address one
> can get when using "void _ _user *to" in device driver?
same too, virtual address. But relative to which user address space we
are dealing with.

>And which kind
> of address the kernel is working with when using "mmap"?

virtual address again :)

>And which
> kind of address we are talking about when divide the memory into user
> space and kernel space?

virtual address :) in x82 32 bit, you have 4 gigabyte addressing
space. It's splitted 3 gigabyte for user space, 1 gigabyte for kernel
space.

Of course, the physical amount of RAM could be lower than 4G....


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-12 11:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-11  9:52 Confusing in Address hz hanks
2012-02-11 16:08 ` cheng chen
2012-02-11 17:33   ` Alexandru Juncu
2012-02-12 11:26 ` Mulyadi Santosa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.