init commit
This commit is contained in:
32
crt/crt1.c
Normal file
32
crt/crt1.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Minimal C runtime — entry point before main.
|
||||
*
|
||||
* Elyz process startup:
|
||||
* the loader transfers control here with an initial capability wallet
|
||||
* (CNode) and a pool of untyped memory. No traditional syscalls exist;
|
||||
* all kernel interaction goes through capability invocation.
|
||||
*
|
||||
* Current state: STUB — the kernel ABI is under construction.
|
||||
* - argc/argv passed on stack (convention inherited from limine boot)
|
||||
* - initial memory pool not yet wired; __libc_init sets up a tiny bump
|
||||
* arena for development.
|
||||
*/
|
||||
|
||||
void _start(void)
|
||||
{
|
||||
extern int main(int, char **, char **);
|
||||
extern void __libc_init(void);
|
||||
|
||||
register long *args __asm__("rsp");
|
||||
int argc = (int)args[0];
|
||||
char **argv = (char **)(args + 1);
|
||||
char **envp = argv + argc + 1;
|
||||
|
||||
__libc_init();
|
||||
|
||||
int ret = main(argc, argv, envp);
|
||||
|
||||
/* No _exit syscall in Elyz — send an Exit message to the PM actor.
|
||||
* For now: infinite halt. */
|
||||
for (;;) __asm__ volatile("hlt");
|
||||
(void)ret;
|
||||
}
|
||||
Reference in New Issue
Block a user