From: Hua Ji <hji@netscreen.com>
To: jerry <jerry.nguyen@serialsystem.com.sg>, Dan Malek <dan@mvista.com>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: RE: how to get the physival address
Date: Thu, 5 Apr 2001 09:58:46 -0700 [thread overview]
Message-ID: <A33AEFDC2EC0D411851900D0B73EBEF73D9BE0@NAPA> (raw)
>Yes, if I use kmalloc is OK, either __pa or virt_to_phys will return the
>physical address.
>But it does not work for defined variable (it was defined in driver so it
>should be in kernel space, isn't it?). I wonder which memory space, this
>variable belong to?
My 2 cents:
Given that ONLY 2 alternatives you can use for memory allocation when
working with kernel, which
are kmalloc and vmalloc, you are facing different memory usages:
Before talking further, you may have realized:
>From 0xC0000000 to 0XC0000000 + physical_memory_size is 1:1 mapped to
0x000000~physical memory size-1.
Surely, kernel also manages virtual memory from 0XC0000000 +
physical_memory_size + 8M hole to 4G
Therefore, if you used kmalloc to allocate memory, surely, you will easily
find: virtual address-3G is the physical address. However, for vmalloc, the
case is otherwise. The reason now is clear: That virtual address is very
probably from 0XC0000000 + physical_memory_size + 8M hole to 4G. This is
REALLY dynamic. Kernel's vmalloc, just like libc malloc, will go through the
free_area to find a first-bit(libc malloc is not first fit) block for you.
Anyway, back to your question. Your variable is in a memory space after 3G.
But it is byond the 3G+physical_memory_size + 8M. For example, your machine
have a 256M memory, so your variable virtual address is possible:
3G+256M+8M+SOME_VALUE.
Wish helpful,
Mike
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
next reply other threads:[~2001-04-05 16:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-05 16:58 Hua Ji [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-04-04 15:54 gdb load address and KERNELLOAD Wolfgang Denk
2001-04-05 4:13 ` how to get the physival address jerry
2001-04-05 5:58 ` Dan Malek
2001-04-05 6:28 ` jerry
2001-04-05 6:30 ` Dan Malek
2001-04-05 9:16 ` Gabriel Paubert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A33AEFDC2EC0D411851900D0B73EBEF73D9BE0@NAPA \
--to=hji@netscreen.com \
--cc=dan@mvista.com \
--cc=jerry.nguyen@serialsystem.com.sg \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).