Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Oct 2008 23:03:35 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r184003 - in projects/releng_6_xen/sys/i386: include xen
Message-ID:  <200810172303.m9HN3ZYl000564@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Fri Oct 17 23:03:35 2008
New Revision: 184003
URL: http://svn.freebsd.org/changeset/base/184003

Log:
  - don't rely on expensive rcr2 emulation
  - fix trap handling to use old-style pass by value of the trapframe

Modified:
  projects/releng_6_xen/sys/i386/include/cpufunc.h
  projects/releng_6_xen/sys/i386/xen/exception.s
  projects/releng_6_xen/sys/i386/xen/xen_machdep.c

Modified: projects/releng_6_xen/sys/i386/include/cpufunc.h
==============================================================================
--- projects/releng_6_xen/sys/i386/include/cpufunc.h	Fri Oct 17 22:55:47 2008	(r184002)
+++ projects/releng_6_xen/sys/i386/include/cpufunc.h	Fri Oct 17 23:03:35 2008	(r184003)
@@ -45,6 +45,7 @@
 #ifdef XEN
 extern void xen_cli(void);
 extern void xen_sti(void);
+extern u_int xen_rcr2(void);
 extern void xen_load_cr3(u_int data);
 extern void xen_tlb_flush(void);
 extern void xen_invlpg(u_int addr);
@@ -410,6 +411,9 @@ rcr2(void)
 {
 	u_int	data;
 
+#ifdef XEN
+	return (xen_rcr2());
+#endif	
 	__asm __volatile("movl %%cr2,%0" : "=r" (data));
 	return (data);
 }

Modified: projects/releng_6_xen/sys/i386/xen/exception.s
==============================================================================
--- projects/releng_6_xen/sys/i386/xen/exception.s	Fri Oct 17 22:55:47 2008	(r184002)
+++ projects/releng_6_xen/sys/i386/xen/exception.s	Fri Oct 17 23:03:35 2008	(r184003)
@@ -93,8 +93,6 @@
 MCOUNT_LABEL(user)
 MCOUNT_LABEL(btrap)
 
-#define	TRAP(a)		pushl $(a) ; jmp alltraps
-
 IDTVEC(div)
 	pushl $0; TRAP(T_DIVIDE)
 IDTVEC(dbg)
@@ -182,11 +180,9 @@ alltraps:
 	pushl	%ds
 	pushl	%es
 	pushl	%fs
-
 alltraps_with_regs_pushed:
 	SET_KERNEL_SREGS
 	FAKE_MCOUNT(TF_EIP(%esp))
-
 calltrap:
 	call	trap
 
@@ -220,9 +216,7 @@ IDTVEC(lcall_syscall)
 	pushl	%fs
 	SET_KERNEL_SREGS
 	FAKE_MCOUNT(TF_EIP(%esp))
-	pushl	%esp
 	call	syscall
-	add	$4, %esp
 	MEXITCOUNT
 	jmp	doreti
 
@@ -236,16 +230,14 @@ IDTVEC(lcall_syscall)
 	SUPERALIGN_TEXT
 IDTVEC(int0x80_syscall)
 	pushl	$2			/* sizeof "int 0x80" */
-	pushl	$0xBEEF			/* for debug */
+	subl	$4,%esp			/* skip over tf_trapno */
 	pushal
 	pushl	%ds
 	pushl	%es
 	pushl	%fs
 	SET_KERNEL_SREGS
 	FAKE_MCOUNT(TF_EIP(%esp))
-	pushl	%esp
 	call	syscall
-	add	$4, %esp
 	MEXITCOUNT
 	jmp	doreti
 
@@ -283,7 +275,6 @@ MCOUNT_LABEL(bintr)
 #ifdef DEV_ATPIC	
 #include <i386/isa/atpic_vector.s>
 #endif
-	
 #ifdef DEV_APIC
 	.data
 	.p2align 4
@@ -385,8 +376,7 @@ doreti_popl_ds:
 	addl	$8,%esp
 	.globl	doreti_iret
 doreti_iret:
-/*	#jmp	hypercall_page + (__HYPERVISOR_iret * 32) */
-	iret
+	jmp	hypercall_page + (__HYPERVISOR_iret * 32)
 	.globl	ecrit
 ecrit:
   	/*
@@ -459,8 +449,10 @@ critical_fixup_table:        
 .byte   0x24	                        #pop    %ecx
 .byte   0x28	                        #pop    %eax
 .byte   0x2c,0x2c,0x2c                  #add    $0x8,%esp
+#if 0
 .byte   0x34				#iret   
-/* .byte   0x34,0x34,0x34,0x34,0x34        #HYPERVISOR_iret    */
+#endif
+.byte   0x34,0x34,0x34,0x34,0x34        #HYPERVISOR_iret
 
 	
 /* # Hypervisor uses this for application faults while it executes.*/

Modified: projects/releng_6_xen/sys/i386/xen/xen_machdep.c
==============================================================================
--- projects/releng_6_xen/sys/i386/xen/xen_machdep.c	Fri Oct 17 22:55:47 2008	(r184002)
+++ projects/releng_6_xen/sys/i386/xen/xen_machdep.c	Fri Oct 17 23:03:35 2008	(r184003)
@@ -373,6 +373,13 @@ xen_sti(void)
 	__sti();
 }
 
+u_int
+xen_rcr2(void)
+{
+
+	return (HYPERVISOR_shared_info->vcpu_info[curcpu].arch.cr2);
+}
+
 void
 _xen_machphys_update(vm_paddr_t mfn, vm_paddr_t pfn, char *file, int line)
 {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810172303.m9HN3ZYl000564>