LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: how to get the physival address
@ 2001-04-05 16:58 Hua Ji
  0 siblings, 0 replies; 6+ messages in thread
From: Hua Ji @ 2001-04-05 16:58 UTC (permalink / raw)
  To: jerry, Dan Malek; +Cc: linuxppc-embedded


>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/

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: gdb load address and KERNELLOAD
@ 2001-04-04 15:54 Wolfgang Denk
  2001-04-05  4:13 ` how to get the physival address jerry
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Denk @ 2001-04-04 15:54 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-embedded


In message <3ACB3E30.E17CC550@mvista.com> Dan Malek wrote:
>
> > The BDM4GDB  project  at  sourceforge  (see  bdm4gdb.sourceforge.net)
> > provides all necessary information to build a home-made parallel port
> > adapter  (schematics, source extension to GDB) which allows to do the
> > same.
>
> Really?  Like it handles all of the memory mapping details, too?

In fact the BDM4GDB had an implementation of MMU support  before  the
BDI200  had  it - credits to Frank Przybylski, who did all (and still
does most of) the work.

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
I often quote myself; it adds spice to my conversation.  - G. B. Shaw

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2001-04-05 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-05 16:58 how to get the physival address Hua Ji
  -- 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox