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.135.231 with SMTP id pv7mr4398241pbb.8.1328902165601; Fri, 10 Feb 2012 11:29:25 -0800 (PST) Path: wr5ni9647pbc.0!nntp.google.com!news2.google.com!goblin3!goblin.stu.neva.ru!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!cs.uu.nl!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: Fri, 10 Feb 2012 20:29:24 +0100 Organization: Update Computer Club Message-ID: References: <4f2e5f77.65538828@nntp.aioe.org> <4f2e89be.49241029@nntp.aioe.org> <4f30d0d8.41682905@nntp.aioe.org> <4f313229.43518694@nntp.aioe.org> <4f37717c.29259157@nntp.aioe.org> <4f339e98.40806741@nntp.aioe.org> <4f360d68.39000374@nntp.aioe.org> NNTP-Posting-Host: 2620:0:105f:b:462a:60ff:fefb:aad8 Mime-Version: 1.0 X-Trace: Iltempo.Update.UU.SE 1328902164 10300 2620:0:105f:b:462a:60ff:fefb:aad8 (10 Feb 2012 19:29:24 GMT) X-Complaints-To: newsmaster@Update.UU.SE NNTP-Posting-Date: Fri, 10 Feb 2012 19:29:24 +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: <4f360d68.39000374@nntp.aioe.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-02-10 14.12, paramucho wrote: > On Wed, 08 Feb 2012 23:29:52 +0100, Johnny Billquist > wrote: > >>>>>>> As you can see E11 doesn't increment R0 and leaves SR1 null. >>>> >>>> So E11 does not behave like the J11, even when asked to, in this case. >>>> But it does work correctly according to the architecture. >>> >>> Let's not go back to the "architecture" debate...we're never gonna >>> agree. I've avoided the issue below with the terms "correct", >>> "different" and "wrong". >> >> Heh. Well, you can perhaps at least agree that according to the >> perceived function of MMR1, E11s behavior is consistent with the idea of >> how MMR1 is used, and any code written that use MMR1 will turn out the >> correct result both with the E11 implementation as well as the J11 >> implementation, even though they behave differently in their >> implementation of it. >> >> There, now you don't have to take the word "architecture" in your mouth. > > Oh well, if you really want to go back there... I tried phrasing it to avoid the term "architecture", but still just look at the behavior of MMR1, which can be done in several ways (obviously), but still be "right". If you really want me to comment on the whole text, let me know. I'll happily point out weaknesses in your analogies (just starting with the fact that analogies are always problematic, as they are just that, analogies). :-) (Oh, and that the VAX is no way as clear cut as you seem to think, or what is your take on the vector option, or the various subsets that were defined later on?) > >>>>> SimH gets this wrong: >>>>> >>>>> J11: >>>>> Test06: mov (pc)+,*(r0)+ >>>>> Before: R0=120000 SP=744 PC=4166 >>>>> After: R0=120002 SP=744 Err=1 SR0=100013 SR1=[0|20] SR2=4166 >>>>> **** >>>> >>>> J11 would appear to work differently than the 11/44 or 11/70. What is >>>> the saved PC on the stack at this point? Has it been updated or not? >>> >>> The PC on the stack is always updated. At present my test program >>> would crash if it wasn't. That's what I need to change to test RTI >>> etc. >> >> Is the PC on the stack updated by two, or by four? That is the question. >> It should always at least have been updated by two, since the >> instruction fetch have always taken place. And that update is not ever >> reflected in MMR1. However, the additional two, from the (PC)+, should >> be recorded in MMR1, if the PC on the stack has been incremented by 4. > > It's incremented by four. If it wasn't my progam would crash. The PC > itself is always incremented by the full and correct amount in these > tests, except for those which test RTI etc. Aha. So I'd say that J11 in essence is doing wrong. It have updated the PC more than just the instruction fetch, but this is not reflected in MMR1. The processor handbooks say it should update MMR1. So, a program that does a rollback cannot do it right with regards to the PC, but have to use MMR2 for that. Why would your program crash if the PC wasn't incremented by 4, by the way??? >>> The simulator follows the Handbook, for simplicity. >>> >>> The document he's referencing is here (and I think I used to have a >>> copy of it): >>> >>> http://www.vaxcluster.de/mambo/index.php?option=displaypage&Itemid=224&op=incl&SubMenu=&slideshow=16&directory=dec_manuals >> >> Yes. That is the handbook that I referred to a few posts ago as well. >> It's really a better source for how a PDP-11 should work (I won't call >> it the architecture, since you object so much). But it leaves a lot up >> to specific implementations on how to do things. Like the handling of >> MMR1 in respect to backing out of changes. Which J11 takes advantage of. >> Simh consiously chose to not fully simulate the J11 here. >> >> That handbook is, by the way, just the last incarnation of the PDP-11 >> Processor Handbook. Unfortunately I don't have my copy where I'm sitting >> (living). But if I remember right, it covers the T11, F11 and J11. >> Possibly also the LSI11. It also touches on the 11/44, and I think the >> 11/34 and the 11/70 with friends. But most of the book is not about >> specific implementations, but about the PDP-11 as such. > > But as I've said above, it's an often retrospective document. It was written way before the 11/93 came about. It was even written before the 11/83 came about. But I agree that it's a book that got updated after each new processor was done, so that it held information that were relevant to the readers. > Architectures are not retrospective, they are working specifications > of new implementations. The point I'm making about the PDP-11 is that > it didn't stick to the architecture (unless you reduce the term > "architecture" to something very fuzzy, almost aspirational). And I disagree. The different PDP-11s were not implemented out of a blue sky, but did actually follow some principles defined way back in 1969. The PDP-11 architecture. If they didn't follow that, then the machines would not have been usable. There is a reason why RT-11 and RSX will work on all different PDP-11 models. They implement the same architecture. >>>> Definitely. Also, it would be interesting to see if J11 behaves the same >>>> with and without the FPA. >>>> I can (eventually) set up to test this on a real 11/70. >>> >>> It would be great to see if the older implementations actually do >>> update PC and/or FPU instructions. What system runs on the 11/70...let >>> me guess :-) >> >> :-) >> >> I'll need to start by just writing a small program that runs under RSX >> and that presents me with the information. Once I have that up and >> running, I can use it on all machines I have. > > I'll send you my code, although it won't help much. My C code is > actually in a pre-processor language and the MACRO code is not > stand-alone. But at least it will synch our efforts. Cool. But yeah, I'll probably rewrite the stuff in MACRO-11 then. But it's nice if we have a common concept of what each test checks for, and how it do it. >>>>> +++++++++++++++++++++++++ >>>>> Summary: >>>>> >>>>> It's all a bit higgledy-piggledy above, so I'll summarise, using the >>>>> J11 behavior as the benchmark, where: >>>>> >>>>> "Correct" means the same as the J11 >>>>> >>>>> "Different" means not the same, but still functional. >>>>> You may willing to accept these. I'm less so inclined. >>>>> >>>>> "Wrong" means a real bug (marked with ****). >>>>> >>>>> 1. Base and EIS instruction sets. >>>>> SimH: Correct on all, except, >>>>> **** Wrong for (PC) inc/dec's which should be ignored >>>>> (because instruction restarts). >>> Correction: >>> Different for (PC) incs/decs (see source comment above) >>>> >>>> I'm not it should be classified as a bug. It depends on what the PC >>>> pushed on the stack looks like. It might be fully correct, but not the >>>> same as J11 (see other comments about this above). >>> >>> The comment from the source, shown above, shows he's being generic >>> rather than specific to the J11. >> >> Right. But unless Simh then also have pushed the "correct" PC on the >> stack, Simh could have a bug here, or just be different. You cannot just >> mess around with MMR1 without also making sure that the registers as >> such have the correct values, with respect to MMR1 and state before the >> trap. > > But that's exactly what the note from his source above says. The idea > is that the machine provides updates for R7=PC but that the updating > software ignores them. Note, the update information, when present, is > provided only for data references, not for PC instructions. I guess > the idea was that the software would be able to determine which > operand was at fault. Not sure I understand what you are saying. Bob states that he's not doing as the J11, yes. He instead updates MMR1 with all PC modifications as well. So far all good. But, unless the pushed PC for the trap also have that updated value, the contents of MMR1 would be wrong. You need to push both the updated PC, and update MMR1, or else do neither, to do it right. As for "PC instructions", I assume you mean things like branching and jumping? Any such modifications will never have taken effect on the PC in the case of a trap. If you do a: JMP @(PC)+ the MMR1 should show R7 modified by 2, and the PC on the stack should point to the next instruction. By the way, the stack and PC modifications of a MARK instruction are also guaranteed to never have been done in case of a trap. >>>>> o I still need to do some tests with RTS Rn and RTI. A slight >>>>> redesign of the utility is required for that. >>>> >>>> RTI? I could see potential for RTS as well as JSR, if the SP points to >>>> invalid memory. But RTI... Hmm... Am I thinking wrong here. But that >>>> could only come from a broken kernel SP, and a trap will then become a >>>> double trap, since you can't trap for the error without a stack. >>>> Or what am I missing? (Too tired to think more...) >>> >>> I was thinking of an RTI on a good stack but where the popped PC/PSW >>> in fact point to unmapped memory. That would be quite common when the >>> kernel returns to user mode. The MMU trap will occur on the kernel >>> stack...but that trap should overwrite the popped PC/PSW... >> >> Um. The MMU will (as always) push the information on the kernel stack, >> but it should not be any different from if your code just happens to run >> off memory into non-existent memory in a straight program flow. >> >> The RTI should not make any difference here, as far as I can tell. The >> instruction fetch will trap. The updated PC should be pushed on the >> kernel stack, and MMR1 should be 0. >> >> Of course the old PC,PSW will be overwritten by the new. The old were >> popped off the stack, and the data is dead. Then new data is pushed on >> to the stack. > > TEST15: > You're correct, and there are three identical results. Isn't it nice. Isn't??? I'd say anything but actually doing it this way is what I would have called not nice. > J11: > SIMH: > E11: > Test15: *rti > Before: R0=100004 SP=740 PC=6612 > After: R0=100004 SP=744 Err=0 SR0=100011 SR1=[0|0] SR2=100004 Thank god. > TEST16: > However, leading on from that starting point I looked at an RTI in > user mode. The user mode stack maps the RTI PC but not the PSW. The > trap is taken in kernel mode of course, so the user mode stack is not > overwritten. In this R0 records the user mode SP. > > SimH has a backed-out result and an unaltered user mode stack. The J11 > upates SR1 and shows the double pop in the user mode stack. > > SimH: > Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) > Before: R0=77776 SP=744 PC=7174 > After: R0=77776 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7174 > > J11: > Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) > Before: R0=77776 SP=744 PC=7174 > After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[26|26] SR2=7174 Both are architecturally correct, but different. > E11 gets it wrong. The stack is double-popped and, of course, there is > no update information. > > E11 > Test16: *rti ; [pc,*ps] r0 = user mode stack (unmapped) > Before: R0=77776 SP=744 PC=7174 > After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7174 Ouch. Bad. Another bug. :-) > TEST17: > This is pretty much the same test as TEST16 using RETURN (RTS PC). The > results are analogous to the previous test: > > SimH: > Test17: *return ; [*pc] r0 = user mode stack (unmapped) > Before: R0=100000 SP=744 PC=7562 > After: R0=100000 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7562 > > J11: > Test17: *return ; [*pc] r0 = user mode stack (unmapped) > Before: R0=100000 SP=744 PC=7562 > After: R0=100002 SP=744 Err=0 SR0=100151 SR1=[0|26] SR2=7562 > > E11: > Test17: *rti ; [*pc] r0 = user mode stack (unmapped) > Before: R0=100000 SP=744 PC=7562 SR0=1 > After: R0=100000 SP=744 Err=0 SR0=100151 SR1=[0|0] SR2=7562 E11 and SimH behaving the same way. > Now, in the earlier tests we've been blithely talking about E11 as > backing-out SR1. But I think what we're seeing is just John's software > realization of the PDP-11 with no particular thought of SR1. In that > context the earlier MFPI problem and the issue in these two tests are > not so much errors as a lack of SR1 implementation. You might very well be right on that. Johnny