예제 #1
0
파일: memcheck.c 프로젝트: aunali1/exopc
void memcheck_type_init()
{
    memcheck_addtype('d', "Base DOS memory (first 640K)");
    memcheck_addtype('r', "Dosemu reserved area");
    memcheck_addtype('h', "Direct-mapped hardware page frame");
    memcheck_addtype('D', "blocks mapped to disk");
}
예제 #2
0
파일: init.c 프로젝트: ccarcel/dosemu2
void map_video_bios(void)
{
  v_printf("Mapping VBIOS = %d\n",config.mapped_bios);

  if (config.mapped_bios) {
    if (config.vbios_file) {
      warn("WARN: loading VBIOS %s into mem at %#x (%#X bytes)\n",
	   config.vbios_file, VBIOS_START, VBIOS_SIZE);
      load_file(config.vbios_file, 0, LINEAR2UNIX(VBIOS_START), VBIOS_SIZE);
    }
    else if (config.vbios_copy) {
      warn("WARN: copying VBIOS from /dev/mem at %#x (%#X bytes)\n",
	   VBIOS_START, VBIOS_SIZE);
      load_file("/dev/mem", VBIOS_START, LINEAR2UNIX(VBIOS_START), VBIOS_SIZE);
    }
    else {
      warn("WARN: copying VBIOS file from /dev/mem\n");
      load_file("/dev/mem", VBIOS_START, LINEAR2UNIX(VBIOS_START), VBIOS_SIZE);
    }

    /* copy graphics characters from system BIOS */
    load_file("/dev/mem", GFX_CHARS, LINEAR2UNIX(GFX_CHARS), GFXCHAR_SIZE);

    memcheck_addtype('V', "Video BIOS");
    memcheck_reserve('V', VBIOS_START, VBIOS_SIZE);
    if (!config.vbios_post || config.chipset == VESA)
      load_file("/dev/mem", 0, (unsigned char *)int_bios_area, sizeof(int_bios_area));
  }
}
예제 #3
0
파일: xms.c 프로젝트: ccarcel/dosemu2
static int
umb_setup(void)
{
  int i;
  size_t addr_start;
  int size, umb;

  for (i = 0; i < UMBS; i++) {
    umbs[i].in_use = FALSE;
  }

  memcheck_addtype('U', "Upper Memory Block (UMB, XMS 3.0)");

  addr_start = 0x00000;     /* start address */
  while ((size = memcheck_findhole(&addr_start, 1024, 0x100000)) != 0) {
    Debug0((dbg_fd, "findhole - from 0x%5.5zX, %dKb\n", addr_start, size/1024));
    memcheck_reserve('U', addr_start, size);

    if (addr_start == 0xa0000 && config.umb_a0 == 2) {
      // FreeDOS UMB bug, reserve 1 para
      const int rsv = 16;
      addr_start += rsv;
      size -= rsv;
    }
    umb = umb_find_unused();
    umbs[umb].in_use = TRUE;
    umbs[umb].free = TRUE;
    umbs[umb].addr = addr_start;
    umbs[umb].size = size;
  }

  for (i = 0; i < UMBS; i++) {
    if (umbs[i].in_use && umbs[i].free) {
      unsigned int addr = umbs[i].addr;
      vm_size_t size = umbs[i].size;
#if 0
      MACH_CALL((vm_deallocate(mach_task_self(),
			       addr,
			       (vm_size_t) size)), "vm_deallocate");
      MACH_CALL((vm_allocate(mach_task_self(), &addr,
			     (vm_size_t) size,
			     FALSE)),
		"vm_allocate of umb block.");
#else
      Debug0((dbg_fd, "umb_setup: addr %x size 0x%04zx\n",
	      addr, size));
#endif
    }
  }

  return 0;
}
예제 #4
0
파일: hma.c 프로젝트: andrewbird/dosemu2
void HMA_init(void)
{
  /* initially, no HMA */
  HMA_MAP(0);
  a20 = 0;
  if (config.ext_mem) {
    ext_mem_base = mmap_mapping(MAPPING_EXTMEM | MAPPING_SCRATCH, -1,
      EXTMEM_SIZE, PROT_READ | PROT_WRITE);
    x_printf("Ext.Mem of size 0x%x at %p\n", EXTMEM_SIZE, ext_mem_base);
    memcheck_addtype('x', "Extended memory (HMA+XMS)");
    memcheck_reserve('x', LOWMEM_SIZE, HMASIZE + EXTMEM_SIZE);
  }
}
예제 #5
0
파일: vesa.c 프로젝트: andrewbird/dosemu2
void vbe_pre_init(void)
{
  int i;
  vga_mode_info *vmi = NULL;
  unsigned int dos_vga_bios = SEGOFF2LINEAR(0xc000,0x0000);
  int bios_ptr = (char *) vgaemu_bios_end - (char *) vgaemu_bios_start;

  static struct {
    char modes[3];
    char reserved1[4];
    char scanlines;
    char character_blocks;
    char max_active_blocks;
    short support_flags;
    short reserved2;
    char save_function_flags;
    char reserved3;
  } vgaemu_bios_functionality_table =
  { .modes =		 {0xff,0xe0,0x0f}, /* Modes 0-7, 0dh-0fh, 10h-13h supported */
    .scanlines =	 7,		   /* scanlines 200,350,400 supported */
    .character_blocks =  2,		   /* This all corresponds to a real BIOS */
    .max_active_blocks = 8,		   /* See Ralf Brown's interrupt list */
    .support_flags =	 0xeff,		   /* INT 10h, AH=1b for documentation */
    .save_function_flags=0x3f
  };

  MEMSET_DOS(dos_vga_bios, 0, VBE_BIOS_MAXPAGES << 12);	/* one page */
  MEMCPY_2DOS(dos_vga_bios, vgaemu_bios_start, bios_ptr);

  vgaemu_bios.prod_name = (char *) vgaemu_bios_prod_name - (char *) vgaemu_bios_start;

  if (Video->setmode) {
    i = (char *) vgaemu_bios_pm_interface_end - (char *) vgaemu_bios_pm_interface;

    if(i + bios_ptr > (VBE_BIOS_MAXPAGES << 12) - 8) {
      error("VBE: vbe_init: protected mode interface to large, disabling\n");
      vgaemu_bios.vbe_pm_interface_len =
	vgaemu_bios.vbe_pm_interface = 0;
    }

    vgaemu_bios.vbe_pm_interface_len = i;
    vgaemu_bios.vbe_pm_interface = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vgaemu_bios_pm_interface, i);
    bios_ptr += i;

    bios_ptr = (bios_ptr + 3) & ~3;
    vgaemu_bios.vbe_mode_list = bios_ptr;

    /* set up video mode list */
    for(i = 0x100; i <= vgaemu_bios.vbe_last_mode; i++) {
      if((vmi = vga_emu_find_mode(i, NULL))) {
	if(vmi->VESA_mode != -1 && bios_ptr < ((VBE_BIOS_MAXPAGES << 12) - 4)) {
	  WRITE_WORD(dos_vga_bios + bios_ptr, vmi->VESA_mode);
	  bios_ptr += 2;
	}
      }
    }

    WRITE_WORD(dos_vga_bios + bios_ptr, -1);
    bios_ptr += 2;

    /* add fonts */
    vgaemu_bios.font_8 = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vga_rom_08, sizeof vga_rom_08);
    bios_ptr += sizeof vga_rom_08;

    vgaemu_bios.font_14 = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vga_rom_14, sizeof vga_rom_14);
    bios_ptr += sizeof vga_rom_14;

    vgaemu_bios.font_16 = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vga_rom_16, sizeof vga_rom_16);
    bios_ptr += sizeof vga_rom_16;

    vgaemu_bios.font_14_alt = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vga_rom_14_alt, sizeof vga_rom_14_alt);
    bios_ptr += sizeof vga_rom_14_alt;

    vgaemu_bios.font_16_alt = bios_ptr;
    MEMCPY_2DOS(dos_vga_bios + bios_ptr, vga_rom_16_alt, sizeof vga_rom_16_alt);
    bios_ptr += sizeof vga_rom_16_alt;
  } else {
    /* only support the initial video mode, can't change it */
    vgaemu_bios_functionality_table.modes[0] = 1 << video_mode;
    vgaemu_bios_functionality_table.modes[1] =
      vgaemu_bios_functionality_table.modes[2] = 0;
  }
  vgaemu_bios.functionality = bios_ptr;
  MEMCPY_2DOS(dos_vga_bios + bios_ptr, &vgaemu_bios_functionality_table,
      sizeof vgaemu_bios_functionality_table);
  bios_ptr += sizeof vgaemu_bios_functionality_table;

  vgaemu_bios.size = bios_ptr;

  WRITE_BYTE(dos_vga_bios + 2, (bios_ptr + ((1 << 9) - 1)) >> 9);
  vgaemu_bios.pages = (bios_ptr + ((1 << 12) - 1)) >> 12;

  if (config.vgaemubios_file) {
    /* EXPERIMENTAL: load and boot the Bochs BIOS */
    int fd = open(config.vgaemubios_file, O_RDONLY);
    int bytes;
    if (fd != -1) {
      bytes = read(fd, LINEAR2UNIX(0xc0000), 65536);
      close(fd);
      vgaemu_bios.pages = (bytes + PAGE_SIZE - 1) / PAGE_SIZE;
      config.vbios_post = 1;
    }
  }

  memcheck_addtype('V', "VGAEMU Video BIOS");
  memcheck_reserve('V', dos_vga_bios, vgaemu_bios.pages << 12);

  if(!config.X_pm_interface) {
    v_printf("VBE: vbe_init: protected mode interface disabled\n");
  }

  v_printf(
    "VBE: vbe_init: %d pages for VGA BIOS, vga.mem.base = %p\n",
    vgaemu_bios.pages, vga.mem.base
  );
}