From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Thread: fdd80,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Thread: 1164f8,5cdb0c1dbaceb85b X-Google-NewGroupId: yes X-Google-Attributes: gide311f70d09,gidd180ab3bd8,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.226.10 with SMTP id ro10mr6446866pbc.6.1328994552854; Sat, 11 Feb 2012 13:09:12 -0800 (PST) Path: wr5ni13596pbc.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!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, 11 Feb 2012 22:09:11 +0100 Organization: Update Computer Club Message-ID: References: <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> <4f396a03.27713593@nntp.aioe.org> NNTP-Posting-Host: 178-83-31-172.dynamic.hispeed.ch Mime-Version: 1.0 X-Trace: Iltempo.Update.UU.SE 1328994551 9176 178.83.31.172 (11 Feb 2012 21:09:11 GMT) X-Complaints-To: newsmaster@Update.UU.SE NNTP-Posting-Date: Sat, 11 Feb 2012 21:09:11 +0000 (UTC) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0) Gecko/20120129 Thunderbird/10.0 In-Reply-To: <4f396a03.27713593@nntp.aioe.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2012-02-11 14:15, paramucho wrote: > On Fri, 10 Feb 2012 20:29:24 +0100, Johnny Billquist > wrote: > > >>> 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. > > The fact there can even be a question about whether it's right or > wrong indicates the lack of a clear reference architecture. This is > not rocket science. I'd say that the J11 breaks the specification. It clearly says that MMR1 should reflect any changes to the PC as well. >> Why would your program crash if the PC wasn't incremented by 4, by the >> way??? > > Because my code is very simple: > > [setup code] > test instruction > [report code] > > When the test instruction crashs the trap ISR simply registers the > fact and RTI's with the C-bit and V-bit set. If the RTI PC was wrong > then my test code would presumably fail. Note, the code which actually > tests RTI, RETURN, JMP etc has a workaround. Oh. I assumed you just printed the information in the trap handler, and didn't return. Seemed like the simple way to do things. But if you return, then it becomes more important that the PC points to the next instruction. I suspect that means that your program might actually fail on some PDP-11 models. For example, if you do a MOV (R0)+,@(PC)+ where it traps on the R0 reference, might, and probably will have the PC pointing to the pointer, and not the next instruction on many PDP-11s. > Of course there are better ways to do these things, but I was in a > hurry and this is throw-away code... :-) >>>>> 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. > > I wasn't applying that book to the 11/8x or 11/9x, but to the CPUs > which it described. It describes the J11, which is the CPU used in the 11/8x and 11/9x machines. >> 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. > > I don't recall that manual being updated after each significant new > CPU and I'm not even sure their was an "Architecture Handbook" which > covered the 11/8x and 11/9x CPU's? All of those machines use the J11 CPU, and the architecture handbook do cover the J11. No need to make a new version of that handbook until a new CPU showed up, and the J11 was the last. > BTW: there was an early architectural spec in one of Gordon Bell's > books. Interestingly it has a completely different FPU instruction set > and also lists a double-word instruction set. If you read the really early documents and plans for the PDP-11 you'll find a lot of odd things and plans which didn't happen the way they planned it. :-) >>> 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. > > The reason that RT-11 works on all the PDP-11 models is because it > contains code which manages all the architectural variations. RT-11 > won't boot on a T11/SBC-11 unless you have the version of RT-11 which > inserts NOPs here and there to manage the interrupt scheme. Hmm. I think I can't remember much of any model-specific code in RSX. But I'm sure there are some things in a few places... Searching through the code right now, in the SST handler, I can't actually find any model-specific code... > Code developed exclusively on an LSI-11 often crashs when moved to > other PDP-11s because the LSI-11 does not implement odd address traps. > That has always been a major drag. I remember that it does not trap odd address access at all. Bad, but hard to do much about. > PDP-11 software was frequently distributed in a variety of > NHD/EIS/FPU/FIS/EAE versions. I know some layered products which came with different versions of libraries. The NHD version works on all machines, while the other ones are faster, but requires that hardware to be available to be able to run. Seems perfectly reasonable. >>>>>> 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. > > It will be good to have alternate tests because my code may have > (more) bugs. I'll send it tomorrow. SR1.R/SR1.MAC is mostly in MACRO, > but relies on 40 years of MACRO libraries and personal habits. The > rest of it is in a completely undocumented personal language which > translates into DECUS C. I'll send the (unpretty) C code as well. Well, my code will be RSX-specific, so not really directly useful by others either. However, maybe easier to adopt. We'll find out. >>>>>>> +++++++++++++++++++++++++ >>>>>>> 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) >>>>>> > > >> 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. > > The "pushed PC for the trap" turns out to be irrelevant to the SR1 > recovery process. All the information is in SR0, SR1 and SR2. MMU SR2 > has the restart PC. The "pushed PC" can be thrown away. > > A compatible recovery process for the cases we've seen so far, except > for two E11 cases, would be: > > 1. Use SR0 to locate the faulting page. Map it. > 2. Apply all SR1 inc/decs to the appropriate saved registers. > (R7 inc/decs may be made, but they will be discarded with > the next step). > 3. Restart the instruction at the location specified by SR2 > > (And this is also how the KDJ11-A manual describes the process). Right. But had MMR1 been updated "correctly", step 3 would not be absolutely required. But as it stands, you need this. >> 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. > > The JMP @#ILLPTR instruction completes with PC=ILLPTR. The trap > doesn't occur until the next instruction fetch (which is, of course, > ILLPTR, which traps). Note SR2 in the listing below. That's the > address of instruction which trapped. Doh! I wasn't thinking straight. :-) > TEST05: > What you've described above is more like this, where half the > instruction is mapped, and the other half ain't: > > 77776 000137 jmp @(pc)+ end of par4 (mapped) > 100000 xxxxxx ;unmapped location beginning of par5 (unmapped) > > In the test below R0 reports the actual PC just before and after the > instruction. > > J11 and SimH do point to the next instruction (100002 in r0). E11 > doesn't. However, J11 doesn't update SR1 and SimH does. It's a > wonderful world of color and variety. Operationally it's innocuous. Right. I think J11 in a way is cheating here, but it seems that Bob knows something about the internals of J11 which is the source of this. >> 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. > > I had looked in various "architectural" documents for information on > MARK in this regard :-) Where did you find it? It's in the "Architecture Handbook". Atleast the earlier version, which I gave a link to before. I wish I had the latest version online. Anyone know if it's available somewhere? >>> 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. :-) > > As we discussed, only if John is actually trying to implement SR1... Well, if he isn't trying, it's still a bug. It means that you cannot use E11 if you want to implement a paging system, since you cannot undo a partial instruction in all cases in E11. And if you tell E11 to act like a J11, it would be nice if code that works on J11 also works in E11. Admittedly no current existing code (apart from possibly diagnostics) actually use this specific feature, so you can get away with having it non-functional. Johnny -- Johnny Billquist || "I'm on a bus || on a psychedelic trip email: bqt@softjar.se || Reading murder books pdp is alive! || tryin' to stay hip" - B. Idol