Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/include Add PTRACE_ILLEGAL_ASM using the MIPS3...
details: https://anonhg.NetBSD.org/src/rev/55ee04d0917f
branches: trunk
changeset: 960419:55ee04d0917f
user: simonb <simonb%NetBSD.org@localhost>
date: Thu Mar 18 23:18:36 2021 +0000
description:
Add PTRACE_ILLEGAL_ASM using the MIPS32r6/MIPS64r6 backwards and
forwards compatible "sigrie" instruction to generate a Reserved
Instruction trap.
diffstat:
sys/arch/mips/include/ptrace.h | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (31 lines):
diff -r 71fed5d2b6fa -r 55ee04d0917f sys/arch/mips/include/ptrace.h
--- a/sys/arch/mips/include/ptrace.h Thu Mar 18 22:51:32 2021 +0000
+++ b/sys/arch/mips/include/ptrace.h Thu Mar 18 23:18:36 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.18 2020/07/26 08:08:41 simonb Exp $ */
+/* $NetBSD: ptrace.h,v 1.19 2021/03/18 23:18:36 simonb Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -67,6 +67,21 @@
#define PTRACE_REG_SP(r) (r)->r_regs[29]
#define PTRACE_REG_INTRV(r) (r)->r_regs[2]
+/*
+ * The sigrie is defined in the MIPS32r6 and MIPS64r6 specs to
+ * generate a Reserved Instruction trap but uses a previously
+ * reserved instruction encoding and is thus both backwards and
+ * forwards compatible.
+ */
+#define PTRACE_ILLEGAL_ASM do { \
+ asm volatile( \
+ ".set push; " \
+ ".set mips32r6; " \
+ "sigrie 0; " \
+ ".set pop; " \
+ ); \
+ } while (0);
+
#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0x00, 0x00, 0x00, 0x0d })
#define PTRACE_BREAKPOINT_ASM __asm __volatile("break")
#define PTRACE_BREAKPOINT_SIZE 4
Home |
Main Index |
Thread Index |
Old Index