Hi, all, I am trying to map some memory page in DomU kernel space. Specifically, I am trying to map the in-kernel module structure of sunrpc whose address is d0848480 and machine address is 00000480. The aligned page becomes zero (that''s weird, I don''t know whether that''s possible). When I tried to map it into Dom0, I got an error number -14 which means bad address. So my question is: 1. Is this kind memory remappable? 2. If so, what''s wrong with this? or what''s the right way to do that? Many thanks in advance! -x _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 27 Jul 2005, at 07:37, Xin Zhao wrote:> I am trying to map some memory page in DomU kernel space. > Specifically, I > am trying to map the in-kernel module structure of sunrpc whose > address is > d0848480 and machine address is 00000480. The aligned page becomes zero > (that''s weird, I don''t know whether that''s possible). When I tried to > map > it into Dom0, I got an error number -14 which means bad address. > > So my question is: > 1. Is this kind memory remappable? > 2. If so, what''s wrong with this? or what''s the right way to do that?The machine address of that structure is certainly not 0x480. Xen would never allocate a page below 1MB to a domain. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Thanks for your reply! But I got the virtual address as d0848480 and then got the corresponding machine address by using virt_to_machine, Is this the right way to do that? Is there any restriction on the memeory that is remappable? I mean, can some memory in DomU un-remappable? Thanks, -x On Wed, 27 Jul 2005, Keir Fraser wrote:> > On 27 Jul 2005, at 07:37, Xin Zhao wrote: > > > I am trying to map some memory page in DomU kernel space. > > Specifically, I > > am trying to map the in-kernel module structure of sunrpc whose > > address is > > d0848480 and machine address is 00000480. The aligned page becomes zero > > (that''s weird, I don''t know whether that''s possible). When I tried to > > map > > it into Dom0, I got an error number -14 which means bad address. > > > > So my question is: > > 1. Is this kind memory remappable? > > 2. If so, what''s wrong with this? or what''s the right way to do that? > > The machine address of that structure is certainly not 0x480. Xen would > never allocate a page below 1MB to a domain. > > -- Keir > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 27 Jul 2005, at 15:55, Xin Zhao wrote:> But I got the virtual address as d0848480 and then got the > corresponding machine address by using virt_to_machine, Is this the > right > way to do that?Where does the virt address d0848480 come from? Some kernel virtual addresses cannot be virt_to_phys''ed or virt_to_machine''d. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
I actually tried to search the module structure pointer of a specified module. For example, I might want to get the module structure pointer of sunrpc kernel module. What I did is to insert a new module into the kernel, then start from __this_module in the new module and follow the link to search all linked module list to look up the "sunrpc" module. If found, I can locate the *mod that points to sunrpc module structure. Please check the find_module function in kernel source code, I did the same thing. After I got the *mod, mod is the virtual address and equal to d0848480, I then convert it into machine address using virt_to_machine. Is this the right way to do that? WHy some kernel virtual addresses cannot be virt_to_machine''d? Any restriction on that? Thanks, -x On Wed, 27 Jul 2005, Keir Fraser wrote:> > On 27 Jul 2005, at 15:55, Xin Zhao wrote: > > > But I got the virtual address as d0848480 and then got the > > corresponding machine address by using virt_to_machine, Is this the > > right > > way to do that? > > Where does the virt address d0848480 come from? Some kernel virtual > addresses cannot be virt_to_phys''ed or virt_to_machine''d. > > -- Keir >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On 27 Jul 2005, at 17:15, Xin Zhao wrote:> WHy some kernel virtual addresses cannot be virt_to_machine''d? Any > restriction on that?Addresses from vmalloc, kmap and fixmap are not in the 1:1 virtual-physical kernel address space. To find the corresponding physical address for such a virtual address you must walk the pagetables. Module structures are vmalloc''ed on i386, so you cannot use virt_to_machine. If your code is Xen-specific (no need to work on native i386) then you can use the arbitrary_virt_to_machine() function that only xenlinux provides. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel