[SLOF] RFC: cp codes

Dinar Valeev k0da at opensuse.org
Tue Feb 9 23:54:46 AEDT 2016

On Mon, Feb 8, 2016 at 6:50 PM, Thomas Huth <thuth at redhat.com> wrote:
> On 08.02.2016 15:10, Dinar Valeev wrote:
>> Hi,
>> I have long standing issue with SLOF. During start SLOF prints cp
>> codes with backspace:
>> https://github.com/aik/SLOF/blob/master/lib/libbootmsg/bootmsg_lvl.S#L61-L64
>> We start a VM and record log, this is fine. But then when we look at
>> the log through WebUI, because of backspace, Mozilla thinks this is a
>> binary file.
>> At devconf I discussed this with Thomas, and he proposed to use nvram
>> variable here. But it seems QEMU's --prom-env seems to be OpenBIOS
>> specific.
>> Any comments for bring --prom-env support to SLOF? Or are there other
>> options I can use,
>> to change libbootmsg behaviour?
> You actually can use the "-pflash" option to save and restore the NVRAM
> contents to/from a persistent file (see the following URL for details:
> http://patchwork.ozlabs.org/patch/293379/)
ok, so this option just does drive_add in QEMU. So it must be some sort of
nvram image formated by some tool
> So I'd suggest to introduce a new environment variable into
> slof/fs/envvar_defaults.fs and then check the contents of the variable
> during the "cp" Forth function, so that it only prints the backslashes
> if the envvar has the right value.
Yep. Did it. But it seems a problem is envvar initialized a way after
we start printing
cp codes.
> By the way, seems like the assembler function bootmsg_cp is only called
> via the wrapper in bootmsg.code nowadays ... IIRC we once also called it
> from the llfw (low-level firmware), that's why it had been written in
> assembler once. However, since this is not the case anymore, I think it
> should also be fine to simply rewrite this function in Forth instead, so
> you could check the envvar more easily.
Is it really necessary? I already introduced a condition based on
argument passed to bootmsg-cp,
do you think it would be better to introduce a new function here?

 // Print CheckPoint
-// input : r3=cp-id
-// change: r3, r4, r5, r6, r7, r11
+// input : r3=cp-id, r5=plaintext
+// change: r3, r4, r5, r6, r7,r9,r10, r11
 // output: none
        mflr    r11
        mr      r9, r3          // save checkpoint ID
+       mr      r10, r4
        li      r3, 'C'
        bl      io_putchar      // print character
        mr      r3, r9
        bl      io_printhex16   // print checkpoint ID
+       mr      r4, r10
+       cmpdi   r4, -1           // plaintext requested
+       beq     plain
+       backspace:
        .rept   5
        li      r3,'\b'
        bl      io_putchar      // print backspaces
+       b       endif
+       li      r3,'\n'
+       bl      io_putchar
        mtlr    r11

>  Thomas

More information about the SLOF mailing list