lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b31086df86febba62f76ff9ec775b7a6e16c1933.camel@xry111.site>
Date:   Mon, 17 Oct 2022 22:19:59 +0800
From:   Xi Ruoyao <xry111@...111.site>
To:     David Laight <David.Laight@...LAB.COM>,
        'Huacai Chen' <chenhuacai@...ngson.cn>,
        Arnd Bergmann <arnd@...db.de>,
        Huacai Chen <chenhuacai@...nel.org>
Cc:     "loongarch@...ts.linux.dev" <loongarch@...ts.linux.dev>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Guo Ren <guoren@...nel.org>, Xuerui Wang <kernel@...0n.name>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V3] LoongArch: Add unaligned access support

On Mon, 2022-10-17 at 13:11 +0000, David Laight wrote:
> From: Huacai Chen
> > Sent: 17 October 2022 13:52
> > 
> > Loongson-2 series (Loongson-2K500, Loongson-2K1000) don't support
> > unaligned access in hardware, while Loongson-3 series (Loongson-3A5000,
> > Loongson-3C5000) are configurable whether support unaligned access in
> > hardware. This patch add unaligned access emulation for those LoongArch
> > processors without hardware support.
> > 
> .....
> > +       } else if (insn.reg2i12_format.opcode == fstd_op ||
> > +               insn.reg3_format.opcode == fstxd_op) {
> > +               value = read_fpr(insn.reg2i12_format.rd);
> > +               res = unaligned_write(addr, value, 8);
> > +               if (res)
> > +                       goto fault;
> > +       } else if (insn.reg2i12_format.opcode == fsts_op ||
> > +               insn.reg3_format.opcode == fstxs_op) {
> > +               value = read_fpr(insn.reg2i12_format.rd);
> > +               res = unaligned_write(addr, value, 4);
> > +               if (res)
> > +                       goto fault;
> 
> Are those right?
> Shouldn't something be converting from 'double' to
> 'float' in there?
> And generating SIGFPE (?) if the exponent is out of range.

To me it looks right.

The semantic of FST.S does not include conversion.  It just stores the
lower 32 bits of a floating-point register into the memory.  If someone
attempts to use FST.S to convert a double into a float, it's a
programming error.

-- 
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ