From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 05:42:38 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5B891065670; Mon, 20 Oct 2008 05:42:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C49218FC28; Mon, 20 Oct 2008 05:42:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9K5gcCN061545; Mon, 20 Oct 2008 05:42:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9K5gc7k061544; Mon, 20 Oct 2008 05:42:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200810200542.m9K5gc7k061544@svn.freebsd.org> From: Kip Macy Date: Mon, 20 Oct 2008 05:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184071 - head/sys/i386/xen X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2008 05:42:38 -0000 Author: kmacy Date: Mon Oct 20 05:42:38 2008 New Revision: 184071 URL: http://svn.freebsd.org/changeset/base/184071 Log: Import interrupt management defines from latest xenlinux Modified: head/sys/i386/xen/exception.s Modified: head/sys/i386/xen/exception.s ============================================================================== --- head/sys/i386/xen/exception.s Mon Oct 20 05:12:50 2008 (r184070) +++ head/sys/i386/xen/exception.s Mon Oct 20 05:42:38 2008 (r184071) @@ -37,18 +37,37 @@ #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 -#define XEN_BLOCK_EVENTS(reg) movb $1,evtchn_upcall_mask(reg) -#define XEN_UNBLOCK_EVENTS(reg) movb $0,evtchn_upcall_mask(reg) -#define XEN_TEST_PENDING(reg) testb $0x1,evtchn_upcall_pending(reg) + +#define sizeof_vcpu_shift 6 + + +#ifdef SMP +#ifdef notyet +#define GET_VCPU_INFO movl TI_cpu(%ebp),reg ; \ + shl $sizeof_vcpu_shift,reg ; \ + addl HYPERVISOR_shared_info,reg +#else +#endif + +#define GET_VCPU_INFO(reg) movl HYPERVISOR_shared_info,reg +#endif + +#define __DISABLE_INTERRUPTS(reg) movb $1,evtchn_upcall_mask(reg) +#define __ENABLE_INTERRUPTS(reg) movb $0,evtchn_upcall_mask(reg) +#define DISABLE_INTERRUPTS(reg) GET_VCPU_INFO(reg) ; \ + __DISABLE_INTERRUPTS(reg) +#define ENABLE_INTERRUPTS(reg) GET_VCPU_INFO(reg) ; \ + __ENABLE_INTERRUPTS(reg) +#define __TEST_PENDING(reg) testb $0xFF,evtchn_upcall_pending(reg) #define POPA \ popl %edi; \ @@ -163,8 +182,7 @@ call_evtchn_upcall: hypervisor_callback_pending: - movl HYPERVISOR_shared_info,%esi - XEN_BLOCK_EVENTS(%esi) /* cli */ + DISABLE_INTERRUPTS(%esi) /* cli */ jmp 10b /* @@ -338,12 +356,11 @@ doreti_ast: * interrupts provides sufficient locking even in the SMP case, * since we will be informed of any new ASTs by an IPI. */ - movl HYPERVISOR_shared_info,%esi - XEN_BLOCK_EVENTS(%esi) /* cli */ + DISABLE_INTERRUPTS(%esi) /* cli */ movl PCPU(CURTHREAD),%eax testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%eax) je doreti_exit - XEN_UNBLOCK_EVENTS(%esi) /* sti */ + ENABLE_INTERRUPTS(%esi) /* sti */ pushl %esp /* pass a pointer to the trapframe */ call ast add $4,%esp @@ -357,12 +374,11 @@ doreti_ast: * registers. The fault is handled in trap.c. */ doreti_exit: - movl HYPERVISOR_shared_info,%esi - XEN_UNBLOCK_EVENTS(%esi) # reenable event callbacks (sti) + ENABLE_INTERRUPTS(%esi) # reenable event callbacks (sti) .globl scrit scrit: - XEN_TEST_PENDING(%esi) + __TEST_PENDING(%esi) jnz hypervisor_callback_pending /* More to go */ MEXITCOUNT