Fix SIGBUS in EnterNaked3() submit/tizen/20200821.032349
authorMikhail Kurinnoi <m.kurinnoi@samsung.com>
Wed, 22 Jul 2020 14:35:40 +0000 (17:35 +0300)
committerAlexander Soldatov/AI Compiler Lab /SRR/Staff Engineer/Samsung Electronics <soldatov.a@samsung.com>
Thu, 23 Jul 2020 13:24:26 +0000 (16:24 +0300)
SP must be 16-byte aligned all the time.

src/arch/arm64/asmhelpers.S

index d91a85f5ee05b8687d10a553a9f931697a9c7bf6..605557aceaeab998533daef4dd35b5532abb6664 100644 (file)
 //   Values of other volatile registers are not preserved.
 
 .macro PUSH_REGS
-    stp fp, lr, [sp, #-16]!
-
-    stp x0, x1, [sp, #-16]!
-    stp x2, x3, [sp, #-16]!
-    stp x4, x5, [sp, #-16]!
-    stp x6, x7, [sp, #-16]!
-    str x8, [sp, #-8]!
-    sub sp, sp, #8
-
-    stp q0, q1, [sp, #-32]!
-    stp q2, q3, [sp, #-32]!
-    stp q4, q5, [sp, #-32]!
-    stp q6, q7, [sp, #-32]!
+    PROLOG_SAVE_REG_PAIR_INDEXED fp, lr, -224 // Allocate space and save Fp, Pc.
+    SAVE_ARGUMENT_REGISTERS sp, 16            // Save x8 and argument registers (x0-x7).
+    SAVE_FLOAT_ARGUMENT_REGISTERS sp, 96      // Save floating-point/SIMD registers (q0-q7).
 .endm
 
 .macro POP_REGS
-    ldp q6, q7, [sp], #32
-    ldp q4, q5, [sp], #32
-    ldp q2, q3, [sp], #32
-    ldp q0, q1, [sp], #32
-
-    add sp, sp, #8
-    ldr x8, [sp], #8
-    ldp x6, x7, [sp], #16
-    ldp x4, x5, [sp], #16
-    ldp x2, x3, [sp], #16
-    ldp x0, x1, [sp], #16
-
-    ldp fp, lr, [sp], #16
+    RESTORE_ARGUMENT_REGISTERS sp, 16         // Restore x8 and argument registers (x0-x7).
+    RESTORE_FLOAT_ARGUMENT_REGISTERS sp, 96   // Restore floating-point/SIMD registers.
+    EPILOG_RESTORE_REG_PAIR_INDEXED fp, lr, 224
 .endm
 
 //