diff options
author | neel <neel@FreeBSD.org> | 2014-07-11 01:23:38 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-07-11 01:23:38 +0000 |
commit | 307c44649f55ed89e7870fde0caf1145bde9c133 (patch) | |
tree | 77c5f122e12613f2027e7966fa720024487cf891 /sys/amd64/vmm | |
parent | fec26f1bbfcb21376dcb6a5a05cebcafdbb80435 (diff) | |
download | FreeBSD-src-307c44649f55ed89e7870fde0caf1145bde9c133.zip FreeBSD-src-307c44649f55ed89e7870fde0caf1145bde9c133.tar.gz |
Use the correct offset when converting a logical address (segment:offset)
to a linear address.
Diffstat (limited to 'sys/amd64/vmm')
-rw-r--r-- | sys/amd64/vmm/vmm_instruction_emul.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c index 261572d..a1cd9f1 100644 --- a/sys/amd64/vmm/vmm_instruction_emul.c +++ b/sys/amd64/vmm/vmm_instruction_emul.c @@ -627,7 +627,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, struct seg_desc *desc, uint64_t offset, int length, int addrsize, int prot, uint64_t *gla) { - uint64_t low_limit, high_limit, segbase; + uint64_t firstoff, low_limit, high_limit, segbase; int glasize, type; KASSERT(seg >= VM_REG_GUEST_ES && seg <= VM_REG_GUEST_GS, @@ -637,6 +637,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, KASSERT((prot & ~(PROT_READ | PROT_WRITE)) == 0, ("%s: invalid prot %#x", __func__, prot)); + firstoff = offset; if (cpu_mode == CPU_MODE_64BIT) { KASSERT(addrsize == 4 || addrsize == 8, ("%s: invalid address " "size %d for cpu_mode %d", __func__, addrsize, cpu_mode)); @@ -722,11 +723,11 @@ vie_calculate_gla(enum vm_cpu_mode cpu_mode, enum vm_reg_name seg, } /* - * Truncate 'offset' to the effective address size before adding + * Truncate 'firstoff' to the effective address size before adding * it to the segment base. */ - offset &= vie_size2mask(addrsize); - *gla = (segbase + offset) & vie_size2mask(glasize); + firstoff &= vie_size2mask(addrsize); + *gla = (segbase + firstoff) & vie_size2mask(glasize); return (0); } |