|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] x86/emul: Work around MISRA R13.2 complaint
On 10.05.2025 02:18, Andrew Cooper wrote:
> Rule 13.2 states: "The value of an expression and its persistent side effects
> shall be the same under all permitted evaluation orders".
>
> Eclair complains about a Rule 13.2 violations because validate_far_branch()
> assigns to rc,
Followed by "goto", i.e. not taking the path to ...
> and the entirety of commit_far_branch() is also assigned to rc.
... that assignment. This pretty clearly looks like a tool shortcoming to
me, and I think it would be a good idea to ...
> --- a/xen/arch/x86/x86_emulate/x86_emulate.c
> +++ b/xen/arch/x86/x86_emulate/x86_emulate.c
> @@ -333,12 +333,14 @@ do {
> \
> : (ip) > (cs)->limit, X86_EXC_GP, 0); \
> })
>
> -#define commit_far_branch(cs, newip) ({ \
> - validate_far_branch(cs, newip); \
> - _regs.r(ip) = (newip); \
> - singlestep = _regs.eflags & X86_EFLAGS_TF; \
> - ops->write_segment(x86_seg_cs, cs, ctxt); \
> -})
> +#define commit_far_branch(cs, newip) ( \
> + ({ \
> + validate_far_branch(cs, newip); \
> + _regs.r(ip) = (newip); \
> + singlestep = _regs.eflags & X86_EFLAGS_TF; \
> + }), \
> + ops->write_segment(x86_seg_cs, cs, ctxt) \
> + )
... add a brief comment here clarifying why this odd a statement is used.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |