Am 28.05.2014 12:05, schrieb BALATON Zoltan:
On Wed, 28 May 2014, Alexander Graf wrote:
So do you happen to have any idea why the code was written the way it was written? I don't feel very confident that I grasp why the original author did it that way.
No I don't have any idea why it looks like this but maybe only because previous changes wanted to preserve as much as possible (or change as little as possible) and they have added up like this. Looking at the commit logs I've found the following:
The exception_return part has been there from the beginning.
In r945 afaerber added call_[di]si_exception to free up 0x380 and
0x480 for illegal vectors.
AFAIR the issue was that the space in the exception table was insufficient so I needed to branch out somewhere.
Another issue to keep in mind was that depending on QEMU's -cpu, OpenBIOS testing revealed that sometimes the exception code was called in place at fffffxxx and sometimes at the relocated addresses, so there were absolute vs. relative branches to consider. From the code relocated to 0x0 (or wherever that was) you need to do absolute jumps into the main OpenBIOS code, which require more instructions.
Regards, Andreas
- The real_[di]si jumps has been added in r1043 by agraf probably
because adding more instructions to the EXCEPTION_PREAMBLE made it not fit in 0x80 bytes any more.
So I think you should now better as it seems you two are the original authors.
Regards, BALATON Zoltan