Date: Tue, 22 Jan 2008 04:52:53 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 133844 for review Message-ID: <200801220452.m0M4qrne069239@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <xen/interface/xen.h> #include <xen/interface/sched.h> -#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 <machine/psl.h> #include <machine/trap.h> + #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 <xen/interface/elfnote.h> - + /* The defines below have been lifted out of <machine/xen-public/arch-x86_32.h> */ #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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801220452.m0M4qrne069239>