commited some changes and added README
[meinos.git] / apps / lib / crt0 / crt0.c
blob9b143111bcf398fd0f122dc413f7d24cf43e3f06
1 /*
2 meinOS - A unix-like x86 microkernel operating system
3 Copyright (C) 2008 Janosch Gräf <janosch.graef@gmx.net>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #include <sys/types.h>
20 #include <sys/shm.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <unistd.h>
24 #include <syscall.h>
25 #include <misc.h>
27 int main(int argc,char *argv[]);
28 void _stdlib_init(); ///< @see apps/lib/stdlibc/stdlib.c
29 void _libmeinos_init(); ///< @see apps/lib/libmeinos/misc.c
31 void _start() {
32 char *backup_argv[] = { NULL };
33 char **argv = backup_argv;
34 int argc = 0;
36 // initialize libs
37 _stdlib_init();
38 _libmeinos_init();
40 // get process data
41 int var = syscall_call(SYSCALL_PROC_GETVAR,1,getpid());
42 if (var!=-1) proc_unpack_procdata(var,&argc,&argv);
44 /*if (var!=-1) {
45 _process_data = shmat(var,NULL,0);
46 if (_process_data!=NULL) get_cmdline(_process_data,&argv,&argc,&_stdin,&_stdout,&_stderr);
48 else _process_data = NULL;
50 // post initialize stdlibc
51 _stdlib_init_post(_stdin,_stdout,_stderr);
52 atexit(crt0_quit);*/
54 // call main function and exit
55 exit(main(argc,argv));
57 while (1);