diff options
author | Michael Brown <mcb30@etherboot.org> | 2009-02-17 00:47:35 +0000 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2009-02-17 00:47:35 +0000 |
commit | 8904cd55f128941d53d9a8beef71fb32a920a92d (patch) | |
tree | a2ce11209520f09931d23ccae2682297ada99288 /src/image | |
parent | 349868b8fdd043c19956594bd144b66395523f02 (diff) | |
download | ipxe-8904cd55f128941d53d9a8beef71fb32a920a92d.tar.gz |
[comboot] Allow for tail recursion of COMBOOT images
Multi-level menus via COMBOOT rely on the COMBOOT program being able
to exit and invoke a new COMBOOT program (the next menu). This works,
but rapidly (within about five iterations) runs out of space in gPXE's
internal stack, since each new image is executed in a new function
context.
Fix by allowing tail recursion between images; an image can now
specify a replacement image for itself, and image_exec() will perform
the necessary tail recursion.
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/script.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/image/script.c b/src/image/script.c index fe7228851..2d2427463 100644 --- a/src/image/script.c +++ b/src/image/script.c @@ -43,10 +43,8 @@ static int script_exec ( struct image *image ) { int rc; /* Temporarily de-register image, so that a "boot" command - * doesn't throw us into an execution loop. Hold a reference - * to avoid the image's being freed. + * doesn't throw us into an execution loop. */ - image_get ( image ); unregister_image ( image ); while ( offset < image->len ) { @@ -80,7 +78,6 @@ static int script_exec ( struct image *image ) { done: /* Re-register image and return */ register_image ( image ); - image_put ( image ); return rc; } |