Ejemplo n.º 1
0
int init_memory(unsigned long arg1){
	unsigned long virt_real_start_addr,virt_start_addr,virt_end_addr;
	unsigned long pc_size;
	unsigned long current_end_memused=&end; /* till this point memory is used*/

	unsigned long phy_end_addr = g_phy_mem_size;
	ut_log("	Initializing memory phy_endaddr : %x  current end:%x symbols_end:%x\n",phy_end_addr,current_end_memused,symbols_end);
	if (symbols_end != 0){
		current_end_memused = symbols_end;
	}

	virt_start_addr=initialise_paging_new(phy_end_addr, current_end_memused,&virt_real_start_addr,&virt_end_addr);
	INIT_LOG("	After Paging initialized Virtual start_addr: %x virtual endaddr: %x  current end:%x virtualreal_start:%x\n",virt_start_addr,virt_end_addr,current_end_memused,virt_real_start_addr);
	INIT_LOG("	code+data  : %x  -%x size:%dK",&_start,&_end);
	INIT_LOG("	free area  : %x - %x size:%dM\n",virt_start_addr,virt_end_addr,(virt_end_addr-virt_start_addr)/1000000);
	virt_start_addr=init_free_area( virt_start_addr, virt_end_addr);

	pc_size = g_pagecache_size ;
	pc_init((unsigned char *)virt_start_addr,pc_size);
	ut_log("	pagecache  : %x - %x size:%dM",virt_start_addr,virt_start_addr+pc_size,pc_size/1000000);

	virt_start_addr=virt_start_addr+pc_size;

#if 0 /* reserve the test memory for testing */
	if (virt_end_addr > (virt_start_addr + (600*1024*1024))){
	test_mem_start = virt_start_addr;
	test_mem_end  = virt_start_addr + 512 *1024 *1204 ; /* 512M */
	virt_start_addr =  test_mem_end + 4096;
	}
#endif

	init_mem(virt_start_addr, virt_end_addr, virt_real_start_addr);
	INIT_LOG("		buddy pages: %x - %x size:%dM\n",virt_start_addr, virt_end_addr,(virt_end_addr-virt_start_addr)/1000000);
	return JSUCCESS;
}
Ejemplo n.º 2
0
/* For the Windows platform, this is the start of the application. */
int WINAPI
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpszArg, int nCmdShow)
{
    wchar_t **argw = NULL;
    int	argc, i;

    /* Set this to the default value (windowed mode). */
    video_fullscreen = 0;

    /* We need this later. */
    hinstance = hInst;

    /* Set the application version ID string. */
    sprintf(emu_version, "%s v%s", EMU_NAME, EMU_VERSION);

#ifdef USE_CRASHDUMP
    /* Enable crash dump services. */
    InitCrashDump();
#endif

    /* First, set our (default) language. */
    set_language(0x0409);

    /* Create console window. */
    CreateConsole(1);

    /* Process the command line for options. */
    argc = ProcessCommandLine(&argw);

    /* Pre-initialize the system, this loads the config file. */
    if (! pc_init(argc, argw)) {
	/* Detach from console. */
	CreateConsole(0);
	return(1);
    }

    /* Cleanup: we may no longer need the console. */
    if (! force_debug)
	CreateConsole(0);

    /* Handle our GUI. */
    i = ui_init(nCmdShow);

    return(i);
}
Ejemplo n.º 3
0
/**
 * Initialize the decoder and player core, including the music pipe.
 */
static void
initialize_decoder_and_player(void)
{
	const struct config_param *param;
	char *test;
	size_t buffer_size;
	float perc;
	unsigned buffered_chunks;
	unsigned buffered_before_play;

	param = config_get_param(CONF_AUDIO_BUFFER_SIZE);
	if (param != NULL) {
		buffer_size = strtol(param->value, &test, 10);
		if (*test != '\0' || buffer_size <= 0)
			g_error("buffer size \"%s\" is not a positive integer, "
				"line %i\n", param->value, param->line);
	} else
		buffer_size = DEFAULT_BUFFER_SIZE;

	buffer_size *= 1024;

	buffered_chunks = buffer_size / CHUNK_SIZE;

	if (buffered_chunks >= 1 << 15)
		g_error("buffer size \"%li\" is too big\n", (long)buffer_size);

	param = config_get_param(CONF_BUFFER_BEFORE_PLAY);
	if (param != NULL) {
		perc = strtod(param->value, &test);
		if (*test != '%' || perc < 0 || perc > 100) {
			g_error("buffered before play \"%s\" is not a positive "
				"percentage and less than 100 percent, line %i",
				param->value, param->line);
		}
	} else
		perc = DEFAULT_BUFFER_BEFORE_PLAY;

	buffered_before_play = (perc / 100) * buffered_chunks;
	if (buffered_before_play > buffered_chunks)
		buffered_before_play = buffered_chunks;

	pc_init(buffered_chunks, buffered_before_play);
}