On Sun, Mar 04, 2012 at 07:26:58PM +0000, Julian Pidancet wrote:
On Sun, Mar 4, 2012 at 7:04 PM, Kevin O'Connor kevin@koconnor.net wrote:
So, I guess the question is, how important is support for current/legacy x86emu versions?
I've tried to replace .code16gcc with .code16 in src/code16gcc.s to see if gcc would be able to generate code which doesn't use 32bit version of the call/ret instructions. The result was quite disappointing, it generates functions like this:
That definitely wont work. Gcc assumes the return address is 32bits - it will be totally confused if it's not. (Function parameters passed on the stack wont be in the right spot.) Likely other things will break as well.
I am going to propose a patch to xorg-devel in the next few days, but in the meantime, it would be nice to find a solution in SeaBIOS so the code can work with older versions of Xorg.
The only thing I can think of would be to post-process the assembler and replace "retl" instructions with "retw $2" instructions. I'm not sure if it would work and it would be real ugly.
-Kevin