From: Vincent Chen <vincentc@andestech.com>
To: <linux-kernel@vger.kernel.org>, <arnd@arndb.de>,
<linux-arch@vger.kernel.org>, <greentime@andestech.com>,
<green.hu@gmail.com>, <deanbo422@gmail.com>
Cc: <vincentc@andestech.com>
Subject: [PATCH 0/2] nds32: Prevent FPU emulator from incorrectly modifying IEX status
Date: Mon, 20 May 2019 09:21:11 +0800 [thread overview]
Message-ID: <1558315273-2795-1-git-send-email-vincentc@andestech.com> (raw)
In order for kernel to capture each denormalized output, the UDF
trapping enable bit is always raised in $fpcsr. Because underflow case will
issue not an underflow exception but also an inexact exception, it causes
that the IEX, IEX cumulative exception, flag in $fpcsr to be raised in each
denormalized output handling. To make the emulation transparent to the
user, the emulator needs to clear the IEX flag in $fpcsr if the result is a
denormalized number. However, if the IEX flag has been raised before this
floating point emulation, this cleanup may be incorrect. To avoid the IEX
flags in $fpcsr be raised in each denormalized output handling, the 1st
patch always enable IEX trap to fix this issue.
The existing floating point emulations is only available for floating
instruction that possibly issue denormalized input and underflow
exceptions. These existing FPU emulations are not sufficient when IEx
Trap is enabled because some floating point instructions only issue inexact
exception. The 2nd patch adds the emulations of such floating point
instructions.
Vincent Chen (2):
nds32: enable IEX trap too when kernel supports denormalized output
nds32: add new emulations for floating point instruction
arch/nds32/include/asm/bitfield.h | 2 +-
arch/nds32/include/asm/fpu.h | 2 +-
arch/nds32/include/asm/fpuemu.h | 12 +++++
arch/nds32/include/asm/syscalls.h | 2 +-
arch/nds32/include/uapi/asm/fp_udfiex_crtl.h | 16 +++++++
arch/nds32/include/uapi/asm/sigcontext.h | 24 ++++++++---
arch/nds32/include/uapi/asm/udftrap.h | 13 ------
arch/nds32/include/uapi/asm/unistd.h | 4 +-
arch/nds32/kernel/fpu.c | 15 +++----
arch/nds32/kernel/sys_nds32.c | 26 ++++++-----
arch/nds32/math-emu/Makefile | 5 ++-
arch/nds32/math-emu/fd2si.c | 30 +++++++++++++
arch/nds32/math-emu/fd2siz.c | 30 +++++++++++++
arch/nds32/math-emu/fd2ui.c | 30 +++++++++++++
arch/nds32/math-emu/fd2uiz.c | 30 +++++++++++++
arch/nds32/math-emu/fpuemu.c | 57 ++++++++++++++++++++++++--
arch/nds32/math-emu/fs2si.c | 29 +++++++++++++
arch/nds32/math-emu/fs2siz.c | 29 +++++++++++++
arch/nds32/math-emu/fs2ui.c | 29 +++++++++++++
arch/nds32/math-emu/fs2uiz.c | 30 +++++++++++++
arch/nds32/math-emu/fsi2d.c | 22 ++++++++++
arch/nds32/math-emu/fsi2s.c | 22 ++++++++++
arch/nds32/math-emu/fui2d.c | 22 ++++++++++
arch/nds32/math-emu/fui2s.c | 22 ++++++++++
24 files changed, 452 insertions(+), 51 deletions(-)
create mode 100644 arch/nds32/include/uapi/asm/fp_udfiex_crtl.h
delete mode 100644 arch/nds32/include/uapi/asm/udftrap.h
create mode 100644 arch/nds32/math-emu/fd2si.c
create mode 100644 arch/nds32/math-emu/fd2siz.c
create mode 100644 arch/nds32/math-emu/fd2ui.c
create mode 100644 arch/nds32/math-emu/fd2uiz.c
create mode 100644 arch/nds32/math-emu/fs2si.c
create mode 100644 arch/nds32/math-emu/fs2siz.c
create mode 100644 arch/nds32/math-emu/fs2ui.c
create mode 100644 arch/nds32/math-emu/fs2uiz.c
create mode 100644 arch/nds32/math-emu/fsi2d.c
create mode 100644 arch/nds32/math-emu/fsi2s.c
create mode 100644 arch/nds32/math-emu/fui2d.c
create mode 100644 arch/nds32/math-emu/fui2s.c
next reply other threads:[~2019-05-20 1:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 1:21 Vincent Chen [this message]
2019-05-20 1:21 ` [PATCH 1/2] nds32: Avoid IEX status being incorrectly modified Vincent Chen
2019-05-20 1:21 ` [PATCH 2/2] nds32: add new emulations for floating point instruction Vincent Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1558315273-2795-1-git-send-email-vincentc@andestech.com \
--to=vincentc@andestech.com \
--cc=arnd@arndb.de \
--cc=deanbo422@gmail.com \
--cc=green.hu@gmail.com \
--cc=greentime@andestech.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®