FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/sysglue/exceptions.S @ 603:d638de8cc6b8
gsm-fw/L1/audio_*/*.h: replacing Leonardo headers with LoCosto versions
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 28 Aug 2014 18:40:12 +0000 |
parents | f05ae34f7ca0 |
children |
rev | line source |
---|---|
312
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This module contains ARM exception handlers which used to be |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * in chipsetsw/system/Main/int.s in TI's Leonardo code. |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 .section "except_stack","aw",%nobits |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 .balign 4 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 .space 512 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 .globl _Except_Stack_SP |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 _Except_Stack_SP: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 .text |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 .code 32 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 @ layout of xdump buffer: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 @ struct xdump_s { |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
17 @ long registers[16] // svc mode registers |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 @ long cpsr // svc mode CPSR |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 @ long exception // magic word + index of vector taken |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 @ long stack[20] // bottom 20 words of usr mode stack |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 @ } |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 .globl _arm_undefined |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 _arm_undefined: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 @ store r12 for Xdump_buffer pointer, r11 for index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 stmfd r13!,{r11,r12} |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 mov r11,#1 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 b save_regs |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 .globl _arm_swi |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 _arm_swi: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 @ store r12 for Xdump_buffer pointer, r11 for index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 stmfd r13!,{r11,r12} |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 mov r11,#2 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 b save_regs |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
36 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
37 .globl _arm_abort_prefetch |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 _arm_abort_prefetch: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 @ store r12 for Xdump_buffer pointer, r11 for index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 stmfd r13!,{r11,r12} |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 mov r11,#3 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
42 b save_regs |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 .globl _arm_abort_data |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 _arm_abort_data: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 @ store r12 for Xdump_buffer pointer, r11 for index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 stmfd r13!,{r11,r12} |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 mov r11,#4 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 b save_regs |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 .globl _arm_reserved |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 _arm_reserved: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 ldr r13,=_Except_Stack_SP @ mode unknown |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 @ store r12 for Xdump_buffer pointer, r11 for index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 stmfd r13!,{r11,r12} |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 mov r11,#5 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 b save_regs |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 save_regs: |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 ldr r12,=xdump_buffer |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 str r14,[r12,#4*15] @ save r14_abt (original PC) into r15 slot |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 stmia r12,{r0-r10} @ save unbanked registers (except r11 and r12) |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 ldmfd r13!,{r0,r1} @ get original r11 and r12 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 str r0,[r12,#4*11] @ save original r11 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 str r1,[r12,#4*12] @ save original r12 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 mrs r0,spsr @ get original psr |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 str r0,[r12,#4*16] @ save original cpsr |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 mrs r1,cpsr @ save mode psr |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 bic r2,r1,#0x1f @ psr with mode bits cleared |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 and r0,r0,#0x1f @ get original mode bits |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 add r0,r0,r2 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 msr cpsr,r0 @ move to pre-exception mode |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 str r13,[r12,#4*13] @ save original SP |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
77 str r14,[r12,#4*14] @ save original LR |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
78 msr cpsr,r1 @ restore mode psr |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
79 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
80 @ r11 has original index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
81 orr r10,r11,#0xDE<<24 @ r10 = 0xDEAD0000 + index of vector taken |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
82 orr r10,r10,#0xAD<<16 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
83 str r10,[r12,#4*17] @ save magic + index |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
84 |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
85 mov r0,r11 @ put index into 1st argument |
f05ae34f7ca0
gsm-fw: ARM exception vectors hooked in
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
86 b dar_exception |