@@ -2093,16 +2093,10 @@ static int em_iret(struct x86_emulate_ctxt *ctxt)
20932093static int em_jmp_far (struct x86_emulate_ctxt * ctxt )
20942094{
20952095 int rc ;
2096- unsigned short sel , old_sel ;
2097- struct desc_struct old_desc , new_desc ;
2098- const struct x86_emulate_ops * ops = ctxt -> ops ;
2096+ unsigned short sel ;
2097+ struct desc_struct new_desc ;
20992098 u8 cpl = ctxt -> ops -> cpl (ctxt );
21002099
2101- /* Assignment of RIP may only fail in 64-bit mode */
2102- if (ctxt -> mode == X86EMUL_MODE_PROT64 )
2103- ops -> get_segment (ctxt , & old_sel , & old_desc , NULL ,
2104- VCPU_SREG_CS );
2105-
21062100 memcpy (& sel , ctxt -> src .valptr + ctxt -> op_bytes , 2 );
21072101
21082102 rc = __load_segment_descriptor (ctxt , sel , VCPU_SREG_CS , cpl ,
@@ -2112,12 +2106,10 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)
21122106 return rc ;
21132107
21142108 rc = assign_eip_far (ctxt , ctxt -> src .val , & new_desc );
2115- if (rc != X86EMUL_CONTINUE ) {
2116- WARN_ON (ctxt -> mode != X86EMUL_MODE_PROT64 );
2117- /* assigning eip failed; restore the old cs */
2118- ops -> set_segment (ctxt , old_sel , & old_desc , 0 , VCPU_SREG_CS );
2119- return rc ;
2120- }
2109+ /* Error handling is not implemented. */
2110+ if (rc != X86EMUL_CONTINUE )
2111+ return X86EMUL_UNHANDLEABLE ;
2112+
21212113 return rc ;
21222114}
21232115
@@ -2177,14 +2169,8 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
21772169{
21782170 int rc ;
21792171 unsigned long eip , cs ;
2180- u16 old_cs ;
21812172 int cpl = ctxt -> ops -> cpl (ctxt );
2182- struct desc_struct old_desc , new_desc ;
2183- const struct x86_emulate_ops * ops = ctxt -> ops ;
2184-
2185- if (ctxt -> mode == X86EMUL_MODE_PROT64 )
2186- ops -> get_segment (ctxt , & old_cs , & old_desc , NULL ,
2187- VCPU_SREG_CS );
2173+ struct desc_struct new_desc ;
21882174
21892175 rc = emulate_pop (ctxt , & eip , ctxt -> op_bytes );
21902176 if (rc != X86EMUL_CONTINUE )
@@ -2201,10 +2187,10 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)
22012187 if (rc != X86EMUL_CONTINUE )
22022188 return rc ;
22032189 rc = assign_eip_far (ctxt , eip , & new_desc );
2204- if ( rc != X86EMUL_CONTINUE ) {
2205- WARN_ON ( ctxt -> mode != X86EMUL_MODE_PROT64 );
2206- ops -> set_segment ( ctxt , old_cs , & old_desc , 0 , VCPU_SREG_CS ) ;
2207- }
2190+ /* Error handling is not implemented. */
2191+ if ( rc != X86EMUL_CONTINUE )
2192+ return X86EMUL_UNHANDLEABLE ;
2193+
22082194 return rc ;
22092195}
22102196
0 commit comments