EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Virtual memory and memory protection

Started by ssubbarayan August 19, 2005
John R. Levine wrote:
> The 8086 had more usable registers than a PDP-11. Amazing but true. > We can argue whether the simpler addressing modes made the '86 > registers less useful.
Good point. And arguably the 386+387 has a similar number of useful registers as does the VAX when FP code is being executed. The VAX had 16 32-bit registers, but those 16 included several with fairly dedicates uses, including the IP (R15), SP (R14) and frame pointer (R13 - EBP on the x86). That leaves 13 fairly general purpose registers, although there were some special uses, compared to six on the 386. But since there was no separate set of FP registers, FP code put very heavy pressure on the available registers, especially given that a double took a pair to hold. But again, the complex addressing modes favor the VAX.
robertwessel2@yahoo.com wrote:

> Terje Mathisen wrote: > >>The original WordStar was supposedly ported (i.e. translated) this way. > > A fair number of CP/M programs were ported to MS-DOS that way. Most > 8080 instructions mapped exactly to one or two 8086 instructions, so > performance was not bad.
Sure, and this was no accident. :-)
> > MS-DOS itself also had a fair bit of campatibility built in (function > numbers and semantics for much of the early the INT 21h API, for > example). There was (is?) even a far call to the MS-DOS kernel > embedded in location +5 of the PSP, which would accept the function > number in CL (this matches the CP/M OS calling convention - "call 5").
Oh, there's plenty more left-over CPM baggage in Dos (particularly V1.0): The stack of all programs were initialialized with a zero work, and offset 0 of the Program Segment Prefix (PSP), where your offset 5 had the OS call, has a shart-hand 'Program Exit' call, in the form of 0xCD 0x20, i.e. INT 20h. Offset 0x5C (afair) contained a preparsed version of the first input parameter, assuming it fit the [D:]FILENAME.EXT pattern, offset 0x80 was the start of the 128-byte program input field etc. Terje -- - <Terje.Mathisen@hda.hydro.com> "almost all programming can be viewed as an exercise in caching"
Grant Edwards wrote:
> On 2005-08-23, robertwessel2@yahoo.com <robertwessel2@yahoo.com> wrote: > >>>The original WordStar was supposedly ported (i.e. translated) this way. >> >>A fair number of CP/M programs were ported to MS-DOS that way. Most >>8080 instructions mapped exactly to one or two 8086 instructions, so >>performance was not bad. > > > That's no excuse for designing such a register-starved > architecture. I can see why the 8086 needed at least as many > registers as the 8080 -- but there's no reason why they > couldn't have tossed in a few extra ones... >
There *are* more registers on the 8086 than on 8080. It seems that Intel had a definite policy to keep the instruction lengths at a minimum. This limits how many registers can be addressed in a single instruction. There is a two-fold advantage of shorter code length: - a certain piece of code needs a smaller memory to store, - the code fetch time is shorter, i.e. faster code. In my practical experience, some pieces of code ported from 80186 to a 68332 grew by 40 to 50 %. (A surprise was that the same code ported from 80186 to an ARM/Thumb kept essentially the same size). -- Tauno Voipio tauno voipio (at) iki fi
robertwessel2@yahoo.com wrote:
> John R. Levine wrote: > >>The 8086 had more usable registers than a PDP-11. Amazing but true. >>We can argue whether the simpler addressing modes made the '86 >>registers less useful. > > Good point. And arguably the 386+387 has a similar number of useful > registers as does the VAX when FP code is being executed. The VAX had > 16 32-bit registers, but those 16 included several with fairly > dedicates uses, including the IP (R15), SP (R14) and frame pointer (R13 > - EBP on the x86). That leaves 13 fairly general purpose registers, > although there were some special uses, compared to six on the 386. > But since there was no separate set of FP registers, FP code put very > heavy pressure on the available registers, especially given that a > double took a pair to hold. > > But again, the complex addressing modes favor the VAX.
Considering the recent thread on VAX vs Alpha, *favored* might be the better word... :-) -Jason [feels really strange typing that with US spelling]
johnl@iecc.com (John R. Levine) writes:
[Someone:]
>>> Now count the original 8086 registers: >>> >>> AX, BX, CX, DX, SI, DI, BP, SP, IP, CS, DS, ES, SS. > >That's also six general registers,
The 8086 has no general-purpose registers. It's an accumulator architecture with an accumulator (AX), an accumulator extension (DX), four index registers (SI, DI, BX, BP) divided into base (BX, BP) and index (SI, DI) registers, a count register (CX), and a stack pointer (SP). In particular, you cannot address through AX, so it is not a general-purpose register. The 8086 was on the road to being a register architecture, though; e.g., you could use AND with all registers, whereas the 68000 restricted AND to working on the accumulators (aka data registers). Followups to comp.arch. - anton -- M. Anton Ertl Some things have to be seen to be believed anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen http://www.complang.tuwien.ac.at/anton/home.html
On 23 Aug 2005 14:27:12 -0700, "robertwessel2@yahoo.com"
<robertwessel2@yahoo.com> wrote:

>It's hard to argue with that, but it had (more-or-less) twice what the >8080 had, and it still fit in 29K transistors.
At least the segment registers would be considered simply memory management registers in most other architectures, rather than general purpose registers. Paul
On 23 Aug 2005 20:34:13 -0700, "robertwessel2@yahoo.com"
<robertwessel2@yahoo.com> wrote:

> >John R. Levine wrote: >> The 8086 had more usable registers than a PDP-11. Amazing but true. >> We can argue whether the simpler addressing modes made the '86 >> registers less useful. > > >Good point. And arguably the 386+387 has a similar number of useful >registers as does the VAX when FP code is being executed.
Or comparing the 386+387 with PDP-11+FPP-11 architecture from the early 1970's. The FPP-11 floating point coprocessor contained six 64 bit floating point registers (AC0..AC5). The full PDP-11 addressing modes (with Rx replaced with ACx in register mode) could be used for one operand (usually the source), while the second operand was AC0 .. AC3. OTOH, the 387 had the eight position stack, with access to the top element only and operands only for the two topmost elements. Paul
Tauno Voipio wrote:
> In my practical experience, some pieces of code ported > from 80186 to a 68332 grew by 40 to 50 %. (A surprise > was that the same code ported from 80186 to an ARM/Thumb > kept essentially the same size).
It always depends on the porting direction. The stuff I ported from 68k to x86 (32 bit mode, though) grew in size, too. Reason: too specialized registers, limited addressing modes (e.g. no postinc/predec except push/pop). -- Bernd Paysan "If you want it done right, you have to do it yourself" http://www.jwdt.com/~paysan/
Paul Keinanen wrote:
> OTOH, the 387 had the eight position stack, with access to the top > element only and operands only for the two topmost elements.
For most operations, one operand on the 387 could be any of the eight stack registers or a memory locataion, not just the top pair.
robertwessel2@yahoo.com wrote:
> Terje Mathisen wrote: > >>The original WordStar was supposedly ported (i.e. translated) this way. > > > > A fair number of CP/M programs were ported to MS-DOS that way. Most > 8080 instructions mapped exactly to one or two 8086 instructions, so > performance was not bad.
What I remember reading at the time was that performance "not bad" in the sense that the converters worked and the programs ran, but that they were poor performers compared to the same app written specifically for 8086 (which is about what I would expect). Is this wrong? --Larry

Memfault Beyond the Launch