Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2018 16:38:00 -0600
From:      Kyle Evans <kevans@freebsd.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Devin Teske <dteske@freebsd.org>, =?UTF-8?Q?Juan_Ram=C3=B3n_Molina_Menor?= <listjm@club.fr>,  FreeBSD Current <freebsd-current@freebsd.org>
Subject:   Re: ACPI panic on boot with new Lua loader and other minor issues
Message-ID:  <CACNAnaFgv_D3%2Bfez0DwXA7CXgOHktKboc5iqoU8yTrbWNDdazg@mail.gmail.com>
In-Reply-To: <CANCZdfqLxkFb3k5nZW34m-GS48WNwio1ueJLU0vgX0-N7Br36g@mail.gmail.com>
References:  <2AFF3AE4-8740-4776-9D8D-7D709EE051C6@gmail.com> <1b9e58fe-2616-b04b-13c2-fee78a33ad6e@club.fr> <CACNAnaFNv5LwDv3Z2dgPe%2Bb%2B3La%2B%2B-4CPNECug5XCdaTT_uo3A@mail.gmail.com> <6EB9705C-92AC-4952-B1F6-642DCD4701F1@freebsd.org> <CANCZdfqLxkFb3k5nZW34m-GS48WNwio1ueJLU0vgX0-N7Br36g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Feb 19, 2018 at 4:32 PM, Warner Losh <imp@bsdimp.com> wrote:
>
>
> On Mon, Feb 19, 2018 at 2:57 PM, Devin Teske <dteske@freebsd.org> wrote:
>>
>>
>>
>> > On Feb 19, 2018, at 2:21 PM, Kyle Evans <kevans@freebsd.org> wrote:
>> >
>> > It seems that the Forth loader might be doing something sneaky and
>> > replacing the standard common "boot" with a Forth boot that handles
>> > this a lot better. CC'ing dteske@ so they can confirm.
>>
>> I can indeed confirm this as fact.
>>
>> Not able to help much because I am driving cross-country (San Francisco to
>> Orlando) right now with the spouse and dog.
>>
>> We get back March 3rd, but I will be checking-in from time to time for
>> sporadic responses during downtime.
>
>
> The command in loader.4th is defined as:
>
> : boot
>   0= if ( interpreted ) get_arguments then
>
>   \ Unload only if a path was passed
>   dup if
>     >r over r> swap
>     c@ [char] - <> if
>       0 1 unload drop
>     else
>       s" kernelname" getenv? if ( a kernel has been loaded )
>         try-menu-unset
>         bootmsg 1 boot exit
>       then
>       load_kernel_and_modules
>       ?dup if exit then
>       try-menu-unset
>       bootmsg 0 1 boot exit
>     then
>   else
>     s" kernelname" getenv? if ( a kernel has been loaded )
>       try-menu-unset
>       bootmsg 1 boot exit
>     then
>     load_kernel_and_modules
>     ?dup if exit then
>     try-menu-unset
>     bootmsg 0 1 boot exit
>   then
>   load_kernel_and_modules
>   ?dup 0= if bootmsg 0 1 boot then
> ;
>
> The thing to know here is when you see 'boot' as part of above script, it's
> calling the 'boot' cli command, not itself recursively.
>
> I can help do more interpretation of the details if you need Kyle. Not sure
> how much to spell out, but the brief pseudo code is:
>
> If there were any arguments that didn't start with '-', unload.
>   otherwise if kernelname is in in the environment, run the 'menu-unset'
> forth word if it exists, print the boot message and boot.
>   Otherwise load the kernel and modules, run the 'menu-unset' forth word (if
> it exists), print the boot message and boot with kernelname
> Otherwise load the kernel and modules, run the 'menu-unset' forth word (if
> it exists), print the boot message and boot with kernelname
> if all that fails, load the kernel and modules and if that works boot them.
>

Yeah, we have something like this on the lua side. Unfortunately, it's
going to wreck people's muscle memory- dropping to the loader prompt
and typing "boot [x]" will never work as expected because lua won't
recognize that as a function call due to spaces as delimiters.

We'd need some shim that takes "cmd [x]" and tries it as "cmd([x])"
(for some [x] that could be multiple space-delimited arguments) before
falling back to the originally typed "cmd [x]" if we want Lua to have
any chance to intercept it and adds its own salt and pepper like Forth
does.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFgv_D3%2Bfez0DwXA7CXgOHktKboc5iqoU8yTrbWNDdazg>