Re: [RFC PATCH 3/7] x86/entry: Implement atomic-IST-entry

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

 



On Mon, Apr 03, 2023 at 10:06:01PM +0800, Lai Jiangshan wrote:
> +static __always_inline
> +void copy_regs_exception_head(struct pt_regs *target, const struct pt_regs *from)
> +{
> +	target->ss	= from->ss;
> +	target->sp	= from->sp;
> +	target->flags 	= from->flags;
> +	target->cs	= from->cs;
> +	target->ip	= from->ip;
> +	target->orig_ax	= from->orig_ax;
> +}
> +
> +static __always_inline
> +void copy_regs_general_registers(struct pt_regs *target, const struct pt_regs *from)
> +{
> +	target->di  = from->di;
> +	target->si  = from->si;
> +	target->dx  = from->dx;
> +	target->cx  = from->cx;
> +	target->ax  = from->ax;
> +	target->r8  = from->r8;
> +	target->r9  = from->r9;
> +	target->r10 = from->r10;
> +	target->r11 = from->r11;
> +	target->bx  = from->bx;
> +	target->bp  = from->bp;
> +	target->r12 = from->r12;
> +	target->r13 = from->r13;
> +	target->r14 = from->r14;
> +	target->r15 = from->r15;
> +}

> +/* Replicate the interrupted atomic-IST-entry's CLEAR_REGS macro. */
> +static __always_inline void replicate_clear_regs(struct pt_regs *target)
> +{
> +	target->di  = 0;
> +	target->si  = 0;
> +	target->dx  = 0;
> +	target->cx  = 0;
> +	target->ax  = 0;
> +	target->r8  = 0;
> +	target->r9  = 0;
> +	target->r10 = 0;
> +	target->r11 = 0;
> +	target->bx  = 0;
> +	target->bp  = 0;
> +	target->r12 = 0;
> +	target->r13 = 0;
> +	target->r14 = 0;
> +	target->r15 = 0;
> +}

I think there's compilers smart enough to see through your attempts at
avoiding mem{set,cpy}() there and I think we'll end up needing something
like __inline_memset() and __inline_memcpy() like here:

https://lore.kernel.org/lkml/Y759AJ%2F0N9fqwDED@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux