On 2018-05-07 15:54, Ralf Ramsauer wrote:
> On 05/07/2018 03:47 PM, Jan Kiszka wrote:
>> On 2018-05-07 15:42, Ralf Ramsauer wrote:
>>> On 05/07/2018 03:37 PM, Jan Kiszka wrote:
>>>> On 2018-05-07 14:12, Ralf Ramsauer wrote:
>>>>> Or fail by setting the cell's state and halt.
>>>>>
>>>>> Signed-off-by: Ralf Ramsauer <[email protected]>
>>>>> ---
>>>>>  inmates/lib/setup.c | 11 +++++++++++
>>>>>  1 file changed, 11 insertions(+)
>>>>>
>>>>> diff --git a/inmates/lib/setup.c b/inmates/lib/setup.c
>>>>> index ed35b6f8..be651696 100644
>>>>> --- a/inmates/lib/setup.c
>>>>> +++ b/inmates/lib/setup.c
>>>>> @@ -4,6 +4,17 @@ void __attribute__((noreturn)) c_entry(void);
>>>>>  
>>>>>  void __attribute__((noreturn)) c_entry(void)
>>>>>  {
>>>>> + /* check if the ABI version of the communication region matches */
>>>>> + if (comm_region->revision != COMM_REGION_ABI_REVISION ||
>>>>> +         memcmp(comm_region->signature, COMM_REGION_MAGIC,
>>>>> +                sizeof(comm_region->signature))) {
>>>>> +                 comm_region->cell_state =
>>>>> +                         JAILHOUSE_CELL_FAILED_COMM_REV;
>>>>> +                 goto spin;
>>>>> +         }
>>>>> +
>>>>> +
>>>>>   inmate_main();
>>>>> +spin:
>>>>>   spin_forever();
>>>>>  }
>>>>>
>>>>
>>>> if (a || b)
>>>>    state = failed;
>>>> else
>>>>    inmate_main;
>>>
>>> Makes sense for the moment, but later I'll add console_init() as well.
>>> Do you want to have all the initialisation in the else path?
>>
>> Err, console_init() is done on demand, when the first printk is issued.
>> No printk in the inmate, no console code in the binary. Actually also no
>> UART code...
> 
> Puh... This would get us rid of that nasty if (inited) check in printk.c :-)

Well, possibly nasty when not done prior to kicking off the second CPU
(if any), right. Otherwise it's fine.

> 
> Hmm. I get your point, but if no console is provided or required (e.g.,
> the linux loader), then console_init() won't initialise anything. Is it
> really all about keeping inmate size low?

That would be the benefit, yes.

> 
> As far as i see, the linux loader is the only inmate that has no output,
> so we save just a few bytes of uart code before we jump to a Linux image
> with the size of several megabytes.

That's currently the use case. But if you imagine inmates that just do
work and not talk about it, there might be others.

It's micro-optimization, but so far the libinmate was designed to
contain everything but only instantiate that on real demand.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to