⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 startup.c

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 C
字号:
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h>

#include "sys/wcetrace.h"
#include "sys/io.h"

//////////////////////////////////////////////////////////////////////

#if 0
#define MAXEXITFUNCS 20

typedef void (*PEXITFUNC)(void);

static PEXITFUNC exittab[MAXEXITFUNCS];
static int nexits;

// Code in import wrapper stores pr here. r12 points to it.
long _prstack[10];
long *_prstackp = &_prstack[9];
#endif

//////////////////////////////////////////////////////////////////////

static jmp_buf exitjmp;
static int exitcode;

//////////////////////////////////////////////////////////////////////

void
abort(void)
{
  longjmp(exitjmp, 1);
}

int
_exit(int code)
{
  exitcode = code;

  longjmp(exitjmp, 1);
}

/*
 * The current thinking here is that we will set up this default environment
 * block.  WCESYS can override this by setting the `environ' pointer to the 
 * shared memory segment it manages
 */

#define ENV_LEN  (64)
char *__env[ENV_LEN];
char **environ = __env;

int
_startup()
{
  WCETRACESET(WCE_IO);
  _initfds();

  /* Initialize environment block */
  memset(__env, 0, sizeof(char *) * ENV_LEN);  

#if 1
  if(setjmp(exitjmp) == 0)
#endif
    exitcode = main();

#if 0
  _do_exit();
#endif

#if 0
  debugprint(L"exitcode %d", exitcode);
#endif

  return exitcode;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -