On Apr 15, 2016, at 5:10 PM, Tarl Neustaedter wrote:
On 2016-Apr-15 16:57 , Programmingkid wrote:
[...] So if we filtered out the comment, things might work correctly. I will try this.
Actually, there are several comments. I saw at least three. Probably the right thing to do would be to find where the "" word is processed and make sure it accepts either CR (0xD) or LF (0xA) as end-of-comment.
My original thought was that the only thing that could differentiate between end-of-line and space was the "accept" word, which I didn't expect to see in the bootloader. I forgot that comment is a variant on accept.
I made a patch that removes comments from the bootscript variable. It did not solve the problem of not being able to boot Mac OS 9. Here is the patch.
Index: libopenbios/bootinfo_load.c =================================================================== --- libopenbios/bootinfo_load.c (revision 1391) +++ libopenbios/bootinfo_load.c (working copy) @@ -134,7 +134,7 @@ char *base; int proplen; phandle_t chosen; - int tag, taglen, script, scriptlen, scriptvalid, entity, chrp; + int tag, taglen, script, scriptlen, scriptvalid, entity, chrp, comment; char tagbuf[128], c; char *device, *filename, *directory, *partition; int current, size; @@ -187,10 +187,26 @@ scriptlen = 0; entity = 0; current = 0; + comment = 0; while (current < size) {
c = base[current++];
+ // filter out comments + if (c == '\') { + comment = 1; + continue; + } + + if (comment) { + // only a carriage return or linefeed character can end a comment + if (c == '\r' || c == '\n') { + comment = 0; + } else { + continue; + } + } + if (c == '<') { script = 0; tag = 1;