* Re: extended segments on 80386
@ 2021-03-15 16:08 Paul Edwards
0 siblings, 0 replies; 2+ messages in thread
From: Paul Edwards @ 2021-03-15 16:08 UTC (permalink / raw)
To: GCC Development
Actually, what I want is a processor with ECS,
EDS and EES, as new registers, and for GCC
to target that, supporting near, far and huge
code pointers and data pointers.
BFN. Paul.
-----Original Message-----
From: Paul Edwards
Sent: Tuesday, March 16, 2021 12:55 AM
To: GCC Development
Subject: extended segments on 80386
Would it be possible for GCC to generate code
that reserves ESI and EDI as "extended segment"
registers to hold a source and destination
"extended segment" of any operation.
This will be the upper 32-bits of a 64-bit address.
When run on a normal 80386, such code will work
fine, and ESI and EDI will always be 0, so that source
and destination are always in the first 4 GiB.
When run on segmentation-aware hardware, the
API to obtain memory, e.g. INT 21H AH=48H (or
something much better, preferably), cx will be
set to 1 to indicate that a "far pointer" is being
requested, and if such memory is available,
EDI will be set to the segment, ie EDI = 2 will
mean the 8 GiB location. The 32-bit offset will
be returned via a normal register, e.g. EAX.
The application will set EDI to 0 before calling
the INT 21H.
Only segment-aware applications will set cx to 1
in the INT 21H request.
The exact same executable will thus work fine, within
the 4 GiB address space, just doing unnecessary
stores and loads of ESI and EDI (always 0), but on
segment-aware hardware, that exact same application
will have access to 16 EiB of memory, although with
size_t restricted to 4 GiB (although you could break
the size_t restriction by using a huge pointer instead
of a far pointer).
If ESI and EDI are not the most appropriate registers,
something else could be chosen.
Will that work?
Thanks. Paul.
^ permalink raw reply [flat|nested] 2+ messages in thread
* extended segments on 80386
2021-03-15 9:22 ` Richard Biener
@ 2021-03-15 13:55 ` Paul Edwards
0 siblings, 0 replies; 2+ messages in thread
From: Paul Edwards @ 2021-03-15 13:55 UTC (permalink / raw)
To: GCC Development
Would it be possible for GCC to generate code
that reserves ESI and EDI as "extended segment"
registers to hold a source and destination
"extended segment" of any operation.
This will be the upper 32-bits of a 64-bit address.
When run on a normal 80386, such code will work
fine, and ESI and EDI will always be 0, so that source
and destination are always in the first 4 GiB.
When run on segmentation-aware hardware, the
API to obtain memory, e.g. INT 21H AH=48H (or
something much better, preferably), cx will be
set to 1 to indicate that a "far pointer" is being
requested, and if such memory is available,
EDI will be set to the segment, ie EDI = 2 will
mean the 8 GiB location. The 32-bit offset will
be returned via a normal register, e.g. EAX.
The application will set EDI to 0 before calling
the INT 21H.
Only segment-aware applications will set cx to 1
in the INT 21H request.
The exact same executable will thus work fine, within
the 4 GiB address space, just doing unnecessary
stores and loads of ESI and EDI (always 0), but on
segment-aware hardware, that exact same application
will have access to 16 EiB of memory, although with
size_t restricted to 4 GiB (although you could break
the size_t restriction by using a huge pointer instead
of a far pointer).
If ESI and EDI are not the most appropriate registers,
something else could be chosen.
Will that work?
Thanks. Paul.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-15 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-15 16:08 extended segments on 80386 Paul Edwards
-- strict thread matches above, loose matches on Subject: below --
2009-11-24 14:05 i370 port - 3.4.6 to 4.4 upgrade attempt Ulrich Weigand
2009-11-28 15:14 ` i370 port - music/sp - possible generic gcc problem Paul Edwards
2009-11-28 16:03 ` Richard Guenther
2021-03-14 5:55 ` negative indexes Paul Edwards
2021-03-14 8:05 ` Richard Biener
2021-03-14 8:12 ` Paul Edwards
2021-03-14 13:37 ` Richard Biener
[not found] ` <755065BE2A0B4B508DD3A262B2A83801@DESKTOP0OKG1VA>
2021-03-15 9:22 ` Richard Biener
2021-03-15 13:55 ` extended segments on 80386 Paul Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).