Esempio 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();
}
Esempio n. 2
0
File: emu.c Progetto: ajithcj/miaow
void frm_emu_init(void)
{
	/* Register architecture */
	frm_emu_arch = arch_list_register("Fermi", "frm");
	frm_emu_arch->sim_kind = frm_emu_sim_kind;

        /* Allocate */
        frm_emu = xcalloc(1, sizeof(struct frm_emu_t));
        if (!frm_emu)
                fatal("%s: out of memory", __FUNCTION__);

        /* Initialize */
        frm_emu->const_mem = mem_create();
        frm_emu->const_mem->safe = 0;
        frm_emu->global_mem = mem_create();
        frm_emu->global_mem->safe = 0;
        frm_emu->total_global_mem_size = 1 << 31; /* 2GB */
        frm_emu->free_global_mem_size = frm_emu->total_global_mem_size;
        frm_emu->global_mem_top = 0;

	frm_disasm_init();
	frm_isa_init();

        /* Create device */
        frm_cuda_object_list = linked_list_create();
        frm_cuda_device_create();
}
Esempio n. 3
0
File: emu.c Progetto: 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();
}