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.221.4 with SMTP id qa4mr16873600pbc.7.1329913311929; Wed, 22 Feb 2012 04:21:51 -0800 (PST) Path: wr5ni55134pbc.0!nntp.google.com!news1.google.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: paramucho@hotmail.com (paramucho) Newsgroups: alt.sys.pdp11,vmsnet.pdp-11,comp.sys.dec Subject: Re: PDP11 Values from MFPT Date: Wed, 22 Feb 2012 12:21:43 GMT Organization: Aioe.org NNTP Server Message-ID: <4f45dd3a.40560415@nntp.aioe.org> References: <4f3f4ae9.40953632@nntp.aioe.org> <4f3f6194.19510701@nntp.aioe.org> <4f41dd56.1857737@nntp.aioe.org> <4f4434a7.18816544@nntp.aioe.org> <4f43806e.38215767@nntp.aioe.org> <4f45b539.51730368@nntp.aioe.org> Reply-To: paramucho@hotmail.com NNTP-Posting-Host: CmgvwL3sOlojnxUjt8znzA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 1.5/32.451 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit On Tue, 21 Feb 2012 20:43:34 +0100, Johnny Billquist wrote: >> System waits ("blocks") may terminate prematurely because of various >> conditions, including stuff that ASTs do. So, when a system wait >> returns, the routine has to make sure that it's actual condition has >> been satisfied, and if it hasn't then it reissues the system wait. The >> stack is not a problem. > >So you need to restart the system call. What if it is a system call that >have been partially completed? The wait does not happen as a unique part >of the call. A system wait *is* a unique part of a system call. You don't need to restart the system call. The "wait" is a loop which retests a wait condition. That's all. >Oh, wait, I bet you are thinking in terms of RT-11 here, where the >distinction between user mode and kernel mode is rather blurry. > >In Unix, as an example, there is no context around to restart in the >middle of a system call. What you have left is the context at user mode, >which is then the start of the system call again. >And this is because a signal is delivered in user mode, so the process >gets out of the kernel, in order to run the signal handler. There is no >way you can keep the kernel context for the user process around at that >point. It can not live on the kernel stack, since you exited from the >kernel. It can not live on the user stack, since that would allow you to >break the security of the kernel. I don't know anything about Unix internals but I have the feeling that it's not a good example because, like RSX, it doesn't have a reentrant kernel where RT, RUST and VMS do. I still think your looking at the issue from an RSX angle when you say "exited from the kernel", in particular when you say the context "can not live on the kernel stack". Kernel and user mode context are both active during all process activity. The key piece of kernel information to save across the ast is in fact the kernel fp/sp before the ast. When an ast exits it returns to a piece of code which issues a system call to handle ast exit. There are rules which forbid one or two scenarios. For example, I don't think you can run a kernel ast when a user ast is running. In such cases the kernel ast is delayed. However, there is nothing in the VMS sources about restarting system calls because of ASTs, or anything else for that matter. >> In the RT-11 sources you'll see a bunch of calls to $SYSWT which >> implement this logic for RT-11. $SYSWT uses co-routines, so they're >> even more convoluted than RT-11 usually is. >> >> I had a look at my RUST/XM system wait code tonight, and I think I >> understand it. The "$stall #10$, prwhi" issues the system wait, with >> 10$ as the continuation address after the system wait and prwhi. >> (hibernation) as the system wait state. >> >> em$spd:: ;suspend >> 10$: mov p$hpcr,r4 ;get the pcr >> $float ;stop the scheduler >> mov pr.sta(r4),r0 ;get the status >> bic #prwak$,pr.sta(r4) ;clear the bit >> bit #stact$,p$hast ;are we in an AST? >> bne 20$ ;yes - forget the rest >> bit #prwak$,r0 ;did we get a wake up? >> bne 20$ ;yes >> $stall #10$, prwhi. ;hibernate >> 20$: $land >> return >> >> em$rsm:: ;resume >> mov p$hpcr,r4 ;get the pcr >> bis #prwak$,pr.sta(r4) ;set wake pending >> return >> >>> See http://en.wikipedia.org/wiki/PCLSRing for more details. >> >> That seems to be some other issue. > >No. It is totally the issue. See my comments above. > >RT-11 can, however, get away with some things that you cannot do in >systems where user mode and kernel mode are totally separate and >isolated from each other. What do you think the (RUST) code above is "getting away with"? BTW: user mode and kernel mode have the same memory map in VMS. They are certainly not totally isolated. In mapped RT-11 and RUST systems they are quite separate. >Assuming I'm right, I can see why a lot of discussion and confusion >comes up between us. The conditions in RT-11 are rather different than >other systems, meaning you can do stuff that is totally impossible in >other OSes. There is a good deal of flexibility unmapped RT-11 systems (e.g. RT-11/SJ, RT-11/FB and RUST/SJ), but in the mapped systems (RT-11/XM, RUST/XM) much of that flexibility is lost. Ian