Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Aug 2014 23:27:28 -0700
From:      Jordan Hubbard <jkh@ixsystems.com>
To:        Rui Paulo <rpaulo@felyko.com>
Cc:        "Wojciech A. Koszek" <wkoszek@freebsd.org>, "<freebsd-hackers@freebsd.org>" <freebsd-hackers@freebsd.org>, "<dteske@FreeBSD.org>" <dteske@FreeBSD.org>, Pedro Giffuni <pfg@freebsd.org>, Pedro Arthur <bygrandao@gmail.com>
Subject:   Re: Lua in the bootloader
Message-ID:  <96E32478-5450-4A35-B68A-4791668AA701@ixsystems.com>
In-Reply-To: <236878C4-2C3E-4744-A04B-736C91032BFC@felyko.com>
References:  <3D62F4F4-ECCF-4622-BB57-D028160F3451@freebsd.org> <157901cfbe83$6cbf18d0$463d4a70$@FreeBSD.org> <A87AA9EB-373F-400E-986E-4D9017EB2375@freebsd.org> <16e101cfbfee$42b3b930$c81b2b90$@FreeBSD.org> <5FE57E4E-A627-4ABA-AB73-F0D60A3602D5@ixsystems.com> <236878C4-2C3E-4744-A04B-736C91032BFC@felyko.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Aug 24, 2014, at 9:07 PM, Rui Paulo <rpaulo@felyko.com> wrote:

> No, it's worse than that.  There's not a really limit on the size and =
the stack can overflow easily on real hardware while at the same time it =
works fine on bhyve at the same time.  userboot vs real hardware.

I=92m not sure I understand why there would be a difference in behavior =
on =93real hardware=94 vs bhyve unless bhyve is initializing ficl =
differently and causing it to change its allocation parameters.  In some =
ways, we lost out for not having gone with =93a real forth=94 =
implementation in the most traditional and compact sense.  In a =
traditional Forth system, the dictionary starts at the bottom of the =
available address space and the stack starts at the top - they grow =
towards one another, which is how I implemented the PC-532 boot loader =
(also in forth, but in assembly language); if you want to keep them out =
of their hair, you just put the stack base further away in memory.

Ficl is a higher-level C implementation and simply allocates a =
fixed-sized chunk of space for the dictionary and for the stack.  Our =
version of ficl is a bit ancient and I=92m still looking through it to =
even see where the dictionary size is chosen.  I suspect we simply made =
some bogus assumptions early on and never caught them until the FreeBSD =
boot environment grew so many logos and menus that it hit the limit.

Not that I disagree with any of the other arguments, mind you.  I think =
a new boot environment language would be fine.  I agree that Forth is =
largely only attractive to people with grey beard hair (though its value =
for torturing Alfred should not be underestimated).  I just think that =
it=92s also going to be awhile before the new hotness is at full =
feature-parity with the current boot loader, and if fixing the amount of =
headroom can buy us a little time, why not?  We hit the limit with =
FreeNAS too (I=92ve seen the same dreaded boot-time crash you did) so =
it=92s not just an academic point for me.

> The limitation of the dictionary and the size of the stack isn't the =
main reason why I would prefer lua over forth.  Why do we need to =
subject ourselves to a stack based language in 2014?  The very limited =
number of people hacking on the Forth boot loader on FreeBSD might have =
a different opinion, but the language is so arcane that I fail to see =
why we shouldn't replace it.

Again, no disagreement, though I do wonder how many Lua programmers =
FreeBSD has that will be able to hit the ground running as a result of =
this evolution.  Anyone?  Raise your hands!   I can=92t raise mine - =
I=92ve never used Lua. :)

- Jordan=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?96E32478-5450-4A35-B68A-4791668AA701>