p z
2009-Jan-17 06:10 UTC
[Xen-devel] Which ways does the event handler be called in the event_channel mechanism?
mini-os/arch/x86/setup.c hi,everybody void arch_init(start_info_t *si) { ...... HYPERVISOR_set_callbacks( __KERNEL_CS, (unsigned long)hypervisor_callback, __KERNEL_CS, (unsigned long)failsafe_callback); ...... } the function HYPERVISOR_set_callbacks() is implemented by do_set_callbacks */xen-3.3.0 /xen/arch/x86/x86_32/traps.c* long do_set_callbacks(unsigned long event_selector, unsigned long event_address, unsigned long failsafe_selector, unsigned long failsafe_address) { struct callback_register event = { .type = CALLBACKTYPE_event, .address = { event_selector, event_address }, }; register_guest_callback(&event); } *xen/arch/x86/x86_32/traps.c* static long register_guest_callback(struct callback_register *reg) { long ret = 0; struct vcpu *v = current; case CALLBACKTYPE_event: v->arch.guest_context.event_callback_cs = reg->address.cs; /*registered*/ v->arch.guest_context.event_callback_eip = reg->address.eip; /*registered*/ break; ...... } Through the above function call link, the event callback function hypervisor_callback() is registered to xen,but I have three questions: 1) In which points do v->arch.guest_context.event_callback_cs:v->arch.guest_context.event_callback_eip be used (or called)? 2) Hypervisor_callback is implemented in the guest kerenl & it eventually call the event handlers implemented by the guest kernel,but how does the functions in guest kernel context be called in the xen context,more exactly where and how does the function call stack be constructed please? 3) After a event is sent to a guest ,the guest kernel can detect the event and call the corresponding event handler by reading the shared info, in which the mini-os really do, but why does the mini-os still register the event channel callback function ? It seems there are two ways in which the event handler is called ,is it right? If it is right ,why xen give the two ways? By the way,what does the ''upcall mechanism'' means? Does it means the event handler is called by xen through calling the registered "v->arch.guest_context.event_callback_cs:v->arch.guest_context.event_callback_eip" pointer directly please? Thanks! _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel