Module Name:    src
Committed By:   riastradh
Date:           Wed Feb 12 01:09:17 UTC 2020

Modified Files:
        src/sys/arch/aarch64/aarch64: vectors.S

Log Message:
Create a buffer space of 512 bytes before the trapframe.

dtrace fbt needs enough space to emulate an

        stp     x29, x30, [sp,#-FRAMESIZE]!

instruction in a function prologue.  In the aarch64 instruction
encoding, FRAMESIZE can be as large as 512 bytes, so reserve this
much space when KDTRACE_HOOKS is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/vectors.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/vectors.S
diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.9 src/sys/arch/aarch64/aarch64/vectors.S:1.10
--- src/sys/arch/aarch64/aarch64/vectors.S:1.9	Fri Oct 12 01:28:57 2018
+++ src/sys/arch/aarch64/aarch64/vectors.S	Wed Feb 12 01:09:17 2020
@@ -1,8 +1,20 @@
-/*	$NetBSD: vectors.S,v 1.9 2018/10/12 01:28:57 ryo Exp $	*/
+/*	$NetBSD: vectors.S,v 1.10 2020/02/12 01:09:17 riastradh Exp $	*/
 
 #include <aarch64/asm.h>
 #include "assym.h"
 #include "opt_ddb.h"
+#include "opt_dtrace.h"
+
+#ifdef KDTRACE_HOOKS
+/*
+ * dtrace needs to emulate  stp x29,x30,[sp,#-FRAMESIZE]!   where
+ * FRAMESIZE can be as large as 512, so create a 512-byte buffer
+ * between the interrupted code's frame and our struct trapframe.
+ */
+#define	TRAP_FRAMESIZE	(TF_SIZE + 512)
+#else
+#define	TRAP_FRAMESIZE	TF_SIZE
+#endif
 
 	/*
 	 * vector_entry macro must be small enough to fit 0x80 bytes!
@@ -11,7 +23,7 @@
 	.align 7	/* aligned 0x80 */
 
 	.if \el == 1
-	sub	sp, sp, #TF_SIZE	/* need to allocate stack on el1 */
+	sub	sp, sp, #TRAP_FRAMESIZE	/* need to allocate stack on el1 */
 	.endif
 
 	stp	x0, x1, [sp, #TF_X0]
@@ -35,7 +47,7 @@
 	.if \el == 0
 	mrs	x20, sp_el0
 	.else
-	add	x20, sp, #TF_SIZE	/* sp is already adjusted */
+	add	x20, sp, #TRAP_FRAMESIZE	/* sp is already adjusted */
 	.endif
 	mrs	x21, elr_el1
 

Reply via email to