[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20d86df48af5e0f0f17a1b1bc6b365d1c158280f.camel@xry111.site>
Date: Thu, 28 Jul 2022 21:30:42 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Youling Tang <tangyouling@...ngson.cn>, loongarch@...ts.linux.dev
Cc: linux-kernel@...r.kernel.org, WANG Xuerui <kernel@...0n.name>,
Huacai Chen <chenhuacai@...nel.org>,
Jinyang He <hejinyang@...ngson.cn>
Subject: Re: [PATCH v2 4/4] LoongArch: Support modules with new relocation
types
On Thu, 2022-07-28 at 20:41 +0800, Youling Tang wrote:
> Unaligned is handled more efficiently before overflow checking, while
> being consistent with apply_r_larch_sop_imm_field.
Will move unaligned before overflow in V3.
> > +
> > + *location &= ~(u32)0x3ffffff;
> > + *location |= (offset >> 18) & 0x3ff;
> > + *location |= ((offset >> 2) & 0xffff) << 10;
>
> It may be better to use the loongarch_instruction format to modify the
> immediate field of the instruction, similar to the following:
>
> union loongarch_instruction *insn = (union loongarch_instruction *)location;
>
> offset >>= 2;
> insn->reg0i26_format.immediate_l = offset & 0xffff;
> insn->reg0i26_format.immediate_h = (offset >> 16) & 0x3ff;
Will use union loongarch_instruction in V3. Why didn't I notice it
before? :(
Thanks for the review!
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists