@@ -1096,15 +1096,15 @@ EXPORT_SYMBOL_GPL(kvm_get_dr);
10961096
10971097bool kvm_rdpmc (struct kvm_vcpu * vcpu )
10981098{
1099- u32 ecx = kvm_register_read (vcpu , VCPU_REGS_RCX );
1099+ u32 ecx = kvm_rcx_read (vcpu );
11001100 u64 data ;
11011101 int err ;
11021102
11031103 err = kvm_pmu_rdpmc (vcpu , ecx , & data );
11041104 if (err )
11051105 return err ;
1106- kvm_register_write (vcpu , VCPU_REGS_RAX , (u32 )data );
1107- kvm_register_write (vcpu , VCPU_REGS_RDX , data >> 32 );
1106+ kvm_rax_write (vcpu , (u32 )data );
1107+ kvm_rdx_write (vcpu , data >> 32 );
11081108 return err ;
11091109}
11101110EXPORT_SYMBOL_GPL (kvm_rdpmc );
@@ -6586,7 +6586,7 @@ static int complete_fast_pio_out(struct kvm_vcpu *vcpu)
65866586static int kvm_fast_pio_out (struct kvm_vcpu * vcpu , int size ,
65876587 unsigned short port )
65886588{
6589- unsigned long val = kvm_register_read (vcpu , VCPU_REGS_RAX );
6589+ unsigned long val = kvm_rax_read (vcpu );
65906590 int ret = emulator_pio_out_emulated (& vcpu -> arch .emulate_ctxt ,
65916591 size , port , & val , 1 );
65926592
@@ -6610,16 +6610,15 @@ static int complete_fast_pio_in(struct kvm_vcpu *vcpu)
66106610 }
66116611
66126612 /* For size less than 4 we merge, else we zero extend */
6613- val = (vcpu -> arch .pio .size < 4 ) ? kvm_register_read (vcpu , VCPU_REGS_RAX )
6614- : 0 ;
6613+ val = (vcpu -> arch .pio .size < 4 ) ? kvm_rax_read (vcpu ) : 0 ;
66156614
66166615 /*
66176616 * Since vcpu->arch.pio.count == 1 let emulator_pio_in_emulated perform
66186617 * the copy and tracing
66196618 */
66206619 emulator_pio_in_emulated (& vcpu -> arch .emulate_ctxt , vcpu -> arch .pio .size ,
66216620 vcpu -> arch .pio .port , & val , 1 );
6622- kvm_register_write (vcpu , VCPU_REGS_RAX , val );
6621+ kvm_rax_write (vcpu , val );
66236622
66246623 return kvm_skip_emulated_instruction (vcpu );
66256624}
@@ -6631,12 +6630,12 @@ static int kvm_fast_pio_in(struct kvm_vcpu *vcpu, int size,
66316630 int ret ;
66326631
66336632 /* For size less than 4 we merge, else we zero extend */
6634- val = (size < 4 ) ? kvm_register_read (vcpu , VCPU_REGS_RAX ) : 0 ;
6633+ val = (size < 4 ) ? kvm_rax_read (vcpu ) : 0 ;
66356634
66366635 ret = emulator_pio_in_emulated (& vcpu -> arch .emulate_ctxt , size , port ,
66376636 & val , 1 );
66386637 if (ret ) {
6639- kvm_register_write (vcpu , VCPU_REGS_RAX , val );
6638+ kvm_rax_write (vcpu , val );
66406639 return ret ;
66416640 }
66426641
@@ -7151,11 +7150,11 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
71517150 if (kvm_hv_hypercall_enabled (vcpu -> kvm ))
71527151 return kvm_hv_hypercall (vcpu );
71537152
7154- nr = kvm_register_read (vcpu , VCPU_REGS_RAX );
7155- a0 = kvm_register_read (vcpu , VCPU_REGS_RBX );
7156- a1 = kvm_register_read (vcpu , VCPU_REGS_RCX );
7157- a2 = kvm_register_read (vcpu , VCPU_REGS_RDX );
7158- a3 = kvm_register_read (vcpu , VCPU_REGS_RSI );
7153+ nr = kvm_rax_read (vcpu );
7154+ a0 = kvm_rbx_read (vcpu );
7155+ a1 = kvm_rcx_read (vcpu );
7156+ a2 = kvm_rdx_read (vcpu );
7157+ a3 = kvm_rsi_read (vcpu );
71597158
71607159 trace_kvm_hypercall (nr , a0 , a1 , a2 , a3 );
71617160
@@ -7196,7 +7195,7 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu)
71967195out :
71977196 if (!op_64_bit )
71987197 ret = (u32 )ret ;
7199- kvm_register_write (vcpu , VCPU_REGS_RAX , ret );
7198+ kvm_rax_write (vcpu , ret );
72007199
72017200 ++ vcpu -> stat .hypercalls ;
72027201 return kvm_skip_emulated_instruction (vcpu );
@@ -8285,23 +8284,23 @@ static void __get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
82858284 emulator_writeback_register_cache (& vcpu -> arch .emulate_ctxt );
82868285 vcpu -> arch .emulate_regs_need_sync_to_vcpu = false;
82878286 }
8288- regs -> rax = kvm_register_read (vcpu , VCPU_REGS_RAX );
8289- regs -> rbx = kvm_register_read (vcpu , VCPU_REGS_RBX );
8290- regs -> rcx = kvm_register_read (vcpu , VCPU_REGS_RCX );
8291- regs -> rdx = kvm_register_read (vcpu , VCPU_REGS_RDX );
8292- regs -> rsi = kvm_register_read (vcpu , VCPU_REGS_RSI );
8293- regs -> rdi = kvm_register_read (vcpu , VCPU_REGS_RDI );
8287+ regs -> rax = kvm_rax_read (vcpu );
8288+ regs -> rbx = kvm_rbx_read (vcpu );
8289+ regs -> rcx = kvm_rcx_read (vcpu );
8290+ regs -> rdx = kvm_rdx_read (vcpu );
8291+ regs -> rsi = kvm_rsi_read (vcpu );
8292+ regs -> rdi = kvm_rdi_read (vcpu );
82948293 regs -> rsp = kvm_register_read (vcpu , VCPU_REGS_RSP );
8295- regs -> rbp = kvm_register_read (vcpu , VCPU_REGS_RBP );
8294+ regs -> rbp = kvm_rbp_read (vcpu );
82968295#ifdef CONFIG_X86_64
8297- regs -> r8 = kvm_register_read (vcpu , VCPU_REGS_R8 );
8298- regs -> r9 = kvm_register_read (vcpu , VCPU_REGS_R9 );
8299- regs -> r10 = kvm_register_read (vcpu , VCPU_REGS_R10 );
8300- regs -> r11 = kvm_register_read (vcpu , VCPU_REGS_R11 );
8301- regs -> r12 = kvm_register_read (vcpu , VCPU_REGS_R12 );
8302- regs -> r13 = kvm_register_read (vcpu , VCPU_REGS_R13 );
8303- regs -> r14 = kvm_register_read (vcpu , VCPU_REGS_R14 );
8304- regs -> r15 = kvm_register_read (vcpu , VCPU_REGS_R15 );
8296+ regs -> r8 = kvm_r8_read (vcpu );
8297+ regs -> r9 = kvm_r9_read (vcpu );
8298+ regs -> r10 = kvm_r10_read (vcpu );
8299+ regs -> r11 = kvm_r11_read (vcpu );
8300+ regs -> r12 = kvm_r12_read (vcpu );
8301+ regs -> r13 = kvm_r13_read (vcpu );
8302+ regs -> r14 = kvm_r14_read (vcpu );
8303+ regs -> r15 = kvm_r15_read (vcpu );
83058304#endif
83068305
83078306 regs -> rip = kvm_rip_read (vcpu );
@@ -8321,23 +8320,23 @@ static void __set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
83218320 vcpu -> arch .emulate_regs_need_sync_from_vcpu = true;
83228321 vcpu -> arch .emulate_regs_need_sync_to_vcpu = false;
83238322
8324- kvm_register_write (vcpu , VCPU_REGS_RAX , regs -> rax );
8325- kvm_register_write (vcpu , VCPU_REGS_RBX , regs -> rbx );
8326- kvm_register_write (vcpu , VCPU_REGS_RCX , regs -> rcx );
8327- kvm_register_write (vcpu , VCPU_REGS_RDX , regs -> rdx );
8328- kvm_register_write (vcpu , VCPU_REGS_RSI , regs -> rsi );
8329- kvm_register_write (vcpu , VCPU_REGS_RDI , regs -> rdi );
8323+ kvm_rax_write (vcpu , regs -> rax );
8324+ kvm_rbx_write (vcpu , regs -> rbx );
8325+ kvm_rcx_write (vcpu , regs -> rcx );
8326+ kvm_rdx_write (vcpu , regs -> rdx );
8327+ kvm_rsi_write (vcpu , regs -> rsi );
8328+ kvm_rdi_write (vcpu , regs -> rdi );
83308329 kvm_register_write (vcpu , VCPU_REGS_RSP , regs -> rsp );
8331- kvm_register_write (vcpu , VCPU_REGS_RBP , regs -> rbp );
8330+ kvm_rbp_write (vcpu , regs -> rbp );
83328331#ifdef CONFIG_X86_64
8333- kvm_register_write (vcpu , VCPU_REGS_R8 , regs -> r8 );
8334- kvm_register_write (vcpu , VCPU_REGS_R9 , regs -> r9 );
8335- kvm_register_write (vcpu , VCPU_REGS_R10 , regs -> r10 );
8336- kvm_register_write (vcpu , VCPU_REGS_R11 , regs -> r11 );
8337- kvm_register_write (vcpu , VCPU_REGS_R12 , regs -> r12 );
8338- kvm_register_write (vcpu , VCPU_REGS_R13 , regs -> r13 );
8339- kvm_register_write (vcpu , VCPU_REGS_R14 , regs -> r14 );
8340- kvm_register_write (vcpu , VCPU_REGS_R15 , regs -> r15 );
8332+ kvm_r8_write (vcpu , regs -> r8 );
8333+ kvm_r9_write (vcpu , regs -> r9 );
8334+ kvm_r10_write (vcpu , regs -> r10 );
8335+ kvm_r11_write (vcpu , regs -> r11 );
8336+ kvm_r12_write (vcpu , regs -> r12 );
8337+ kvm_r13_write (vcpu , regs -> r13 );
8338+ kvm_r14_write (vcpu , regs -> r14 );
8339+ kvm_r15_write (vcpu , regs -> r15 );
83418340#endif
83428341
83438342 kvm_rip_write (vcpu , regs -> rip );
0 commit comments