16,6 → 16,9 |
#include <stdint.h> |
#include <stdlib.h> |
#include <string.h> |
#include <stdio.h> |
#include <sys/kos_io.h> |
|
#include "cpu_features.h" |
|
|
51,8 → 54,6 |
} |
|
void __main (){}; |
|
|
void init_reent(); |
|
void __attribute__((noreturn)) |
73,11 → 74,26 |
_exit(retval); |
}; |
|
struct app_hdr |
{ |
char banner[8]; |
int version; |
int start; |
int iend; |
int memsize; |
int stacktop; |
char *cmdline; |
char *path; |
}; |
|
|
void __attribute__((noreturn)) |
__crt_startup (void) |
{ |
int nRet; |
struct app_hdr *header; |
|
|
init_reent(); |
|
/* |
89,12 → 105,12 |
__initPOSIXHandles(); |
|
__appcwdlen = strrchr(&__pgmname, '/') - &__pgmname + 1; |
|
__appcwdlen = __appcwdlen > 1023 ? 1023 : __appcwdlen; |
|
strncpy(__appcwd, &__pgmname, __appcwdlen); |
memcpy(__appcwd, &__pgmname, __appcwdlen); |
__appcwd[__appcwdlen] = 0; |
|
set_cwd(__appcwd); |
|
arg[0] = &__pgmname; |
|
if( __cmdline != 0) |
113,6 → 129,7 |
*/ |
// _mingw32_init_fmode (); |
|
|
nRet = main (_argc, _argv, NULL); |
|
/* |
119,7 → 136,7 |
* Perform exit processing for the C library. This means |
* flushing output and calling 'atexit' registered functions. |
*/ |
_exit (nRet); |
exit (nRet); |
} |
|
|