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
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# The PSP crash record (C2PMSG) — full field map and TA attribution
`C2PMSG_N` = `0x3010900 + 4*N`, read from the host via `adev.rreg(90112+64+N)`.
## Field map (verified by full 0..127 before/after diffing across two faults)
| reg | addr | meaning |
|-----|------|---------|
| 67 | 0x3010a0c | command **submitted** counter, +0x10 per TA invoke |
| 68 | 0x3010a10 | command **completed** counter, +0x10 per completion |
| 81 | 0x3010a44 | free-running tick/timestamp counter |
| 82 | 0x3010a48 | `fault_lr` — PC of the last SVC return before the fault |
| 83 | 0x3010a4c | packed exception class/mode word |
| 84 | 0x3010a50 | faulting PC |
| 85 | 0x3010a54 | FSR (DFSR for data aborts) |
| 86 | 0x3010a58 | FAR (DFAR for data aborts) |
| 87 | 0x3010a5c | panic code, written by the halt routine `sub_E0F890` |
| 88 | 0x3010a60 | constant magic `0xec7f4a9c` ("record valid") |
| 89,90,91 | | boot-time constants (`0xc04318ac`, `0x371b2db8`, `0x0d310095`) |
`sub_E0F890` (SYS_DRV) is the panic/halt routine:
```c
void __noreturn sub_E0F890(int a1) {
*((_DWORD *)*off_E0F8A4 + 663) = a1; // 663*4 = 0xA5C -> C2PMSG 87
sysdrv_memclr_fast((void *)0xFFFFFF00, 0x40u);
while (1) ; // halt spin
}
```
In both observed faults reg 87 stayed 0, i.e. the fault path reaches the halt
spin without setting a panic code.
## Can we tell which TA faulted? **No — there is no task/TA id in the record.**
Two clean, single-fault records driven from *different* TAs:
| reg | HDCP (cmd 0x0F subcmd12 canary smash) | ASD (cmd 0x12 -> ASD 0x308) |
|-----|---------------------------------------|------------------------------|
| 82 | 0x0040173e (HDCP range) | 0x00e04b8e (SYS_DRV range) |
| 83 | 0x25041017 | 0x25041017 **identical** |
| 84 | 0x0040433c (HDCP range) | 0x00e01938 (SYS_DRV range) |
| 85 | 0x00000005 | 0x00000037 |
| 86 | 0xdeadbeef | 0x00d5b000 |
| 88 | 0xec7f4a9c | 0xec7f4a9c **identical** |
**Correction to earlier notes:** field 83 was previously recorded as
`0x25031016` for the ASD fault and treated as a per-TA discriminator. That
sample came from a *repeat* fault on an already-wedged card. On a clean first
fault both TAs produce **0x25041017**, so field 83 encodes only the exception
class/mode (byte 0x10 = ARM User mode = TA context) and does NOT identify the TA.
Likewise reg 88 is a fixed magic, not a per-task hash.
### What attribution IS possible
1. **Address-range matching** on PC (84) and fault_lr (82) against the loaded
images:
- HDCP 0x400100..0x407100
- DTM 0x400100..0x402200 (overlaps HDCP! see below)
- ASD 0xd00100..0xd33100
- SYS_DRV 0xe00100..0xe27790
2. **HDCP vs DTM overlap**: both are based at 0x400100. A PC above 0x402200 is
necessarily HDCP (beyond DTM's image). Inside 0x400100..0x402200 the record
alone cannot distinguish them — you must know which TA you were driving.
3. **Caveat — the PC often names the *victim*, not the *culprit*.** The ASD
fault has PC *and* fault_lr in SYS_DRV (`sysdrv_memcpy` @0xe01938), because
the over-read happens in shared system code called on behalf of ASD. The
record gives no indication that ASD was the requester; that comes only from
knowing the call chain you drove.
4. **In-flight detection**: reg 67 (submitted) advances +0x10 per invoke while
reg 68 (completed) only advances on completion, so `67 - 68 == 0x10`
indicates a command hung in flight — a cheap liveness/hang signal that does
not require the fault fields at all.
## Practical recipe
```python
C2P = 90112 + 64
rec = {n: adev.rreg(C2P + n) for n in (67,68,81,82,83,84,85,86,87,88)}
assert rec[88] == 0xec7f4a9c # record valid
pc, lr = rec[84], rec[82]
# attribute by range; remember PC may be in SYS_DRV on behalf of a TA
inflight = (rec[67] - rec[68]) != 0
```
|