Exemplo n.º 1
0
/* Initialize GPU kernel */
void si_emu_init()
{
	/* Register architecture */
	si_emu_arch = arch_list_register("SouthernIslands", "si");
	si_emu_arch->sim_kind = si_emu_sim_kind;

	/* Open report file */
	if (*si_emu_report_file_name)
	{
		si_emu_report_file = file_open_for_write(si_emu_report_file_name);
		if (!si_emu_report_file)
			fatal("%s: cannot open report for Southern Islands emulator",
				si_emu_report_file_name);
	}

	/* Initialize */
	si_emu = xcalloc(1, sizeof(struct si_emu_t));
	si_emu->timer = m2s_timer_create("Southern Islands GPU Timer");
	si_emu->global_mem = mem_create();
	si_emu->global_mem->safe = 0;

	/* CB0 and CB1 are going to map to the beginning of the virtual address space */
	si_emu->global_mem_top = GLOBAL_MEMORY_START;

	/* Initialize disassembler (decoding tables...) */
	si_disasm_init();

	/* Initialize ISA (instruction execution tables...) */
	si_isa_init();

	/* Initialize OpenCL objects */
	si_emu->opencl_repo = si_opencl_repo_create();
	si_emu->opencl_platform = si_opencl_platform_create();
	si_emu->opencl_device = si_opencl_device_create();
}
Exemplo n.º 2
0
void EmuCreate(Emu *self, char *name)
{
	/* Initialize */
	self->name = xstrdup(name);
	self->timer = m2s_timer_create(name);

	/* Virtual functions */
	asObject(self)->Dump = EmuDump;
}
Exemplo n.º 3
0
Arquivo: emu.c Projeto: ajithcj/miaow
void x86_emu_init(void)
{
	union
	{
		unsigned int as_uint;
		unsigned char as_uchar[4];
	} endian;

	/* Endian check */
	endian.as_uint = 0x33221100;
	if (endian.as_uchar[0])
		fatal("%s: host machine is not little endian", __FUNCTION__);

	/* Register architecture */
	x86_emu_arch = arch_list_register("x86", "x86");
	x86_emu_arch->sim_kind = x86_emu_sim_kind;

	/* Host types */
	M2S_HOST_GUEST_MATCH(sizeof(long long), 8);
	M2S_HOST_GUEST_MATCH(sizeof(int), 4);
	M2S_HOST_GUEST_MATCH(sizeof(short), 2);

	/* Initialization */
	x86_sys_init();
	x86_isa_init();

	/* Create */
	x86_emu = xcalloc(1, sizeof(struct x86_emu_t));

	/* Event for context IPC reports */
	EV_X86_CTX_IPC_REPORT = esim_register_event_with_name(x86_ctx_ipc_report_handler, "x86_ctx_ipc_report");

	/* Initialize */
	x86_emu->current_pid = 1000;  /* Initial assigned pid */
	x86_emu->timer = m2s_timer_create("x86 emulation timer");
	
	/* Initialize mutex for variables controlling calls to 'x86_emu_process_events()' */
	pthread_mutex_init(&x86_emu->process_events_mutex, NULL);

	/* Initialize GPU emulators */
	x86_emu->gpu_kind = x86_emu_gpu_evergreen;

#ifdef HAVE_OPENGL
	/* GLUT */
	x86_glut_init();
#endif

	/* OpenGL */
	x86_opengl_init();
}
Exemplo n.º 4
0
void esim_init()
{
	/* Create structures */
	esim_event_info_list = list_create();
	esim_event_heap = heap_create(20);
	esim_end_event_list = linked_list_create();
	
	/* List of frequency domains */
	esim_domain_list = list_create();
	list_add(esim_domain_list, NULL);

	/* Initialize global timer */
	esim_timer = m2s_timer_create(NULL);
	m2s_timer_start(esim_timer);

	/* Register special events */
	ESIM_EV_INVALID = esim_register_event_with_name(NULL, 0, "Invalid");
	ESIM_EV_NONE = esim_register_event_with_name(NULL, 0, "None");
}