Exemplo n.º 1
0
/*void DPMI_init(DWORD cs, char *cmdline) */
void DPMI_init(process_info_t *pi)
{
  char **argv;
  int argc = fd32_get_argv(pi->filename, pi->args, &argv);

  use_lfn = 1;
#ifdef ENABLE_BIOSVGA
  use_biosvga = 0;
#endif
  use_biosmouse = 0;

  /* Default use direct dos_exec, only support COFF-GO32 */
  dos_exec_switch(DOS_DIRECT_EXEC);

  if (argc > 1) {
    int c, option_index = 0;
    message("DPMI Init: command line\n");
    /* Parse the command line */
    for ( ; (c = getopt_long (argc, argv, "X:", dpmi_options, &option_index)) != -1; ) {
      switch (c) {
        case 0:
          use_lfn = 0;
          message("LFN disabled\n");
          break;
#ifdef ENABLE_BIOSVGA
        case 1:
          use_biosvga = 1;
          message("BIOS vga enabled\n");
          break;
#endif
        case 'X':
          if (strcmp(optarg, "vm86") == 0)
            dos_exec_switch(DOS_VM86_EXEC);
          else if (strcmp(optarg, "direct") == 0)
            dos_exec_switch(DOS_DIRECT_EXEC);
          else if (strcmp(optarg, "wrapper") == 0)
            dos_exec_switch(DOS_WRAPPER_EXEC);
          break;
        default:
          break;
      }
    }
  }
  fd32_unget_argv(argc, argv);

#ifdef ENABLE_DIRECTBIOS
  fd32_enable_real_mode_int(0x11); /* Get BIOS equipment list */
  fd32_enable_real_mode_int(0x15); /* PS BIOS interface */
  fd32_enable_real_mode_int(0x1A); /* PCI BIOS interface */
  fd32_enable_real_mode_int(0x6d); /* VIDEO BIOS entry point */
#else
  l1_int_bind(0x11, chandler);
  l1_int_bind(0x15, chandler);
  l1_int_bind(0x1A, chandler);
  fd32_enable_real_mode_int(0x6d);
#endif

  l1_int_bind(0x10, chandler);
  l1_int_bind(0x16, chandler);
  l1_int_bind(0x21, chandler);
  l1_int_bind(0x25, chandler);
  l1_int_bind(0x2A, chandler); /* Network */
  l1_int_bind(0x2F, chandler);
  l1_int_bind(0x31, chandler);
  l1_int_bind(0x33, chandler);

  _mousebios_init();
  _vga_init();
  _drive_init();

  x86_get_cpu(&cpu);
  message("DPMI installed.\n");
}
Exemplo n.º 2
0
/**
 * Initializes the gl library and the vga devices. Then initializes all of the 
 * memory required for the window manager, and sets all default values.
 * 
 */
void _win_man_init( void ) {
	int i = 0;
	int j = 0;
	void* bPtrOffset = 0;
	int dW, dH = 0;
	int x, y;
	Uint32 s_arr_size, buff_size;
	
	_vga_init();
	
	//setup the memory for the arrays and 
	// this module
	wm_memory = (void *)( 0x20000000 );
	//array of screen_infos
	screen_info_arr = (screen_info *)( ((Uint32)wm_memory) + WIN_MAN_MEM );

	//get screen info
	dW = vga_mode_info->XResolution / 2;
	dH = vga_mode_info->YResolution / 2;
	
	//begining of buffers
	s_arr_size = (DEFAULT_SCREENS) * sizeof( struct screen_info ); 
	buff_size  = (DEFAULT_SCREENS) * dH * dW * 4;

	bPtrOffset = (void *)((Uint32)screen_info_arr + s_arr_size );
	_vmeml2_static_address( (Uint32) _vga_get_start_mem(), (Uint32) _vga_get_end_mem(), TRUE );
	_vmeml2_static_address( ( (Uint32) wm_memory ), (Uint32) ( (Uint32) wm_memory ) + s_arr_size + buff_size + WIN_MAN_MEM , TRUE ); 

	_gl_init();
	
//	c_printf("\n%x %x\n", (Uint32) _vga_get_start_mem(), (Uint32) _vga_get_end_mem() );
//	c_printf("\n%x %x\n", ( (Uint32) wm_memory ), (Uint32) ( (Uint32) wm_memory ) + buff_size + s_arr_size + WIN_MAN_MEM);

//	c_printf("\nscrn: %x bOff: %x \n", screen_info_arr, bPtrOffset);
	//fill out the default screens [[ * vga_mode_info->LinbytesPerScanLine)/8) ]]
	for(i = 0; i < DEFAULT_SCREENS; i++) {
		screen_info_arr[i].buf_num = i;
		screen_info_arr[i].w = dW;
		screen_info_arr[i].h = dH;
		screen_info_arr[i].bPtr = (Uint32 *)(((Uint32)bPtrOffset) + (( i * dH * dW * 4 )));
		screen_info_arr[i].pid = 0;
		screen_info_arr[i].active = 0;
		screen_info_arr[i].blocking = 0;
		screen_info_arr[i].dirty = 1; //default dirty
		//gl_print stuff
		screen_info_arr[i].x_max = dW / FONT_WIDTH;
		screen_info_arr[i].y_max = (dH / FONT_HEIGHT)-1;
		screen_info_arr[i].curr_x = 0;
		screen_info_arr[i].curr_y = 0;
		screen_info_arr[i].buf_x = 0;
		for(y = 0; y < 200; y++){
			for(x = 0; x < 200; x++)
				screen_info_arr[i].lines[y][x] = '\0';
		}
		#ifdef WM_DEBUG
		c_printf("%d  - %x || ", i,  screen_info_arr[i].bPtr);
		#endif
	}
	//c_printf("%x %x %x %x size_struct:%x \n",  screen_info_arr[0].bPtr, buff_size, s_arr_size, WIN_MAN_MEM, sizeof( struct screen_info ));
	//clear buffer mem
	_kmemclr(screen_info_arr[0].bPtr, buff_size );
	
	#ifdef WM_DEBUG
	c_printf("\n-Total Memory(B): %d blocks(x64KB), %d\n", vga_vesa_info->TotalMemory, (vga_vesa_info->TotalMemory * 64)*1024);
	for(i = 0; i < DEFAULT_SCREENS; i++) {
		c_printf("%d - (%d, %d) - %x || ", 
		screen_info_arr[i].buf_num, 
		screen_info_arr[i].w, 
		screen_info_arr[i].h, 
		screen_info_arr[i].bPtr);
	}
	#endif
	//set the default displayed screens
	wm_memory->screens[0] = 0;
	wm_memory->screens[1] = 1;
	wm_memory->screens[2] = 2;
	wm_memory->screens[3] = 3;
	
	//test
	for(i = 0; i < screen_info_arr[0].w; i++) {
		for(j = 0; j < screen_info_arr[0].h; j++) {
			screen_info_arr[0].bPtr[ ( j * screen_info_arr[0].w ) + i] = 0x18181818;
		}
	}
	for(i = 0; i < screen_info_arr[2].w; i++) {
		for(j = 0; j < screen_info_arr[2].h; j++) {
			screen_info_arr[2].bPtr[ ( j * screen_info_arr[2].w ) + i] = 0xffffffff;
		}
	}
	wm_memory->active_quad = 0;
}