[OpenBIOS] PATCH: Correct b?branch for negative offset branches

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Mon Apr 6 00:10:23 CEST 2009


Hi everyone,

Please find enclosed a patch against current SVN that allows b?branch to 
work for negative offset branches. With this patch applied, the 
following output can be seen under openbios-unix on x86 (32-bit):


For the non-branch case (flags is set to -1):

0 > here  ok
1 > 10 c, ff c, ff c, ff c, ff c,  ok
1 > b1 c,  ok
1 > 10 c, aa c, aa c, aa c, aa c,  ok
1 > 9d c,  ok
1 > 02 c, 16 c,  ok
1 > 14 c, f7 c,  ok
1 > 02 c, 16 c,  ok
1 > 00 c,  ok
1 > dup 1 byte-load
byte-load: exception caught!
  ok


For the branch case (flags is set to 0):

0 > here  ok
1 > 10 c, 00 c, 00 c, 00 c, 00 c,  ok
1 > b1 c,  ok
1 > 10 c, aa c, aa c, aa c, aa c,  ok
1 > 9d c,  ok
1 > 02 c, 16 c,  ok
1 > 14 c, f7 c,  ok
1 > 02 c, 16 c,  ok
1 > 00 c,  ok
1 > dup 1 byte-load -55555556
byte-load: exception caught!
  ok


Note that in terms of docbranch, the branch action being taken is 
actually the opposite to what you may expect due to the use of 
setup-tmp-comp (hence the extra invert is required). So as an example, 
if flags is set to 0 then docbranch does not change the PC, and so we 
execute the contents of the temporary buffer which contains everything 
from b(<mark) to b(>resolve). On the other hand, if flags is non-zero 
then docbranch will branch back to the b(>resolve), and so the temporary 
buffer contents are ignored.

AFAICT the behaviour is correct from the above examples, but again I'd 
suggest that someone with more OpenBIOS experience should verify to make 
sure that this is the right approach.


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openbios-bbranch.patch
Type: text/x-diff
Size: 1166 bytes
Desc: not available
URL: <http://lists.openbios.org/pipermail/openbios/attachments/20090405/8d529d0d/attachment.bin>


More information about the OpenBIOS mailing list