[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH for-next] x86/pv: Factor out the calculation of LDT/GDT descriptor pointers



>>> On 17.10.17 at 17:05, <andrew.cooper3@xxxxxxxxxx> wrote:
> @@ -16,4 +17,14 @@ static inline int pv_emul_is_mem_write(const struct 
> x86_emulate_state *state,
>                                                : X86EMUL_UNHANDLEABLE;
>  }
>  
> +/* Return a pointer to the GDT/LDT descriptor referenced by sel. */
> +static inline const struct desc_struct *gdt_ldt_desc_ptr(unsigned int sel)

I guess returning a pointer to const here is on the assumption that
you hope we would never have a need to fiddle with the descriptor?

> +{
> +    const struct vcpu *curr = current;
> +    const struct desc_struct *tbl = (void *)
> +        ((sel & X86_XEC_TI) ? LDT_VIRT_START(curr) : GDT_VIRT_START(curr));

While the two happen to match, using an error code related
constant with something named "selector" doesn't look to be
really correct. But given the match, I don't mind it being this
way.

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.