diff options
-rw-r--r-- | linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c | 8 | ||||
-rw-r--r-- | tools/xenstore/Makefile | 2 | ||||
-rw-r--r-- | tools/xenstore/xenstored_core.c | 14 | ||||
-rw-r--r-- | tools/xenstore/xs.c | 3 | ||||
-rw-r--r-- | xen/arch/x86/vmx.c | 12 | ||||
-rw-r--r-- | xen/arch/x86/vmx_platform.c | 44 |
6 files changed, 35 insertions, 48 deletions
diff --git a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c index 431448df30..088b7e0e36 100644 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/fault.c @@ -588,7 +588,15 @@ vmalloc_fault: pmd_k = pmd_offset(pud_k, address); if (!pmd_present(*pmd_k)) goto no_context; +#ifndef CONFIG_XEN set_pmd(pmd, *pmd_k); +#else + /* + * When running on Xen we must launder *pmd_k through + * pmd_val() to ensure that _PAGE_PRESENT is correctly set. + */ + set_pmd(pmd, __pmd(pmd_val(*pmd_k))); +#endif pte_k = pte_offset_kernel(pmd_k, address); if (!pte_present(*pte_k)) diff --git a/tools/xenstore/Makefile b/tools/xenstore/Makefile index 13164f08d6..82c64dfc6f 100644 --- a/tools/xenstore/Makefile +++ b/tools/xenstore/Makefile @@ -12,7 +12,7 @@ BASECFLAGS=-Wall -W -g -Werror # Make gcc generate dependencies. BASECFLAGS += -Wp,-MD,.$(@F).d PROG_DEP = .*.d -#BASECFLAGS+= -O3 $(PROFILE) +BASECFLAGS+= -O3 $(PROFILE) #BASECFLAGS+= -I$(XEN_ROOT)/tools BASECFLAGS+= -I$(XEN_ROOT)/tools/libxc BASECFLAGS+= -I$(XEN_ROOT)/xen/include/public diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index 219748e8f1..c9cc84b4c3 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1310,8 +1310,12 @@ static int out_of_mem(void *data) static void consider_message(struct connection *conn) { - struct buffered_data *in = NULL; - enum xsd_sockmsg_type type = conn->in->hdr.msg.type; + /* + * 'volatile' qualifier prevents register allocation which fixes: + * warning: variable 'xxx' might be clobbered by 'longjmp' or 'vfork' + */ + struct buffered_data *volatile in = NULL; + enum xsd_sockmsg_type volatile type = conn->in->hdr.msg.type; jmp_buf talloc_fail; assert(conn->state == OK); @@ -1449,7 +1453,11 @@ static void unblock_connections(void) struct connection *new_connection(connwritefn_t *write, connreadfn_t *read) { - struct connection *new; + /* + * 'volatile' qualifier prevents register allocation which fixes: + * warning: variable 'xxx' might be clobbered by 'longjmp' or 'vfork' + */ + struct connection *volatile new; jmp_buf talloc_fail; new = talloc(talloc_autofree_context(), struct connection); diff --git a/tools/xenstore/xs.c b/tools/xenstore/xs.c index ff31244166..5d36a8d642 100644 --- a/tools/xenstore/xs.c +++ b/tools/xenstore/xs.c @@ -628,7 +628,8 @@ bool xs_shutdown(struct xs_handle *h) if (ret) { char c; /* Wait for it to actually shutdown. */ - read(h->fd, &c, 1); + while ((read(h->fd, &c, 1) < 0) && (errno == EINTR)) + continue; } return ret; } diff --git a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c index 1a40653d7f..5cb4882b0a 100644 --- a/xen/arch/x86/vmx.c +++ b/xen/arch/x86/vmx.c @@ -730,7 +730,7 @@ static void vmx_io_instruction(struct cpu_user_regs *regs, int vmx_copy(void *buf, unsigned long laddr, int size, int dir) { - unsigned long mfn; + unsigned long gpa, mfn; char *addr; int count; @@ -739,8 +739,14 @@ vmx_copy(void *buf, unsigned long laddr, int size, int dir) if (count > size) count = size; - mfn = get_mfn_from_pfn(laddr >> PAGE_SHIFT); - /* XXX check whether laddr is valid */ + if (vmx_paging_enabled(current)) { + gpa = gva_to_gpa(laddr); + mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT); + } else + mfn = get_mfn_from_pfn(laddr >> PAGE_SHIFT); + if (mfn == INVALID_MFN) + return 0; + addr = (char *)map_domain_page(mfn) + (laddr & ~PAGE_MASK); if (dir == VMX_COPY_IN) diff --git a/xen/arch/x86/vmx_platform.c b/xen/arch/x86/vmx_platform.c index 863931ee54..9a4381ce24 100644 --- a/xen/arch/x86/vmx_platform.c +++ b/xen/arch/x86/vmx_platform.c @@ -583,49 +583,13 @@ static int vmx_decode(unsigned char *opcode, struct instruction *instr) } } -/* XXX use vmx_copy instead */ int inst_copy_from_guest(unsigned char *buf, unsigned long guest_eip, int inst_len) { - unsigned long gpa; - unsigned long mfn; - unsigned char *inst_start; - int remaining = 0; - - if ( (inst_len > MAX_INST_LEN) || (inst_len <= 0) ) + if (inst_len > MAX_INST_LEN || inst_len <= 0) return 0; - - if ( vmx_paging_enabled(current) ) - { - gpa = gva_to_gpa(guest_eip); - mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT); - - /* Does this cross a page boundary ? */ - if ( (guest_eip & PAGE_MASK) != ((guest_eip + inst_len) & PAGE_MASK) ) - { - remaining = (guest_eip + inst_len) & ~PAGE_MASK; - inst_len -= remaining; - } - } - else - { - mfn = get_mfn_from_pfn(guest_eip >> PAGE_SHIFT); - } - - inst_start = map_domain_page(mfn); - memcpy((char *)buf, inst_start + (guest_eip & ~PAGE_MASK), inst_len); - unmap_domain_page(inst_start); - - if ( remaining ) - { - gpa = gva_to_gpa(guest_eip+inst_len+remaining); - mfn = get_mfn_from_pfn(gpa >> PAGE_SHIFT); - - inst_start = map_domain_page(mfn); - memcpy((char *)buf+inst_len, inst_start, remaining); - unmap_domain_page(inst_start); - } - - return inst_len+remaining; + if (!vmx_copy(buf, guest_eip, inst_len, VMX_COPY_IN)) + return 0; + return inst_len; } void send_mmio_req(unsigned char type, unsigned long gpa, |