xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Memory Mapping
@ 2011-05-06 14:50 Lakshitha Harshan
  2011-05-06 15:31 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 6+ messages in thread
From: Lakshitha Harshan @ 2011-05-06 14:50 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 245 bytes --]

Hi all,

I want to get the access to task structs in domUs to get the memory
addresses of code segments in each process. So how do I read/map the data
correctly which I get through xc_map_foreign_range or  xc_map_foreign_batch?

Thanks,
Harshan

[-- Attachment #1.2: Type: text/html, Size: 306 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Memory mapping
@ 2009-02-16 16:58 Frederic Beck
  2009-02-18 14:35 ` Frederic Beck
  0 siblings, 1 reply; 6+ messages in thread
From: Frederic Beck @ 2009-02-16 16:58 UTC (permalink / raw)
  To: xen-devel

Hello

I managed to do what i wanted with my module (finally gave up on the
syscall and did everything in the module init), and i foudn the offsets
i was looking for. I later found out that what i've done was already
available via XenAccess (tools/linux-offset-finder).

I have the following offsets:
linux_name = 0x225;
linux_tasks = 0xd0;
linux_mm = 0xe8;
linux_pid = 0x10c;
linux_pgd = 0x24;
linux_addr = 0x84;

After disabling fast system calls handling, i modified  do_guest_trap in
xen/arch/x86/traps.c. I get the user regs to have access to the CPU
registers EAX, EIP and ESP (info i wanna log via the tracing). I take
the ESP and apply the mask 0xFFFFF000 to get the base address of the
thread_info struct.

user_regs = guest_cpu_user_regs();
base_addr = (user_regs->esp & 0xFFFFF000);

Then the first 4 bytes after this base_addr are on a regular system a
pointer to a task_struct where the PId of the current task is stored,
which i wanna get. On a regular OS (i tested on Dom0 or DomU) I can
find easily the PID and print it out. I would like to do the same in
the hypervisor. 

I tried to map the same code without modification, but i begin reading
memory addresses that do not exist and the hypervisor crashes when i
create my DomU. So far, i'm not very surprised, as there must be some
virtual memory handling that i'm missing.

However, i do not understand well how i can do the mapping. how do i
map this kernel address in the hypervisor to read the right memory
address ?

I guess that this mapping will be different for HVM and PV domains ? Is
there a function that dynamically detects what kind of domain the guest
is ?

Moreover, i found out in XenAccess that the right formula to get the
PID would be 
memcpy(&pid, memory + offset + PID_OFFSET - TASKS_OFFSET,4);
I guess that memory is the base adress of the virtual stack. How can i
find that value ? in that case the base_addr i calculated earlier would
be the offset ?

Thanks for the help!

Regards
Fred

^ permalink raw reply	[flat|nested] 6+ messages in thread
* RE: Xeno-unstable crashing at boot
@ 2005-05-16 19:55 Ian Pratt
  2005-05-17 11:52 ` Mike Wray
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Pratt @ 2005-05-16 19:55 UTC (permalink / raw)
  To: Mike Wray; +Cc: xen-devel

 > > What hardware is the problem machine? It has an impresively 
> long list of
> > ACPI table entries. Since the code being executed is the 
> native Linux
> > code it's surprising that it's having problems. 
> 
> It's a dual processor 2.8GHz xeon, 2GB RAM.
> The cpuinfo was attached to an earlier email.
> I've attached it again, with hwconf.

No, I mean the make and model of the machine. I have 3 different kinds
of dual 2.8GHz Xeon with tg3 NICs that Xen unstable works fine with. It
something specific to your particular machine, probably the BIOS. (BTW:
are their BIOS upgrades available?)

> > Please can you try using a DEBUG=y build of Xen, and then adding
> > show_guest_stack earlier in the failure path.
> 
> So 'DEBUG=y make world'?

"make clean; make debug=y dist" should do it.

> Can you suggest what a good place 'earlier in the failure 
> path' might be?

I expect you'll get an error message from Xen before the BUG in domain
crash. See where the error message comes from, and then add the
show_guest_stack to the appropriate path.

Thanks,
Ian

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

end of thread, other threads:[~2011-05-06 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-06 14:50 Memory Mapping Lakshitha Harshan
2011-05-06 15:31 ` Konrad Rzeszutek Wilk
  -- strict thread matches above, loose matches on Subject: below --
2009-02-16 16:58 Memory mapping Frederic Beck
2009-02-18 14:35 ` Frederic Beck
2005-05-16 19:55 Xeno-unstable crashing at boot Ian Pratt
2005-05-17 11:52 ` Mike Wray
2005-05-17 13:26   ` Keir Fraser
2005-05-17 16:01     ` memory mapping Grzegorz Milos
2005-05-17 16:09       ` Grzegorz Milos

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).