|
| 1 | +TC275 A14 / st.w [A14]-4 class-4 interpretation |
| 2 | +================================================ |
| 3 | +Date: 2026-07-16 |
| 4 | +Attach: .hil_tmp/tc275_attach_only.cfg (already in trap; PC=ulmk_kern_trap_panic) |
| 5 | +ELF: /home/ulipe/fun/build/ulipe-tricore-tc275_lite/ulmk |
| 6 | +git -C ulmk diff kernel/ipc/ep.c | head -100 → (empty; no local ep.c changes) |
| 7 | + |
| 8 | +CSA frame @ 0x70002cc0 (Upper context; A11=0xa0009630 as requested) |
| 9 | +----------------------------------------------------------------- |
| 10 | +Word idx field (UC) value |
| 11 | + 0 0 PCXI 0x003700b2 |
| 12 | + 1 1 PSW 0x18001584 |
| 13 | + 2 2 A10 (SP) 0x70008228 |
| 14 | + 3 3 A11 (PC/RA) 0xa0009630 |
| 15 | + 4 4 D8 0x00000000 |
| 16 | + 5 5 D9 0x00000000 |
| 17 | + 6 6 D10 0x00000000 |
| 18 | + 7 7 D11 0x00000000 |
| 19 | + 8 8 A12 0x00000000 |
| 20 | + 9 9 A13 0x00000000 |
| 21 | + 10 10 A14 0x70008230 |
| 22 | + 11 11 A15 0xa000b8b8 |
| 23 | + 12 12 D12 0x00000000 |
| 24 | + 13 13 D13 0x00000000 |
| 25 | + 14 14 D14 0x00000000 |
| 26 | + 15 15 D15 0x00000000 |
| 27 | + |
| 28 | +PSW decode: CDC=4 CDE=1 IS=0 IO=1 (User-1/driver) PRS[13:12]=1 (userspace) |
| 29 | +scratch @ 0x70008280 = 1 (hil_mark(1) done; pinmux_init never reached 0x11/0x70) |
| 30 | + |
| 31 | +A14 / A10 / store EA |
| 32 | +-------------------- |
| 33 | +A14 (word 10) = 0x70008230 → DSPR frame pointer, NOT a code pointer |
| 34 | + addr2line(A14): N/A (RAM). Symbol: root_stack_g+4016 |
| 35 | +A10 (word 2) = 0x70008228 → SP (= A14-8) |
| 36 | +A15 (word 11) = 0xa000b8b8 → ulmk_user_thread_entry |
| 37 | +A11 (word 3) = 0xa0009630 → pinmux_init+0x48 |
| 38 | + |
| 39 | +store address = A14 - 4 = 0x7000822c |
| 40 | + mdw: readable, currently 0 (root_stack_g+4012) |
| 41 | + root_stack_g @ 0x70007280 size 0x1000 → top 0x70008280 |
| 42 | + EA is 84 bytes below stack top (0x54) — inside the root thread stack BSS |
| 43 | + |
| 44 | +addr2line A11: |
| 45 | + 0xa0009630 pinmux_init (insn: st.w [%a14]-4, %d2) |
| 46 | + |
| 47 | +Faulting instruction |
| 48 | +-------------------- |
| 49 | + a000962c: call a00090e2 <ulmk_ep_create> /* server.c stub: syscall 30 */ |
| 50 | + a0009630: st.w [%a14]-4, %d2 ← A11 / fault PC |
| 51 | + a0009634: ld.w %d2, [%a14]-4 |
| 52 | + |
| 53 | +So class-4 fires on the *caller* spill of ulmk_ep_create's return value |
| 54 | +into a stack local, immediately after the CALL returns — not on a |
| 55 | +peripheral SFR pointer. |
| 56 | + |
| 57 | +User call chain (UC A11, oldest → fault) |
| 58 | +---------------------------------------- |
| 59 | + _ulmk_thread_trampoline → ulmk_user_thread_entry → ulmk_root_thread |
| 60 | + → board_services_init (hil_mark(1); pinmux_init(0)) |
| 61 | + → pinmux_init +0x48 (after call ulmk_ep_create) ← FAULT |
| 62 | + |
| 63 | +ulmk_ep_create @ 0xa00090e2 (first ~8 insns): |
| 64 | + mov.aa a14, sp |
| 65 | + sub.a sp, 8 |
| 66 | + syscall 30 |
| 67 | + st.w [a14]-4, d2 |
| 68 | + ld.w d2, [a14]-4 |
| 69 | + ret |
| 70 | + |
| 71 | +pinmux_init @ 0xa00095e8 (prologue + path to fault): |
| 72 | + mov.aa a14, sp |
| 73 | + sub.a sp, 48 |
| 74 | + ... memset / g_pinmux_eps check ... |
| 75 | + call ulmk_ep_create |
| 76 | + st.w [a14]-4, d2 ← class-4 site |
| 77 | + |
| 78 | +Why st.w [A14]-4 class-4'd |
| 79 | +-------------------------- |
| 80 | +1. The effective address is a *normal stack slot* (root_stack_g+4012), not |
| 81 | + MMIO. A14 is the C frame pointer from `mov.aa %a14,%sp` in pinmux_init. |
| 82 | + This is not "A14 held a bad code/SFR pointer". |
| 83 | + |
| 84 | +2. Class-4 entry is confirmed via CSA walk through _trap_class4 (see |
| 85 | + trap-pc-summary.txt). DIEAR/DIETR @ 0xF7E19080/84 and 0xF7E1A014/18 |
| 86 | + are 0 at panic halt — panic/printk nest cleared or never latched for |
| 87 | + postmortem; cannot re-read the precise fault EA from SFRs now. |
| 88 | + |
| 89 | +3. Best interpretation of the locus: |
| 90 | + - Primary: data-memory class-4 on the post-ep_create stack store in |
| 91 | + pinmux_init (fault PC = 0xa0009630). |
| 92 | + - The store itself is innocuous C ABI; a class-4 on DSPR user stack |
| 93 | + after syscall 30 points to *kernel/syscall/MPU return path* leaving |
| 94 | + the thread unable to write its own stack (or a bus/data error on |
| 95 | + that line), not to pinmux SFR programming (pinmux_port intentionally |
| 96 | + avoids mem_map for that reason — see server.c comment). |
| 97 | + - Note: A10=0x70008228 is only A14-8, whereas pinmux_init's prologue |
| 98 | + subtracts 48 (expected SP 0x70008200). That SP anomaly is consistent |
| 99 | + with context corruption or a partial restore around the syscall/CALL |
| 100 | + boundary; the store EA still follows A14 and lands in root_stack. |
| 101 | + |
| 102 | +4. ep.c: no uncommitted diff — if ep_create/syscall is implicated, it is |
| 103 | + in the already-built kernel image, not a dirty working-tree patch. |
| 104 | + |
| 105 | +5. Not the fault: A14-as-code (RAM); g_pinmux_eps lookup (already passed); |
| 106 | + pinmux PORT SFR writes (those happen later in pinmux_server / apply). |
| 107 | + |
| 108 | +Bottom line |
| 109 | +----------- |
| 110 | +class-4 at st.w [%a14]-4 in pinmux_init right after ulmk_ep_create returns, |
| 111 | +EA=0x7000822c ∈ root_stack_g. A14 is FP (DSPR), A10 is SP. Investigate |
| 112 | +syscall-30 / MPU / context restore on return to userspace — not pinmux |
| 113 | +pad MMIO, and not a bad A14 code pointer. |
0 commit comments