hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/arch/powerpc/include/asm/sstep.h
....@@ -1,11 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * Copyright (C) 2004 Paul Mackerras <paulus@au.ibm.com>, IBM
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License
6
- * as published by the Free Software Foundation; either version
7
- * 2 of the License, or (at your option) any later version.
84 */
5
+#include <asm/inst.h>
96
107 struct pt_regs;
118
....@@ -19,9 +16,9 @@
1916 * Note that IS_MTMSRD returns true for both an mtmsr (32-bit)
2017 * and an mtmsrd (64-bit).
2118 */
22
-#define IS_MTMSRD(instr) (((instr) & 0xfc0007be) == 0x7c000124)
23
-#define IS_RFID(instr) (((instr) & 0xfc0007fe) == 0x4c000024)
24
-#define IS_RFI(instr) (((instr) & 0xfc0007fe) == 0x4c000064)
19
+#define IS_MTMSRD(instr) ((ppc_inst_val(instr) & 0xfc0007be) == 0x7c000124)
20
+#define IS_RFID(instr) ((ppc_inst_val(instr) & 0xfc0007fe) == 0x4c000024)
21
+#define IS_RFI(instr) ((ppc_inst_val(instr) & 0xfc0007fe) == 0x4c000064)
2522
2623 enum instruction_type {
2724 COMPUTE, /* arith/logical/CR op, etc. */
....@@ -43,6 +40,7 @@
4340 CACHEOP,
4441 BARRIER,
4542 SYSCALL,
43
+ SYSCALL_VECTORED_0,
4644 MFMSR,
4745 MTMSR,
4846 RFI,
....@@ -52,6 +50,8 @@
5250
5351 #define INSTR_TYPE_MASK 0x1f
5452
53
+#define OP_IS_LOAD(type) ((LOAD <= (type) && (type) <= LOAD_VSX) || (type) == LARX)
54
+#define OP_IS_STORE(type) ((STORE <= (type) && (type) <= STORE_VSX) || (type) == STCX)
5555 #define OP_IS_LOAD_STORE(type) (LOAD <= (type) && (type) <= STCX)
5656
5757 /* Compute flags, ORed in with type */
....@@ -93,13 +93,23 @@
9393 #define VSX_LDLEFT 4 /* load VSX register from left */
9494 #define VSX_CHECK_VEC 8 /* check MSR_VEC not MSR_VSX for reg >= 32 */
9595
96
+/* Prefixed flag, ORed in with type */
97
+#define PREFIXED 0x800
98
+
9699 /* Size field in type word */
97100 #define SIZE(n) ((n) << 12)
98101 #define GETSIZE(w) ((w) >> 12)
99102
100103 #define GETTYPE(t) ((t) & INSTR_TYPE_MASK)
104
+#define GETLENGTH(t) (((t) & PREFIXED) ? 8 : 4)
101105
102106 #define MKOP(t, f, s) ((t) | (f) | SIZE(s))
107
+
108
+/* Prefix instruction operands */
109
+#define GET_PREFIX_RA(i) (((i) >> 16) & 0x1f)
110
+#define GET_PREFIX_R(i) ((i) & (1ul << 20))
111
+
112
+extern s32 patch__exec_instr;
103113
104114 struct instruction_op {
105115 int type;
....@@ -136,7 +146,7 @@
136146 * otherwise.
137147 */
138148 extern int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
139
- unsigned int instr);
149
+ struct ppc_inst instr);
140150
141151 /*
142152 * Emulate an instruction that can be executed just by updating
....@@ -153,7 +163,7 @@
153163 * 0 if it could not be emulated, or -1 for an instruction that
154164 * should not be emulated (rfid, mtmsrd clearing MSR_RI, etc.).
155165 */
156
-extern int emulate_step(struct pt_regs *regs, unsigned int instr);
166
+extern int emulate_step(struct pt_regs *regs, struct ppc_inst instr);
157167
158168 /*
159169 * Emulate a load or store instruction by reading/writing the