On 2023-03-22 13:40, Mouse wrote:
[...] - I noticed that when SIMH is configured with 512MB of memory, the calculated size of the system page table ends up being a bit larger than the 2^21 entries needed to map all of system space.That's odd. Maybe it's reserving enough space for _two_ copies of physical memory or something? I also think that's a theoretical bug; EL-00032-00-decStd32_Jan90 says | Thus, there could be as many as 2**21 pages in the system region. In | order to express the values 0 through 2**21 (200000 (hex)) inclusive, | the length field in the SLR is 22 bits. SLR values not in the range | of 0 to 200000 (hex) inclusive are reserved values and result in | UNDEFINED operation. I'd be surprised if an implementation didn't simply use a 22-bit register, capable of representing 0 through 3fffff, but it looks to me as though implementors have the latitude to do otherwise. At least for models for which that's the applicable VARM.
Let's first of all agree that a page table size larger than 2^21 entries is pointless. The MMU will pick which page table to use based on the top two bits of the virtual address. The 9 low bits are the address within the page, which means there are 21 bits that are used to index into the page table. So it's impossible for the MMU to access any entry outside of this range, no matter what the page table length register says. The length register is only there to prevent going outside of the table, in case the table is less than 2^21 number of entries.
As the length can be anything from 0 to 2^21 entries, you need 2^21+1 values to be possible to be represented in the length register, hence the requirements that it is 22 bits.
Now, if the length register have a value larger than 200000 (hex), the result is undefined. It might be that it will work fine, it might be that it will not. But the OS should never have a reason to have anything larger stored there in the first place, and we should certainly not depend on it actually just acting like a 22-bit register with no constraints.
So I'd say there is clearly a bug in the code, if the SLR register gets a value larger than 200000 (hex), and we should fix it.
This is independent of any CAS emulation issues. Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt%softjar.se@localhost || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol