[SLOF] RFC: cp codes

Alexey Kardashevskiy aik at ozlabs.ru
Wed Feb 10 11:33:06 AEDT 2016

On 02/09/2016 11:54 PM, Dinar Valeev wrote:
> 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.

Not just drive_add, you need this too:
-global spapr-nvram.drive=foo

 > So it must be some sort of nvram image formated by some tool

SLOF formats it, if it is big enough, it takes a minute or so (for 64k 
image?) so you will definitely notice.

>> 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,

How do you decide what to pass to this new parameter if it is not envvar? 
QEMU hack?

> do you think it would be better to introduce a new function here?

It would be better to install an addon to firefox to fix the actual issue 
:) If you send me a link which has the specific problem, I'll look around. 
I already have an addon to open mbox's from patchworks, for example.

>   //*****************************************************************************
>   // 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
>   ENTRY(bootmsg_cp)
>          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
>          .endr
> +       b       endif
> +plain:
> +       li      r3,'\n'
> +       bl      io_putchar
> +endif:
>          mtlr    r11
>          blr


More information about the SLOF mailing list