Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Switch x86_retpatch[] -> HOTPATCH().
details: https://anonhg.NetBSD.org/src/rev/4fba9ae742f0
branches: trunk
changeset: 358549:4fba9ae742f0
user: maxv <maxv%NetBSD.org@localhost>
date: Sun Jan 07 13:43:23 2018 +0000
description:
Switch x86_retpatch[] -> HOTPATCH().
diffstat:
sys/arch/amd64/amd64/lock_stubs.S | 15 +++++----------
sys/arch/amd64/include/frameasm.h | 9 +++++----
sys/arch/i386/i386/lock_stubs.S | 24 +++++++-----------------
sys/arch/i386/include/frameasm.h | 9 +++++----
sys/arch/x86/x86/patch.c | 11 ++++-------
5 files changed, 26 insertions(+), 42 deletions(-)
diffs (167 lines):
diff -r cb7531299224 -r 4fba9ae742f0 sys/arch/amd64/amd64/lock_stubs.S
--- a/sys/arch/amd64/amd64/lock_stubs.S Sun Jan 07 13:37:39 2018 +0000
+++ b/sys/arch/amd64/amd64/lock_stubs.S Sun Jan 07 13:43:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock_stubs.S,v 1.27 2018/01/07 13:15:23 maxv Exp $ */
+/* $NetBSD: lock_stubs.S,v 1.28 2018/01/07 13:43:23 maxv Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -50,7 +50,10 @@
#define LOCK(num) \
HOTPATCH(HP_NAME_NOLOCK, 1) ; \
lock
-#define RET(num) .Lret ## num: ret; nop; nop; ret
+#define RET(num) \
+ HOTPATCH(HP_NAME_RETFENCE, 3) ; \
+ ret; nop; nop ; \
+ ret
#ifndef LOCKDEBUG
@@ -335,11 +338,3 @@
RET(8)
END(__cpu_simple_lock_try)
- .type _C_LABEL(x86_retpatch), @object
-LABEL(x86_retpatch)
-#ifndef LOCKDEBUG
- .quad .Lret1, .Lret2, .Lret3, .Lret4, .Lret5, .Lret6
-#endif
- .quad .Lret7, .Lret8
- .quad 0
-END(x86_retpatch)
diff -r cb7531299224 -r 4fba9ae742f0 sys/arch/amd64/include/frameasm.h
--- a/sys/arch/amd64/include/frameasm.h Sun Jan 07 13:37:39 2018 +0000
+++ b/sys/arch/amd64/include/frameasm.h Sun Jan 07 13:43:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: frameasm.h,v 1.25 2018/01/07 13:15:23 maxv Exp $ */
+/* $NetBSD: frameasm.h,v 1.26 2018/01/07 13:43:23 maxv Exp $ */
#ifndef _AMD64_MACHINE_FRAMEASM_H
#define _AMD64_MACHINE_FRAMEASM_H
@@ -35,9 +35,10 @@
#define STI(temp_reg) sti
#endif /* XEN */
-#define HP_NAME_CLAC 1
-#define HP_NAME_STAC 2
-#define HP_NAME_NOLOCK 3
+#define HP_NAME_CLAC 1
+#define HP_NAME_STAC 2
+#define HP_NAME_NOLOCK 3
+#define HP_NAME_RETFENCE 4
#define HOTPATCH(name, size) \
123: ; \
diff -r cb7531299224 -r 4fba9ae742f0 sys/arch/i386/i386/lock_stubs.S
--- a/sys/arch/i386/i386/lock_stubs.S Sun Jan 07 13:37:39 2018 +0000
+++ b/sys/arch/i386/i386/lock_stubs.S Sun Jan 07 13:43:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock_stubs.S,v 1.27 2018/01/07 13:15:24 maxv Exp $ */
+/* $NetBSD: lock_stubs.S,v 1.28 2018/01/07 13:43:24 maxv Exp $ */
/*-
* Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.27 2018/01/07 13:15:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.28 2018/01/07 13:43:24 maxv Exp $");
#include "opt_lockdebug.h"
@@ -49,7 +49,11 @@
#define LOCK(num) \
HOTPATCH(HP_NAME_NOLOCK, 1) ; \
lock
-#define RET(num) .Lret ## num: ret; nop; nop; ret
+#define RET(num) \
+ HOTPATCH(HP_NAME_RETFENCE, 3) ; \
+ ret; nop; nop ; \
+ ret
+
#define ENDLABEL(name,a) .align a; LABEL(name)
#if !defined(LOCKDEBUG)
@@ -359,17 +363,3 @@
RET(8)
END(__cpu_simple_lock_try)
-/*
- * Patchpoints to replace with NOP when ncpu == 1.
- */
- .data
-
-LABEL(x86_retpatch)
-#ifndef LOCKDEBUG
- .long .Lret1, .Lret2, .Lret3, .Lret4, .Lret5
-#ifndef __XEN__
- .long .Lret6
-#endif
-#endif
- .long .Lret7, .Lret8
- .long 0
diff -r cb7531299224 -r 4fba9ae742f0 sys/arch/i386/include/frameasm.h
--- a/sys/arch/i386/include/frameasm.h Sun Jan 07 13:37:39 2018 +0000
+++ b/sys/arch/i386/include/frameasm.h Sun Jan 07 13:43:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: frameasm.h,v 1.20 2018/01/07 13:15:24 maxv Exp $ */
+/* $NetBSD: frameasm.h,v 1.21 2018/01/07 13:43:24 maxv Exp $ */
#ifndef _I386_FRAMEASM_H_
#define _I386_FRAMEASM_H_
@@ -27,9 +27,10 @@
testb $0xff,EVTCHN_UPCALL_PENDING(reg)
#endif
-#define HP_NAME_CLAC 1
-#define HP_NAME_STAC 2
-#define HP_NAME_NOLOCK 3
+#define HP_NAME_CLAC 1
+#define HP_NAME_STAC 2
+#define HP_NAME_NOLOCK 3
+#define HP_NAME_RETFENCE 4
#define HOTPATCH(name, size) \
123: ; \
diff -r cb7531299224 -r 4fba9ae742f0 sys/arch/x86/x86/patch.c
--- a/sys/arch/x86/x86/patch.c Sun Jan 07 13:37:39 2018 +0000
+++ b/sys/arch/x86/x86/patch.c Sun Jan 07 13:43:23 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: patch.c,v 1.28 2018/01/07 13:37:39 maxv Exp $ */
+/* $NetBSD: patch.c,v 1.29 2018/01/07 13:43:24 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.28 2018/01/07 13:37:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.29 2018/01/07 13:43:24 maxv Exp $");
#include "opt_lockdebug.h"
#ifdef i386
@@ -83,7 +83,6 @@
void _atomic_cas_cx8(void);
void _atomic_cas_cx8_end(void);
-extern void *x86_retpatch[];
extern void *atomic_lockpatch[];
#define X86_NOP 0x90
@@ -273,10 +272,8 @@
0x0F, 0xAE, 0xE8 /* lfence */
};
- for (i = 0; x86_retpatch[i] != 0; i++) {
- /* ret,nop,nop,ret -> lfence,ret */
- patchbytes(x86_retpatch[i], bytes, sizeof(bytes));
- }
+ /* ret,nop,nop -> lfence */
+ x86_hotpatch(HP_NAME_RETFENCE, bytes, sizeof(bytes));
}
#ifdef amd64
Home |
Main Index |
Thread Index |
Old Index