Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/aarch64/aarch64 Create a buffer space of 512 bytes ...



details:   https://anonhg.NetBSD.org/src/rev/f9b7e1ac5849
branches:  trunk
changeset: 744739:f9b7e1ac5849
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Feb 12 01:09:17 2020 +0000

description:
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.

diffstat:

 sys/arch/aarch64/aarch64/vectors.S |  18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 3decbb7558eb -r f9b7e1ac5849 sys/arch/aarch64/aarch64/vectors.S
--- a/sys/arch/aarch64/aarch64/vectors.S        Wed Feb 12 00:41:50 2020 +0000
+++ b/sys/arch/aarch64/aarch64/vectors.S        Wed Feb 12 01:09:17 2020 +0000
@@ -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
 



Home | Main Index | Thread Index | Old Index