On Thu, Aug 20, 2009 at 03:57:28AM -0700, Dmitry Afanasyev wrote:
> Hello!
> 
> I need to get physical memory address from virtual and read some data by it 
> from /dev/mem. Does kvm_physaddr from libkvm can help me?
> 
> For example, I have a pointer of type int and it points to 5. If I translate 
> that pointer address to physical address by kvm_physaddr and read from 
> /dev/mem with physical address as shift in /dev/mem do I get 5?

Yes.  This is essentially what mdb does for its physical memory
debugging APIs, so you can demonstrate the above using ::vtop
and "\" (format from physical instead of virtual) to see this.

I'll pick the symbol "rootfs" which is a struct but begins 
with a well-known string:

# mdb -k
...
> rootfs/s
rootfs:
rootfs:         zfs
> rootfs::vtop
virtual fffffffffbc00f48 mapped to physical a400f48
> a400f48\s
0xa400f48:      zfs

-Mike

-- 
Mike Shapiro, Sun Microsystems Open Storage / Fishworks. blogs.sun.com/mws/
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to