Date: Fri, 11 Jul 2014 01:23:39 +0000 (UTC) From: Neel Natu <neel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r268521 - head/sys/amd64/vmm Message-ID: <201407110123.s6B1Ndqh038294@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: neel Date: Fri Jul 11 01:23:38 2014 New Revision: 268521 URL: http://svnweb.freebsd.org/changeset/base/268521 Log: Use the correct offset when converting a logical address (segment:offset) to a linear address. Modified: head/sys/amd64/vmm/vmm_instruction_emul.c Modified: head/sys/amd64/vmm/vmm_instruction_emul.c ============================================================================== --- head/sys/amd64/vmm/vmm_instruction_emul.c Fri Jul 11 01:23:15 2014 (r268520) +++ head/sys/amd64/vmm/vmm_instruction_emul.c Fri Jul 11 01:23:38 2014 (r268521) @@ -627,7 +627,7 @@ vie_calculate_gla(enum vm_cpu_mode cpu_m 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_m 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_m } /* - * 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407110123.s6B1Ndqh038294>