Re: Silly new instructions
- From: torbenm@xxxxxxxxxxx (Torben Ægidius Mogensen)
- Date: 15 Aug 2005 12:42:50 +0200
"Peter \"Firefly\" Lund" <firefly@xxxxxxx> writes:
> On Sat, 13 Aug 2005, Dan Koren wrote:
>
> > One could also argue the case that having the SP
> > and the PC (almost) invisible and inaccessible to
> > (user mode) software could bring very considerable
> > benefits.
>
> So you could load/store stuff relative to the SP (and possibly
> relative to a base pointer) but you couldn't get the effective address
> of that stuff?
>
> That wouldn't play well with automatic arrays in C, for example, as
> they are typically implemented.
And similarly for call-by-reference to stack-allocated objects an
Pascal-style non-local variables.
Moving the SP to an unnumbered register with limited access will
require a complete rethinking of the way addresses are handled. It
could work like this:
- Registers and memory add an extra tag bit that identify whether
what you have is a pointer or integer.
- Pointers are always intervals of memory addresses, so they take up
two words/registers (aligned). The tag bit in the second word
indicates whether the interval stores code or data. The PC is an
interval plus offset.
- No pointer arithmetic, only pointer+offset.
- Load/store instructions take a pointer and offset and trap if the
offset takes the address outside the interval. Store to code
addresses is not allowed in user mode.
- All jumps are relative to an address (i.e., interval) stored in a
register-pair or memory (or current PC). It is checked that the
offset is within bounds and that the address is to code (when in
user mode).
- Instructions exist for joining adjacent intervals or splitting an
interval in two. These can be used for managing stacks, heaps etc.
You can only join intervals of the same type (code or data), and
when you split an interval, the two new intervals will be of the
same type as the original.
- When overwriting a register or memory-word that is tagged as an
address interval, both words in the interval must be overwritten.
I.e., you need to check the tags for the full double-word.
- Superviser mode can set up intervals at "real" addresses and tag
them as desired.
Note that this doesn't give full protection, as it is possible to
split an interval and still load/store relative to the original. But
it means that you can give a user process access only to limited code
and data spaces.
Note that it is, AFAICS, possible to implement C with these
restrictions. Pointers just take up more space than usual (three
words: Two for an interval and one for an offset into this).
Torben
.
- References:
- Re: Code density and performance?
- From: Eric P.
- Re: PART 3. Why it seems difficult to make an OOO VAX competitive (really long)
- From: Nick Maclaren
- Re: PART 3. Why it seems difficult to make an OOO VAX competitive (really long)
- From: Peter \"Firefly\" Lund
- Silly new instructions
- From: Peter \"Firefly\" Lund
- Re: Silly new instructions
- From: John Savard
- Re: Silly new instructions
- From: John Ahlstrom
- Re: Silly new instructions
- From: Dan Koren
- Re: Silly new instructions
- From: Peter \"Firefly\" Lund
- Re: Code density and performance?
- Prev by Date: Re: Code density and performance?
- Next by Date: Re: SoC bus architecture (typical)
- Previous by thread: Re: Silly new instructions
- Next by thread: Re: Silly new instructions
- Index(es):
Relevant Pages
|