Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 Drop the hardcoded array, use the hotpatch ...



details:   https://anonhg.NetBSD.org/src/rev/c07fb0dc464c
branches:  trunk
changeset: 931317:c07fb0dc464c
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Apr 26 13:37:14 2020 +0000

description:
Drop the hardcoded array, use the hotpatch section.

diffstat:

 common/lib/libc/arch/i386/atomic/atomic.S   |  11 +++--------
 common/lib/libc/arch/x86_64/atomic/atomic.S |  14 +++-----------
 sys/arch/x86/x86/patch.c                    |   8 ++------
 3 files changed, 8 insertions(+), 25 deletions(-)

diffs (103 lines):

diff -r 9f3a90c154e1 -r c07fb0dc464c common/lib/libc/arch/i386/atomic/atomic.S
--- a/common/lib/libc/arch/i386/atomic/atomic.S Sun Apr 26 13:09:52 2020 +0000
+++ b/common/lib/libc/arch/i386/atomic/atomic.S Sun Apr 26 13:37:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic.S,v 1.24 2020/04/25 15:26:16 bouyer Exp $       */
+/*     $NetBSD: atomic.S,v 1.25 2020/04/26 13:37:14 maxv Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -44,7 +44,8 @@
 
 #ifdef _HARDKERNEL
 #include "opt_xen.h"
-#define        LOCK(n)         .Lpatch ## n:   lock
+#include <machine/frameasm.h>
+#define        LOCK(n)         HOTPATCH(HP_NAME_NOLOCK, 1); lock
 #define        ENDLABEL(a)     _ALIGN_TEXT; LABEL(a)
 #else
 #define        LOCK(n)         lock
@@ -269,12 +270,6 @@
        ret
 END(sse2_mfence)
 ENDLABEL(sse2_mfence_end)
-
-atomic_lockpatch:
-       .globl  atomic_lockpatch
-       .long   .Lpatch1, .Lpatch2, .Lpatch3, .Lpatch4, .Lpatch5
-       .long   .Lpatch6, .Lpatch7, .Lpatch8, .Lpatch9, .Lpatch10
-       .long   .Lpatch12, .Lpatch13, .Lpatch14, .Lpatch15, 0
 #endif /* _HARDKERNEL */
 
 ALIAS(atomic_add_32,_atomic_add_32)
diff -r 9f3a90c154e1 -r c07fb0dc464c common/lib/libc/arch/x86_64/atomic/atomic.S
--- a/common/lib/libc/arch/x86_64/atomic/atomic.S       Sun Apr 26 13:09:52 2020 +0000
+++ b/common/lib/libc/arch/x86_64/atomic/atomic.S       Sun Apr 26 13:37:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atomic.S,v 1.18 2019/02/17 07:34:44 isaki Exp $        */
+/*     $NetBSD: atomic.S,v 1.19 2020/04/26 13:37:14 maxv Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -39,7 +39,8 @@
 #endif
 
 #ifdef _HARDKERNEL
-#define        LOCK(n)         .Lpatch ## n:   lock
+#include <machine/frameasm.h>
+#define        LOCK(n)         HOTPATCH(HP_NAME_NOLOCK, 1); lock
 #define        ENDLABEL(a)     _ALIGN_TEXT; LABEL(a)
 #else
 #define        LOCK(n)         lock
@@ -285,15 +286,6 @@
        ret
 END(sse2_mfence)
 ENDLABEL(sse2_mfence_end)
-
-atomic_lockpatch:
-       .globl  atomic_lockpatch
-       .quad   .Lpatch1, .Lpatch2, .Lpatch3, .Lpatch4, .Lpatch5
-       .quad   .Lpatch6, .Lpatch7, .Lpatch8, .Lpatch9, .Lpatch10
-       .quad   .Lpatch12, .Lpatch13, .Lpatch14, .Lpatch15
-       .quad   .Lpatch16, .Lpatch17, .Lpatch18, .Lpatch19, .Lpatch20
-       .quad   .Lpatch21, .Lpatch22, .Lpatch24, .Lpatch25
-       .quad   .Lpatch26, 0
 #endif /* _HARDKERNEL */
 
 ALIAS(atomic_add_32,_atomic_add_32)
diff -r 9f3a90c154e1 -r c07fb0dc464c sys/arch/x86/x86/patch.c
--- a/sys/arch/x86/x86/patch.c  Sun Apr 26 13:09:52 2020 +0000
+++ b/sys/arch/x86/x86/patch.c  Sun Apr 26 13:37:14 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: patch.c,v 1.40 2020/04/25 15:26:18 bouyer Exp $        */
+/*     $NetBSD: patch.c,v 1.41 2020/04/26 13:37:14 maxv Exp $  */
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.40 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.41 2020/04/26 13:37:14 maxv Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -83,8 +83,6 @@
 void   _atomic_cas_cx8(void);
 void   _atomic_cas_cx8_end(void);
 
-extern void    *atomic_lockpatch[];
-
 #define        X86_NOP         0x90
 #define        X86_REP         0xf3
 #define        X86_RET         0xc3
@@ -211,8 +209,6 @@
 
                /* lock -> nop */
                x86_hotpatch(HP_NAME_NOLOCK, bytes, sizeof(bytes));
-               for (int i = 0; atomic_lockpatch[i] != 0; i++)
-                       patchbytes(atomic_lockpatch[i], bytes, sizeof(bytes));
 #endif
        }
 



Home | Main Index | Thread Index | Old Index