[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [PATCH] [PATCH] make XenFreeBSD trapframe the same as native



ChangeSet 1.1409, 2005/05/02 09:33:19+01:00, kmacy@xxxxxxxxxx

        [PATCH] [PATCH] make XenFreeBSD trapframe the same as native
        
        # This is a BitKeeper generated diff -Nru style patch.
        #
        # ChangeSet
        #   2005/05/01 16:04:24-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx
        #   Make trapframe the same size as on native i386
        #   Signed-off-by: Kip Macy <kmacy@xxxxxxxxxxx>
        #
        # freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h
        #   2005/05/01 16:04:20-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +3 -2
        #   add per-cpu fields for evtchn and page faults
        #
        # freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c
        #   2005/05/01 16:04:20-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +1 -9
        #   remove STACK_DEBUGGING cruft
        #   fetch cr2 from pcpu area
        #
        # freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c
        #   2005/05/01 16:04:20-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +1 -2
        #   remove unused trap_nesting
        #   add cr2 field
        #
        # freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s
        #   2005/05/01 16:04:20-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +41 -31
        #   Save CR2 after trap frame then move to pcpu area
        #
        # BitKeeper/deleted/.del-ucontext.h~6f534fc91cb2d96b
        #   2005/05/01 15:56:03-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +0 -1
        #   Delete: freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h
        #
        # BitKeeper/deleted/.del-frame.h~fbfe41b49597c684
        #   2005/05/01 15:55:59-07:00 kmacy@xxxxxxxxxxxxxxxxxxxx +3 -3
        #   Delete: freebsd-5.3-xen-sparse/i386-xen/include/frame.h
        #



 b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s |   72 +++++----
 b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c  |    3 
 b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c      |   10 -
 b/freebsd-5.3-xen-sparse/i386-xen/include/pcpu.h       |    5 
 freebsd-5.3-xen-sparse/i386-xen/include/frame.h        |  129 -----------------
 freebsd-5.3-xen-sparse/i386-xen/include/ucontext.h     |  105 -------------
 6 files changed, 46 insertions(+), 278 deletions(-)


diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s      2005-05-02 
05:04:44 -04:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/exception.s      2005-05-02 
05:04:44 -04:00
@@ -91,47 +91,52 @@
 MCOUNT_LABEL(btrap)
 
 IDTVEC(div)
-       pushl $0; pushl $0; TRAP(T_DIVIDE)
+       pushl $0; TRAP(T_DIVIDE)
 IDTVEC(dbg)
-       pushl $0; pushl $0; TRAP(T_TRCTRAP)
+       pushl $0; TRAP(T_TRCTRAP)
 IDTVEC(nmi)
-       pushl $0; pushl $0; TRAP(T_NMI)
+       pushl $0; TRAP(T_NMI)
 IDTVEC(bpt)
-       pushl $0; pushl $0; TRAP(T_BPTFLT)
+       pushl $0; TRAP(T_BPTFLT)
 IDTVEC(ofl)
-       pushl $0; pushl $0; TRAP(T_OFLOW)
+       pushl $0; TRAP(T_OFLOW)
 IDTVEC(bnd)
-       pushl $0; pushl $0; TRAP(T_BOUND)
+       pushl $0; TRAP(T_BOUND)
 IDTVEC(ill)
-       pushl $0; pushl $0; TRAP(T_PRIVINFLT)
+       pushl $0; TRAP(T_PRIVINFLT)
 IDTVEC(dna)
-       pushl $0; pushl $0; TRAP(T_DNA)
+       pushl $0; TRAP(T_DNA)
 IDTVEC(fpusegm)
-       pushl $0; pushl $0; TRAP(T_FPOPFLT)
+       pushl $0; TRAP(T_FPOPFLT)
 IDTVEC(tss)
-       pushl $0; TRAP(T_TSSFLT)
+       TRAP(T_TSSFLT)
 IDTVEC(missing)
-       pushl $0; TRAP(T_SEGNPFLT)
+       TRAP(T_SEGNPFLT)
 IDTVEC(stk)
-       pushl $0; TRAP(T_STKFLT)
+       TRAP(T_STKFLT)
 IDTVEC(prot)
-       pushl $0; TRAP(T_PROTFLT)
+       TRAP(T_PROTFLT)
 IDTVEC(page)
+       pushl %eax 
+       movl  4(%esp),%eax
+       movl  %eax,-44(%esp)    # move cr2 after trap frame
+       popl %eax
+       addl $4,%esp
        TRAP(T_PAGEFLT)
 IDTVEC(mchk)
-       pushl $0; pushl $0; TRAP(T_MCHK)
+       pushl $0; TRAP(T_MCHK)
 IDTVEC(rsvd)
-       pushl $0; pushl $0; TRAP(T_RESERVED)
+       pushl $0; TRAP(T_RESERVED)
 IDTVEC(fpu)
-       pushl $0; pushl $0; TRAP(T_ARITHTRAP)
+       pushl $0; TRAP(T_ARITHTRAP)
 IDTVEC(align)
-       pushl $0; TRAP(T_ALIGNFLT)
+       TRAP(T_ALIGNFLT)
 
 IDTVEC(xmm)
-       pushl $0; pushl $0; TRAP(T_XMMFLT)
+       pushl $0; TRAP(T_XMMFLT)
 
 IDTVEC(hypervisor_callback)
-        pushl $T_HYPCALLBACK;  pushl %eax; TRAP(T_HYPCALLBACK)
+       pushl %eax; TRAP(T_HYPCALLBACK)
 
 hypervisor_callback_pending:
        movl    $T_HYPCALLBACK,TF_TRAPNO(%esp)
@@ -161,6 +166,12 @@
        movl    $KPSEL,%eax
        movl    %eax,%fs
        FAKE_MCOUNT(TF_EIP(%esp))
+save_cr2:
+       movl    TF_TRAPNO(%esp),%eax
+       cmpl    $T_PAGEFLT,%eax
+       jne     calltrap
+       movl    -4(%esp),%eax
+       movl    %eax,PCPU(CR2)
 calltrap:
        movl    TF_EIP(%esp),%eax
        cmpl    $scrit,%eax
@@ -217,8 +228,7 @@
        SUPERALIGN_TEXT
 IDTVEC(int0x80_syscall)
        pushl   $2                      /* sizeof "int 0x80" */
-       pushl   $0xCAFE
-       pushl   $0xDEAD
+       pushl   $0xBEEF
        pushal
        pushl   %ds
        pushl   %es
@@ -324,7 +334,7 @@
 doreti_popl_ds:
        popl    %ds
        POPA
-       addl    $12,%esp
+       addl    $8,%esp
        .globl  doreti_iret
 doreti_iret:
        iret
@@ -341,7 +351,7 @@
        ALIGN_TEXT
        .globl  doreti_iret_fault
 doreti_iret_fault:
-       subl    $12,%esp
+       subl    $8,%esp
        pushal
        pushl   %ds
        .globl  doreti_popl_ds_fault
@@ -376,7 +386,7 @@
         movl  %esp,%esi
         add  %eax,%esi        # %esi points at end of src region
         movl  %esp,%edi
-        add  $0x44,%edi       # %edi points at end of dst region
+        add  $0x40,%edi       # %edi points at end of dst region
         movl  %eax,%ecx
         shr  $2,%ecx          # convert bytes to words
         je   16f              # skip loop if nothing to copy
@@ -403,8 +413,8 @@
 .byte   0x20                           #pop    %edx
 .byte   0x24                           #pop    %ecx
 .byte   0x28                           #pop    %eax
-.byte   0x2c,0x2c,0x2c                  #add    $0xc,%esp
-.byte   0x38                           #iret   
+.byte   0x2c,0x2c,0x2c                  #add    $0x8,%esp
+.byte   0x34                           #iret   
 
        
 /* # Hypervisor uses this for application faults while it executes.*/
@@ -412,17 +422,17 @@
        pushal
        call xen_failsafe_handler
 /*#    call install_safe_pf_handler */
-        movl 32(%esp),%ebx
+        movl 28(%esp),%ebx
 1:      movl %ebx,%ds
-        movl 36(%esp),%ebx
+        movl 32(%esp),%ebx
 2:      movl %ebx,%es
-        movl 40(%esp),%ebx
+        movl 36(%esp),%ebx
 3:      movl %ebx,%fs
-        movl 44(%esp),%ebx
+        movl 40(%esp),%ebx
 4:      movl %ebx,%gs
 /*#        call install_normal_pf_handler */
        popal
-       addl $16,%esp
+       addl $12,%esp
        iret
 
 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c       2005-05-02 
05:04:44 -04:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/genassym.c       2005-05-02 
05:04:44 -04:00
@@ -200,8 +200,7 @@
 ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt));
 ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
-ASSYM(PC_TRAP_NESTING, offsetof(struct pcpu, pc_trap_nesting));
-
+ASSYM(PC_CR2, offsetof(struct pcpu, pc_cr2));
 ASSYM(PC_CR3, offsetof(struct pcpu, pc_pdir));
 
 #ifdef DEV_APIC
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c 
b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c
--- a/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c   2005-05-02 05:04:44 
-04:00
+++ b/freebsd-5.3-xen-sparse/i386-xen/i386-xen/trap.c   2005-05-02 05:04:44 
-04:00
@@ -181,11 +181,6 @@
        u_int sticks = 0;
        int i = 0, ucode = 0, type, code;
        vm_offset_t eva;
-#ifdef STACK_DEBUGGING
-       int nesting, current_sp;
-       static int prev_csp = 0, prev_ssp = 0;
-       nesting = PCPU_GET(trap_nesting);
-#endif
 
 #ifdef POWERFAIL_NMI
        static int lastalert = 0;
@@ -227,7 +222,7 @@
                 * kernel can print out a useful trap message and even get
                 * to the debugger.
                 */
-               eva = frame.tf_cr2;
+               eva = PCPU_GET(cr2);
 
                if (td->td_critnest != 0)                       
                    trap_fatal(&frame, eva);
@@ -613,9 +608,6 @@
        mtx_assert(&Giant, MA_NOTOWNED);
 userout:
 out:
-#ifdef STACK_DEBUGGING 
-       PCPU_SET(trap_nesting, nesting);
-#endif
        return;
 }
 
diff -Nru a/freebsd-5.3-xen-sparse/i386-xen/include/frame.h 
b/freebsd-5.3-xen-sparse/i386-xen/include/frame.h
--- a/freebsd-5.3-xen-sparse/i386-xen/include/frame.h   2005-05-02 05:04:44 
-04:00
+++ /dev/null   Wed Dec 31 16:00:00 196900
@@ -1,129 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *     This product includes software developed by the University of
- *     California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- *     from: @(#)frame.h       5.2 (Berkeley) 1/18/91
- * $FreeBSD: src/sys/i386/include/frame.h,v 1.23 2003/07/22 08:11:15 peter Exp 
$
- */
-
-#ifndef _MACHINE_FRAME_H_

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.