j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Mac OS 9's CHRP boot info is delimited by an ASCII EOT, so the bootscript loader will truncate the malloc() size if it encounters one to avoid an out-of-memory error.
Signed-off-by: Cormac O'Brien i.am.cormac.obrien@gmail.com
--- libopenbios/bootinfo_load.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libopenbios/bootinfo_load.c b/libopenbios/bootinfo_load.c index fa9e36b..a3ce00e 100644 --- a/libopenbios/bootinfo_load.c +++ b/libopenbios/bootinfo_load.c @@ -161,6 +161,15 @@ bootinfo_init_program(void) feval("load-size"); size = POP();
+ 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);
On 18/06/15 05:05, Cormac O'Brien wrote:
Mac OS 9's CHRP boot info is delimited by an ASCII EOT, so the bootscript loader will truncate the malloc() size if it encounters one to avoid an out-of-memory error.
I think a bit more context is needed here, i.e. something along the lines of OS 9's boot info consists of a standard Forth bootscript terminated by by an EOT character followed by a large binary blob which is relocated by the Forth payload.
Signed-off-by: Cormac O'Brien i.am.cormac.obrien@gmail.com
libopenbios/bootinfo_load.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/libopenbios/bootinfo_load.c b/libopenbios/bootinfo_load.c index fa9e36b..a3ce00e 100644 --- a/libopenbios/bootinfo_load.c +++ b/libopenbios/bootinfo_load.c @@ -161,6 +161,15 @@ bootinfo_init_program(void) feval("load-size"); size = POP();
And a couple of lines comment here to reflect above is good for people that don't have the git history to hand and are wondering what is going on here.
- 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);
Other than that, it's a lot simpler than the previous version and looking good.
ATB,
Mark.