1
0
mirror of synced 2026-01-11 23:42:44 +00:00
This commit is contained in:
Andras Tantos 2021-01-26 16:29:14 -08:00
commit 3e08db5099
3 changed files with 29 additions and 6 deletions

View File

@ -140,13 +140,15 @@ Mainframe_c::Mainframe_c(const Configuration_c &aConfig, CLogger_c &aLogger, boo
mLogger(aConfig),
mOsType(OsTypes_e::None),
mUseHostRealTimeClock(aConfig.get<bool>("UseHostRealTimeClock", true)),
mRealTimeClockIncrement(aConfig.get<CInt_t>("RealTimeClockIncrement", 10)),
mRealTimeClockChunkLimit(aConfig.get<CInt_t>("RealTimeClockChunkLimit", 5000)),
mDeltaClockIncrement(aConfig.get<CInt_t>("DeltaClockIncrement", 1)),
mDisableAutoTerminal(aDisableAutoTerminal)
{
mLogger.SetParent(aLogger);
mChannels.resize(aConfig.get<size_t>("ChannelCount", 8));
mOwnedChannels.resize(mChannels.size());
try {
mRealTimeClockIncrement = aConfig.get<CInt_t>("RealTimeClockIncrement", 10);
std::string MachineType = aConfig.get<std::string>("MachineType", "J90");
if (MachineType == "J90") {
mMachineType = MachineTypes_e::J90;
@ -768,11 +770,15 @@ CInt_t Mainframe_c::GetRealTimeClock() const {
if (mUseHostRealTimeClock) {
boost::timer::nanosecond_type DeltaTime = mRealTimeTimer.elapsed().wall - mRealTimeStart;
CInt_t DeltaClocks = CInt_t(double(DeltaTime) / mSystemClockPeriod);
if (DeltaClocks == mLastRealTimeReading) {
DeltaClocks += 1;
CInt_t NewRTC = mRealTimeClock + DeltaClocks;
if (NewRTC > mLastRealTimeReading + mRealTimeClockChunkLimit) {
mLastRealTimeReading = NewRTC;
return NewRTC;
} else {
NewRTC = mLastRealTimeReading + mRealTimeClockIncrement;
mLastRealTimeReading = NewRTC;
return NewRTC;
}
mLastRealTimeReading = DeltaClocks;
return mRealTimeClock + DeltaClocks;
} else {
return mRealTimeClock;
}

View File

@ -341,7 +341,7 @@ public:
void Dump(size_t aIdent=0) const;
void DumpMemories() const;
void DumpHistory();
CLogger_c &GetLogger() { return mLogger; }
CLogger_c &GetLogger() const { return mLogger; }
virtual uint64_t GetTimeStamp() const override { return mEnableTimeStamp ? mTickCnt : 0ULL; }
virtual uint64_t GetResolution() const override { return 105000000ULL; } // TODO: make this configurable
@ -367,6 +367,7 @@ protected:
bool mMultiThreaded;
bool mDisableAutoTerminal;
mutable CInt_t mLastRealTimeReading;
CInt_t mDeltaClockIncrement;
class MainFrameEventDispatcher_c: public DebugEventDispatcher_c {
public:
@ -409,6 +410,7 @@ protected:
double mSystemClockPeriod;
CInt_t mRealTimeClock;
CInt_t mRealTimeClockIncrement;
CInt_t mRealTimeClockChunkLimit;
bool mUseHostRealTimeClock;
struct WatchPoint_c {

View File

@ -206,12 +206,15 @@ void PrintIntArg(std::ostream &aLogger, size_t aArg, const ExchangePacket_c &aEx
void ParseUnicosExchangePacket(const ExchangePacket_c &aCurrentEP, const ExchangePacket_c &aNewEP, std::ostream &aLogger, const Cpu_c &aCpu) {
static size_t LastSysCall = SIZE_MAX;
const Mainframe_c &Mainframe = aCpu.GetMainframe();
if (aCurrentEP.GetMode().IsMonitorMode()) {
CInt_t S[8];
for (size_t Idx = 0; Idx<sizeof(S) / sizeof(S[0]); ++Idx) S[Idx] = aNewEP.GetS(Idx);
CInt_t A[8];
for (size_t Idx = 0; Idx<sizeof(A) / sizeof(A[0]); ++Idx) A[Idx] = aNewEP.GetA(Idx);
//aLogger << "return from monitor mode with XA: " << HexPrinter(aCpu.GetExchangePacketAddress()) << " " << "IBA: " << HexPrinter(aCurrentEP.GetInstBaseAddr());
// Swapping out from monitor mode - parse it as a reply
if (LastSysCall < SysCallTableSize) {
try {
@ -260,6 +263,16 @@ void ParseUnicosExchangePacket(const ExchangePacket_c &aCurrentEP, const Exchang
aLogger << " , ";
PrintStringArrayArg(aLogger, 2, aCurrentEP, Mainframe);
break;
case 0x9b: // waitpid
PrintIntArg(aLogger, 0, aCurrentEP, Mainframe);
aLogger << " , ";
PrintPtrArg(aLogger, 1, aCurrentEP, Mainframe);
aLogger << " , ";
PrintIntArg(aLogger, 2, aCurrentEP, Mainframe);
break;
case 125: // mtimes
PrintPtrArg(aLogger, 0, aCurrentEP, Mainframe);
break;
default:
for (uint32_t ArgIdx = 0; ArgIdx < std::min(Entry.ArgCnt, uint32_t(10)); ++ArgIdx) {
if (ArgIdx != 0) aLogger << " , ";
@ -285,6 +298,8 @@ void ParseUnicosExchangePacket(const ExchangePacket_c &aCurrentEP, const Exchang
//aLogger << "XA: " << HexPrinter(aCpu.GetExchangePacketAddress()) << " " << "IBA: " << HexPrinter(aCurrentEP.GetInstBaseAddr()) << " ";
//aLogger << "unknown SYSCALL with S0 = " << HexPrinter(S[0]);
}
} else {
//aLogger << "entering monitor mode with XA: " << HexPrinter(aCpu.GetExchangePacketAddress()) << " " << "IBA: " << HexPrinter(aCurrentEP.GetInstBaseAddr()) << " ";
}
}
}