|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "debugger_private.h"
1.1.1.2 root 10: #include "mpu88xx0.h"
1.1 root 11: #include "m88100.h"
12: #include "m88100disasm.h"
13:
14: class DebuggerMD_m88xx0 : public DebuggerMD
15: {
1.1.1.2 root 16: using inherited = DebuggerMD;
1.1 root 17: public:
1.1.1.2 root 18: DebuggerMD_m88xx0(Debugger *parent_, m88kcpu *cpu_);
19: ~DebuggerMD_m88xx0() override;
1.1 root 20:
1.1.1.2 root 21: void ReqSet(uint32 flag) override { cpu->atomic_reqflag |= flag; }
22: void ReqClr(uint32 flag) override { cpu->atomic_reqflag &= ~flag; }
1.1 root 23:
1.1.1.2 root 24: bool IsSuper() const override { return (cpu->psr & m88100reg::PSR_SUPER); }
25: bool MMUEnabled() const override;
26: uint64 TranslateAddr(saddr_t laddr) override;
1.1 root 27:
28: // XXX ?
1.1.1.2 root 29: uint32 GetPC() const override { return cpu->Getxip(); }
1.1 root 30:
1.1.1.2 root 31: void SetStepOut() override;
32: bool IsStepOut() const override;
33: uint64 GetRegAddr(const char *name) const override;
34: void BackupRegs() override;
35: bool ShowRegister(Console *cons, const std::vector<std::string>& args)
36: override;
37: const HelpMessages& GetRegisterHelp() const override;
38:
1.1.1.3 ! root 39: BranchHistory& GetBrHist() const override { return cpu->brhist; }
! 40: BranchHistory& GetExHist() const override { return cpu->exhist; }
1.1 root 41:
1.1.1.2 root 42: bool CheckLEA(uint32 laddr) override {
1.1 root 43: bool rv = cpu->lastaddr == laddr;
44: cpu->lastaddr = 0; // XXX: ていうかここでクリアはおかしい
45: return rv;
46: }
47:
48: bool Disassemble(saddr_t laddr,
1.1.1.2 root 49: std::string& mnemonic, std::vector<uint8>& bin) override;
1.1 root 50: std::string FormatDisasm(const std::string& mnemonic,
1.1.1.2 root 51: const std::vector<uint8>& bin) override;
1.1 root 52: std::string FormatDisasmLive(const std::string& mnemonic,
1.1.1.2 root 53: const std::vector<uint8>& bin) override;
1.1 root 54:
55: private:
56: m88kcpu *cpu = NULL; // CPU コア
57: m88100reg prev {};
1.1.1.2 root 58:
59: // 前回アクセス時の論理ページ。.addr == 0xffffffff なら無効。
60: // [0] が Inst、[1] が Data XXX とりあえず
61: saddr_t last_lpage[2];
62: uint32 last_ppage[2];
63:
64: static bool IsBBTB0(uint32 op);
65: static bool IsBB1(uint32 op);
66: static bool IsTB1(uint32 op);
67: static bool IsBBTB1(uint32 op);
68: const char *CondStr(uint32 op);
69:
70: static const HelpMessages HelpMsgRegister;
71: bool MatchCMMUCmd(const std::string& cmdname, const char *name, int *);
72: void ShowRegMain(Console *cons);
73: void ShowRegCache(Console *cons, const std::vector<std::string>& args,
74: int id);
75: void ShowRegCacheOverview(Console *cons, int id);
76: void ShowRegCacheSet(Console *cons, int id, int setidx);
77: void ShowRegCtrl(Console *cons);
78: void ShowRegFPU(Console *cons);
79: void ShowRegMMU(Console *cons, int id);
80: void ShowRegOther(Console *cons);
81:
82: // cmp 命令後の分岐命令で結果レジスタを表示するため、
83: // cmp 命令のデスティネーションレジスタを覚えておく。
84: // -1 なら該当しないの意。
85: int cmp_rd;
86:
87: uint32 so_r1 = 0; // ステップアウト判定用
1.1 root 88: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.