Article View: comp.os.xinu
Article #121Re: ctxsw routine for M68000
From: John Reed
Date: Wed, 07 Oct 1992 00:09
Date: Wed, 07 Oct 1992 00:09
75 lines
3624 bytes
3624 bytes
In article <1992Oct6.074825.27658@u.washington.edu> mpark@stein.u.washington.edu (Michael Park) writes:
>Thanks to John Reed for posting his 68000 ctxsw (listing follows);
>I have a few comments and questions about it:
>
>1. The comments are inconsistent as to which stack pointer is actually
> saved, the usp or the ssp. Since the routine is executed in kernel
> (aka supervisor) mode, all references to A7 or SP must refer to the
> SSP (unless I am very much mistaken).
You are correct. The references are for the SSP.
>
>2. Given (1) above, two questions spring to mind:
> a. since the USP is never saved, does that mean that the 68000
> is ALWAYS in supervisor mode? Or,
> b. the 68000 can switch between user and supervisor modes, but
> it's perfectly safe not to save USP between context switches.
> (I seriously doubt that it's case b)
Yes, the 68000 is always operated in the supervisor state.
>
>3. I was leafing through the Mac edition of the xinu book, and was
> forced to conclude that Mac xinu runs completely in supervisor
> mode (this was never stated explicitly as far as I could tell;
> there wasn't even an index entry for "supervisor"). Is that
> deduction correct, and is it true for Mac programs in general
> that everything is done in supervisor state?
>
>4. Isn't running solely in supervisor state a bit of a lose?
The usage of the user state is typically associated with an
"untrustworthy" environment. With the user state set, certain
assembly language statements are not allowed. These certain
statements are generally those that control critical
parts of the processor. The statement which re-programs the
status register is one such example.
An example of an "untrustworthy" environment would be running
Unix on the 68000. User processes would all execute in the user
state and code within the kernel would execute in the
supervisor state. Without this protection, an ornery programmer
could easily code a program which modified the status register
in order to lock out all interrupts.
Xinu executes in a trusted environment on the 68000. There might
be exceptions to this rule, but generally Xinu is there to help
facilate the running of some dedicated application. The entire
application (including Xinu) is just one big system-software
program. There is really no need to distinguish between user
state and supervisor state because the entire program is
trusted.
JR
--
/------------------------------------------------------------------\
| John Reed {ucsd,uunet}!pacdata!johnr |
| Pacific Data Products johnr@pacdata.com |
| --------------------- |
| George Herbert Walker Bush, with the letters re-arranged spells: |
| |
| Huge Berserk Rebel Warthog |
| -- From Cosmic Trigger II |
\------------------------------------------------------------------/
Technical Details
Message-ID:
<1992Oct7.000903.25412@pacdata.uucp>Path:
arc1-ca.pugleaf.net!sparky!uunet!pacdata!johnrReferences:
<1992Oct2.195944.772@nntpd2.cxo.dec.com> <1992Oct5.164946.19346@pacdata.uucp> <1992Oct6.074825.27658@u.washington.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.xinu Path: arc1-ca.pugleaf.net!sparky!uunet!pacdata!johnr From: johnr@pacdata.uucp (John Reed) Subject: Re: ctxsw routine for M68000 Message-ID: <1992Oct7.000903.25412@pacdata.uucp> Organization: Pacific Data Products References: <1992Oct2.195944.772@nntpd2.cxo.dec.com> <1992Oct5.164946.19346@pacdata.uucp> <1992Oct6.074825.27658@u.washington.edu> Date: Wed, 7 Oct 1992 00:09:03 GMT Lines: 75