|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
1.1.1.2 root 7: //
8: // デバッガのメモリアクセスヘルパー(?)
9: //
1.1 root 10:
11: #pragma once
12:
1.1.1.3 root 13: #include "debugger_defs.h"
1.1.1.4 root 14: #include "bus.h"
1.1 root 15:
1.1.1.4 root 16: class IODevice;
1.1 root 17:
18: class DebuggerMemoryStream
19: {
20: public:
1.1.1.3 root 21: // コンストラクタ (全部入り)
1.1.1.4 root 22: DebuggerMemoryStream(const DebuggerMD *md_, busaddr laddr_);
1.1 root 23:
24: // 現在のアドレスを表示用に整形して str に代入する。
25: // アドレス変換でバスエラーが起きたら false を返す。
26: bool FormatAddr(std::string& str);
27:
28: // アドレスをリセットする。
29: void ResetAddr(uint32 newaddr);
30:
1.1.1.3 root 31: // アドレスを n 進める(戻す)。
32: void Offset(int n);
33:
34: // 以下 Peek*()/Read*() はいずれも読み込んだデータを返す。
1.1 root 35: // (uint64)-1 ならアクセスの結果バスエラー。
36: // (uint64)-2 ならアドレス変換でバスエラー。
37:
1.1.1.3 root 38: // laddr から指定バイト数を右詰めで読み込むが、アドレスは進めない。
39: // 命令ワード読み込み用なので bytes は 1, 2, 4 を想定。
40: uint64 Peek(int bytes);
41:
42: // laddr から指定バイト数を右詰めで読み込んで、アドレスを進める。
43: // 命令ワード読み込み用なので bytes は 1, 2, 4 を想定。
44: uint64 Read(int bytes);
1.1 root 45:
46: // laddr から1バイト読み込んで、アドレスを進める。
1.1.1.5 ! root 47: uint64 Read1();
1.1 root 48:
49: public:
1.1.1.4 root 50: busaddr laddr {}; // (論理)アドレス
1.1 root 51: uint32 paddr {}; // 物理アドレス
52:
53: private:
1.1.1.3 root 54: // アクセスするバス
1.1.1.4 root 55: IODevice *bus {};
1.1.1.3 root 56:
57: int lcol; // 論理アドレス幅の16進桁数
58: int pcol; // 物理アドレス幅の16進桁数
1.1 root 59:
1.1.1.3 root 60: bool translate {}; // アドレス変換が必要なら true
61: bool pageover {}; // 256バイト境界をまたいだら true
62: const DebuggerMD *md {}; // アドレス変換に必要
1.1 root 63: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.