This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gas/ld x86 16-bit 64kb limit and ominous "unreal mode"


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


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