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

Etienne Lorrain etienne_lorrain@yahoo.fr
Mon Jul 11 10:20:00 GMT 2005


 Hello Josef,

> >   Even with -Os, which is a GCC option so has no influence on GAS, the
> >  only 16 bits relocs in Gujin are in the assembler inserts: asm("...").
> For my code it has an influence, maybe i will further study your code...

  OK, some optimisation of -Os may generate some relative jump to 16 bits
 offset - I probably have few of them too, I did not check too much if all
 of mine are optimised to 8 bits relative jumps.
 
> I am thinking about solving that by letting gcc first output gas-asm
> code, using perl to patch all 'ret' to 'far ret', and then assembler
> it. 

  I generate in my Makefile the .S file and run it through "sed" to remove
 the ".align 32" to remove 32 bytes alignment. You could do something
 like it with a "sed < file.S > file.s 's/ret/retl/g;s/call/calll/g'"
 (to check) or something similar.
  The other solution is to find where ".codegcc" is managed in GAS and
 patch GAS to output the hexadecimal of calll/retl instead of call/ret
 creating something like ".codelgcc" for Long or ".codesgcc" for Segment.

> ;-). YES, thats also a problem. Therefore i intend to use for every data
> access a special function written in assembler, which takes the linear
> address, and uses %fs:offset to get/write the value.

  You have probably never heard of peek and poke functions of BASIC, but
 the C-inline assembler functions you want are peekb()/peekw()/peekl()
 and pokeb()/pokew()/pokel() in Gujin/library.h . My versions have a name
 finishing with "_doorclosed" to say that those do not assume segment
 with more than 64 Kbytes available.

> I have 6 weeks to get this done!

  A patch is quite easy, a clean solution always takes more time...
  As I said I cannot help for the relocation stuff, I have never looked
 at that part of ld source code - I do not know the details.

  Etienne.


	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com



More information about the Binutils mailing list