mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:17:45 +00:00
Kernel: Pass process arguments directly on the stack.
Get rid of the convoluted get_arguments and get_environment syscalls. This patch also adds a simple /bin/env that just prints its environment.
This commit is contained in:
parent
e969419202
commit
6d3e12899b
9 changed files with 59 additions and 66 deletions
|
@ -13,28 +13,19 @@ char** environ;
|
|||
void __malloc_init();
|
||||
void __stdio_init();
|
||||
|
||||
int _start()
|
||||
int _start(int argc, char** argv, char** env)
|
||||
{
|
||||
errno = 0;
|
||||
environ = env;
|
||||
|
||||
__stdio_init();
|
||||
__malloc_init();
|
||||
|
||||
int status = 254;
|
||||
int argc;
|
||||
char** argv;
|
||||
int rc = syscall(SC_get_arguments, &argc, &argv);
|
||||
if (rc < 0)
|
||||
goto epilogue;
|
||||
rc = syscall(SC_get_environment, &environ);
|
||||
if (rc < 0)
|
||||
goto epilogue;
|
||||
status = main(argc, argv);
|
||||
int status = main(argc, argv);
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
epilogue:
|
||||
syscall(SC_exit, status);
|
||||
|
||||
// Birger's birthday <3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue