16bit code generation

David Laight david at l8s.co.uk
Sun Mar 22 17:15:15 CDT 2009


On Sun, Mar 22, 2009 at 11:34:03AM +1100, Ben Klein wrote:
> Oops, missed reply-to-all.
> 
> 2009/3/22 Tijl Coosemans <tijl at ulyssis.org>:
> > I was reading through binutils documentation and came across this.
> > Maybe it can be used to compile 16 bit tests.
> >
> > 3.2.4. 16-bit mode
> > Binutils (2.9.1.0.25+) now fully support 16-bit mode (registers and
> > addressing) on i386 PCs. Use .code16 and .code32 to switch between
> > assembly modes.
> >
> > Also, a neat trick used by several people (including the oskit authors)
> > is to force GCC to produce code for 16-bit real mode, using an inline
> > assembly statement asm(".code16\n"). GCC will still emit only 32-bit
> > addressing modes, but GAS will insert proper 32-bit prefixes for them.

I believe that does work and has been used by 'bochs' to compile bios code.

> 16bit mode is required for building bootloaders. The question here is,
> is it possible for Wine to run raw 16bit code when running under a
> *nix kernel, which typically (always?) run in protected mode? I
> believe it is not possible without some sort of 16bit emulator/wrapper
> (e.g., current win16 libs are actually compiled as 32bit).

NetBSD (at least) has VM86 support in the kernel, however I don't know
if it still works :-)

	David

-- 
David Laight: david at l8s.co.uk



More information about the wine-devel mailing list