Mac OS 9's CHRP boot info consists of the standard SGML document terminated by an ASCII EOT, followed by a large binary blob which is relocated by the Forth script. This patch allows the bootinfo loader to stop loading the script if it detects an EOT, avoiding the out-of-memory error previously encountered when booting OS 9.
Signed-off-by: Cormac O'Brien i.am.cormac.obrien@gmail.com --- libopenbios/bootinfo_load.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/libopenbios/bootinfo_load.c b/libopenbios/bootinfo_load.c index fa9e36b..4b6a52c 100644 --- a/libopenbios/bootinfo_load.c +++ b/libopenbios/bootinfo_load.c @@ -161,6 +161,16 @@ bootinfo_init_program(void) feval("load-size"); size = POP();
+ /* Check for a delimiting ASCII EOT, as in Mac OS 9 */ + current = 0; + while (current < size) { + if (base[current] == 0x04) { + size = current; + break; + } + current++; + } + bootscript = malloc(size); if (bootscript == NULL) { DPRINTF("Can't malloc %d bytes\n", size);