Optimize real mode page table lookup.
This commit is contained in:
parent
ad51361a2c
commit
d7312c88b4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=205649
@ -112,17 +112,16 @@ x86bios_set_fault(struct x86emu *emu, uint32_t addr)
|
|||||||
static void *
|
static void *
|
||||||
x86bios_get_pages(uint32_t offset, size_t size)
|
x86bios_get_pages(uint32_t offset, size_t size)
|
||||||
{
|
{
|
||||||
int i;
|
vm_offset_t page;
|
||||||
|
|
||||||
if (offset + size > X86BIOS_MEM_SIZE + X86BIOS_IVT_SIZE)
|
if (offset + size > X86BIOS_MEM_SIZE + X86BIOS_IVT_SIZE)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (offset >= X86BIOS_MEM_SIZE)
|
if (offset >= X86BIOS_MEM_SIZE)
|
||||||
offset -= X86BIOS_MEM_SIZE;
|
offset -= X86BIOS_MEM_SIZE;
|
||||||
i = offset / X86BIOS_PAGE_SIZE;
|
page = x86bios_map[offset / X86BIOS_PAGE_SIZE];
|
||||||
if (x86bios_map[i] != 0)
|
if (page != 0)
|
||||||
return ((void *)(x86bios_map[i] + offset -
|
return ((void *)(page + offset % X86BIOS_PAGE_SIZE));
|
||||||
i * X86BIOS_PAGE_SIZE));
|
|
||||||
|
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user