4 ms·
more importantly too many operands with side effects (auto increments) result in complexity in the handling of exceptions (do you restart or save partial intern
by Taniwha 7y ago
more importantly too many operands with side effects (auto increments) result in complexity in the handling of exceptions (do you restart or save partial internal state - compare the 68020 with the 68040 for example)
- monocasa 7y agoYep. I'm playing with a 68k decoder frontend for a modified boom core. Indirect memory accesses are the bane of my existence at the moment.
- Taniwha 7y ago- 68000s were just broken (couldn't restart a page fault) - we still put unix on it, hacked the compiler to probe the stack to do stack extension on swapping only systems - 68010s were essentially a 68000 with this fixed - unix could do a real paging system - 68020s dumped their entire microcode state on the kernel stack - to do signals correctly (ie recusively) unix systems had to be able to spill this to user space and validate it on the way back in - 68030s and 68040s were saner and restarted exceptions in useful ways
- anyfoo 7y agoWow. Having pretty much ventured from 6502 directly to the 386 and later ARM, 68k was something I never really took a close look at. Was that limitation in the original 68000 unintentional, or did they just not design for faulting in virtual memory at page granularity? After all, you don't need to be able to restart on a page fault if you just swap in whole tasks out and back into memory just before switching to them (which you know when you're going to do), and you still get virtual memory's benefit of the swapped in tasks being able to occupy different physical, and discontiguous, memory regions without the task itself noticing. So did they only design for that, or did they actually make a mistake?
- tropo 7y agoThey didn't support any MMU at all. People would add one as a separate chip, right between the CPU and the RAM, but this wasn't supported. The CPU was unaware of it. There was no way for the MMU to tell the CPU to take a recoverable fault. Sun solved this problem in an expensive way. The MMU would make the CPU wait while a second 68000 was used to process the page fault.
- anyfoo 7y agoAh, your comment about them being "broken" led me to believe that some form of virtual memory was expected in the design. Now that you mention it, I recall reading that two 68000s story before (possibly from another comment you made here?), and reading it this second time, it still amazes me. Is it possible to find the source code involved? Not sure what of Sun's kernels is available.
- Taniwha 7y agoThere was no builtin in MMU in early chips (68000-68020). An external MMU for the 68000/68010 did exist - a weird thing called a 68451 that mapped arbitrary power of two aligned physical blocks of memory to arbitrary power of two aligned virtual addresses (harder to use and particularly hard to allocate memory for) - it was VERY slow (7 clocks from memory) and was rumored to have been designed by a summer intern at Moto. You do need to restart instructions if you want your stack to extend automatically, there's a hack you can do to make this happen on a 68000 You could do a paging system on a 68010/68451 - you had to treat the 68451 as a software refilled TLB Sun built their own MMU using SRAM, at the time there was a guy going around the Valley designing "sun-style" MMUs, for IP reasons every one was different, some were broken (one I ported to couldn't protect the kernel from user mode). Someone (maybe Sun?) managed to get 68000s to do paging by having two of them and freezing the primary on a page fault and having the second one load the page somehow. 68020s had external MMUs, Moto made the PMMU which most people used Phillips tried to make one (it never really worked), Apple had a weird pseudo MMU that fit in a PMMU socket on the mac 2 - it emulated the 24-bit addressing on the 68000 (Apple had stupidly used the upper bits in their pointers) Finally: I think that the 68000 not being able to restart a page fault was probably a mistake, something they hadn't thought all the way through
- anyfoo 7y agoFrom what I could glean from the combined 68000+68010 data sheet, the 68010 also dumps some internal state on the stack to support restarts, though that now just makes me more curious about the differences between 68010 and 68020 in that regard.