Print this page
11787 Kernel needs to be built with retpolines
11788 Kernel needs to generally use RSB stuffing
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: John Levon <john.levon@joyent.com>
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/i86pc/sys/asm_misc.h
+++ new/usr/src/uts/i86pc/sys/asm_misc.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 - * Copyright 2017 Joyent, Inc.
24 + * Copyright 2019 Joyent, Inc.
25 25 */
26 26
27 27 #ifndef _SYS_ASM_MISC_H
28 28 #define _SYS_ASM_MISC_H
29 29
30 30 #ifdef __cplusplus
31 31 extern "C" {
32 32 #endif
33 33
34 +#define RET_INSTR 0xc3
35 +#define NOP_INSTR 0x90
36 +#define STI_INSTR 0xfb
37 +#define JMP_INSTR 0x00eb
38 +
34 39 #ifdef _ASM /* The remainder of this file is only for assembly files */
35 40
36 41 /* Load reg with pointer to per-CPU structure */
37 42 #if defined(__amd64)
38 43 #define LOADCPU(reg) \
39 44 movq %gs:CPU_SELF, reg;
40 45 #else
41 46 #define LOADCPU(reg) \
42 47 movl %gs:CPU_SELF, reg;
43 48 #endif
44 49
45 -#define RET_INSTR 0xc3
46 -#define NOP_INSTR 0x90
47 -#define STI_INSTR 0xfb
48 -#define JMP_INSTR 0x00eb
49 -
50 -
51 50 #if defined(__i386)
52 51
53 52 #define _HOT_PATCH_PROLOG \
54 53 push %ebp; \
55 54 mov %esp, %ebp; \
56 55 push %ebx; \
57 56 push %esi; \
58 57 push %edi
59 58
60 59 #define _HOT_PATCH(srcaddr, dstaddr, size) \
61 60 movl $srcaddr, %esi; \
62 61 movl $dstaddr, %edi; \
63 62 movl $size, %ebx; \
64 63 0: pushl $1; \
65 64 /*CSTYLED*/ \
66 65 movzbl (%esi), %eax; \
67 66 pushl %eax; \
68 67 pushl %edi; \
69 68 call hot_patch_kernel_text; \
70 69 addl $12, %esp; \
71 70 inc %edi; \
72 71 inc %esi; \
73 72 dec %ebx; \
74 73 test %ebx, %ebx; \
75 74 jne 0b
76 75
77 76 #define _HOT_PATCH_EPILOG \
78 77 pop %edi; \
79 78 pop %esi; \
80 79 pop %ebx; \
81 80 mov %ebp, %esp; \
82 81 pop %ebp
83 82
84 83 #endif /* __i386 */
85 84
86 85 #endif /* _ASM */
87 86
88 87 #ifdef __cplusplus
89 88 }
90 89 #endif
91 90
92 91 #endif /* _SYS_ASM_MISC_H */
↓ open down ↓ |
32 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX