diff options
author | jkim <jkim@FreeBSD.org> | 2010-03-25 17:03:52 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2010-03-25 17:03:52 +0000 |
commit | 7725810bd916059862a195671326db9aaf40db64 (patch) | |
tree | 25ae93529d9c8bb1d8b841ed212ee23c065643ed /sys | |
parent | 49ca5d49ba1fb8b0550024f816e6e6bb7f9e3a0a (diff) | |
download | FreeBSD-src-7725810bd916059862a195671326db9aaf40db64.zip FreeBSD-src-7725810bd916059862a195671326db9aaf40db64.tar.gz |
Optimize real mode page table lookup.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/x86bios/x86bios.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/compat/x86bios/x86bios.c b/sys/compat/x86bios/x86bios.c index e90d80b..d4e650c 100644 --- a/sys/compat/x86bios/x86bios.c +++ b/sys/compat/x86bios/x86bios.c @@ -112,17 +112,16 @@ x86bios_set_fault(struct x86emu *emu, uint32_t addr) static void * x86bios_get_pages(uint32_t offset, size_t size) { - int i; + vm_offset_t page; 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 - - i * X86BIOS_PAGE_SIZE)); + page = x86bios_map[offset / X86BIOS_PAGE_SIZE]; + if (page != 0) + return ((void *)(page + offset % X86BIOS_PAGE_SIZE)); return (NULL); } |