From 9f8f207e4b9cfbcbd78cc705d8c3ca9e3ff3ce03 Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Sun, 9 Feb 2025 20:13:38 +0200 Subject: [PATCH] lab2: add livepatching of image in RAM --- lab1_v2.S | 6 ------ start.S | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lab1_v2.S b/lab1_v2.S index 8d1d386..dff10b9 100644 --- a/lab1_v2.S +++ b/lab1_v2.S @@ -17,12 +17,6 @@ lab1_v2: push.n {lr} - mov r0, #2073 - bl int_to_str - - ldr r0, =2473005196 - bl int_to_str - bl calculate_formula_v2 bl int_to_str diff --git a/start.S b/start.S index 2bf26a8..c1e853a 100644 --- a/start.S +++ b/start.S @@ -53,6 +53,25 @@ bootload_v2: ldr.n r3, =__ram_start add r3, r3, #1 + + push {r3} + blx r3 + pop {r3} + + @ patch A + ldr r0, =0x707ff64d @ 0xDF7F + str r0, [r3, #0xb] + + push {r3} + blx r3 + pop {r3} + + @ patch A and B + ldr r0, =0x000af240 @ 0x000A + str r0, [r3, #0xb] + ldr r0, =0x010af240 @ 0x000A + str r0, [r3, #0xf] + blx r3 pop {pc}