From owner-p4-projects@FreeBSD.ORG Tue Jan 22 04:52:54 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CF63E16A41B; Tue, 22 Jan 2008 04:52:53 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6487016A419 for ; Tue, 22 Jan 2008 04:52:53 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3CCE313C44B for ; Tue, 22 Jan 2008 04:52:53 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0M4qr97069242 for ; Tue, 22 Jan 2008 04:52:53 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0M4qrne069239 for perforce@freebsd.org; Tue, 22 Jan 2008 04:52:53 GMT (envelope-from kmacy@freebsd.org) Date: Tue, 22 Jan 2008 04:52:53 GMT Message-Id: <200801220452.m0M4qrne069239@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 133844 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jan 2008 04:52:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=133844 Change 133844 by kmacy@pandemonium:kmacy:xen31 on 2008/01/22 04:51:53 update to use the hypercall page interface Affected files ... .. //depot/projects/xen31/sys/i386/include/xen/hypercall.h#7 edit .. //depot/projects/xen31/sys/i386/xen/exception.s#4 edit .. //depot/projects/xen31/sys/i386/xen/locore.s#8 edit .. //depot/projects/xen31/sys/i386/xen/xen_machdep.c#16 edit .. //depot/projects/xen31/sys/sys/cdefs.h#4 edit Differences ... ==== //depot/projects/xen31/sys/i386/include/xen/hypercall.h#7 (text+ko) ==== @@ -33,80 +33,91 @@ #include #include -#define _hypercall0(type, name) \ -({ \ - long __res; \ - asm volatile ( \ - TRAP_INSTR \ - : "=a" (__res) \ - : "0" (__HYPERVISOR_##name) \ - : "memory" ); \ - (type)__res; \ +#define __STR(x) #x +#define STR(x) __STR(x) + +#if defined(XEN) +#define HYPERCALL_STR(name) \ + "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)" +#else +#define HYPERCALL_STR(name) \ + "mov hypercall_stubs,%%eax; " \ + "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; " \ + "call *%%eax" +#endif + +#define _hypercall0(type, name) \ +({ \ + long __res; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res) \ + : \ + : "memory" ); \ + (type)__res; \ }) -#define _hypercall1(type, name, a1) \ -({ \ - long __res, __ign1; \ - __asm__ volatile ( \ - TRAP_INSTR \ - : "=a" (__res), "=b" (__ign1) \ - : "0" (__HYPERVISOR_##name), "1" ((long)(a1)) \ - : "memory" ); \ - (type)__res; \ +#define _hypercall1(type, name, a1) \ +({ \ + long __res, __ign1; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res), "=b" (__ign1) \ + : "1" ((long)(a1)) \ + : "memory" ); \ + (type)__res; \ }) -#define _hypercall2(type, name, a1, a2) \ -({ \ - long __res, __ign1, __ign2; \ - __asm__ volatile ( \ - TRAP_INSTR \ - : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ - : "0" (__HYPERVISOR_##name), "1" ((long)(a1)), \ - "2" ((long)(a2)) \ - : "memory" ); \ - (type)__res; \ +#define _hypercall2(type, name, a1, a2) \ +({ \ + long __res, __ign1, __ign2; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2) \ + : "1" ((long)(a1)), "2" ((long)(a2)) \ + : "memory" ); \ + (type)__res; \ }) -#define _hypercall3(type, name, a1, a2, a3) \ -({ \ - long __res, __ign1, __ign2, __ign3; \ - __asm__ volatile ( \ - TRAP_INSTR \ - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ - "=d" (__ign3) \ - : "0" (__HYPERVISOR_##name), "1" ((long)(a1)), \ - "2" ((long)(a2)), "3" ((long)(a3)) \ - : "memory" ); \ - (type)__res; \ +#define _hypercall3(type, name, a1, a2, a3) \ +({ \ + long __res, __ign1, __ign2, __ign3; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)) \ + : "memory" ); \ + (type)__res; \ }) -#define _hypercall4(type, name, a1, a2, a3, a4) \ -({ \ - long __res, __ign1, __ign2, __ign3, __ign4; \ - __asm__ volatile ( \ - TRAP_INSTR \ - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ - "=d" (__ign3), "=S" (__ign4) \ - : "0" (__HYPERVISOR_##name), "1" ((long)(a1)), \ - "2" ((long)(a2)), "3" ((long)(a3)), \ - "4" ((long)(a4)) \ - : "memory" ); \ - (type)__res; \ +#define _hypercall4(type, name, a1, a2, a3, a4) \ +({ \ + long __res, __ign1, __ign2, __ign3, __ign4; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3), "=S" (__ign4) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)), "4" ((long)(a4)) \ + : "memory" ); \ + (type)__res; \ }) -#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ -({ \ - long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \ - __asm__ volatile ( \ - TRAP_INSTR \ - : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ - "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ - : "0" (__HYPERVISOR_##name), "1" ((long)(a1)), \ - "2" ((long)(a2)), "3" ((long)(a3)), \ - "4" ((long)(a4)), "5" ((long)(a5)) \ - : "memory" ); \ - (type)__res; \ -}) +#define _hypercall5(type, name, a1, a2, a3, a4, a5) \ +({ \ + long __res, __ign1, __ign2, __ign3, __ign4, __ign5; \ + __asm__ volatile ( \ + HYPERCALL_STR(name) \ + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), \ + "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) \ + : "1" ((long)(a1)), "2" ((long)(a2)), \ + "3" ((long)(a3)), "4" ((long)(a4)), \ + "5" ((long)(a5)) \ + : "memory" ); \ + (type)__res; \ +}) static inline int HYPERVISOR_set_trap_table( ==== //depot/projects/xen31/sys/i386/xen/exception.s#4 (text+ko) ==== @@ -37,10 +37,12 @@ #include #include + #include "assym.s" #define SEL_RPL_MASK 0x0002 - +#define __HYPERVISOR_iret 23 + /* Offsets into shared_info_t. */ #define evtchn_upcall_pending /* 0 */ #define evtchn_upcall_mask 1 @@ -367,7 +369,7 @@ addl $8,%esp .globl doreti_iret doreti_iret: - iret + jmp hypercall_page + (__HYPERVISOR_iret * 32) .globl ecrit ecrit: /* ==== //depot/projects/xen31/sys/i386/xen/locore.s#8 (text+ko) ==== @@ -56,7 +56,7 @@ #define __ASSEMBLY__ #include - + /* The defines below have been lifted out of */ #define FLAT_RING1_CS 0xe019 /* GDT index 259 */ #define FLAT_RING1_DS 0xe021 /* GDT index 260 */ @@ -76,15 +76,12 @@ ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE, .long, KERNBASE) ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET, .long, KERNBASE) ELFNOTE(Xen, XEN_ELFNOTE_ENTRY, .long, btext) -#ifdef notyet ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long, hypercall_page) -#endif ELFNOTE(Xen, XEN_ELFNOTE_HV_START_LOW, .long, HYPERVISOR_VIRT_START) -#ifdef notyet +#if 0 ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel") -#else - ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "pae_pgdir_above_4gb|supervisor_mode_kernel|writable_descriptor_tables") #endif + ELFNOTE(Xen, XEN_ELFNOTE_FEATURES, .asciz, "writable_page_tables|supervisor_mode_kernel|writable_descriptor_tables") #ifdef PAE ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE, .asciz, "yes") @@ -242,6 +239,16 @@ .long tmpstack, KERNEL_DS .text + +.p2align 12, 0x90 + +#define HYPERCALL_PAGE_OFFSET 0x1000 +.org HYPERCALL_PAGE_OFFSET +ENTRY(hypercall_page) + .cfi_startproc + .skip 0x1000 + .cfi_endproc + /********************************************************************** * * This is where the bootblocks start us, set the ball rolling... ==== //depot/projects/xen31/sys/i386/xen/xen_machdep.c#16 (text+ko) ==== @@ -261,7 +261,6 @@ struct mmuext_op op; op.cmd = MMUEXT_INVLPG_ALL; op.arg1.linear_addr = va & ~PAGE_MASK; - xen_flush_queue(); PANIC_IF(HYPERVISOR_mmuext_op(&op, 1, NULL, DOMID_SELF) < 0); } ==== //depot/projects/xen31/sys/sys/cdefs.h#4 (text+ko) ==== @@ -49,7 +49,7 @@ * Can update to a more recent version when we implement * the hypercall page */ -#define __XEN_INTERFACE_VERSION__ 0x00030202 +#define __XEN_INTERFACE_VERSION__ 0x00030203 #endif /* * This code has been put in place to help reduce the addition of