Ejemplo n.º 1
0
static void init_primary_helper(uint32_t pageable_part, uint32_t nsec_entry)
{
	/*
	 * Mask asynchronous exceptions before switch to the thread vector
	 * as the thread handler requires those to be masked while
	 * executing with the temporary stack. The thread subsystem also
	 * asserts that IRQ is blocked when using most if its functions.
	 */
	thread_set_exceptions(THREAD_EXCP_ALL);
	init_vfp_sec();

	init_runtime(pageable_part);

	IMSG("Initializing (%s)\n", core_v_str);

	thread_init_primary(generic_boot_get_handlers());
	thread_init_per_cpu();
	init_sec_mon(nsec_entry);


	main_init_gic();
	init_vfp_nsec();

	if (init_teecore() != TEE_SUCCESS)
		panic();
	DMSG("Primary CPU switching to normal world boot\n");
}
Ejemplo n.º 2
0
bool codegen(ast_t* program, pass_opt_t* opt)
{
  if(opt->verbosity >= VERBOSITY_MINIMAL)
    fprintf(stderr, "Generating\n");

  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  genned_strings_init(&c.strings, 64);
  ffi_decls_init(&c.ffi_decls, 64);

  if(!init_module(&c, program, opt))
    return false;

  init_runtime(&c);
  genprim_reachable_init(&c, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}
Ejemplo n.º 3
0
int main(int argc, char **argv) {
  init_runtime();

  //env_dump(globals);
  //symtab_dump();

  printf("\nREADER TEST:\n");
  value_prn(reader_read("   135   "));
  value_prn(reader_read("   -35   "));
  value_prn(reader_read("   foo'bah  "));
  value_prn(reader_read("  [1 23 4]"));
  value_prn(reader_read("  [1 23 4 55 six 7 eight]"));
  value_prn(reader_read("  'barf  "));
  value_prn(reader_read("  [1 23 [4 55 'six 7] \"eight\" 9]"));
  value_prn(reader_read("  {foo=bar baz=\"barf\" zoo=1221}"));

/* Output expected:
READER TEST:
135
-35
foo'bah
[1 23 4]
[1 23 4 55 six 7 eight]
[quote barf]
[1 23 [4 55 [quote six] 7] eight 9]
{foo=bar baz=barf zoo=1221}
*/

  return 0;
}
Ejemplo n.º 4
0
Archivo: codegen.c Proyecto: dckc/ponyc
bool codegen(ast_t* program, pass_opt_t* opt)
{
  printf("Generating\n");
  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  init_module(&c, program, opt);
  init_runtime(&c);
  genprim_builtins(&c);

  // Emit debug info for this compile unit.
  dwarf_init(&c.dwarf, c.opt, c.builder, c.target_data, c.module);
  dwarf_compileunit(&c.dwarf, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}
Ejemplo n.º 5
0
Archivo: vm.c Proyecto: hellcoderz/vm
int main (int argc, char const *argv[]) {
  void *literals[] = {
    (void *) "the answer is:",
    (void *) "print",
    (void *) 30,
    (void *) 2
  };
  
  byte instructions[] = {
    PUSH_SELF,
    PUSH_STRING, 0,
    CALL,        1, 1,
    PUSH_NUMBER, 2,
    PUSH_NUMBER, 3,
    ADD,
    SET_LOCAL,   0,
    PUSH_BOOL,   0,
    JUMP_UNLESS, 6,
    PUSH_SELF,
    GET_LOCAL,   0,
    CALL,        1, 1,
    RETURN
  };
  
  init_runtime();
  run(literals, instructions);
  destroy_runtime();
  
  return 0;
}
Ejemplo n.º 6
0
/**
 * Function for getting free/busy information.
 * @param result A pointer to struct _response where the result is to stored.
 * @see response. Caller is responsible for freeing the memory.
 * @param start time_t variable specifying start and end for range. Both
 * are included in range.
 * @param end time_t variable specifying start and end for range. Both
 * are included in range.
 * @param URL Defines CalDAV resource. Receiver is responsible for freeing
 * the memory. [http://][username[:password]@]host[:port]/url-path.
 * See (RFC1738).
 * @return Ok, FORBIDDEN, or CONFLICT. @see CALDAV_RESPONSE
 */
CALDAV_RESPONSE caldav_get_freebusy(response *result,
				  time_t start,
				  time_t end,
				  const char* URL,
				  runtime_info* info) {
	caldav_settings settings;
	CALDAV_RESPONSE caldav_response;

	g_return_val_if_fail(info != NULL, TRUE);

	init_runtime(info);
	if (!result) {
		result = malloc(sizeof(response *));
		memset(result, '\0', sizeof(response *));
	}
	init_caldav_settings(&settings);
	settings.ACTION = FREEBUSY;
	settings.start = start;
	settings.end = end;
	if (info->options->debug)
		settings.debug = TRUE;
	else
		settings.debug = FALSE;
	if (info->options->trace_ascii)
		settings.trace_ascii = 1;
	else
		settings.trace_ascii = 0;
	if (info->options->use_locking)
		settings.use_locking = 1;
	else
		settings.use_locking = 0;
	parse_url(&settings, URL);
	gboolean res = make_caldav_call(&settings, info);
	if (res) {
		result->msg = NULL;
		if (info->error->code > 0) {
			switch (info->error->code) {
				case 403: caldav_response = FORBIDDEN; break;
				case 409: caldav_response = CONFLICT; break;
				case 423: caldav_response = LOCKED; break;
				case 501: caldav_response = NOTIMPLEMENTED; break;
				default: caldav_response = CONFLICT; break;
			}
		}
		else {
			/* fall-back to conflicting state */
			caldav_response = CONFLICT;
		}
	}
	else {
		result->msg = g_strdup(settings.file);
		caldav_response = OK;
	}
	free_caldav_settings(&settings);
	return caldav_response;
}
Ejemplo n.º 7
0
Archivo: vm.c Proyecto: napile/vm
int main (int argc, char const *argv[]) {
  void *literals[] = LITERALS;
  byte instructions[] = INSTRUCTIONS;
  
  init_runtime();
  run(literals, instructions);
  destroy_runtime();
  
  return 0;
}
Ejemplo n.º 8
0
bool codegen_gen_test(compile_t* c, ast_t* program, pass_opt_t* opt,
  pass_id last_pass)
{
  if(last_pass < PASS_REACH)
  {
    memset(c, 0, sizeof(compile_t));

    genned_strings_init(&c->strings, 64);
    ffi_decls_init(&c->ffi_decls, 64);

    if(!init_module(c, program, opt))
      return false;

    init_runtime(c);
    genprim_reachable_init(c, program);

    const char* main_actor = c->str_Main;
    const char* env_class = c->str_Env;

    ast_t* package = ast_child(program);
    ast_t* main_def = ast_get(package, main_actor, NULL);

    if(main_def == NULL)
      return false;

    ast_t* main_ast = type_builtin(opt, main_def, main_actor);
    ast_t* env_ast = type_builtin(opt, main_def, env_class);

    if(lookup(opt, main_ast, main_ast, c->str_create) == NULL)
      return false;

    reach(c->reach, main_ast, c->str_create, NULL, opt);
    reach(c->reach, env_ast, c->str__create, NULL, opt);
    reach_done(c->reach, c->opt);
  }

  if(opt->limit == PASS_REACH)
    return true;

  if(last_pass < PASS_PAINT)
    paint(&c->reach->types);

  if(opt->limit == PASS_PAINT)
    return true;

  if(!gentypes(c))
    return false;

  return true;
}
Ejemplo n.º 9
0
/**
 * Function for modifying a task.
 * @param object Appointment following ICal format (RFC2445). Receiver is
 * responsible for freeing the memory.
 * @param URL Defines CalDAV resource. Receiver is responsible for freeing
 * the memory. [http://][username[:password]@]host[:port]/url-path.
 * See (RFC1738).
 * @return Ok, FORBIDDEN, or CONFLICT. @see CALDAV_RESPONSE
 */
CALDAV_RESPONSE caldav_tasks_modify_object(const char* object,
				     const char* URL,
				     runtime_info* info) {
	caldav_settings settings;
	CALDAV_RESPONSE caldav_response;

	g_return_val_if_fail(info != NULL, TRUE);

	init_runtime(info);
	init_caldav_settings(&settings);
	settings.file = g_strdup(object);
	settings.ACTION = MODIFYTASKS;
	if (info->options->debug)
		settings.debug = TRUE;
	else
		settings.debug = FALSE;
	if (info->options->trace_ascii)
		settings.trace_ascii = 1;
	else
		settings.trace_ascii = 0;
	if (info->options->use_locking)
		settings.use_locking = 1;
	else
		settings.use_locking = 0;
	parse_url(&settings, URL);
	gboolean res = make_caldav_call(&settings, info);
	if (res) {
		if (info->error->code > 0) {
			switch (info->error->code) {
				case 403: caldav_response = FORBIDDEN; break;
				case 409: caldav_response = CONFLICT; break;
				case 423: caldav_response = LOCKED; break;
				case 501: caldav_response = NOTIMPLEMENTED; break;
				default: caldav_response = CONFLICT; break;
			}
		}
		else {
			/* fall-back to conflicting state */
			caldav_response = CONFLICT;
		}
	}
	else {
		caldav_response = OK;
	}
	free_caldav_settings(&settings);
	return caldav_response;
}
Ejemplo n.º 10
0
SMC::SMC ()
{
    if (!initialized) {

	init_runtime();

	init_stencil();

	init_chemistry();

	init_variables();

	initialized = true;
    }

    build_multifabs();

    init_from_scratch();

    wt_fb1 = wt_fb2 = wt_chem1 = wt_chem2 = wt_hypdiff = 0.0;
}
Ejemplo n.º 11
0
/**
 * Function to test wether a calendar resource is CalDAV enabled or not.
 * @param URL Defines CalDAV resource. Receiver is responsible for
 * freeing the memory. [http://][username[:password]@]host[:port]/url-path.
 * See (RFC1738).
 * @result 0 (zero) means no CalDAV support, otherwise CalDAV support
 * detechted.
 */
int caldav_enabled_resource(const char* URL, runtime_info* info) {
	CURL* curl;
	caldav_settings settings;
	struct config_data data;

	g_return_val_if_fail(info != NULL, TRUE);

	init_runtime(info);
	init_caldav_settings(&settings);

	parse_url(&settings, URL);
	curl = get_curl(&settings);
	if (!curl) {
		info->error->code = -1;
		info->error->str = g_strdup("Could not initialize libcurl");
		settings.file = NULL;
		return TRUE;
	}

	if (info->options->trace_ascii)
		data.trace_ascii = 1;
	else
		data.trace_ascii = 0;
	if (info->options->use_locking)
		settings.use_locking = 1;
	else
		settings.use_locking = 0;

	if (info->options->debug) {
		curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, my_trace);
		curl_easy_setopt(curl, CURLOPT_DEBUGDATA, &data);
		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
	}
	gboolean res = test_caldav_enabled(curl, &settings, info->error);
	free_caldav_settings(&settings);
	curl_easy_cleanup(curl);
	return (res && (info->error->code == 0 || info->error->code == 200)) ? 1 : 0;
}
Ejemplo n.º 12
0
bool codegen(ast_t* program, pass_opt_t* opt)
{
  PONY_LOG(opt, VERBOSITY_MINIMAL, ("Generating\n"));

  pony_mkdir(opt->output);

  compile_t c;
  memset(&c, 0, sizeof(compile_t));

  init_module(&c, program, opt);
  init_runtime(&c);
  genprim_reachable_init(&c, program);

  bool ok;

  if(c.opt->library)
    ok = genlib(&c, program);
  else
    ok = genexe(&c, program);

  codegen_cleanup(&c);
  return ok;
}