Greetings,
I have committed a few cleanups to baremetal to make the environment a bit more useful.
The lib directory contains a new startup function in _main.c which locates the top of RAM using the linuxbios table and checks for a signature there. If absent, it moves the stack to high ram, and initializes a simple structure containing pointers to the lbmemory structs in the table, and the highest address of freely usable ram.
Bounce buffers and such are allocated by subtracting from the dree RAM value.
When an additional baremetal program is run, it will detect the existant structure and use its values. Together, this allows for arbitrary stacking of payloads and safely returning to the calling payload.
A 'terminal payload' such as a kernel elf image may simply ignore all of that and do what it wants.
This is still subject to change, and amounts to a platform for discussion and a little practical exprimentation.
G'day, sjames