This is the mail archive of the gas2@sourceware.cygnus.com mailing list for the gas2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [masaki@eie.monolta.co.jp: GAS bug and etc]



> Supporting 16-bit mode assembly for the 386 is not harmful if it is
> easy, but if it takes up a lot of time, then it might be better off
> left out.  Do we need to have a program that runs in 16-bit mode for
> booting?  If so, how big a program would it have to be?  (I presume
> all it needs to do is switch to 32-bit mode.)  Might it be easier to
> hand assemble that program than to add and subsequently maintain this
> gas feature?

Even when in protected mode, the 386 and up processors support
variable width operations.  For example, when C calls for a "short",
the 386 uses a 16-bit register and thus needs 16-bit operations.  This
has nothing to do with the runtime mode of the CPU or the default size
of the segment (16 vs 32), and must be supported on all 386-based
systems, including Hurd.

The theory is that since gas must already support these 16-bit
instructions for the i386 anyway, it should be trivial to tell it that
the *default* size should be assumed different, so that it would
produce code that assumed it was running in a 16-bit segment instead
of a 32-bit segment.  Then, the only work that would need to be done
is to produce dos-style OMF output, which is also used for some 32-bit
systems.

As for the separate topic of bootstrapping 32-bit programs in the
16-bit world of DOS, we've got that covered already, so that you can
fully bootstrap djgpp 2.0 with nothing but GNU tools.  We wrote a VERY
simple 16-bit assembler with which to assemble the bootstrap code.

DJ