summaryrefslogtreecommitdiff
path: root/thumb2regs.s
diff options
context:
space:
mode:
authorCamil Staps2016-12-13 20:20:22 +0000
committerCamil Staps2016-12-13 20:20:22 +0000
commit61757e482c6d6b662dedeb55a654ba9e192beb78 (patch)
tree9e0f3bb12a3204735bfcd58604ec0d6bb8f85637 /thumb2regs.s
parentFix some cases where it is really r0/.. and not BSTACK_4/.. we're talking about (diff)
Swap r1 and r10 (BSTACK_3 and HEAP_PTR)
Diffstat (limited to 'thumb2regs.s')
-rw-r--r--thumb2regs.s41
1 files changed, 41 insertions, 0 deletions
diff --git a/thumb2regs.s b/thumb2regs.s
index c7494b2..c5cb467 100644
--- a/thumb2regs.s
+++ b/thumb2regs.s
@@ -7,6 +7,9 @@
@ B stack pointer: r13 (sp)
@ link/scratch register: r14 (lr)
+.if 0
+
+@ ARM allocation
BSTACK_0 .req r4
BSTACK_1 .req r3
BSTACK_2 .req r2
@@ -25,3 +28,41 @@ HEAP_PTR .req r10
SCRATCH_REG .req r12
LINK_REG .req r14
+
+.else
+
+@ Thumb-2 optimised allocation
+BSTACK_0 .req r4
+BSTACK_1 .req r3
+BSTACK_2 .req r2
+BSTACK_3 .req r11
+BSTACK_4 .req r10
+BSTACK_PTR .req r13
+
+ASTACK_0 .req r6
+ASTACK_1 .req r7
+ASTACK_2 .req r8
+ASTACK_3 .req r12
+ASTACK_PTR .req r5
+
+HEAP_FREE .req r9
+HEAP_PTR .req r1
+
+SCRATCH_REG .req r0
+LINK_REG .req r14
+
+.macro store_bstack_and_lr
+ push {r2,r3,r4,r10,r11,lr}
+.endm
+.macro load_bstack_and_pc
+ pop {r2,r3,r4,r10,r11,pc}
+.endm
+
+.macro store_global_registers
+ push {HEAP_PTR}
+.endm
+.macro load_global_registers
+ pop {HEAP_PTR}
+.endm
+
+.endif