From 5487761f542fb5f6fe07741f550006b37c6f0559 Mon Sep 17 00:00:00 2001 From: Enrico Lumetti Date: Thu, 6 May 2021 16:53:18 +0200 Subject: [PATCH] Experiments with aarch64 stack --- aarch64-hello.s | 13 ++++++++++++- runtime.s | 6 ------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/aarch64-hello.s b/aarch64-hello.s index 75b33a9..e0f7d53 100644 --- a/aarch64-hello.s +++ b/aarch64-hello.s @@ -1,6 +1,17 @@ -.global start +.global main + +main: + stp x30, x19, [sp, -16]! + b start + +conclusion: + ldp x30, x19, [sp], 16 + mov x8, 93 // sys_exit() is at index 93 in kernel functions table + svc #0 // generate kernel call sys_exit(123); start: mov x0, 1 + str x0, [sp, -16]! + ldr x0, [sp], 16 add x0, x0, 41 b conclusion diff --git a/runtime.s b/runtime.s index 406b1c3..8b13789 100644 --- a/runtime.s +++ b/runtime.s @@ -1,7 +1 @@ -.global main, conclusion -main: - b start -conclusion: - mov x8, 93 // sys_exit() is at index 93 in kernel functions table - svc #0 // generate kernel call sys_exit(123);