bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with .code16gcc in gnu as


From: Brian Hurt
Subject: Problem with .code16gcc in gnu as
Date: Fri, 5 Oct 2001 17:46:22 -0500 (CDT)

I'm trying to use GCC/GAS/GLD to write a PC BIOS.  As such, I'm giving
.code16gcc a serious workout (along with having fun and games with ld).

The problem I'm running into is the code:
    *((int *) 0x600000ul) = 3;
which compiles into the x86 instruction:
        movl    $3, 0x600000
basically.  The problem is that in 16-bit code, gnu as truncates the
memory address constant to 16 bits, i.e. 0.  This is bad.

Is there any possibility to fix gas so that if it's in code16gcc mode, it
recognizes 32-bit address constants and puts a proper addr32 prefix on the
instruction?

By the way, this code construct can make sense in 16-bit mode, *if* you're
in unreal mode.  Basically, you go into protected mode, load all the
segment registers with descriptors that have a base address of 0 and a
limit of 4G, then drop back out of protected mode.  Segment/offset
addressing works the "normal" brain damaged way, but you don't have the
64K limit anymore.  32-bit offsets are legal.

Brian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]