@@ -1820,22 +1820,22 @@ static int writeback(struct x86_emulate_ctxt *ctxt, struct operand *op)
18201820 return X86EMUL_CONTINUE ;
18211821}
18221822
1823- static int push (struct x86_emulate_ctxt * ctxt , void * data , int bytes )
1823+ static int emulate_push (struct x86_emulate_ctxt * ctxt , const void * data , int len )
18241824{
18251825 struct segmented_address addr ;
18261826
1827- rsp_increment (ctxt , - bytes );
1827+ rsp_increment (ctxt , - len );
18281828 addr .ea = reg_read (ctxt , VCPU_REGS_RSP ) & stack_mask (ctxt );
18291829 addr .seg = VCPU_SREG_SS ;
18301830
1831- return segmented_write (ctxt , addr , data , bytes );
1831+ return segmented_write (ctxt , addr , data , len );
18321832}
18331833
18341834static int em_push (struct x86_emulate_ctxt * ctxt )
18351835{
18361836 /* Disable writeback. */
18371837 ctxt -> dst .type = OP_NONE ;
1838- return push (ctxt , & ctxt -> src .val , ctxt -> op_bytes );
1838+ return emulate_push (ctxt , & ctxt -> src .val , ctxt -> op_bytes );
18391839}
18401840
18411841static int emulate_pop (struct x86_emulate_ctxt * ctxt ,
@@ -1863,7 +1863,8 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt,
18631863 void * dest , int len )
18641864{
18651865 int rc ;
1866- unsigned long val , change_mask ;
1866+ unsigned long val = 0 ;
1867+ unsigned long change_mask ;
18671868 int iopl = (ctxt -> eflags & X86_EFLAGS_IOPL ) >> X86_EFLAGS_IOPL_BIT ;
18681869 int cpl = ctxt -> ops -> cpl (ctxt );
18691870
@@ -1920,7 +1921,7 @@ static int em_enter(struct x86_emulate_ctxt *ctxt)
19201921 return X86EMUL_UNHANDLEABLE ;
19211922
19221923 rbp = reg_read (ctxt , VCPU_REGS_RBP );
1923- rc = push (ctxt , & rbp , stack_size (ctxt ));
1924+ rc = emulate_push (ctxt , & rbp , stack_size (ctxt ));
19241925 if (rc != X86EMUL_CONTINUE )
19251926 return rc ;
19261927 assign_masked (reg_rmw (ctxt , VCPU_REGS_RBP ), reg_read (ctxt , VCPU_REGS_RSP ),
@@ -1954,7 +1955,7 @@ static int em_push_sreg(struct x86_emulate_ctxt *ctxt)
19541955static int em_pop_sreg (struct x86_emulate_ctxt * ctxt )
19551956{
19561957 int seg = ctxt -> src2 .val ;
1957- unsigned long selector ;
1958+ unsigned long selector = 0 ;
19581959 int rc ;
19591960
19601961 rc = emulate_pop (ctxt , & selector , 2 );
@@ -2000,7 +2001,7 @@ static int em_popa(struct x86_emulate_ctxt *ctxt)
20002001{
20012002 int rc = X86EMUL_CONTINUE ;
20022003 int reg = VCPU_REGS_RDI ;
2003- u32 val ;
2004+ u32 val = 0 ;
20042005
20052006 while (reg >= VCPU_REGS_RAX ) {
20062007 if (reg == VCPU_REGS_RSP ) {
@@ -2229,7 +2230,7 @@ static int em_cmpxchg8b(struct x86_emulate_ctxt *ctxt)
22292230static int em_ret (struct x86_emulate_ctxt * ctxt )
22302231{
22312232 int rc ;
2232- unsigned long eip ;
2233+ unsigned long eip = 0 ;
22332234
22342235 rc = emulate_pop (ctxt , & eip , ctxt -> op_bytes );
22352236 if (rc != X86EMUL_CONTINUE )
@@ -2241,7 +2242,8 @@ static int em_ret(struct x86_emulate_ctxt *ctxt)
22412242static int em_ret_far (struct x86_emulate_ctxt * ctxt )
22422243{
22432244 int rc ;
2244- unsigned long eip , cs ;
2245+ unsigned long eip = 0 ;
2246+ unsigned long cs = 0 ;
22452247 int cpl = ctxt -> ops -> cpl (ctxt );
22462248 struct desc_struct new_desc ;
22472249
@@ -3011,7 +3013,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
30113013 ret = em_push (ctxt );
30123014 }
30133015
3014- ops -> get_dr (ctxt , 7 , & dr7 );
3016+ dr7 = ops -> get_dr (ctxt , 7 );
30153017 ops -> set_dr (ctxt , 7 , dr7 & ~(DR_LOCAL_ENABLE_MASK | DR_LOCAL_SLOWDOWN ));
30163018
30173019 return ret ;
@@ -3184,7 +3186,7 @@ static int em_call_far(struct x86_emulate_ctxt *ctxt)
31843186static int em_ret_near_imm (struct x86_emulate_ctxt * ctxt )
31853187{
31863188 int rc ;
3187- unsigned long eip ;
3189+ unsigned long eip = 0 ;
31883190
31893191 rc = emulate_pop (ctxt , & eip , ctxt -> op_bytes );
31903192 if (rc != X86EMUL_CONTINUE )
@@ -3866,15 +3868,6 @@ static int check_cr_access(struct x86_emulate_ctxt *ctxt)
38663868 return X86EMUL_CONTINUE ;
38673869}
38683870
3869- static int check_dr7_gd (struct x86_emulate_ctxt * ctxt )
3870- {
3871- unsigned long dr7 ;
3872-
3873- ctxt -> ops -> get_dr (ctxt , 7 , & dr7 );
3874-
3875- return dr7 & DR7_GD ;
3876- }
3877-
38783871static int check_dr_read (struct x86_emulate_ctxt * ctxt )
38793872{
38803873 int dr = ctxt -> modrm_reg ;
@@ -3887,10 +3880,10 @@ static int check_dr_read(struct x86_emulate_ctxt *ctxt)
38873880 if ((cr4 & X86_CR4_DE ) && (dr == 4 || dr == 5 ))
38883881 return emulate_ud (ctxt );
38893882
3890- if (check_dr7_gd (ctxt ) ) {
3883+ if (ctxt -> ops -> get_dr (ctxt , 7 ) & DR7_GD ) {
38913884 ulong dr6 ;
38923885
3893- ctxt -> ops -> get_dr (ctxt , 6 , & dr6 );
3886+ dr6 = ctxt -> ops -> get_dr (ctxt , 6 );
38943887 dr6 &= ~DR_TRAP_BITS ;
38953888 dr6 |= DR6_BD | DR6_ACTIVE_LOW ;
38963889 ctxt -> ops -> set_dr (ctxt , 6 , dr6 );
@@ -4505,11 +4498,11 @@ static const struct instr_dual instr_dual_0f_38_f1 = {
45054498};
45064499
45074500static const struct gprefix three_byte_0f_38_f0 = {
4508- ID (0 , & instr_dual_0f_38_f0 ), N , N , N
4501+ ID (0 , & instr_dual_0f_38_f0 ), ID ( 0 , & instr_dual_0f_38_f0 ) , N , N
45094502};
45104503
45114504static const struct gprefix three_byte_0f_38_f1 = {
4512- ID (0 , & instr_dual_0f_38_f1 ), N , N , N
4505+ ID (0 , & instr_dual_0f_38_f1 ), ID ( 0 , & instr_dual_0f_38_f1 ) , N , N
45134506};
45144507
45154508/*
@@ -5449,7 +5442,7 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
54495442 ctxt -> dst .val = ops -> get_cr (ctxt , ctxt -> modrm_reg );
54505443 break ;
54515444 case 0x21 : /* mov from dr to reg */
5452- ops -> get_dr (ctxt , ctxt -> modrm_reg , & ctxt -> dst . val );
5445+ ctxt -> dst . val = ops -> get_dr (ctxt , ctxt -> modrm_reg );
54535446 break ;
54545447 case 0x40 ... 0x4f : /* cmov */
54555448 if (test_cc (ctxt -> b , ctxt -> eflags ))
0 commit comments