x86/hvm: Correct some address space terminology

The function hvm_translate_linear_addr() translates a virtual address to a
linear address, not a linear address to a physical address.  Correct its name.

Both hvm_translate_virtual_addr() and hvmemul_virtual_to_linear() return a
linear address, but a parameter name of paddr is easily confused with paddr_t.
Rename it to linear, to clearly identify the address space, and for
consistency with hvm_virtual_to_linear_addr().

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2017-04-06 18:12:58 +01:00
1 parent 4feb9779c9
commit df429b9c3f
2 files changed
+14 -14

No files matched your search

+6 -6
View File
@@ -506,7 +506,7 @@ static int hvmemul_virtual_to_linear(
unsigned long *reps,
enum hvm_access_type access_type,
struct hvm_emulate_ctxt *hvmemul_ctxt,
unsigned long *paddr)
unsigned long *linear)
{
struct segment_register *reg;
int okay;
@@ -514,7 +514,7 @@ static int hvmemul_virtual_to_linear(
if ( seg == x86_seg_none )
{
*paddr = offset;
*linear = offset;
return X86EMUL_OKAY;
}
@@ -549,16 +549,16 @@ static int hvmemul_virtual_to_linear(
okay = hvm_virtual_to_linear_addr(
seg, reg, offset - (*reps - 1) * bytes_per_rep,
*reps * bytes_per_rep, access_type,
hvmemul_ctxt->ctxt.addr_size, paddr);
*paddr += (*reps - 1) * bytes_per_rep;
hvmemul_ctxt->ctxt.addr_size, linear);
*linear += (*reps - 1) * bytes_per_rep;
if ( hvmemul_ctxt->ctxt.addr_size != 64 )
*paddr = (uint32_t)*paddr;
*linear = (uint32_t)*linear;
}
else
{
okay = hvm_virtual_to_linear_addr(
seg, reg, offset, *reps * bytes_per_rep, access_type,
hvmemul_ctxt->ctxt.addr_size, paddr);
hvmemul_ctxt->ctxt.addr_size, linear);
}
if ( okay )
+8 -8
View File
@@ -136,13 +136,13 @@ static struct segment_register *hvm_get_seg_reg(
return seg_reg;
}
static int hvm_translate_linear_addr(
static int hvm_translate_virtual_addr(
enum x86_segment seg,
unsigned long offset,
unsigned int bytes,
enum hvm_access_type access_type,
struct sh_emulate_ctxt *sh_ctxt,
unsigned long *paddr)
unsigned long *linear)
{
const struct segment_register *reg;
int okay;
@@ -152,7 +152,7 @@ static int hvm_translate_linear_addr(
return -PTR_ERR(reg);
okay = hvm_virtual_to_linear_addr(
seg, reg, offset, bytes, access_type, sh_ctxt->ctxt.addr_size, paddr);
seg, reg, offset, bytes, access_type, sh_ctxt->ctxt.addr_size, linear);
if ( !okay )
{
@@ -183,7 +183,7 @@ hvm_read(enum x86_segment seg,
unsigned long addr;
int rc;
rc = hvm_translate_linear_addr(
rc = hvm_translate_virtual_addr(
seg, offset, bytes, access_type, sh_ctxt, &addr);
if ( rc || !bytes )
return rc;
@@ -265,7 +265,7 @@ hvm_emulate_write(enum x86_segment seg,
if ( seg == x86_seg_ss )
perfc_incr(shadow_fault_emulate_stack);
rc = hvm_translate_linear_addr(
rc = hvm_translate_virtual_addr(
seg, offset, bytes, hvm_access_write, sh_ctxt, &addr);
if ( rc || !bytes )
return rc;
@@ -291,7 +291,7 @@ hvm_emulate_cmpxchg(enum x86_segment seg,
if ( bytes > sizeof(long) )
return X86EMUL_UNHANDLEABLE;
rc = hvm_translate_linear_addr(
rc = hvm_translate_virtual_addr(
seg, offset, bytes, hvm_access_write, sh_ctxt, &addr);
if ( rc )
return rc;
@@ -345,7 +345,7 @@ const struct x86_emulate_ops *shadow_init_emulation(
/* Attempt to prefetch whole instruction. */
sh_ctxt->insn_buf_eip = regs->rip;
sh_ctxt->insn_buf_bytes =
(!hvm_translate_linear_addr(
(!hvm_translate_virtual_addr(
x86_seg_cs, regs->rip, sizeof(sh_ctxt->insn_buf),
hvm_access_insn_fetch, sh_ctxt, &addr) &&
!hvm_fetch_from_guest_linear(
@@ -374,7 +374,7 @@ void shadow_continue_emulation(struct sh_emulate_ctxt *sh_ctxt,
{
/* Prefetch more bytes. */
sh_ctxt->insn_buf_bytes =
(!hvm_translate_linear_addr(
(!hvm_translate_virtual_addr(
x86_seg_cs, regs->rip, sizeof(sh_ctxt->insn_buf),
hvm_access_insn_fetch, sh_ctxt, &addr) &&
!hvm_fetch_from_guest_linear(
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.