Example #1
0
void main (int argc, char *argv[])
{
  CORBA_Server_Environment env = dice_default_server_environment;
  l4dm_dataspace_t ds;
  l4_threadid_t pager;
  l4_addr_t addr;
  l4_size_t size;
  int  rc, t;
  int  is_int = 0;
  int  value_int = 0;
  char buf[0x1000];
  char *p = buf;
  int optionid;
  int opt = 0;
  const struct option long_options[] =
                {
                { "events",      no_argument, NULL, 'e'},
		{ 0, 0, 0, 0}
                };

  //init_globals();

  if (!names_register("os2exec"))
    {
      LOG("Error registering on the name server!");
      return;
    }

  if (!names_waitfor_name("os2srv", &os2srv, 30000))
    {
      LOG("os2srv not found on name server!");
      return;
    }

  if (!names_waitfor_name("os2fs", &fs, 30000))
    {
      LOG("os2fs not found on name server!");
      return;
    }
  LOG("os2fs tid:%x.%x", fs.id.task, fs.id.lthread);

  if (!names_waitfor_name("LOADER", &loader, 30000))
    {
      LOG("LOADER not found on name server!");
      return;
    }

  execsrv = l4_myself();

  // Parse command line arguments
  for (;;)
  {
    opt = getopt_long(argc, argv, "e", long_options, &optionid);
    if (opt == -1) break;
    switch (opt)
    {
      case 'e':
        LOG("using events server");
	use_events = 1;
	break;
      
      default:
        LOG("Error: Unknown option %c", opt);
        usage();
        return;
    }
  }

  // start events thread
  if (use_events)
  {
    // start events thread
    l4thread_create(event_thread, 0, L4THREAD_CREATE_ASYNC);
    LOG("event thread started");
  }

  /* reserve the area below 64 Mb for application private code
     (not for use by libraries, loaded by execsrv) */
  addr = 0x2f000; size = 0x04000000 - addr;
  if ((rc  = l4rm_direct_area_setup_region(addr,
					   size,
					   L4RM_DEFAULT_REGION_AREA,
					   L4RM_REGION_BLOCKED, 0,
					   L4_INVALID_ID)) < 0)
    {
      LOG_printf("main(): setup region %x-%x failed (%d)!\n",
	  addr, addr + size, rc);
      l4rm_show_region_list();
      enter_kdebug("PANIC");
    }
  memset (&options, 0, sizeof(options));

#if 0
  if (!CfgGetopt("debugmodmgr", &is_int, &value_int, (char **)&p))
    if (is_int)
      options.debugmodmgr = value_int;

  if (!CfgGetopt("debugixfmgr", &is_int, &value_int, (char **)&p))
    if (is_int)
      options.debugixfmgr = value_int;

  if (!CfgGetopt("libpath", &is_int, &value_int, (char **)&p))
    if (!is_int)
    {
      options.libpath = (char *)malloc(strlen(p) + 1);
      strcpy(options.libpath, p);
    }

  LOG("debugmodmgr=%d", options.debugmodmgr);
  LOG("debugixfmgr=%d", options.debugixfmgr);
  LOG("libpath=%s", options.libpath);
#endif
  options.libpath = (char *)malloc(4);
  strcpy(options.libpath, "c:\\");

  /* get our l4env infopage as a dataspace */
  rc = l4loader_app_info_call(&loader, l4_myself().id.task,
                              0, &p, &ds, &env);
  /* attach it */  
  attach_ds(&ds, L4DM_RO, &infopage);

#if 0
  /* load shared libs */
  rc = loadso();
  if (rc)
  {
    LOG("Error loading shared libraries");
    return;
  }
#endif

  init_memmgr(&root_area);

  /* load IXF's */
  rc = load_ixfs();
  if (rc)
  {
    LOG("Error loading IXF driver");
    return;
  }
			      
  /* Initializes the module list. Keeps info about which dlls an process have loaded and
     has linked to it (Only support for LX dlls so far). The head of the linked list is
     declared as a global inside dynlink.c */
  rc = ModInitialize();
  if (rc)
  {
    LOG("Can't initialize module manager");
    return;
  }

  // server loop
  LOG("execsrv started.");
  env.malloc = (dice_malloc_func)malloc;
  env.free = (dice_free_func)free;
  os2exec_server_loop(&env);
}
Example #2
0
/*
 * Initialize sequence before T-Kernel starts
 */
EXPORT ER init_system( void )
{
	ER	ercd;

	/* Platform dependent initialize sequence */
	DispProgress(0x10);
	ercd = init_device();
	if ( ercd < E_OK ) {
		goto err_ret;
	}

	/* Initialize subsystem */
	DispProgress(0x11);
	ercd = init_subsystems();
	if ( ercd < E_OK ) {
		goto err_ret;
	}

	/* Initialize segment manager */
	DispProgress(0x12);
	ercd = init_segmgr();
	if ( ercd < E_OK ) {
		goto err_ret;
	}
#ifdef _BTRON_
	ercd = init_bk_early();
	if (ercd < E_OK) {
		vd_printf("error init_bk_early\n");
		goto err_ret;
	}

#endif
	/* Initialize memory manager */
	DispProgress(0x13);
	ercd = init_memmgr();
	if ( ercd < E_OK ) {
		goto err_ret;
	}

#ifdef _BTRON_
	/* Initialize slab allocator */
	DispProgress(0x14);
	ercd = init_slab_allocator();
	if ( ercd < E_OK ) {
		vd_printf("init_slab_allocator\n");
		goto err_ret;
	}
	
	/* Initialize bk */
	DispProgress(0x15);
	ercd = init_bk();
	if ( ercd < E_OK ) {
		vd_printf("init_bk\n");
		goto err_ret;
	}
#else
	/* Initialize Imalloc */
	DispProgress(0x14);
	ercd = init_Imalloc();
	if ( ercd < E_OK ) {
		goto err_ret;
	}
#endif

	return(ercd);

err_ret:
#if USE_KERNEL_MESSAGE
	tm_putstring((UB*)"!ERROR! init_kernel\n");
#endif
	//tm_monitor(); /* Stop */
	return(ercd);
}
Example #3
0
/*
 * Initialize sequence before T-Kernel starts
 */
EXPORT void init_system( void )
{
	ER	ercd;

	/* if i'm first processor, execution */
	if ( get_prid() == 0 ) {
		/* Platform dependent initialize sequence */
		DispProgress(0x10);
		ercd = init_device();
		if ( ercd < E_OK ) {
			goto err_ret;
		}

		/* Initialize subsystem */
		DispProgress(0x11);
		ercd = init_subsystems();
		if ( ercd < E_OK ) {
			goto err_ret;
		}

		/* Initialize segment manager */
		DispProgress(0x12);
		ercd = init_segmgr();
		if ( ercd < E_OK ) {
			goto err_ret;
		}

		/* Initialize memory manager */
		DispProgress(0x13);
		ercd = init_memmgr();
		if ( ercd < E_OK ) {
			goto err_ret;
		}

		/* Initialize Imalloc */
		DispProgress(0x14);
		ercd = init_Imalloc();
		if ( ercd < E_OK ) {
			goto err_ret;
		}
	} else {
		/* Platform dependent initialize sequence */
		DispProgress(0x10);
		ercd = init_device();
		if ( ercd < E_OK ) {
			goto err_ret;
		}

		/* Initialize segment manager */
		DispProgress(0x12);
		ercd = init_segmgr();
		if ( ercd < E_OK ) {
			goto err_ret;
		}
	}

	return;

err_ret:
#if USE_KERNEL_MESSAGE
	tm_putstring((UB*)"!ERROR! init_kernel\n");
#endif
	tm_monitor(); /* Stop */
}