diff options
author | Avi Kivity <avi@redhat.com> | 2011-04-03 05:33:12 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-05-11 07:57:07 -0400 |
commit | 52fd8b445f5e8572526e3f84c753079470152414 (patch) | |
tree | 08d38c7913c1141b6897ebd2c8391af7e077ae5c /arch/x86/kvm/emulate.c | |
parent | 83b8795a29c53a5f9f202933818128aa54c3e8d2 (diff) |
KVM: x86 emulator: move linearize() downwards
So it can call emulate_gp() without forward declarations.
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/emulate.c')
-rw-r--r-- | arch/x86/kvm/emulate.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index a2d343c4c0c1..601a9bca4b72 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -489,21 +489,6 @@ static unsigned seg_override(struct x86_emulate_ctxt *ctxt, | |||
489 | return c->seg_override; | 489 | return c->seg_override; |
490 | } | 490 | } |
491 | 491 | ||
492 | static int linearize(struct x86_emulate_ctxt *ctxt, | ||
493 | struct segmented_address addr, | ||
494 | unsigned size, bool write, | ||
495 | ulong *linear) | ||
496 | { | ||
497 | struct decode_cache *c = &ctxt->decode; | ||
498 | ulong la; | ||
499 | |||
500 | la = seg_base(ctxt, ctxt->ops, addr.seg) + addr.ea; | ||
501 | if (c->ad_bytes != 8) | ||
502 | la &= (u32)-1; | ||
503 | *linear = la; | ||
504 | return X86EMUL_CONTINUE; | ||
505 | } | ||
506 | |||
507 | static int emulate_exception(struct x86_emulate_ctxt *ctxt, int vec, | 492 | static int emulate_exception(struct x86_emulate_ctxt *ctxt, int vec, |
508 | u32 error, bool valid) | 493 | u32 error, bool valid) |
509 | { | 494 | { |
@@ -543,6 +528,21 @@ static int emulate_nm(struct x86_emulate_ctxt *ctxt) | |||
543 | return emulate_exception(ctxt, NM_VECTOR, 0, false); | 528 | return emulate_exception(ctxt, NM_VECTOR, 0, false); |
544 | } | 529 | } |
545 | 530 | ||
531 | static int linearize(struct x86_emulate_ctxt *ctxt, | ||
532 | struct segmented_address addr, | ||
533 | unsigned size, bool write, | ||
534 | ulong *linear) | ||
535 | { | ||
536 | struct decode_cache *c = &ctxt->decode; | ||
537 | ulong la; | ||
538 | |||
539 | la = seg_base(ctxt, ctxt->ops, addr.seg) + addr.ea; | ||
540 | if (c->ad_bytes != 8) | ||
541 | la &= (u32)-1; | ||
542 | *linear = la; | ||
543 | return X86EMUL_CONTINUE; | ||
544 | } | ||
545 | |||
546 | static int segmented_read_std(struct x86_emulate_ctxt *ctxt, | 546 | static int segmented_read_std(struct x86_emulate_ctxt *ctxt, |
547 | struct segmented_address addr, | 547 | struct segmented_address addr, |
548 | void *data, | 548 | void *data, |