This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: gas/ld x86 16-bit 64kb limit and ominous "unreal mode"
- From: Josef Angermeier <sijoange at cip dot informatik dot uni-erlangen dot de>
- To: Etienne Lorrain <etienne_lorrain at yahoo dot fr>
- Cc: binutils at sources dot redhat dot com
- Date: Thu, 30 Jun 2005 12:40:49 +0200
- Subject: Re: gas/ld x86 16-bit 64kb limit and ominous "unreal mode"
- References: <20050630095106.62347.qmail@web26909.mail.ukl.yahoo.com>
On Thu, Jun 30, 2005 at 11:51:05AM +0200, Etienne Lorrain wrote:
> > Using gcc/gas to generate a pc-bios for a virtual machine, i face
> > now the problem, that gas/gcc just knows about the small memory
> > modell and so my code is restricted to 64kb somehow.
> If you are using .code16gcc and GCC, you are probably using only 32
> bits pointers and not only 16 bits pointers. The trick is that the
> upper 16 bits have to be null and you are restricted to 16 bits
> values.
Yes, thats how gas does it.
> It is possible to go to "unreal" mode and use 32 bits pointers for
> data access once the segment limits have been set to their max
> value. You could have a look to http://gujin.org compilation switch
> BIG_MALLOC to see how to do that.
Nice bootloader !:-)
> It is possible to use "far" pointer for the code using
> segment:offset pair and transforming all call and ret by calll and
> retl, but your executable
Yes, thats probably my choice. - writing a little linker to do exactly
that.
> will no more be relocatable - you have to create a linker section to
> handle relocation at load time. You can also use 32 bits code
> address, but _only_ with interrupt disabled, and without any
> exception (like division by 0 or division overflow) possible: such an
> interrupt will save on the stack a 16 bits segment and a 16 bits
> offset, so no return possible to the interrupted treatment because
> the MSB of the offset is lost...
i also wondered about the interrupts' pushing of IP. Concluded that i
could maybe change all my bios interrupt handlers to save at first the
'eip' on the stack. Bizarre but probably a solution. But then i found
out that unreal code can't be simulated in V86 mode, and that was the
final KO-criteria of that idea. (because my pc-bios-bios needs to be
v86-compatible)
Etienne, thanks for you competent answer, helped me to verify that my
thoughts were correct.
> Etienne.
Josef