From daa57b017e00b548525ab132bea05168222719e4 Mon Sep 17 00:00:00 2001 From: rosshjb Date: Tue, 5 Nov 2024 22:46:50 +0900 Subject: [PATCH] fix: fix frame pointer manipulation --- Chapter 06/codesnippets.s | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Chapter 06/codesnippets.s b/Chapter 06/codesnippets.s index 3b93c02..9ef2e4b 100644 --- a/Chapter 06/codesnippets.s +++ b/Chapter 06/codesnippets.s @@ -49,14 +49,16 @@ l5: STR W0, [SP] // Store a l6: ADD SP, SP, #16 -l7: SUB FP, SP, #16 +l7: STR FP, [SP, #-16]! // Save FP + SUB FP, SP, #16 SUB SP, SP, #16 l8: STR W0, [FP] // Store a - STR W1, [FP, #-4] // Store b - STR W2, [FP, #-8] // Store c + STR W1, [FP, #4] // Store b + STR W2, [FP, #8] // Store c ADD SP, SP, #16 + LDR FP, [SP], #16 // Restore FP l9: BL SUMFN B l10