Re: AW: [Fwd: Re: EDE - Personal Suggestions and Ideas]

Gábor Lénárt
2004-05-26T10:30:15Z

On Wed, May 26, 2004 at 11:09:41AM +0100, David Given wrote:
> On Wednesday 26 May 2004 07:20, you wrote:
> [...]
> > What about supporting 286 protected mode in a manner that more than one
> > text+data segment per program are possible - still far-pointers were to be
> > implmented, but would segment switching not be easier with HW-protection
> > (in comparison to 8086)? I am not familiar with compiler programming, so
> > I have no idea of how much work it would be.
> > The last time I looked into the elks sources there was code for
> > initializing 286 protected mode - don't know if it works.
>
> The problem with using far pointers is that you end up having to encode
> segment IDs into the pointers themselves, which makes things really painful.
> Particularly, on systems that don't have an MMU, the segment ID controls the
> address of the segment; so on the 8086 and 8088 you won't be able to move
> your application's segments around while the program's running.

Why? On 16 bit protected mode (80286) you CAN alter the starting address of
a segment while refeering the same selector before and after this action
(this is because in protected mode the segment register only contains a
'selector' which is an index in the descriptor table which describes the
segment). Sure, real mode does not allow this, because in real mode the
content of the segment register is simply the starting address of the
segment divided by 16, allowing maximum of 1Mb address space (1Mb+64K-16byte
if you set segment register to 0xFFFF, but on XT this simply warps arount
the the start of the memory, while on AT this is called HMA, and for
avoiding warping around se so called A20 line enabling was needed, etc, but
it's out of scope here I think).

> (Brief tutorial on segments: the 8086, 8088 and 80286 are *not* 32-bit
> processors. They are 16-bit processors. They can address a total of 64kB of
> memory. However, they have a feature where you can select which 64kB of
> memory you want to use out of a much larger memory region. Each area is

Yep, exactly. Intel's first 32 bit CPU was the 386.
8086 and 80286 is only address maximum 64K at 'once' (sure not including
the fact that you can use different segment for data, code and stack,
also an extra segment register (ES) was introduced), but 286 does not have
got 32 bit instructions and registers as well. Yes, they're 16 bit CPUs.

> Also, far pointers are slow and cause bloated and annoying code. One of the
> problems is that now your pointers are 32 bits wide, but your integers are 16
> --- and while this shouldn't affect well-written code, there's a lot of
> badly-written code out there.

Yep, but if you don't want to buy +386 system, and you wanna to provide
the possibility to run a Linux-like OS on 8086 and 286 you should deal with
them ...

- Gábor (larta'H)
-
To unsubscribe from this list: send the line "unsubscribe linux-8086" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html