Hello!
I'm trying to modified some codes in Xen VMM.
But I can not understand how Xen VMM to share memory regions with domains!
I tried to imitate the block device in Xen.
In block device, it would get free page memory for process structure
blk_ring_base
and call the macro SHARE_PFN_WITH_DOMAIN to share with domains.
code is like this:
p->blk_ring_base = (blk_ring_t *)get_free_page(GFP_KERNEL);
clear_page(p->blk_ring_base);
SHARE_PFN_WITH_DOMAIN(virt_to_page(p->blk_ring_base), p->domain);
But I can't not understand how guest OS to get these i/o data from
blk_ring_base.
I found some codes as below:
op.cmd = BLOCK_IO_OP_RING_ADDRESS;
(void)HYPERVISOR_block_io_op(&op);
It would ask the VMM where the io ring memory ! and get the I/O ring address
!!
set_fixmap(FIX_BLKRING_BASE, op.u.ring_mfn << PAGE_SHIFT);
blk_ring = (blk_ring_t *)fix_to_virt(FIX_BLKRING_BASE);
However I don't understand these codes means ! How Xen VMM get the block I/O
ring's data ?
And I tried to imitate these codes to do share memory with domains !
At the Xen VMM sides:
In task structure, I added :
void *temp;
unsigned int temp_size;
long hypervisor_temp(struct task_struct *p, dom0_tmp_t *tmp)
{
int ret;
unsigned long cpu_mask = 0;
int p_size;
if ( sizeof(*p->temp) > PAGE_SIZE ) BUG();
p->temp = (void *)get_free_page(GFP_KERNEL);
clear_page(p->temp);
p->temp = tmp->test;
SHARE_PFN_WITH_DOMAIN(virt_to_page(p->temp), p->domain);
cpu_mask = mark_guest_event(p, _EVENT_TEMP);
guest_event_notify(cpu_mask);
put_task_struct(p);
return 0;
}
In block_io_op_t structure, I added :
unsigned long temp_mfn;
In do_block_io_op function added:
case POLICY_ADDRESS:
op.u.temp_mfn = virt_to_phys(p->temp) >> PAGE_SHIFT;
ret = copy_to_user(u_block_io_op, &op, sizeof(op)) ? -EFAULT : 0;
break;
At the guest OS sides:
void * temp;
static int __init setup_temp_event(void)
{
block_io_op_t op;
op.cmd = TEMP_ADDRESS;
(void)HYPERVISOR_block_io_op(&op);
set_fixmap(FIX_TEMP_BASE, op.u.temp_mfn << PAGE_SHIFT);
temp = (void *)fix_to_virt(FIX_TEMP_BASE);
(void)request_irq(_EVENT_POLICY, temp_irq, SA_SAMPLE_RANDOM, "temp",
NULL);
return 0;
}
However I got the error message like this :
" Kernel panic: Failed mmu update: c01c4cc0, 14 "
How can I solve this ?
thanks a lot !
----- Original Message -----
From: "Ian Pratt" <Ian.Pratt@xxxxxxxxxxxx>
To: "K.C. Chiu" <B8844014@xxxxxxxxxxxxxxxxx>
Cc: "Ian Pratt" <Ian.Pratt@xxxxxxxxxxxx>; <rolf.neugebauer@xxxxxxxxx>;
<xen-devel@xxxxxxxxxxxxxxxxxxxxx>; <Ian.Pratt@xxxxxxxxxxxx>
Sent: Tuesday, May 11, 2004 3:15 PM
Subject: Re: [Xen-devel] How does hypervisor handle the hypercalls fromguest
OSes?
>
> > Well, I'm trying to enhance the operating system security through VMM
> > technology.
> >
> > For guest OS's Audit log, I want to put the audit log file in domain 0's
> > file system to avoid any modification from guest OSes.
> >
> > therefore, I need to encapsulate a new command into dom0's operation
> > hypercall and hanlde the command in hypervisor to read the audit log
file.
>
> Use xen 1.3 ("unstable") as this provides much better support for
> doing this -- there are generic communication and console paths
> for between domains.
>
> You could either just use the console connection to domain 0 (and
> have xend log security messages to disk), or create a separate
> console connection for security messages (again, modifying xend
> to log to the messages).
>
> Ian
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-devel
|