cynix

x86 UNIX-like OS
git clone git://git.2f30.org/cynix
Log | Files | Refs | README | LICENSE

crt0.c (356B)


      1 extern int main(int argc, char **argv);
      2 extern void _init_signal(void);
      3 
      4 #define sys_exit(status) \
      5 	({ \
      6 		int __num = 1, err_code = status; \
      7 		asm volatile ("int $0x80" :: "a"(__num), "b"(err_code)); \
      8 	})
      9 
     10 static char *argv[] = { "arg0", (char *)0 };
     11 
     12 void
     13 _start(void)
     14 {
     15 	int ret;
     16 
     17 	_init_signal();
     18 	ret = main(1, argv);
     19 	sys_exit(ret);
     20 	for (;;);
     21 }
     22