forked from westerndigitalcorporation/swerv-ISS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WhisperMessage.h
60 lines (52 loc) · 2 KB
/
WhisperMessage.h
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
//
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright 2018 Western Digital Corporation or its affiliates.
//
// This program is free software: you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation, either version 3 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program. If not, see <https://www.gnu.org/licenses/>.
//
#pragma once
#include <stdint.h>
enum WhisperMessageType { Peek, Poke, Step, Until, Change, ChangeCount,
Quit, Invalid, Reset, Exception, EnterDebug,
ExitDebug, LoadFinished };
// Be careful changing this: test-bench file (defines.svh) needs to be
// updated.
enum WhisperExceptionType { InstAccessFault, DataAccessFault,
ImpreciseStoreFault, ImpreciseLoadFault,
DataMemoryError, InstMemoryError,
NonMaskableInterrupt };
/// Structure used to communicate with the whisper program using
/// sockets. When a ChangeCount message is returned by whisper (as a
/// reply to a Step or a ChangeCount request), the address is set to
/// the program-counter of the last executed instruction, the resource
/// is set to the opcode of that instruction and the value is set to
/// the number of change records generated by that instruction.
struct WhisperMessage
{
#ifdef __cplusplus
WhisperMessage(uint32_t hart = 0, WhisperMessageType type = Invalid,
uint32_t resource = 0, uint64_t address = 0,
uint64_t value = 0)
: hart(hart), type(type), resource(resource), address(address),
value(value)
{ }
#endif
uint32_t hart;
uint32_t type;
uint32_t resource;
uint32_t pad;
uint64_t address;
uint64_t value;
char buffer[128];
};