4 ms·
Freestanding C requires nothing more than the bootloader be written in assembler and that's an architectural dependency; most I/O mapped, embedded devices simpl
by deaddodo 6y ago
Freestanding C requires nothing more than the bootloader be written in assembler and that's an architectural dependency; most I/O mapped, embedded devices simply require the binary be loaded in a specific location (usually an offset on ROM). CRT0 itself can also be bootstrapped in C.
That's quite different than a low-level kernel bootstrap, which is what you linked. Regardless of whether you do it in Assembler or the aforementioned languages, you must build a hoist outside of Golang.
- pjmlp 6y agoTry to implement malloc/free in freestanding C, or soft floating point for that matter. Inline Assembly doesn't count as C, isn't part of ISO C and any language can have such extensions, including Go.
- deaddodo 6y agoWhy would I need to, when it’s already been done? https://github.com/blanham/liballoc/ https://github.com/blanham/liballoc/ It’s not even uncommon, as liballoc is one of the top recommended allocators for hobby OSes. I never mentioned inline assembler. Whilst any decent OS will most definitely fall back on assembler, and I never claimed otherwise, it’s not a requirement. It, or another of the aforementioned, would be within the realm of standard Golang. You’re jumping through hoops to equate a language out of it’s intended use cases to ones completely within their’s. It’s not a knock on Go (or other GC’d languages), it’s just a reality of the compromise on specific features. You also couldn’t write an OS in a VM’d language without having a VM hypervisor; it doesn’t mean they’re bad languages.
- pjmlp 6y ago> There are 4 functions which you need to implement on your system: int liballoc_lock(); int liballoc_unlock(); void* liballoc_alloc(int); int liballoc_free(void*,int); So where is the ISO C implementation of those?