Support memory wraparound instead of high memory as VM86 mode does.

Suggested by:	delphij
This commit is contained in:
jkim 2010-03-22 18:43:36 +00:00
parent e8d4382fb5
commit a40c3ddf5a

View File

@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$");
#define X86BIOS_IVT_SIZE 0x00000500 /* 1K + 256 (BDA) */
#define X86BIOS_SEG_SIZE 0x00010000 /* 64K */
#define X86BIOS_MEM_SIZE (0x00100000 + X86BIOS_SEG_SIZE)
/* 1M + 64K (high memory) */
#define X86BIOS_MEM_SIZE 0x00100000 /* 1M */
#define X86BIOS_IVT_BASE 0x00000000
#define X86BIOS_RAM_BASE 0x00001000
@ -115,9 +114,11 @@ x86bios_get_pages(uint32_t offset, size_t size)
{
int i;
if (offset + size > X86BIOS_MEM_SIZE)
if (offset + size > X86BIOS_MEM_SIZE + X86BIOS_IVT_SIZE)
return (NULL);
if (offset >= X86BIOS_MEM_SIZE)
offset -= X86BIOS_MEM_SIZE;
i = offset / X86BIOS_PAGE_SIZE;
if (x86bios_map[i] != 0)
return ((void *)(x86bios_map[i] + offset -
@ -526,13 +527,6 @@ x86bios_map_mem(void)
return (1);
}
#endif
/* Change attribute for high memory. */
if (pmap_change_attr((vm_offset_t)x86bios_rom + X86BIOS_ROM_SIZE -
X86BIOS_SEG_SIZE, X86BIOS_SEG_SIZE, PAT_WRITE_BACK) != 0) {
pmap_unmapdev((vm_offset_t)x86bios_ivt, X86BIOS_IVT_SIZE);
pmap_unmapdev((vm_offset_t)x86bios_rom, X86BIOS_ROM_SIZE);
return (1);
}
x86bios_seg = contigmalloc(X86BIOS_SEG_SIZE, M_DEVBUF, M_WAITOK,
X86BIOS_RAM_BASE, x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
@ -556,10 +550,6 @@ x86bios_map_mem(void)
X86BIOS_ROM_BASE, X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE - 1,
(void *)((vm_offset_t)x86bios_rom + X86BIOS_ROM_BASE -
(vm_offset_t)x86bios_rom_phys));
printf("x86bios: HIMEM 0x%06x-0x%06x at %p\n",
X86BIOS_MEM_SIZE - X86BIOS_SEG_SIZE, X86BIOS_MEM_SIZE - 1,
(void *)((vm_offset_t)x86bios_rom + X86BIOS_ROM_SIZE -
X86BIOS_SEG_SIZE));
}
return (0);