mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
Fix backwards Fcode branches (bbranch and b?branch).
According to the specification, the destination for a backwards Fcode branch must be resolved from the bottom rather than the top of the cstack. The existing version of the code was simply doing a swap, and so nesting any branches within a backward branch would fail since the wrong destination would be resolved from the stack. This patch adds a new cstack-startdepth variable to keep track of the cstack base location within an execution context (setup-tmp-comp and execute-tmp-comp) and alters the backward branches to make use of it. With this patch in place, Milax under Qemu doesn't crash anymore but sits in an infinite loop reading sectors from the CDROM. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk> git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@638 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
committed by
Mark Cave-Ayland
parent
ba52470cce
commit
dbc5a9c3ba
@@ -166,6 +166,8 @@ defer environment?
|
||||
variable tmp-comp-depth -1 tmp-comp-depth !
|
||||
variable tmp-comp-buf 0 tmp-comp-buf !
|
||||
|
||||
variable cstack-startdepth -1 cstack-startdepth ! \ start depth of the cstack
|
||||
|
||||
: setup-tmp-comp ( -- )
|
||||
state @ 0 = (if)
|
||||
here tmp-comp-buf @ here! , \ save here and switch to tmp directory
|
||||
@@ -173,9 +175,20 @@ variable tmp-comp-buf 0 tmp-comp-buf !
|
||||
depth tmp-comp-depth ! \ save control depth
|
||||
]
|
||||
(then)
|
||||
|
||||
\ If start of new execution context, record the location of the bottom
|
||||
\ of the new cstack (required for backwards Fcode branches)
|
||||
cstack-startdepth @ -1 = (if)
|
||||
depth cstack-startdepth !
|
||||
(then)
|
||||
;
|
||||
|
||||
: execute-tmp-comp ( -- )
|
||||
\ If at the end of this execution context, reset cstack location
|
||||
depth cstack-startdepth @ = (if)
|
||||
-1 cstack-startdepth !
|
||||
(then)
|
||||
|
||||
depth tmp-comp-depth @ =
|
||||
(if)
|
||||
-1 tmp-comp-depth !
|
||||
|
||||
Reference in New Issue
Block a user