Xen FAQ Design and in Depth

reference http://wiki.xenproject.org/wiki/Xen_FAQ_Design_and_in_Depth

How does Xen process System Calls on para-virtualized guest?


When ever a system call is invoked via interrupt or sys center control gets transferred to the kernel (ring 0), which is then handled via system call handler. System call never goes to libc but Libc is a library that provides POSIX interface to the user space applications and in a way wrapper for invocation of a system call.

System call interrupt based [i386]: During booting process, linux kernel of a domU register's its IDT with Xen Hypervisor via HYPERVISOR_set_trap_table(trap_table); [arch/i386/kernel/traps-xen.c]. Xen maintains two IDT's, one global IDT (its own) and other per domain IDT. Xen uses global IDT to register the entire trap handler except for system call handler (int 0x80). When a VM gets scheduled, its system call handler (from per domain IDT table) is registered with the processor. Hence when a domain/VM executes a system call, its own handler is executed.

在启动过程中,domU的linux内核通过HYPERVISOR_set_trap_table超级调用注册其IDT(中断描述符表),Xen包括两种IDT,一种是全局的IDT(xen使用),还有一种是每个dom的IDT,Xen用全局IDT注册全部的陷入句柄,除了系统调用句柄 (int 0x80),当一个vm被调度的时候,它用自己的系统调用句柄在processor上注册,所以当一个dom执行系统调用的时候,它是执行自己的句柄。

Implementation differs for x86_64: Xen registers its own system call handler with the processor and from that handler routes the request to VM/Domain specific handler.

 

How can I tell if my OS is running on a physical machine or a virtual machine ?


 You should be able to get some useful information from the DMI, e.g:

% for i in system-manufacturer system-product-name system-version\ system-serial-number; do echo

-n "$i: "; sudo dmidecode -s $i; done



system-manufacturer: Xen system-product-name: HVM domU system-version: 3.3.1 system-serial- number: 89e5915f-dead-beef-cefd-46904ea94c4a

OR

Probably checking kernel process, check your process table for: [xenwatch] [xenbus] Another clue is checking the kernle suffix, for example:

# uname -r 2.6.24-23-xen and the proc files:

/proc/xen/capabilities

 

你可能感兴趣的:(design)