Finally fixed the cc hang for good.
The problem was that two consequtive reads of the RTC in quick succession within the compiler was used to validate the results in the buffer filled by the mtimes syscall. This syscall buffer is potentially filled by another processor or by the same one, so the programmers decided to use two techniques to decide if the results are reliable: 1. Read the buffer twice and compare 2. Make sure that the two reads happened within 200 clock-cycles from one another. Since our RTC is based on the host clock, the actual time passed between those two instructions depends on the host speed. This fix allows for a - programmable - interval within which if two RTC queries are made, we return an artificially low delta time. This makes cc happy, while doesn't interfere with normal OS operation and scheduling. The setting (RealTimeClockChunkLimit, which defaults to 5000) might need to be adjusted for slow machines, such as the RaspberryPi4 or similar.
This commit is contained in:
@@ -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()) << " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user