summaryrefslogtreecommitdiff
path: root/thumb2regs.s
blob: 9b2a4dbbae603e5b457c9b3d3c1525ea53815428 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@ B stack registers:     r4 r3 r2 r1 r0
@ A stack registers:     r6 r7 r8 r11 (fp)
@ n free heap words:     r5
@ A stack pointer:       r9 (sb)
@ heap pointer:          r10 (sl)
@ scratch register:      r12 (ip)
@ 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
BSTACK_3 .req r1
BSTACK_4 .req r0
BSTACK_PTR .req r13

ASTACK_0 .req r6
ASTACK_1 .req r7
ASTACK_2 .req r8
ASTACK_3 .req r11
ASTACK_PTR .req r9

HEAP_FREE .req r5
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 r8
BSTACK_3 .req r11
BSTACK_4 .req r10
BSTACK_PTR .req r13

ASTACK_0 .req r6
ASTACK_1 .req r7
ASTACK_2 .req r2
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