Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Move x86_hotpatch() in !XENPV section. Fixes XEN3* ...



details:   https://anonhg.NetBSD.org/src/rev/c130fca1c46d
branches:  trunk
changeset: 971726:c130fca1c46d
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat May 02 17:14:01 2020 +0000

description:
Move x86_hotpatch() in !XENPV section. Fixes XEN3* builds.

diffstat:

 sys/arch/amd64/amd64/cpufunc.S |  78 ++++++++++++++++++++--------------------
 sys/arch/i386/i386/cpufunc.S   |  80 +++++++++++++++++++++---------------------
 2 files changed, 79 insertions(+), 79 deletions(-)

diffs (201 lines):

diff -r 3f8c603df964 -r c130fca1c46d sys/arch/amd64/amd64/cpufunc.S
--- a/sys/arch/amd64/amd64/cpufunc.S    Sat May 02 17:11:25 2020 +0000
+++ b/sys/arch/amd64/amd64/cpufunc.S    Sat May 02 17:14:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.S,v 1.50 2020/05/02 11:37:17 maxv Exp $        */
+/*     $NetBSD: cpufunc.S,v 1.51 2020/05/02 17:14:01 bouyer Exp $      */
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -180,6 +180,44 @@
 2:
        jmp     1b
 END(tsc_get_timecount)
+
+/*
+ * %rdi = name
+ * %rsi = sel
+ */
+ENTRY(x86_hotpatch)
+       /* save RFLAGS, and disable intrs */
+       pushfq
+       cli
+
+       /* save CR0, and disable WP */
+       movq    %cr0,%rcx
+       pushq   %rcx
+       andq    $~CR0_WP,%rcx
+       movq    %rcx,%cr0
+
+       callq   _C_LABEL(x86_hotpatch_apply)
+
+       /* write back and invalidate cache */
+       wbinvd
+
+       /* restore CR0 */
+       popq    %rcx
+       movq    %rcx,%cr0
+
+       /* flush instruction pipeline */
+       pushq   %rax
+       callq   x86_flush
+       popq    %rax
+
+       /* clean up */
+       movq    %rax,%rdi
+       callq   _C_LABEL(x86_hotpatch_cleanup)
+
+       /* restore RFLAGS */
+       popfq
+       ret
+END(x86_hotpatch)
 #endif /* !XENPV */
 
 ENTRY(rdmsr_safe)
@@ -380,41 +418,3 @@
        outl    %eax, %dx
        ret
 END(outl)
-
-/*
- * %rdi = name
- * %rsi = sel
- */
-ENTRY(x86_hotpatch)
-       /* save RFLAGS, and disable intrs */
-       pushfq
-       cli
-
-       /* save CR0, and disable WP */
-       movq    %cr0,%rcx
-       pushq   %rcx
-       andq    $~CR0_WP,%rcx
-       movq    %rcx,%cr0
-
-       callq   _C_LABEL(x86_hotpatch_apply)
-
-       /* write back and invalidate cache */
-       wbinvd
-
-       /* restore CR0 */
-       popq    %rcx
-       movq    %rcx,%cr0
-
-       /* flush instruction pipeline */
-       pushq   %rax
-       callq   x86_flush
-       popq    %rax
-
-       /* clean up */
-       movq    %rax,%rdi
-       callq   _C_LABEL(x86_hotpatch_cleanup)
-
-       /* restore RFLAGS */
-       popfq
-       ret
-END(x86_hotpatch)
diff -r 3f8c603df964 -r c130fca1c46d sys/arch/i386/i386/cpufunc.S
--- a/sys/arch/i386/i386/cpufunc.S      Sat May 02 17:11:25 2020 +0000
+++ b/sys/arch/i386/i386/cpufunc.S      Sat May 02 17:14:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.S,v 1.39 2020/05/02 11:37:17 maxv Exp $        */
+/*     $NetBSD: cpufunc.S,v 1.40 2020/05/02 17:14:01 bouyer Exp $      */
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include <sys/errno.h>
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.39 2020/05/02 11:37:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.S,v 1.40 2020/05/02 17:14:01 bouyer Exp $");
 
 #include "opt_xen.h"
 
@@ -71,6 +71,44 @@
        lidt    (%eax)
        ret
 END(lidt)
+
+ENTRY(x86_hotpatch)
+       /* save EFLAGS, and disable intrs */
+       pushfl
+       cli
+
+       /* save CR0, and disable WP */
+       movl    %cr0,%ecx
+       pushl   %ecx
+       andl    $~CR0_WP,%ecx
+       movl    %ecx,%cr0
+
+       pushl   4*4(%esp) /* arg2 */
+       pushl   4*4(%esp) /* arg1 */
+       call    _C_LABEL(x86_hotpatch_apply)
+       addl    $2*4,%esp
+
+       /* write back and invalidate cache */
+       wbinvd
+
+       /* restore CR0 */
+       popl    %ecx
+       movl    %ecx,%cr0
+
+       /* flush instruction pipeline */
+       pushl   %eax
+       call    x86_flush
+       popl    %eax
+
+       /* clean up */
+       pushl   %eax
+       call    _C_LABEL(x86_hotpatch_cleanup)
+       addl    $4,%esp
+
+       /* restore RFLAGS */
+       popfl
+       ret
+END(x86_hotpatch)
 #endif /* XENPV */
 
 ENTRY(x86_read_flags)
@@ -274,41 +312,3 @@
        outl    %eax, %dx
        ret
 END(outl)
-
-ENTRY(x86_hotpatch)
-       /* save EFLAGS, and disable intrs */
-       pushfl
-       cli
-
-       /* save CR0, and disable WP */
-       movl    %cr0,%ecx
-       pushl   %ecx
-       andl    $~CR0_WP,%ecx
-       movl    %ecx,%cr0
-
-       pushl   4*4(%esp) /* arg2 */
-       pushl   4*4(%esp) /* arg1 */
-       call    _C_LABEL(x86_hotpatch_apply)
-       addl    $2*4,%esp
-
-       /* write back and invalidate cache */
-       wbinvd
-
-       /* restore CR0 */
-       popl    %ecx
-       movl    %ecx,%cr0
-
-       /* flush instruction pipeline */
-       pushl   %eax
-       call    x86_flush
-       popl    %eax
-
-       /* clean up */
-       pushl   %eax
-       call    _C_LABEL(x86_hotpatch_cleanup)
-       addl    $4,%esp
-
-       /* restore RFLAGS */
-       popfl
-       ret
-END(x86_hotpatch)



Home | Main Index | Thread Index | Old Index