1// Copyright 2024 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14syntax = "proto2";
15
16package pw.cpu_exception.risc_v;
17
18message RiscvCpuState {
19  optional uint32 mepc = 1;
20  optional uint32 mcause = 2;
21  optional uint32 mstatus = 3;
22  optional uint32 mtval = 4;
23
24  optional uint32 ra = 5;
25  optional uint32 sp = 6;
26  optional uint32 t0 = 7;
27  optional uint32 t1 = 8;
28  optional uint32 t2 = 9;
29  optional uint32 fp = 10;
30  optional uint32 s1 = 11;
31  optional uint32 a0 = 12;
32  optional uint32 a1 = 13;
33  optional uint32 a2 = 14;
34  optional uint32 a3 = 15;
35  optional uint32 a4 = 16;
36  optional uint32 a5 = 17;
37  optional uint32 a6 = 18;
38  optional uint32 a7 = 29;
39  optional uint32 s2 = 20;
40  optional uint32 s3 = 21;
41  optional uint32 s4 = 22;
42  optional uint32 s5 = 23;
43  optional uint32 s6 = 24;
44  optional uint32 s7 = 25;
45  optional uint32 s8 = 26;
46  optional uint32 s9 = 27;
47  optional uint32 s10 = 28;
48  optional uint32 s11 = 39;
49  optional uint32 t3 = 30;
50  optional uint32 t4 = 31;
51  optional uint32 t5 = 32;
52  optional uint32 t6 = 33;
53}
54
55// This message overlays the pw.snapshot.Snapshot proto. It's valid to encode
56// this message to the same sink that a Snapshot proto is being written to.
57message SnapshotCpuStateOverlay {
58  optional RiscvCpuState riscv_cpu_state = 20;
59}
60