From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: ffc31,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidf4c4f7386e,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.74.201 with SMTP id w9mr2622486pbv.0.1328381513064; Sat, 04 Feb 2012 10:51:53 -0800 (PST) Path: lh20ni260415pbb.0!nntp.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.stack.nl!newsfeed.Update.UU.SE!news.Update.UU.SE!not-for-mail From: Johnny Billquist Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Sat, 04 Feb 2012 19:51:50 +0100 Organization: Update Computer Club Message-ID: References: <4f12e49d$0$295$14726298@news.sunsite.dk> <4f175c07.15409279@nntp.aioe.org> <4f20c6e3$0$284$14726298@news.sunsite.dk> <4f215614.266356@nntp.aioe.org> <4f24a237$0$295$14726298@news.sunsite.dk> <4f2537ed.51306295@nntp.aioe.org> <4f28b73b$0$290$14726298@news.sunsite.dk> <4f291473.18988613@nntp.aioe.org> <4f2a3a1e.28631752@nntp.aioe.org> <4f2a8c5a.52418379@nntp.aioe.org> <4f2e5f77.65538828@nntp.aioe.org> NNTP-Posting-Host: 74.125.122.49 Mime-Version: 1.0 X-Trace: Iltempo.Update.UU.SE 1328381512 8521 74.125.122.49 (4 Feb 2012 18:51:52 GMT) X-Complaints-To: newsmaster@Update.UU.SE NNTP-Posting-Date: Sat, 4 Feb 2012 18:51:52 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 In-Reply-To: <4f2e5f77.65538828@nntp.aioe.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-02-04 18.06, paramucho wrote: > On Fri, 03 Feb 2012 12:24:15 +0100, Johnny Billquist > wrote: > >> On 2012-02-02 14.31, paramucho wrote: >>> On Thu, 02 Feb 2012 01:14:39 +0100, Johnny Billquist >>> wrote: >>> >>>> On 2012-02-01 14:48, paramucho wrote: >>>>> On Wed, 01 Feb 2012 12:48:42 +0100, Johnny Billquist >>>>> wrote: > > >>>> We might read things in a different way. "Undefined" is, in this >>>> circumstance, as far as I can tell, only something that is valid as far >>>> as a general view of a PDP-11 is concerned. If you emulate a specific >>>> implementation, the behavior is not undefined. And Simh aims to >>>> implement the same twists as the machine it pretends to emulate. You >>>> have found a case where it does not behave the same way as the machine >>>> it claims to emulate. I'd say that this means Simh have a bug. >>>> >>>> Undefined generally only means that different implementations of a >>>> PDP-11 are free to do this as they see fit, and no program should depend >>>> on a specific behavior. >>>> However, a specific implementation will only do it one way or another. >>> >>> I have been using "undefined" in the architectural sense, that is, >>> behavior which is not specified by the *architecture* or explicitly >>> specified as "undefined". That's fairly well-known terminology. >> >> Excellent. So we are using it the same way. > > No, we ain't! Really? You could have fooled me. >> So when E11 is configured to simulate a J11, it is expected to do things >> the same way as a J11, and if you managed to find corner cases where it >> doesn't, then it is a bug in E11, since it is expected to behave the >> same as a J11. And the same for Simh. That is why all those options in >> the config exist - to make the emulator implement all the odd behavior >> of that specific implementation. > > I'm talking about the architecture: But the J11 is not the architecture. It is a specific implementation. Thus, "undefined" does not make sense when we talk about the J11 specifically. "Undefined" is only meaningful when we talk about the architecture. So, you using instructions, or behavior, that you claim are undefined, is to me an illegal use of the word "undefined". As it is only undefined for the architecture. Any implementation will have a defined behavior. > By "architecture" I mean the specification of the system in the > relevant documents. For example, the 11/73 is specified by the > documents in http://www.bitsavers.org/pdf/dec/pdp11/1173/. The > relevant XXDP processor tests provide further clarification of the > architecture. In some cases it may be necessary to refer to the actual > hardware if the specification is fuzzy. > > You're talking about the implementation: Right. And the 11/73 is a specific implementation, not an "architecture". The PDP-11 is the architecture. > By "implementation" I mean the behavior of the actual machine. It may > have behaviors which are not part of the architecture or which are > specified by the architecture "undefined" or "unpredictable". > The implementation behavior may contain "don't care" states which are > not specified or defined by the architecture. Right. But a specific implementation will have a deterministic behavior with regard to these details. Thus, it is not "undefined". >> E11 (or Simh) is not a generic PDP-11 implementation, but aims to >> emulate specific models, with all their quirks. > > That doesn't have to be an issue as we can consider each emulated > model separately. We in fact must. As Simh does not implement any PDP-11 based on the architecture, but instead just tries to simulate a number of existing implementations. >>> Clearly, there can be *no* undefined *implementation* behavior and >>> thus the distinction between "defined" and "undefined" is meaningless >>> if applied to the implementation. >> >> Right. >> >>> But to take your point that an emulation could avoid "undefined" >>> architecture states by referring to "unspecified implementation >>> behavior" I'd make two arguments. >> >> I'm not sure I made that point. I think my point was that the emulator >> don't have any "undefined" behavior. It claims to emulate a specific >> system/model, and thus it should (obviously) have the same quirks as the >> system it emulates. >> Your response that you are exploiting "undefined" behavior to find out >> what system it is, is, in my view, invalid for an emulator that aims to >> emulate another system. It should not be possible to tell the emulation >> apart from the system it emulates. Otherwise the emulation is buggy. So, >> any trick you figured out to detect that you are running under Simh is, >> by definition, a bug in Simh. > > The point depends on the distinction between "architecture" and > "implementation" made above... I think you are using the term "architecture" wrong, if you think that a PDP-11/73 is an architecture. >>> Second, I don't think that emulator authors are as strict as you >>> imply. >> >> I think that Bob definitely are that strict. And I'm pretty sure that >> John in general are too, since he have gone to great lengths to >> implement the specific behavior of different implementations of the >> PDP-11 for these undefined things. > > But I don't think you're consistent in your expectations. See below. I think you are jumping to wrong conclusions, but I can partly agree with you. However, I should also point out (which I've done in other posts as well) that I am not looking for such strict simulation. I'm also perfectly comfortable with adding an instruction that don't exist in any other existing implementation of the PDP-11. But that is my view. I use PDP-11s (both real and simulated) as a way to develop software. Not to act as a museum, nor as a collector. >>> For example, consider the following "programming difference" >>> from one of the J11 architecture documents: >>> >>> 30. If a register contains an odd value in mode 2 and a [11/73] >>> bus error occurs, the register will be incremented >>> >>> If a register contains an odd value in mode 2 and a [11/34] >>> bus error occurs, the register will be unchanged. >>> >>> SimH gets it right for its default J11 CPU, where it increments >>> and wrong for an 11/34, where it should be unchanged. E11 is the other >>> way around: right for its default 11/34 CPU, where it's unchanged and >>> wrong for the J11 where it should increment. Now these are examples of >>> incorrect implementation differences (that I would never rely on for a >>> detection test), however, there's no screaming need for SimH or E11 to >>> fix them. >> >> Have you tried, for both, to tell that it should be an 11/34 and an >> 11/73 respectively, and see what the results becomes for both? > > Yikes, that's *exactly* how I did the tests. I ran the test on the > 11/73 and 11/34 models on both SimH and E11. I put part of the display > in a response to Al Kossow. But your comments are confusing. If you are talking about the J11 (which is an implementation and not an architecture, by the way), then the 11/34 comments make no sense. The 11/34 does not use the J11 (implementation), but have another implementation of the PDP-11 architecture. And if you find a note in a J11 manual that tells how the 11/34 is expected to behave, it's a nice piece of information, but I would prefer to check the documentation for the 11/34 instead, if I want information on that machine. Also, I'm not sure I get the "default" reference. Any simulator probably have a default machine they will do if you don't specify anything else, but if you change the model it should simulate, the "default" should be irrelevant. However, different simulators can (and probably will) have different bugs. One doing things wrong one way, and the other in another way. Unless both produce the correct results for both selected models, I'd say both have a bug here. >> But there might be bugs. I think they should be reported in that case. > > I'll upload the utility for anyone who wants to do that (I just got > back from a two month visit down south and hope to upload the stuff > I've been promising in the next week or so--I need to reorganise some > directories so that the development tree I upload looks sensible and > like what I use locally). I'll happily look at, and play with that code. >>> Whenever I write a new RUST driver I first get it up and running under >>> V11, and then on couple of different real PDP-11s. Then I test E11 and >>> SimH, where I often have to make changes to the driver to get it work. >>> Likewise, I have a debugger which uses the trace trap to store an >>> execution history. It works well under E11 but is a bit wierd under >>> SimH. >> >> Maybe a bug in Simh that should be reported? I know it took some working >> before the trace trap worked ok in E11. > > I have a (short) TODO list for SimH things that need reporting, but > trace isn't on it. Although I wrote the code a long time ago I didn't > test it under E11 or SimH until this week. I wouldn't know what to > report other than "it fails". I saw John Wilson's acknowledgement of > your effort in helping get the T-bit work in E11, so you're probably > better equipped than I to work on SimH :-) Just about the only time I > use SimH is when I test stuff for these threads. I very seldom use Simh as well. I use E11 a lot more, but I have my trusty 11/93 sitting right next to my desk, and that is actually my preferred machine. Simh is mostly for small experiments for me. >>> One of the key strengths of SimH is its portability across different >>> systems, and in to the future since it sticks pretty much to >>> straightforward C code. This portability may well be one reason that >>> SimH doesn't mimic asynchronous I/O. There are always trade-offs. >> >> I noted another thing that had been sitting in the back of my head, and >> which John Wilson documents in the manual for E11. Both RSX and RT-11 >> sometimes actually requires that I/O takes a little while before it >> completes, or else the OS malfunctions. >> How much you'd want to call that synchronous, I don't know. E11 >> basically can do a fixed number of instructions delay before reporting >> I/O as complete. > > It's more a fudge than an asynchronous service, but I know what you > mean. V11 has the same kind of thing (because there's no choice). Right > On a real PDP-11 DL11 terminal interface there is no additional delay > (unless output is suspended with ([ctrl/s]). Indeed, a good DLx11 is > double buffered so the first character completes immediately. The > following test counts instructions for four output characters. The > counts are in octal and need to be multipled by three (there are three > instructions in the counting loop). I think the bugs that John noted were for input, not output. So having an output device being able to swallow several characters is not a problem for either OS. > I haven't used this delay test for detection in the past because SimH > used to display nulls as spaces on Windows. Since that problem no > longer exists (AFAIK) I can now use the delay test as part of the > detection process. Probably not something to blame Simh for, though. >>>> A lot of the "undefined" behavior is in fact things that are used to >>>> identify one CPU from another. >>> >>> Which is exactly what I've used in the past and that's what I'm using >>> with the emulators. I made the point elsewhere: that software often >>> relies on the unchanging behavior of an implementation. One could make >>> the case that an emulation should likewise strive to be unchanging >>> whenever possible if it wants to emulate real machines. >> >> My point is that an emulation should not have a different behavior from >> the system it tries to emulate. You are depending on exactly this "error". > > You can call it an "error" if you want to. For me it's a "difference", > one among many, and one which is much less likely to be corrected. But the stated aim for these simulators is that they should truthfully emulate an existing machine! Thus, you are using bugs where they don't truthfully emulate these machines to tell this. I think that would imply that it is bugs in the simulation, and as such, I would think they should go away. > The only way I can detect an emulator in its standard deliverable form > is to locate distinctive behavior (which you call "errors"). The trick > is to find behavior which is not worth correcting, for whatever > reason. The only other alternative I have is to give up on detection, > and I'm not going to do that. Well. You are on a potential collision course with some simulation implementers in that case. But that is not my problem. :-) > We're going round in circles. At this point in the post you expect the > emulation to correct differences ("errors"). At other points you > accept differences, such as timing. You even seem to accept > differences in the architecturally defined MMU SR1 register in E11 as > "right"! You are failing to separate my personal opinions from what I perceive are the goals of the simulators (and their implementers). However, to point something out. Architectually, the SR1 register is defined to store the values needed to adjust registers modified from an instruction only partially executed. As such, the architecture leaves the exact usage and implementation up to the implementer. If you do a PDP-11 implementation which never will leave registers in an updated state for an aborted instruction, the correct value in SR1 (by the architectural definition) is always zero. However, if we talk about other, already existing implementations, they might very well do something else, which leaves non-zero values in SR1. So, from an architectural point of view, I'm totally adhering to the architecture. From a specific implementations point of view, this is not a valid approach. If you want to emulate an implementation truthfully, you also need to do that for this aspect (of course). >>> That's cool (the only thing I thread in V11 is the terminal). E11 aims >>> at high performance and I guess that's *one* reason that John Wilson >>> didn't bother to implement MMU register SR1--it would have adversely >>> affected performance (since it requires a 2-part calculation and store >>> for every register/mode access). >> >> Um? Are we talking about MMR1 here? The register used to record >> autoincrement/autodecrement of general registers during execution of an >> instruction in case the instruction aborts? > > Yes So I guess JW did not implement it correctly. I guess you are also right on why. >> Or are you talking about some other register? >> Looking in RSX, it don't seem like the kernel use that ever, but it does >> get propagated to user programs when you get a trap in the user program, >> so potentially it could be needed in RSX. >> >> But it would probably only be useful if you wanted to restart >> instructions after page faults, and since no OS that I know of do page >> faults, I can see how it is not being used anywhere. > > It was an architectural flop. It was never used. We discussed it > recently. My typing hands get itchy when I think about it. At some > point in the next twenty years I plan to write a system which does use > it. The problem is that you really need to start from scratch--it > would be messy to add that functionality into an existing system. I know we talked about paging not long ago. I wouldn't call it a flop. I'd call the MARK instruction a flop. There are some other unused features in some machines as well. Wouldn't necessarily call them flops either, just because they weren't used. But of course, this depends on your definition of flop, which might differ from mine. :-) One good reason why no software use SR1 is that not all machines capable of running RSX, RT11, Unix and so on, have SR1 at all. You'd either have to write an OS specifically for machines with this feature, or else it is not usable. I think DEC just didn't feel motivated for such a restricted set of machines, at the time they were still pondering new OSes for the PDP-11, and the range of machines that were available back then. >>> My detection tests involve SR1. The shakiest part of my approach is >>> that it would be quite reasonable for E11 to improve SR1 emulation at >>> some point (regardless of my tests), although since no system actually >>> uses the functionality there's no real incentive to do so. > > On closer inspection I find that I'm not using SR1 for E11 detection > tests at all. In fact, my E11 test checks whether bits 5 and 6 of MMU > SR0 are writeable. These bits are not writeable on the F11 or J11, but > a closer inspection of the 11/34 architecture documents indicates they > may well be writeable on a real 11/34, and that's the default E11 CPU. > I may have to find a different E11 test (see further below). Ah. Next question (obviously) is if you tested SR1 in E11 and found it failing, or if it actually works right? > If anyone with an 11/34 is still reading this long post the test that > needs to be performed is something like this: Not me. Been over 10 years since I last were around an 11/34. > Now, on a separate note, consider the SimH SR0 implementation as well: > > SimH 11/34 MMU SR0 bits 5&6 Not writeable. Always zero. > E11 11/34 MMU SR0 bits 5&6 (Perhaps) Writeable. > > SimH simply retains the architectural J11 state which defines the bits > as read-only. > > Which implementation is correct? Which is in error? We would need to check a real PDP-11/34 for the answer which one is correct (if any), obviously. >> I can see that it might be costly to maintain it, but on the other hand, >> if trappings never will occur with registers updated that needs >> rollback, SR1 can be left zero at all times. >> So it might actually be that E11 already does it "right". > > I admire the flexibility you have with the definitions of "error" > above and "right" here :-) Earlier any "difference" was an > "error". Now a difference which clearly doesn't match the architecture > can be considered "right"! You are right that from a strict following the implementation it should simulate, this would not be correct. From an architectural point of view, however, it would be perfectly valid. Since I'm not in the strict simulation camp anyway, I wouldn't mind someone taking that freedom. However, for someone who wants a truthful simulation, this would be wrong. > This thread has forced me to get a real PDP-11 working again so that I > can realistically test some of the code on real iron. The hardware > came up pretty well, but it took a couple of days to figure out that > winpcap (which I use to network RUST to my Windows box) had changed > some of its behavior significantly. It's nice to hear the hum of > PDP-11 again and to have a VT220 on my desk (which still looks cool). That is a good thing. :-) > During the course of this thread I've worked out roughly how to go > forward with E11 and SimH detection. > > 1. If it's V11, exit > > 2. If a boot rom is present at 173000, exit. > i > I haven't mentioned this sanity test, but it is currently > performed and is good emulator test. Most sensible real PDP-11 > systems that would run RUST would have a boot rom. SimH and E11 > don't have it. But it's not enough of a test on its own (and I'm > not sure about real 11/9x's). The E11 machines I run have a boot rom, which I believe I mentioned earlier. Real 11/9x machines also have a boot rom at 173000. > 3. If a terminal output delay is present then it's probably an > emulator. (See discussion above) > > 4. If the clock/terminal baud rate test result exceeds a maximum then > it's probably an emulator. (As previously discussed) > > 5. Reuse the existing MMU tests to *discriminate* between SimH and > E11 rather than to *detect* the emulators. > > The resulting test uses multiple types of evidence and that's probably > the best way to go rather than having a single critical point. I still > need a non-MMU method to discriminate between E11 and SimH though. Have fun. :-) Johnny