From: "Jan Beulich" Subject: [PATCH] x86/PV: remove read_descriptor()'s regs parameter Date: Tue, 30 Aug 2016 06:18:19 -0600 Message-ID: <57C595AB020000780010A248@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part182E879B.1__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1behzl-0004H7-Se for xen-devel@lists.xenproject.org; Tue, 30 Aug 2016 12:18:25 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part182E879B.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline As of commit a35dc6ccbb ("x86: remove the use of vm86_mode()") it is unused. Signed-off-by: Jan Beulich --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1851,7 +1851,6 @@ long do_fpu_taskswitch(int set) =20 static int read_descriptor(unsigned int sel, const struct vcpu *v, - const struct cpu_user_regs * regs, unsigned long *base, unsigned long *limit, unsigned int *ar, @@ -2267,8 +2266,7 @@ static int emulate_privileged_op(struct uint64_t val; bool_t vpmu_msr; =20 - if ( !read_descriptor(regs->cs, v, regs, - &code_base, &code_limit, &ar, 1) ) + if ( !read_descriptor(regs->cs, v, &code_base, &code_limit, &ar, 1) ) goto fail; op_default =3D op_bytes =3D (ar & (_SEGMENT_L|_SEGMENT_DB)) ? 4 : 2; ad_default =3D ad_bytes =3D (ar & _SEGMENT_L) ? 8 : op_default; @@ -2359,8 +2357,8 @@ static int emulate_privileged_op(struct =20 if ( !(ar & _SEGMENT_L) ) { - if ( !read_descriptor(data_sel, v, regs, - &data_base, &data_limit, &ar, 0) ) + if ( !read_descriptor(data_sel, v, &data_base, &data_limit, + &ar, 0) ) goto fail; if ( !(ar & _SEGMENT_S) || !(ar & _SEGMENT_P) || @@ -3133,7 +3131,7 @@ static void emulate_gate_op(struct cpu_u * Decode instruction (and perhaps operand) to determine RPL, * whether this is a jump or a call, and the call return offset. */ - if ( !read_descriptor(regs->cs, v, regs, &base, &limit, &ar, 0) || + if ( !read_descriptor(regs->cs, v, &base, &limit, &ar, 0) || !(ar & _SEGMENT_S) || !(ar & _SEGMENT_P) || !(ar & _SEGMENT_CODE) ) @@ -3298,7 +3296,7 @@ static void emulate_gate_op(struct cpu_u } =20 if ( (opnd_sel !=3D regs->cs && - !read_descriptor(opnd_sel, v, regs, &base, &limit, &ar, 0)) || + !read_descriptor(opnd_sel, v, &base, &limit, &ar, 0)) || !(ar & _SEGMENT_S) || !(ar & _SEGMENT_P) || ((ar & _SEGMENT_CODE) && !(ar & _SEGMENT_WR)) ) @@ -3318,7 +3316,7 @@ static void emulate_gate_op(struct cpu_u return; } =20 - if ( !read_descriptor(sel, v, regs, &base, &limit, &ar, 0) || + if ( !read_descriptor(sel, v, &base, &limit, &ar, 0) || !(ar & _SEGMENT_S) || !(ar & _SEGMENT_CODE) || (!jump || (ar & _SEGMENT_EC) ? @@ -3371,7 +3369,7 @@ static void emulate_gate_op(struct cpu_u esp =3D v->arch.pv_vcpu.kernel_sp; ss =3D v->arch.pv_vcpu.kernel_ss; if ( (ss & 3) !=3D (sel & 3) || - !read_descriptor(ss, v, regs, &base, &limit, &ar, 0) || + !read_descriptor(ss, v, &base, &limit, &ar, 0) || ((ar >> 13) & 3) !=3D (sel & 3) || !(ar & _SEGMENT_S) || (ar & _SEGMENT_CODE) || @@ -3400,7 +3498,7 @@ static void emulate_gate_op(struct cpu_u { const unsigned int *ustkp; =20 - if ( !read_descriptor(regs->ss, v, regs, &base, &limit, = &ar, 0) || + if ( !read_descriptor(regs->ss, v, &base, &limit, &ar, 0) = || ((ar >> 13) & 3) !=3D (regs->cs & 3) || !(ar & _SEGMENT_S) || (ar & _SEGMENT_CODE) || @@ -3433,7 +3431,7 @@ static void emulate_gate_op(struct cpu_u sel |=3D (regs->cs & 3); esp =3D regs->esp; ss =3D regs->ss; - if ( !read_descriptor(ss, v, regs, &base, &limit, &ar, 0) || + if ( !read_descriptor(ss, v, &base, &limit, &ar, 0) || ((ar >> 13) & 3) !=3D (sel & 3) ) { do_guest_trap(TRAP_gp_fault, regs); --=__Part182E879B.1__= Content-Type: text/plain; name="x86-PV-read_descriptor-no-regs.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-PV-read_descriptor-no-regs.patch" x86/PV: remove read_descriptor()'s regs parameter=0A=0AAs of commit = a35dc6ccbb ("x86: remove the use of vm86_mode()") it is=0Aunused.=0A=0ASign= ed-off-by: Jan Beulich =0A=0A--- a/xen/arch/x86/traps.c= =0A+++ b/xen/arch/x86/traps.c=0A@@ -1851,7 +1851,6 @@ long do_fpu_taskswitc= h(int set)=0A =0A static int read_descriptor(unsigned int sel,=0A = const struct vcpu *v,=0A- = const struct cpu_user_regs * regs,=0A unsigned = long *base,=0A unsigned long *limit,=0A = unsigned int *ar,=0A@@ -2267,8 +2266,7 @@ static int = emulate_privileged_op(struct=0A uint64_t val;=0A bool_t = vpmu_msr;=0A =0A- if ( !read_descriptor(regs->cs, v, regs,=0A- = &code_base, &code_limit, &ar, 1) )=0A+ if ( !read_descri= ptor(regs->cs, v, &code_base, &code_limit, &ar, 1) )=0A goto = fail;=0A op_default =3D op_bytes =3D (ar & (_SEGMENT_L|_SEGMENT_DB)) ? = 4 : 2;=0A ad_default =3D ad_bytes =3D (ar & _SEGMENT_L) ? 8 : = op_default;=0A@@ -2359,8 +2357,8 @@ static int emulate_privileged_op(struct= =0A =0A if ( !(ar & _SEGMENT_L) )=0A {=0A- if ( = !read_descriptor(data_sel, v, regs,=0A- = &data_base, &data_limit, &ar, 0) )=0A+ if ( !read_descriptor(dat= a_sel, v, &data_base, &data_limit,=0A+ = &ar, 0) )=0A goto fail;=0A if ( !(ar & = _SEGMENT_S) ||=0A !(ar & _SEGMENT_P) ||=0A@@ -3133,7 = +3131,7 @@ static void emulate_gate_op(struct cpu_u=0A * Decode = instruction (and perhaps operand) to determine RPL,=0A * whether this = is a jump or a call, and the call return offset.=0A */=0A- if ( = !read_descriptor(regs->cs, v, regs, &base, &limit, &ar, 0) ||=0A+ if ( = !read_descriptor(regs->cs, v, &base, &limit, &ar, 0) ||=0A !(ar & = _SEGMENT_S) ||=0A !(ar & _SEGMENT_P) ||=0A !(ar & = _SEGMENT_CODE) )=0A@@ -3298,7 +3296,7 @@ static void emulate_gate_op(struct= cpu_u=0A }=0A =0A if ( (opnd_sel !=3D regs->cs &&=0A- = !read_descriptor(opnd_sel, v, regs, &base, &limit, &ar, 0)) ||=0A+ = !read_descriptor(opnd_sel, v, &base, &limit, &ar, 0)) ||=0A !(ar = & _SEGMENT_S) ||=0A !(ar & _SEGMENT_P) ||=0A ((ar & = _SEGMENT_CODE) && !(ar & _SEGMENT_WR)) )=0A@@ -3318,7 +3316,7 @@ static = void emulate_gate_op(struct cpu_u=0A return;=0A }=0A =0A- = if ( !read_descriptor(sel, v, regs, &base, &limit, &ar, 0) ||=0A+ if ( = !read_descriptor(sel, v, &base, &limit, &ar, 0) ||=0A !(ar & = _SEGMENT_S) ||=0A !(ar & _SEGMENT_CODE) ||=0A (!jump || = (ar & _SEGMENT_EC) ?=0A@@ -3371,7 +3369,7 @@ static void emulate_gate_op(st= ruct cpu_u=0A esp =3D v->arch.pv_vcpu.kernel_sp;=0A = ss =3D v->arch.pv_vcpu.kernel_ss;=0A if ( (ss & 3) !=3D (sel = & 3) ||=0A- !read_descriptor(ss, v, regs, &base, &limit, = &ar, 0) ||=0A+ !read_descriptor(ss, v, &base, &limit, &ar, = 0) ||=0A ((ar >> 13) & 3) !=3D (sel & 3) ||=0A = !(ar & _SEGMENT_S) ||=0A (ar & _SEGMENT_CODE) = ||=0A@@ -3400,7 +3498,7 @@ static void emulate_gate_op(struct cpu_u=0A = {=0A const unsigned int *ustkp;=0A =0A- = if ( !read_descriptor(regs->ss, v, regs, &base, &limit, &ar, 0) ||=0A+ = if ( !read_descriptor(regs->ss, v, &base, &limit, &ar, 0) = ||=0A ((ar >> 13) & 3) !=3D (regs->cs & 3) ||=0A = !(ar & _SEGMENT_S) ||=0A (ar & = _SEGMENT_CODE) ||=0A@@ -3433,7 +3431,7 @@ static void emulate_gate_op(struc= t cpu_u=0A sel |=3D (regs->cs & 3);=0A esp =3D = regs->esp;=0A ss =3D regs->ss;=0A- if ( !read_descri= ptor(ss, v, regs, &base, &limit, &ar, 0) ||=0A+ if ( !read_descr= iptor(ss, v, &base, &limit, &ar, 0) ||=0A ((ar >> 13) & = 3) !=3D (sel & 3) )=0A {=0A do_guest_trap(TRAP_= gp_fault, regs);=0A --=__Part182E879B.1__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --=__Part182E879B.1__=--